Moby
|
An array of triangles indexed into shared vertices. More...
#include <IndexedTriArray.h>
Public Member Functions | |
IndexedTriArray (boost::shared_ptr< const std::vector< Ravelin::Origin3d > > vertices, const std::vector< IndexedTri > &facets) | |
IndexedTriArray (boost::shared_ptr< const std::vector< Ravelin::Origin3d > > vertices, boost::shared_ptr< const std::vector< IndexedTri > > facets) | |
template<class ForwardIterator1 , class ForwardIterator2 > | |
IndexedTriArray (ForwardIterator1 vertices, ForwardIterator1 verts_end, ForwardIterator2 facets_begin, ForwardIterator2 facets_end) | |
Creates an indexed triangle mesh from containers of vertices and facets. More... | |
template<class OutputIterator > | |
OutputIterator | get_tris (OutputIterator output_begin, boost::shared_ptr< const Ravelin::Pose3d > P) const |
Converts an indexed triangle mesh to a container of triangles. | |
unsigned | num_tris () const |
Triangle | get_triangle (unsigned i, boost::shared_ptr< const Ravelin::Pose3d > P) const |
Gets the i'th triangle from this mesh. | |
IndexedTriArray | transform (const Ravelin::Transform3d &T) const |
Transforms this mesh to a new mesh. | |
IndexedTriArray | compress_vertices () const |
Compresses the vertices used in an IndexedTriArray to create a new mesh. | |
void | write_to_obj (const std::string &filename) const |
IndexedTriArray & | operator= (const IndexedTriArray &mesh) |
Copies one mesh to another. | |
std::vector< std::list < unsigned > > | determine_vertex_edge_map () const |
Determines a map from vertices to edges. More... | |
std::vector< std::list < unsigned > > | determine_vertex_facet_map () const |
Determines a map from vertices to facet indices. | |
std::map< Ravelin::sorted_pair < unsigned >, std::list < unsigned > > | determine_edge_facet_map () const |
Determines a map from edges to facet indices. | |
void | calc_volume_ints (double volume_ints[10]) const |
Calculates the volume integrals of this primitive as a triangle mesh. | |
const std::list< unsigned > & | get_incident_facets (unsigned i) const |
Gets the indices of facets incident to a vertex. | |
boost::shared_ptr< const std::vector< IndexedTri > > | get_facets_pointer () const |
Gets the pointer to the vector of facets. | |
boost::shared_ptr< const std::vector< Ravelin::Origin3d > > | get_vertices_pointer () const |
Gets the pointer to the vector of vertices. | |
const std::vector< IndexedTri > & | get_facets () const |
Gets the vector of facets. | |
const std::vector < Ravelin::Origin3d > & | get_vertices () const |
Gets the vector of verties. | |
bool | is_coplanar (unsigned vidx) const |
Determines whether a vertex is coplanar (all faces touching the vertex are coplanar) | |
bool | is_coplanar (unsigned v1, unsigned v2) const |
Determines whether an edge (v1,v2) is coplanar (all faces touching the edge are coplanar) | |
template<class ForwardIterator1 , class ForwardIterator2 > | |
IndexedTriArray (ForwardIterator1 verts_begin, ForwardIterator1 verts_end, ForwardIterator2 facets_begin, ForwardIterator2 facets_end) | |
Creates an indexed triangle mesh from containers of vertices and facets. More... | |
template<class OutputIterator > | |
OutputIterator | get_tris (OutputIterator output_begin, boost::shared_ptr< const Ravelin::Pose3d > P) const |
Converts an indexed triangle mesh to a container of triangles. | |
template<class OutputIterator > | |
OutputIterator | intersect (const IndexedTriArray &mesh_a, const IndexedTriArray &mesh_b, OutputIterator output_begin, boost::shared_ptr< const Ravelin::Pose3d > Pa, boost::shared_ptr< const Ravelin::Pose3d > Pb, bool exit_early) |
Intersects two meshes together and returns indices of intersecting triangles. More... | |
Static Public Member Functions | |
template<class OutputIterator > | |
static OutputIterator | intersect (const IndexedTriArray &mesh_a, const IndexedTriArray &mesh_b, OutputIterator output_begin, boost::shared_ptr< const Ravelin::Pose3d > Pa, boost::shared_ptr< const Ravelin::Pose3d > Pb, bool exit_early) |
Intersects two meshes together and returns indices of intersecting triangles. More... | |
static IndexedTriArray | read_from_obj (const std::string &filename) |
Reads triangle mesh from a Wavefront OBJ file. | |
static void | write_to_obj (const IndexedTriArray &mesh, const std::string &filename) |
static IndexedTriArray | merge (const IndexedTriArray &mesh1, const IndexedTriArray &mesh2, double equal_tol=0.0) |
Merges two meshes together to create a new mesh. More... | |
An array of triangles indexed into shared vertices.
Moby::IndexedTriArray::IndexedTriArray | ( | ForwardIterator1 | verts_begin, |
ForwardIterator1 | verts_end, | ||
ForwardIterator2 | facets_begin, | ||
ForwardIterator2 | facets_end | ||
) |
Creates an indexed triangle mesh from containers of vertices and facets.
vertices | an iterator to the beginning of a container of Point3d objects |
verts_end | an iterator to the end of a container of Point3d objects |
facets_begin | an iterator to the beginning of a container of IndexedTri objects |
facets_end | an iterator to the end of a container of IndexedTri objects |
Moby::IndexedTriArray::IndexedTriArray | ( | ForwardIterator1 | verts_begin, |
ForwardIterator1 | verts_end, | ||
ForwardIterator2 | facets_begin, | ||
ForwardIterator2 | facets_end | ||
) |
Creates an indexed triangle mesh from containers of vertices and facets.
vertices | an iterator to the beginning of a container of Point3d objects |
verts_end | an iterator to the end of a container of Point3d objects |
facets_begin | an iterator to the beginning of a container of IndexedTri objects |
facets_end | an iterator to the end of a container of IndexedTri objects |
vector< list< unsigned > > IndexedTriArray::determine_vertex_edge_map | ( | ) | const |
Determines a map from vertices to edges.
Referenced by Moby::OBB::calc_min_volume_OBB().
|
static |
Intersects two meshes together and returns indices of intersecting triangles.
mesh_a | the first mesh |
mesh_b | the second mesh |
output_begin | an iterator pointing to the beginning of a container of std::pair<unsigned, unsigned> objects (on return, container will hold indices of intersecting triangles of mesh_a and mesh_b) |
exit_early | if true, exits after first intersection detected |
OutputIterator Moby::IndexedTriArray::intersect | ( | const IndexedTriArray & | mesh_a, |
const IndexedTriArray & | mesh_b, | ||
OutputIterator | output_begin, | ||
boost::shared_ptr< const Ravelin::Pose3d > | Pa, | ||
boost::shared_ptr< const Ravelin::Pose3d > | Pb, | ||
bool | exit_early | ||
) |
Intersects two meshes together and returns indices of intersecting triangles.
mesh_a | the first mesh |
mesh_b | the second mesh |
output_begin | an iterator pointing to the beginning of a container of std::pair<unsigned, unsigned> objects (on return, container will hold indices of intersecting triangles of mesh_a and mesh_b) |
exit_early | if true, exits after first intersection detected |
References get_tris().
|
static |
Merges two meshes together to create a new mesh.
References get_facets(), and get_vertices().