Moby
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
Moby::Polyhedron Class Reference

A potentially-non-convex polyhedron of genus 0. More...

#include <Polyhedron.h>

Classes

struct  Edge
 The edge structure. More...
 
struct  Face
 The face structure. More...
 
struct  Feature
 A vertex, face, or edge in a polyhedron. More...
 
struct  Vertex
 The vertex structure. More...
 
class  VertexFaceIterator
 iterates over the vertices in a face More...
 

Public Types

enum  LocationType {
  eInside, eOutside, eOnVertex, eOnEdge,
  eOnFace
}
 
enum  FeatureType { eVertex, eEdge, eFace }
 Gets the Voronoi plane from two input features. More...
 

Public Member Functions

 Polyhedron ()
 Creates a minimum polyhedron.
 
 Polyhedron (const Polyhedron &p)
 
boost::shared_ptr
< Polyhedron::Feature
find_closest_feature (const Ravelin::Origin3d &p, unsigned closest_facet) const
 Finds the closest feature of the polyhedron to the point, given the closest facet. More...
 
Polyhedronoperator= (const Polyhedron &p)
 Assignment operator.
 
Polyhedron shallow_copy () const
 Does a shallow copy of this polyhedron.
 
std::vector< boost::shared_ptr
< Vertex > > & 
get_vertices ()
 
const std::vector
< boost::shared_ptr< Vertex > > & 
get_vertices () const
 
const std::vector
< boost::shared_ptr< Edge > > & 
get_edges () const
 
const std::vector
< boost::shared_ptr< Face > > & 
get_faces () const
 
bool inside (const Ravelin::Origin3d &point, double tol=NEAR_ZERO)
 
bool inside_or_on (const Ravelin::Origin3d &point, double tol=NEAR_ZERO)
 
LocationType location (const Ravelin::Origin3d &point, boost::shared_ptr< Polyhedron::Feature > &closest_feature, double tol=NEAR_ZERO) const
 
double calc_volume () const
 
bool degenerate () const
 
void write_to_obj (const std::string &filename) const
 Writes the polyhedron to Wavefront OBJ format.
 
Polyhedron transform (const Ravelin::Transform3d &T) const
 Transforms a polyhedron.
 
double calc_signed_distance (const Ravelin::Origin3d &point, unsigned &closest_facet) const
 Gets the signed distance and closest facet to a point.
 
double calc_signed_distance (const Ravelin::Origin3d &point) const
 Gets the signed distance from a point to the polyhedron.
 
std::pair< Ravelin::Origin3d,
Ravelin::Origin3d > 
get_bounding_box_corners () const
 Gets the corners of the axis-aligned bounding box of this polyhedron.
 
bool is_convex ()
 Determines whether this polyhedron convex (to w/in floating point tolerance)
 
double convexity ()
 Gets the convexity of this polyhedron. More...
 
template<class ForwardIterator >
Polyhedron calc_convex_hull (ForwardIterator begin, ForwardIterator end)
 Computes the convex hull for a polyhedron.
 

Static Public Member Functions

static double vclip (boost::shared_ptr< const PolyhedralPrimitive > pA, boost::shared_ptr< const PolyhedralPrimitive > pB, boost::shared_ptr< const Ravelin::Pose3d > poseA, boost::shared_ptr< const Ravelin::Pose3d > poseB, boost::shared_ptr< const Polyhedron::Feature > &closestA, boost::shared_ptr< const Polyhedron::Feature > &closestB)
 Executes the V-Clip algorithm on two polyhedra, determining closest features and signed distance.
 
static Polyhedron calc_minkowski_diff (boost::shared_ptr< const PolyhedralPrimitive > pA, boost::shared_ptr< const PolyhedralPrimitive > pB, boost::shared_ptr< const Ravelin::Pose3d > poseA, boost::shared_ptr< const Ravelin::Pose3d > poseB)
 Computes the Minkowski difference of two polyhedral primitives. More...
 
static void to_vrml (std::ostream &out, const Polyhedron &p, Ravelin::Origin3d diffuse_color=Ravelin::Origin3d(1, 1, 1), bool wireframe=false)
 Finds the feature(s) of this polyhedron closest to the point. More...
 
template<class ForwardIterator >
static Polyhedron calc_convex_hull (ForwardIterator begin, ForwardIterator end)
 Computes the convex hull for a polyhedron.
 
static double calc_dist (FeatureType fA, FeatureType fB, boost::shared_ptr< const Polyhedron::Feature > closestA, boost::shared_ptr< const Polyhedron::Feature > closestB, Ravelin::Transform3d &aTb)
 Computes the distance between two features.
 

Friends

class TessellatedPolyhedron
 

Detailed Description

A potentially-non-convex polyhedron of genus 0.

Member Enumeration Documentation

Gets the Voronoi plane from two input features.

The function takes the tyoes and the pointers of the two features and returns a plane If a point is a positive distance away from the plane, then the point is closer to the first feature If a point is a negative distance away from the plane, then the point is closer to the second feature

Member Function Documentation

Polyhedron Polyhedron::calc_minkowski_diff ( boost::shared_ptr< const PolyhedralPrimitive pA,
boost::shared_ptr< const PolyhedralPrimitive pB,
boost::shared_ptr< const Ravelin::Pose3d >  poseA,
boost::shared_ptr< const Ravelin::Pose3d >  poseB 
)
static

Computes the Minkowski difference of two polyhedral primitives.

Returns
a polyhedron- the 'data' field of each vertex is of type boost::shared_ptr<std::pair<int, int> >, where the first integer is the index of a vertex from the first polyhedron and the second integer is the index of a vertex from the second polyhedron.
double Moby::Polyhedron::convexity ( )
inline

Gets the convexity of this polyhedron.

Convexity values less than epsilon (where epsilon is some number near zero) indicate that the polyhedron is convex; greater values indicate that the polyhedron is non-convex.

Referenced by is_convex().

boost::shared_ptr< Polyhedron::Feature > Polyhedron::find_closest_feature ( const Ravelin::Origin3d &  p,
unsigned  closest_facet 
) const

Finds the closest feature of the polyhedron to the point, given the closest facet.

Parameters
closest_facetthe closest facet to the point on return
void Polyhedron::to_vrml ( std::ostream &  out,
const Polyhedron p,
Ravelin::Origin3d  diffuse_color = Ravelin::Origin3d(1,1,1),
bool  wireframe = false 
)
static

Finds the feature(s) of this polyhedron closest to the point.

Parameters
pthe query point
closest_featuresthe closest features on return
insidewhether the point is inside or outside the polyhedron on return
Returns
the distanceSends this polyhedron to the specified stream using VRML

References Moby::Polyhedron::VertexFaceIterator::advance(), and Moby::Polyhedron::VertexFaceIterator::has_next().


The documentation for this class was generated from the following files: