#include <Polyhedron.h>
Public Types | |
| enum | LocationType { Inside, Outside, OnVertex, OnEdge, OnFace } |
Public Member Functions | |
| Polyhedron (const std::vector< TriangleConstPtr > &mesh) | |
| Constructs a polyhedron from a triangle mesh. | |
| Polyhedron (const Polyhedron &p) | |
| void | operator= (const Polyhedron &p) |
| Copies a polyhedron. | |
| void | construct_from_mesh (const std::vector< TriangleConstPtr > &mesh) |
| Constructs this polyhedron from a given triangle mesh. | |
| const std::list< TriangleConstPtr > & | get_incident_facets (Vector3ConstPtr v) const |
| Gets the facets incident to the specified vertex. | |
| void | transform (const Matrix4 &T) |
| Transforms this polyhedron by the given transformation matrix. | |
| const std::vector< Vector3ConstPtr > & | get_vertices () const |
| const std::vector< TriangleConstPtr > & | get_facets () const |
| bool | inside (const Vector3 &point) const |
| Determines whether the specified point is strictly inside this polyhedron. | |
| bool | inside_or_on (const Vector3 &point) const |
| Determines whether the specified point is in or on this polyhedron. | |
| LocationType | location (const Vector3 &point) const |
| Determines the location of the specified point with respect to this polyhedron. | |
| bool | contains_facet (TriangleConstPtr t) const |
| Determines whether the specified facet exists in the polyhedron. | |
| bool | contains_vertex (boost::shared_ptr< Vector3 > v) const |
| std::list< PolyhedronPtr > | convexify (unsigned max_pieces=std::numeric_limits< unsigned >::max(), Real max_volume=std::numeric_limits< Real >::max()) const |
| Makes this polyhedron convex by splitting it into multiple disjoint pieces. | |
| Real | calc_volume () const |
| Calculates the volume of this polyhedron. | |
| std::pair< Vector3, Vector3 > | get_bounding_box_corners () const |
| Gets the corners of the bounding box of this polyhedron. | |
| bool | is_convex () const |
| Gets whether this polyhedron is convex. | |
Static Public Member Functions | |
| static void | to_VRML (std::ostream &out, const Polyhedron &p, Vector3 diffuse_color=Vector3(1, 1, 1), bool wireframe=false) |
| Sends this polyhedron to the specified stream using VRML. | |
Though this class is used for representing polyhedron, it is possible to represent arbitrary (i.e., non-closed) triangle meshes as well.
| Polyhedron::Polyhedron | ( | const std::vector< TriangleConstPtr > & | mesh | ) |
Constructs a polyhedron from a triangle mesh.
| void Polyhedron::transform | ( | const Matrix4 & | T | ) |
Transforms this polyhedron by the given transformation matrix.
| Polyhedron::LocationType Polyhedron::location | ( | const Vector3 & | point | ) | const |
Determines the location of the specified point with respect to this polyhedron.
This method handles queries when the polyhedron is not convex or more detail is necessary. Adapted from O'Rourke, p. 247-250. Runs in worst-case time O(f), where f is the number of faces of the polyhedron.
| bool Polyhedron::contains_facet | ( | TriangleConstPtr | t | ) | const |
Determines whether the specified facet exists in the polyhedron.
| std::list< PolyhedronPtr > Polyhedron::convexify | ( | unsigned | max_pieces = std::numeric_limits<unsigned>::max(), |
|
| Real | max_volume = std::numeric_limits<Real>::max() | |||
| ) | const |
Makes this polyhedron convex by splitting it into multiple disjoint pieces.
| max_pieces | the maximum number of pieces generated | |
| max_volume | the maximum volume of the pieces generated |
1.5.1