Library of Assembled Shared Sources
|
A very simple 3D polygon :) More...
#include <parallelogram_3d.h>
Public Member Functions | |
Parallelogram3D () | |
constructs an empty parallelogram. | |
Parallelogram3D (const TPoint &support, const TVector &sizeX, const TVector &sizeY) | |
Constructs a parallelogram with a support and two sizes. | |
const TValue | squaredArea () const |
returns squared area of parallelogram to avoid the square root. | |
const TValue | area () const |
return area of the polygons surface. | |
const TValue | perimeter () const |
return sum of the lengths of all edges | |
bool | isSimple () const |
return true if polygon is simple, false if not. | |
bool | isConvex () const |
return true if polygon is convex, false if not. | |
bool | isReflex (int indexOfVertex) const |
return true if inner angle of vertex is reflex (is > 180 degrees). | |
Related Symbols | |
(Note that these are not member symbols.) | |
template<typename T, class NP, class PP> | |
Result | intersect (const Parallelogram3D< T > ¶llelogram, const Ray3D< T, NP, PP > &ray, T &u, T &v, T &t, const T &tMin=T()) |
Find the intersection of a ray and a parallelogram by their parameter t on the ray and it's coordinates (u,v) on the parallelogram. | |
template<typename T, class NP, class PP> | |
Result | intersect (const Parallelogram3D< T > ¶llelogram, const Ray3D< T, NP, PP > &ray, T &t, const T &tMin=T()) |
Find the intersection of a ray and a parallelogram by their parameter t on the ray. | |
A very simple 3D polygon :)
Definition at line 63 of file parallelogram_3d.h.
lass::prim::Parallelogram3D< T >::Parallelogram3D | ( | ) |
constructs an empty parallelogram.
support is origin and sizes are zero.
Definition at line 61 of file parallelogram_3d.inl.
const Parallelogram3D< T >::TValue lass::prim::Parallelogram3D< T >::squaredArea | ( | ) | const |
returns squared area of parallelogram to avoid the square root.
Definition at line 147 of file parallelogram_3d.inl.
Referenced by area().
const Parallelogram3D< T >::TValue lass::prim::Parallelogram3D< T >::area | ( | ) | const |
return area of the polygons surface.
The area of a surface is the amount of material needed to "cover" it completely, Eric W. Weisstein. "Area." From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/Area.html
Definition at line 158 of file parallelogram_3d.inl.
References squaredArea().
const Parallelogram3D< T >::TValue lass::prim::Parallelogram3D< T >::perimeter | ( | ) | const |
return sum of the lengths of all edges
Definition at line 169 of file parallelogram_3d.inl.
bool lass::prim::Parallelogram3D< T >::isSimple | ( | ) | const |
return true if polygon is simple, false if not.
A polygon P is said to be simple (or Jordan) if the only points of the plane belonging to two polygon edges of P are the polygon vertices of P. Such a polygon has a well defined interior and exterior. Simple polygons are topologically equivalent to a disk., Eric W. Weisstein. "Simple Polygon." From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/SimplePolygon.html
In 3D, we test if the 2D mapping on the major axis is simple.
Definition at line 212 of file parallelogram_3d.inl.
bool lass::prim::Parallelogram3D< T >::isConvex | ( | ) | const |
return true if polygon is convex, false if not.
A planar polygon is convex if it contains all the line segments connecting any pair of its points. Thus, for example, a regular pentagon is convex, while an indented pentagon is not. A planar polygon that is not convex is said to be a concave polygon, Eric W. Weisstein. "Convex Polygon." From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/ConvexPolygon.html
A simple polygon is convex if all the cross products of adjacent edges will be the same sign (we ignore zero signs, only + or - are taken in account), a concave polygon will have a mixture of cross product signs.
A polygon with less than three vertices is always convex. A polygon with all colinear vertices is considered convex (not very usefull maybe, but convex).
Definition at line 224 of file parallelogram_3d.inl.
bool lass::prim::Parallelogram3D< T >::isReflex | ( | int | indexOfVertex | ) | const |
return true if inner angle of vertex is reflex (is > 180 degrees).
Definition at line 236 of file parallelogram_3d.inl.
|
Find the intersection of a ray and a parallelogram by their parameter t on the ray and it's coordinates (u,v) on the parallelogram.
A maximum of two possible intersections with t > 0.
parallelogram | [in] the parallelogram |
ray | [in] the ray |
oU | [out] the parameter of the intersection point on the parallelogram. |
oV | [out] the parameter of the intersection point on the parallelogram. |
t | [out] the parameter of the intersection point > tMin. |
tMin | [in] the minimum t that may be returned as valid intersection. |
Definition at line 79 of file parallelogram_3d_ray_3d.h.
|
Find the intersection of a ray and a parallelogram by their parameter t on the ray.
A maximum of two possible intersections with t > 0.
parallelogram | [in] the parallelogram |
ray | [in] the ray |
t | [out] the parameter of the intersection point > tMin. |
tMin | [in] the minimum t that may be returned as valid intersection. |
Definition at line 141 of file parallelogram_3d_ray_3d.h.