Moby
|
Represents a triangle mesh "primitive" for inertia properties, collision detection, and visualization. More...
#include <TriangleMeshPrimitive.h>
Public Member Functions | |
TriangleMeshPrimitive () | |
Creates the triangle mesh primitive. | |
TriangleMeshPrimitive (const std::string &filename, bool center=true) | |
TriangleMeshPrimitive (const std::string &filename, const Ravelin::Pose3d &T, bool center=true) | |
void | set_edge_sample_length (double len) |
Sets the edge sample length for this triangle mesh. | |
virtual osg::Node * | create_visualization () |
Creates the visualization for this primitive. | |
virtual double | get_bounding_radius () const |
double | get_edge_sample_length () const |
Gets the length of an edge in the mesh above which point sub-samples are created. | |
virtual double | calc_signed_dist (const Point3d &p) const |
Computes the signed distance to a point from the mesh. | |
virtual void | load_from_xml (boost::shared_ptr< const XMLTree > node, std::map< std::string, BasePtr > &id_map) |
Implements Base::load_from_xml() More... | |
virtual void | save_to_xml (XMLTreePtr node, std::list< boost::shared_ptr< const Base > > &shared_objects) const |
Implements Base::save_to_xml() | |
virtual BVPtr | get_BVH_root (CollisionGeometryPtr geom) |
Gets the pointer to the root bounding box. | |
virtual void | get_vertices (boost::shared_ptr< const Ravelin::Pose3d > P, std::vector< Point3d > &vertices) const |
Get vertices corresponding to this primitive. More... | |
virtual double | calc_dist_and_normal (const Point3d &point, std::vector< Ravelin::Vector3d > &normals) const |
Computes the distance and normal from a point on the mesh. | |
virtual boost::shared_ptr < const IndexedTriArray > | get_mesh (boost::shared_ptr< const Ravelin::Pose3d > P) |
Gets the underlying triangle mesh for this primitive. | |
void | set_mesh (boost::shared_ptr< const IndexedTriArray > mesh) |
Sets the mesh. | |
virtual void | set_pose (const Ravelin::Pose3d &T) |
Transforms this primitive. | |
virtual double | calc_signed_dist (boost::shared_ptr< const Primitive > p, Point3d &pthis, Point3d &pp) const |
Computes the signed distance between this and another primitive. | |
virtual bool | is_convex () const |
Returns whether the mesh is convex (currently mesh must be convex) | |
template<class InputIterator , class OutputIterator > | |
OutputIterator | get_vertices (const IndexedTriArray &tris, InputIterator fselect_begin, InputIterator fselect_end, OutputIterator output, boost::shared_ptr< const Ravelin::Pose3d > P) |
Gets the vertex indices from selected facets of an IndexedTriArray. More... | |
Public Member Functions inherited from Moby::Primitive | |
Primitive () | |
Constructs a primitive under the identity transformation. | |
Primitive (const Ravelin::Pose3d &T) | |
void | update_visualization () |
Updates the visualization on the primitive. | |
void | set_mass (double mass) |
Sets the mass of this primitive. More... | |
void | set_density (double density) |
Sets the density of this primitive. | |
virtual Point3d | get_supporting_point (const Ravelin::Vector3d &d) const |
Gets a supporting point from a primitive. | |
void | add_collision_geometry (CollisionGeometryPtr cg) |
Adds a collision geometry. | |
void | remove_collision_geometry (CollisionGeometryPtr cg) |
Removes a collision geometry. | |
boost::shared_ptr< const Ravelin::Pose3d > | get_pose (CollisionGeometryPtr g) const |
Gets the pose of this primitive relative to a particular collision geometry. | |
virtual double | calc_max_dist (double lin_cont, double ang_cont, double dist, const Ravelin::Vector3d &d0, const Ravelin::Vector3d &w0, boost::shared_ptr< const Ravelin::Pose3d > P) |
Computes the maximum distance by a point on the geometry. | |
virtual osg::Node * | get_visualization () |
Gets the visualization for this primitive. More... | |
boost::shared_ptr< const Ravelin::Pose3d > | get_inertial_pose () const |
Gets the inertial frame of this primitive. | |
boost::shared_ptr< const Ravelin::Pose3d > | get_pose () const |
Gets the pose of this primitive. | |
const Ravelin::SpatialRBInertiad & | get_inertia () const |
Gets the inertia for this primitive. | |
Public Member Functions inherited from Moby::Base | |
Base (const Base *b) | |
Additional Inherited Members | |
Static Public Member Functions inherited from Moby::Base | |
template<class T > | |
static boost::shared_ptr< T > | clone (boost::shared_ptr< T > x) |
Static method for cloning a shared pointer. | |
Public Attributes inherited from Moby::Base | |
boost::shared_ptr< void > | userdata |
Any relevant userdata. | |
std::string | id |
The unique ID for this object. | |
Protected Attributes inherited from Moby::Primitive | |
boost::shared_ptr < Ravelin::Pose3d > | _F |
The pose of this primitive (relative to the global frame) | |
boost::shared_ptr < Ravelin::Pose3d > | _jF |
The inertial pose of this primitive (relative to the global frame) | |
boost::shared_ptr< double > | _density |
The density of this primitive. | |
Ravelin::SpatialRBInertiad | _J |
The inertia of the primitive. | |
std::map< boost::weak_ptr < CollisionGeometry > , boost::shared_ptr < Ravelin::Pose3d > > | _cg_poses |
The poses of this primitive, relative to a collision geometry. | |
std::set< boost::shared_ptr < Ravelin::Pose3d > > | _poses |
The poses, relative to a particular collision geometry. | |
Represents a triangle mesh "primitive" for inertia properties, collision detection, and visualization.
OutputIterator Moby::TriangleMeshPrimitive::get_vertices | ( | const IndexedTriArray & | tris, |
InputIterator | fselect_begin, | ||
InputIterator | fselect_end, | ||
OutputIterator | output, | ||
boost::shared_ptr< const Ravelin::Pose3d > | P | ||
) |
Gets the vertex indices from selected facets of an IndexedTriArray.
tris | the triangle mesh |
fselect_begin | iterator to a container of type unsigned (facet indices) |
fselect_end | iterator to a container of type unsigned (facet indices) |
output | beginning iterator to a container of type Point3d; unique vertices are copied here on return |
References Moby::IndexedTri::a, Moby::IndexedTri::b, Moby::IndexedTri::c, Moby::IndexedTriArray::get_facets(), and Moby::IndexedTriArray::get_vertices().
|
virtual |
Get vertices corresponding to this primitive.
Gets the vertex indices from selected facets of an IndexedTriArray.
tris | the triangle mesh |
fselect_begin | iterator to a container of type unsigned (facet indices) |
fselect_end | iterator to a container of type unsigned (facet indices) |
output | beginning iterator to a container of type Point3d; unique vertices are copied here on return |
Implements Moby::Primitive.
|
virtual |
Implements Base::load_from_xml()
Reimplemented from Moby::Primitive.
References Moby::XMLAttrib::get_bool_value(), Moby::XMLAttrib::get_real_value(), Moby::Primitive::load_from_xml(), Moby::IndexedTriArray::read_from_obj(), set_edge_sample_length(), set_mesh(), and Moby::Primitive::update_visualization().