#include <Polygon.h>
Inheritance diagram for Polygon:
Public Types | |
enum | edgeProjection { XY, YZ, XZ, NONE_PROJ } |
Public Member Functions | |
Polygon () | |
Polygon (const Vector3 *va, const Vector3 *na, const Vector2 *uva, unsigned n) | |
Polygon (const Vector3 *va, const Vector3 *na, const Vector2 *uva, unsigned n, const Vector3 &norm, bool fixedn) | |
virtual | ~Polygon () |
virtual void | rayIntersection (PointEnv *pPE, int mask, const Vector3 &origin, const Vector3 &direction, float maxD=MAXFLOAT) |
virtual bool | mapToUV (const Vector3 &v, Vector2 &uv) |
virtual void | randomSample (int mask, PointEnv &pe, double *pdf) |
virtual bool | randomDirection (const Vector3 &pov, Vector3 &dir, double *pdf) |
virtual Interval | extent (const Vector3 &direction) const |
virtual Vector3 | centroid (void) const |
virtual double | radius (const Vector3 ¢roid) const |
virtual Geometry * | clone (const Matrix4 *pTrMat) const |
virtual bool | separation (Geometry &geom, Vector3 *pDir) |
virtual double | distance (const Geometry &geom, Vector3 *pDir) |
virtual void | dump (const char *intent, const char *tab) |
bool | pointInsidePolygon (const Vector3 &p, Vector3 *n, Vector2 *u) |
virtual Vector3 | getFacetNormal (void) const |
virtual bool | haveFixedNormal (void) const |
virtual Vector3 | getVertex (unsigned index) const |
virtual Vector3 | getVertNormal (unsigned index) const |
virtual bool | haveVertNormals (void) const |
virtual Vector2 | getVertUVCoord (unsigned) const |
virtual bool | haveVertUVCoords (void) const |
virtual unsigned | numVertices (void) const |
virtual double | getFXYZ (void) const |
virtual edgeProjection | getEdgeProjection (void) const |
bool | setVertices (const Vector3 *va, unsigned n) |
bool | setNormals (const Vector3 *na) |
bool | setUVCoords (const Vector2 *uva) |
void | setFacetNormal (const Vector3 &norm, bool fixedn) |
virtual void | __debug (void) |
void | insideOut (bool b) |
Interval | extent (float x, float y, float z) const |
virtual double | radius (void) const |
Geometry * | clone (void) const |
Mesh * | mesh (int density=0) const |
Static Public Attributes | |
static const float | EPS = 1e-03 |
epsilon variation (tolerance) of zero | |
Protected Member Functions | |
virtual Mesh * | _mesh (int) const |
virtual void | _duplicate_attributes (const Geometry &) |
virtual Vector3 | _get_facet_normal (void) const |
virtual Vector3 | _get_vertex (unsigned) const |
virtual Vector3 | _get_vert_normal (unsigned) const |
virtual Vector2 | _get_vert_uv_coord (unsigned) const |
virtual void | _rotateX (float) |
virtual void | _rotateY (float) |
virtual void | _rotateZ (float) |
virtual void | _rotate (float, const Vector3 &) |
virtual void | _rotate (const Matrix3 &) |
virtual void | _translate (float, float, float) |
virtual void | _transform (const Matrix4 &) |
virtual void | _scale (float) |
void | _set_edge_projection (void) |
double * | _precompute_proj (void))[6];bool_separation_by_plane(const Geometry &) const ;bool_separation_by_edges(Geometry &) const ;bool_point_inside_polygon(const Vector3 &, Vector3 *, Vector2 * |
bool | _coplanar_tri_collision (Polygon &, const Vector3 &v0, const Vector3 &v1, const Vector3 &v2, const Vector3 &u0, const Vector3 &u1, const Vector3 &u2) |
int | _triTriCollision (Polygon &) |
void | _translate (const Vector3 &v) |
Protected Attributes | |
Vector3 * | _vertices |
array of vertices | |
Vector3 * | _normals |
vertex normals, can be NULL | |
Vector2 * | _uvCoords |
UV coordinates (e.g. texture coords.). | |
unsigned | _nVert |
number of polygon's vertices | |
Vector3 | _normal |
facet normal, NEVER ACCESS DIRECTLY BUT THROUGH THE _get_facet_normal() | |
bool | _normalFixed |
fixed/random orientation of facet normal | |
double | _fxyz |
edgeProjection | _edgeProjection |
best projection plane | |
double | _area |
double(* | _proj )[6] |
speed up of ray intersection calculations | |
bool | _insideOut |
Definition at line 14 of file Polygon.h.
|
|
|
Implicit constructor with all attributes set to zero/null Definition at line 574 of file Polygon.cc. References Polygon::_area, Polygon::_fxyz, Polygon::_normals, Polygon::_proj, Polygon::_uvCoords, and Polygon::_vertices. |
|
Constructor. Facet normal is computed from vertices.
Definition at line 585 of file Polygon.cc. References Polygon::_normals, Polygon::_proj, Polygon::_uvCoords, Polygon::_vertices, Polygon::setNormals(), Polygon::setUVCoords(), and Polygon::setVertices(). |
|
Constructor.
Definition at line 599 of file Polygon.cc. References Polygon::_normals, Polygon::_proj, Polygon::_uvCoords, Polygon::_vertices, Polygon::setFacetNormal(), Polygon::setNormals(), Polygon::setUVCoords(), and Polygon::setVertices(). |
|
Destructor. Definition at line 616 of file Polygon.cc. References Polygon::_normals, Polygon::_proj, Polygon::_uvCoords, and Polygon::_vertices. |
|
for debugging purposes. Reimplemented from Geometry. Reimplemented in _Surface. Definition at line 1009 of file Polygon.cc. References Polygon::_normal, and Polygon::getVertex(). |
|
Definition at line 302 of file Polygon.cc. References ESG_EDGE_AGAINST_TRI_EDGES. |
|
Reimplemented from Geometry. Reimplemented in _Surface, Rectangle, and OSGPolygon. Definition at line 45 of file Polygon.cc. References Geometry::_duplicate_attributes(), Polygon::_normals, Polygon::_nVert, Polygon::_uvCoords, and Polygon::_vertices. Referenced by Rectangle::_duplicate_attributes(), Triangle::clone(), and Polygon::clone(). |
|
Definition at line 80 of file Polygon.cc. References Polygon::_get_vertex(), and Polygon::_nVert. Referenced by _Surface::_Surface(), OSGPolygon::OSGPolygon(), Rectangle::Rectangle(), and Polygon::setVertices(). |
|
Reimplemented in _Surface, and OSGPolygon. Definition at line 94 of file Polygon.cc. References Polygon::_normals. Referenced by Polygon::getVertNormal(). |
|
Reimplemented in _Surface. Definition at line 99 of file Polygon.cc. References Polygon::_uvCoords. Referenced by Polygon::getVertUVCoord(). |
|
Reimplemented in _Surface, and OSGPolygon. Definition at line 89 of file Polygon.cc. References Polygon::_vertices. Referenced by Polygon::_get_facet_normal(), Polygon::_triTriCollision(), Polygon::centroid(), Polygon::extent(), Polygon::getVertex(), Polygon::radius(), Triangle::randomSample(), Rectangle::randomSample(), Polygon::randomSample(), Rectangle::Rectangle(), Polygon::setFacetNormal(), and Polygon::setVertices(). |
|
Implements Geometry. Reimplemented in _Surface. Definition at line 7 of file Polygon.cc. References Polygon::_fxyz, Polygon::_normal, Polygon::_normals, Polygon::_nVert, Polygon::_vertices, and Polygon::haveVertNormals(). |
|
Referenced by Rectangle::_scale(). |
|
Implements Geometry. Reimplemented in _Surface, and Rectangle. Definition at line 528 of file Polygon.cc. References Polygon::_normals, Polygon::_vertices, and Polygon::haveVertNormals(). |
|
Implements Geometry. Reimplemented in _Surface, and Rectangle. Definition at line 512 of file Polygon.cc. References Polygon::_normals, Polygon::_vertices, and Polygon::haveVertNormals(). |
|
Implements Geometry. Reimplemented in _Surface, and Rectangle. Definition at line 469 of file Polygon.cc. References Polygon::_normals, Polygon::_vertices, and Polygon::haveVertNormals(). |
|
Implements Geometry. Reimplemented in _Surface, and Rectangle. Definition at line 484 of file Polygon.cc. References Polygon::_normals, Polygon::_vertices, and Polygon::haveVertNormals(). |
|
Implements Geometry. Reimplemented in _Surface, and Rectangle. Definition at line 498 of file Polygon.cc. References Polygon::_normals, Polygon::_vertices, and Polygon::haveVertNormals(). |
|
Implements Geometry. Reimplemented in _Surface, and Rectangle. Definition at line 562 of file Polygon.cc. References Polygon::_proj, and Polygon::_vertices. |
|
Definition at line 104 of file Polygon.cc. References Polygon::_edgeProjection, Polygon::_normal, Polygon::XY, Polygon::XZ, and Polygon::YZ. Referenced by _Surface::_rotate(), _Surface::_rotateX(), _Surface::_rotateY(), _Surface::_rotateZ(), _Surface::_transform(), OSGPolygon::OSGPolygon(), Rectangle::Rectangle(), Polygon::setFacetNormal(), and Polygon::setVertices(). |
|
Implements Geometry. Reimplemented in _Surface, and Rectangle. Definition at line 548 of file Polygon.cc. References Polygon::_normals, Polygon::_vertices, and Polygon::haveVertNormals(). Referenced by Triangle::clone(), and Polygon::clone(). |
|
Definition at line 38 of file Geometry.h. |
|
Implements Geometry. Reimplemented in _Surface, and Rectangle. Definition at line 540 of file Polygon.cc. References Polygon::_vertices. |
|
Triangle-triangle intersection test. Reference: Tomas Moller, 1997. "A Fast Triangle-Triangle Intersection Test", Journal of Graphics Tools, 2(2), 1997 Although the input parametters are polygons, collision works with only triangles. That is, only the first three coordinates of both polygons are used! Returns: -1 = detection failed (not triangles?) 0 = separation 1 = collision Definition at line 351 of file Polygon.cc. References Polygon::_fxyz, Polygon::_get_vertex(), Polygon::_normal, Geometry::EPS, ESG_COMPUTE_INTERVALS, ESG_SORT, and Polygon::numVertices(). Referenced by Polygon::separation(). |
|
Implements Geometry. Definition at line 795 of file Polygon.cc. References Polygon::_get_vertex(). Referenced by SurfaceMesh::getActPlaneCentroid(). |
|
Duplicates geometry
Reimplemented in _Surface, and OSGPolygon. Definition at line 155 of file Geometry.h. Referenced by BVH::__get_edges(), BVH::__get_meshes(), ObjsInAreaExplorer::_accept_new_transformation(), SphereTree::_enlarge_bv(), FDHTree::_enlarge_bv(), BVExplorer::_iterate(), BVDistRot::BVDistRot(), and ObjsInAreaExplorer::ObjsInAreaExplorer(). |
|
Duplicates and transforms geometry
Implements Geometry. Reimplemented in _Surface, Triangle, and OSGPolygon. Definition at line 787 of file Polygon.cc. References Polygon::_duplicate_attributes(), and Polygon::_transform(). |
|
Computes approximate distance between this and given geometries (lower bound of distance)
Implements Geometry. Definition at line 841 of file Polygon.cc. References MINDOUBLE. |
|
Writes information about this geometry to std. out.
Implements Geometry. Reimplemented in _Surface. Definition at line 846 of file Polygon.cc. References Polygon::_normal, Polygon::_normalFixed, Polygon::_normals, Polygon::_uvCoords, Polygon::_vertices, and Polygon::haveVertNormals(). |
|
Returns extent occupied by the geometry in given direction
Definition at line 124 of file Geometry.h. |
|
Returns extent occupied by the geometry in given direction
Implements Geometry. Definition at line 769 of file Polygon.cc. References Polygon::_get_vertex(), Interval::max, MAXFLOAT, and Interval::min. |
|
Definition at line 922 of file Polygon.cc. |
|
Definition at line 873 of file Polygon.cc. References Polygon::_normal. Referenced by Surface::_mesh(), SurfaceMesh::getActPlane(), and SurfaceMesh::getActPlaneNormal(). |
|
Definition at line 917 of file Polygon.cc. References Polygon::_fxyz. Referenced by SurfaceMesh::getActPlane(). |
|
Reimplemented in _Surface, and OSGPolygon. Definition at line 883 of file Polygon.cc. References Polygon::_get_vertex(). Referenced by Polygon::__debug(). |
|
Reimplemented in _Surface, and OSGPolygon. Definition at line 888 of file Polygon.cc. References Polygon::_get_vert_normal(), and Polygon::haveVertNormals(). |
|
Reimplemented in _Surface, and OSGPolygon. Definition at line 900 of file Polygon.cc. References Polygon::_get_vert_uv_coord(), and Polygon::haveVertUVCoords(). |
|
Definition at line 878 of file Polygon.cc. References Polygon::_normalFixed. Referenced by Surface::_mesh(). |
|
Reimplemented in _Surface, and OSGPolygon. Definition at line 895 of file Polygon.cc. References Polygon::_normals. Referenced by Polygon::_mesh(), Rectangle::_rotate(), Polygon::_rotate(), Rectangle::_rotateX(), Polygon::_rotateX(), Rectangle::_rotateY(), Polygon::_rotateY(), Rectangle::_rotateZ(), Polygon::_rotateZ(), Rectangle::_transform(), Polygon::_transform(), Polygon::dump(), Polygon::getVertNormal(), and Polygon::rayIntersection(). |
|
Reimplemented in _Surface, and OSGPolygon. Definition at line 907 of file Polygon.cc. References Polygon::_uvCoords. Referenced by Polygon::getVertUVCoord(), and Polygon::rayIntersection(). |
|
Inverts facet normals (turns the object inside-out)
Definition at line 56 of file Geometry.h. |
|
Maps 3D point from surface to the UV surface representation
Implements Geometry. Definition at line 687 of file Polygon.cc. |
|
Returns polygonal mesh computed from this geometry
Definition at line 24 of file Geometry.cc. References Geometry::_insideOut, Geometry::_mesh(), and Mesh::turnInsideOut(). Referenced by BVH::__get_edges(), BVH::__get_meshes(), NurbsSurface::_mesh(), and POVRayExporter::_process_leaf(). |
|
Definition at line 912 of file Polygon.cc. Referenced by Surface::_mesh(), Polygon::_triTriCollision(), SurfaceMesh::getActVert2(), SurfaceMesh::getActVertNormal2(), SurfaceMesh::goToNextEdge(), and Surface::numEdges(). |
|
|
|
Returns radius of minimal packing sphere with center in the ceontroid of the geometry
Reimplemented in Cylinder, NurbsSurface, Point3D, Sphere, and Surface. Definition at line 148 of file Geometry.h. |
|
Returns radius of minimal packing sphere having given center
Implements Geometry. Definition at line 806 of file Polygon.cc. References Polygon::_get_vertex(), and MAXDOUBLE. |
|
Computes random direction towards the surface in accord to the point of view.
Implements Geometry. Definition at line 762 of file Polygon.cc. References Polygon::_fxyz, Polygon::_normal, and Polygon::_normalFixed. Referenced by Surface::randomDirection(). |
|
Computes random point on the surface
Implements Geometry. Reimplemented in Rectangle, and Triangle. Definition at line 692 of file Polygon.cc. References Polygon::_get_vertex(), Polygon::_normal, ENV_HAVE_NOTHING, ENV_WANT_NORMAL, ENV_WANT_SURFACE_POINT, ENV_WANT_UV_COORD, PointEnv::mask, Interval::max, and Interval::min. Referenced by Surface::randomSample(). |
|
Computes point of intersection of ray with this geometry
Implements Geometry. Definition at line 624 of file Polygon.cc. References Polygon::_fxyz, Polygon::_normal, Polygon::_normalFixed, PointEnv::distance, ENV_HAVE_DISTANCE, ENV_HAVE_INTERFERENCE, ENV_HAVE_INTERSECTION, ENV_HAVE_N_DOT_D, ENV_HAVE_N_DOT_O, ENV_HAVE_NORMAL, ENV_HAVE_NOTHING, ENV_HAVE_UV_COORD, ENV_WANT_NORMAL, ENV_WANT_UV_COORD, Geometry::EPS, Polygon::haveVertNormals(), Polygon::haveVertUVCoords(), PointEnv::intersection, PointEnv::mask, PointEnv::nd, PointEnv::no, PointEnv::normal, PointEnv::normalOrientation, PointEnv::OUTWARDS_NORMAL, PointEnv::RANDOM_NORMAL, and PointEnv::uvCoord. |
|
Checks if there is separation between this and given geometries
Implements Geometry. Definition at line 820 of file Polygon.cc. References Polygon::_normal, and Polygon::_triTriCollision(). |
|
Sets facet normal.
Definition at line 1000 of file Polygon.cc. References Polygon::_fxyz, Polygon::_get_vertex(), Polygon::_normal, Polygon::_normalFixed, and Polygon::_set_edge_projection(). Referenced by Polygon::Polygon(). |
|
Sets normals of polygon's vertices. Old normals are deleted, if any.
Definition at line 960 of file Polygon.cc. References Polygon::_normals. Referenced by Polygon::Polygon(). |
|
Sets UV coordinates of polygon's vertices. Old coords are deleted, if any.
Definition at line 980 of file Polygon.cc. References Polygon::_uvCoords. Referenced by Polygon::Polygon(). |
|
Sets polygon's vertices. Old vertices, their normals and UV coordinates are deleted. Facet normal is computed from vertices.
Definition at line 927 of file Polygon.cc. References Polygon::_area, Polygon::_fxyz, Polygon::_get_facet_normal(), Polygon::_get_vertex(), Polygon::_normal, Polygon::_normalFixed, Polygon::_normals, Polygon::_proj, Polygon::_set_edge_projection(), Polygon::_uvCoords, and Polygon::_vertices. Referenced by Polygon::Polygon(). |
|
Definition at line 27 of file Polygon.h. Referenced by Polygon::Polygon(), Triangle::randomSample(), and Polygon::setVertices(). |
|
best projection plane
Definition at line 26 of file Polygon.h. Referenced by OSGPolygon::_duplicate_attributes(), _Surface::_duplicate_attributes(), and Polygon::_set_edge_projection(). |
|
|
Definition at line 23 of file Geometry.h. Referenced by Geometry::_duplicate_attributes(), and Geometry::mesh(). |
|
|
fixed/random orientation of facet normal
Definition at line 24 of file Polygon.h. Referenced by OSGPolygon::_duplicate_attributes(), _Surface::_duplicate_attributes(), _Surface::_Surface(), Polygon::dump(), _Surface::dump(), Polygon::haveFixedNormal(), OSGPolygon::OSGPolygon(), Polygon::randomDirection(), Triangle::randomSample(), Rectangle::randomSample(), Polygon::rayIntersection(), Rectangle::Rectangle(), Polygon::setFacetNormal(), and Polygon::setVertices(). |
|
|
number of polygon's vertices
Definition at line 22 of file Polygon.h. Referenced by Polygon::_duplicate_attributes(), OSGPolygon::_duplicate_attributes(), _Surface::_duplicate_attributes(), Polygon::_get_facet_normal(), Polygon::_mesh(), Rectangle::_rotate(), Rectangle::_rotateX(), Rectangle::_rotateY(), Rectangle::_rotateZ(), Rectangle::_scale(), Rectangle::_transform(), Rectangle::_translate(), OSGPolygon::OSGPolygon(), and Rectangle::Rectangle(). |
|
speed up of ray intersection calculations
Definition at line 29 of file Polygon.h. Referenced by OSGPolygon::_duplicate_attributes(), _Surface::_rotate(), _Surface::_rotateX(), _Surface::_rotateY(), _Surface::_rotateZ(), Polygon::_scale(), _Surface::_scale(), _Surface::_Surface(), _Surface::_transform(), Polygon::Polygon(), Rectangle::Rectangle(), Polygon::setVertices(), and Polygon::~Polygon(). |
|
UV coordinates (e.g. texture coords.).
Definition at line 21 of file Polygon.h. Referenced by Polygon::_duplicate_attributes(), Polygon::_get_vert_uv_coord(), Polygon::dump(), Polygon::haveVertUVCoords(), Polygon::Polygon(), Triangle::randomSample(), Rectangle::Rectangle(), Polygon::setUVCoords(), Polygon::setVertices(), and Polygon::~Polygon(). |
|
|
epsilon variation (tolerance) of zero
Definition at line 20 of file Geometry.h. Referenced by FDH::_cut_line(), Sphere::_duplicate_attributes(), FDH::_get_corners(), FDH::_mesh(), Sphere::_scale(), Polygon::_triTriCollision(), Sphere::rayIntersection(), Polygon::rayIntersection(), Point3D::rayIntersection(), Hemisphere::rayIntersection(), Sphere::setRadius(), and Sphere::Sphere(). |