The Parametric Pseudo-Manifold (PPS) Library 1.0
|
This class represents a Parametric Pseudo-Surface that approximates a PN triangle surface. More...
#include <ppsfrompnt.h>
Public Types | |
typedef dcel::Surface < VertexAttribute, FaceAttribute, int, HalfedgeAttribute > | Surface |
Defines Surface as an alias for dcel::Surface< VertexAttribute , FaceAttribute , int , HalfedgeAttribute > | |
Public Member Functions | |
PPSfromPNT (Surface *mesh) | |
Creates an instance of this PPSfromPNT class. | |
~PPSfromPNT () | |
Destroys an instance of this class. | |
void | eval_surface (Face *face, double u, double v, double w, double &x, double &y, double &z) const |
Computes a point on the PN triangle patch associated with a given face of the PPS underlying triangle mesh. | |
bool | mesh_has_boundary () const |
Determines if the underlying mesh of this PPS has a non-empty boundary. | |
bool | mesh_is_simplicial () const |
Determines if the underlying mesh of this PPS is a simplicial complex. | |
unsigned int | get_id (Halfedge *h) const |
Returns the identifier of a given half-edge. | |
Vertex * | get_org (Halfedge *h) const |
Returns the origin vertex of a given half-edge of this PPS underlying mesh. | |
Vertex * | get_dst (Halfedge *h) const |
Returns the destination vertex of a given half-edge of this PPS underlying mesh. | |
Edge * | get_edge (Halfedge *h) const |
Returns the edge a given half-edge of this PPS underlying mesh belongs to. | |
Face * | get_face (Halfedge *h) const |
Returns the face a given half-edge of this PPS underlying mesh belongs to. | |
Halfedge * | get_prev (Halfedge *h) const |
Returns the half-edge that precedes a given half-edge of this PPS underlying mesh in the face cycle of half-edges that contains both half-edges. | |
Halfedge * | get_next (Halfedge *h) const |
Returns the half-edge that succeeds a given half-edge of this PPS underlying mesh in the face cycle of half-edges that contains both half-edges. | |
Halfedge * | get_mate (Halfedge *h) const |
Returns the mate of a given half-edge of this PPS underlying mesh. | |
Halfedge * | get_halfedge (Face *face) const |
Returns the first half-edge of the cycle of half-edges of a given face of this PPS underlying mesh. | |
Halfedge * | get_halfedge (Vertex *vertex) const |
Returns one half-edge with origin at a given vertex of this PPS underlying mesh. It is assumed that this method will always return the same half-edge (as many half-edges may share the same origin vertex). | |
unsigned | get_degree (Vertex *vertex) const |
Returns the degree of a given vertex of this PPS underlying mesh. The degree of a vertex is the number of edges incident to the vertex. | |
Bezier * | get_shape_function (Vertex *vertex) const |
Returns the shape function associated with a given vertex of this PPS underlying mesh. The shape function is a rectangular Bézier patch. | |
void | set_shape_function (Vertex *vertex, Bezier *patch) |
Assigns a shape function to a given vertex of this PPS underlying mesh. | |
VertexIterator | vertices_begin () const |
Returns a vertex iterator set to the initial vertex of a vertex sequence of this PPS underlying mesh. | |
bool | is_done (const VertexIterator &iterator) const |
Returns a logic value true if a given vertex iterator has reached the end of a vertex sequence of this PPS underlying mesh; otherwise, it returns the logic value false. | |
void | move_forward (VertexIterator &iterator) const |
Makes the iterator point to the vertex succeeding its current vertex in a vertex sequence of this PPS underlying mesh. | |
Vertex * | get_vertex (const VertexIterator &iterator) const |
Returns the current vertex of a given vertex iterator for a vertex sequence of this PPS underlying mesh. | |
EdgeIterator | edges_begin () const |
Returns an edge iterator set to the initial edge of an edge sequence of this PPS underlying mesh. | |
bool | is_done (const EdgeIterator &iterator) const |
Returns A logic value true if a given edge iterator has reached the end of an edge sequence of this PPS underlying mesh; otherwise, it returns the logic value false. | |
void | move_forward (EdgeIterator &iterator) const |
Makes the iterator point to the edge succeeding its current edge in an edge sequence of this PPS underlying mesh. | |
Edge * | get_edge (const EdgeIterator &iterator) const |
Returns the current edge of a given edge iterator for an edge sequence of this PPS underlying mesh. | |
FaceIterator | faces_begin () const |
Returns a face iterator set to the initial face of a face sequence of this PPS underlying mesh. | |
bool | is_done (const FaceIterator &iterator) const |
Returns A logic value true if a given face iterator has reached the end of a face sequence of this PPS underlying mesh; otherwise, it returns the logic value false. | |
void | move_forward (FaceIterator &iterator) const |
Makes the iterator point to the face succeeding its current face in a face sequence of this PPS underlying mesh. | |
Face * | get_face (const FaceIterator &iterator) const |
Returns the current face of a given face iterator for a face sequence of this PPS underlying mesh. | |
Private Member Functions | |
void | build_pnt_surface () |
Computes a PN triangle surface patch for each face of a given triangle mesh, and then assigns the patch to the face. | |
void | compute_vertex_normal_vector (Vertex *vertex, double &x, double &y, double &z) |
Computes a unit vector at a given surface mesh vertex. | |
void | compute_face_normal_vector (Face *face, double &x, double &y, double &z) |
Computes the unit vector of a given surface mesh face. |
This class represents a Parametric Pseudo-Surface that approximates a PN triangle surface.
Definition at line 67 of file ppsfrompnt.h.
ppsfrompnt::PPSfromPNT::PPSfromPNT | ( | Surface * | mesh | ) |
Creates an instance of this PPSfromPNT class.
mesh | A Pointer to a surface mesh represented by a DCEL. |
mesh | A Pointer to a surface mesh represented by an DCEL. |
Definition at line 58 of file ppsfrompnt.cpp.
References build_pnt_surface(), edges_begin(), get_edge(), is_done(), and move_forward().
: PPS< Surface >( mesh ) { // // Sets the owner of each half-edge attribute set. // for ( EdgeIterator eit = edges_begin() ; !is_done( eit ) ; move_forward( eit ) ) { Edge* edge = get_edge( eit ) ; Halfedge* h1 = edge->get_first_halfedge() ; Halfedge* h2 = edge->get_second_halfedge() ; h1->get_attributes().set_owner( h1 ) ; h2->get_attributes().set_owner( h2 ) ; } // // Create the PN triangle surface. // build_pnt_surface() ; }
void ppsfrompnt::PPSfromPNT::compute_face_normal_vector | ( | Face * | face, |
double & | x, | ||
double & | y, | ||
double & | z | ||
) | [private] |
Computes the unit vector of a given surface mesh face.
face | A pointer to a surface mesh face. |
x | A reference to the first component of the normal vector. |
y | A reference to the second component of the normal vector. |
z | A reference to the third component of the normal vector. |
Definition at line 266 of file ppsfrompnt.cpp.
Referenced by compute_vertex_normal_vector().
{ Halfedge* h1 = face->get_halfedge() ; Halfedge* h2 = h1->get_next() ; Halfedge* h3 = h1->get_prev() ; double x1 = h1->get_origin()->x() ; double y1 = h1->get_origin()->y() ; double z1 = h1->get_origin()->z() ; double x2 = h2->get_origin()->x() ; double y2 = h2->get_origin()->y() ; double z2 = h2->get_origin()->z() ; double x3 = h3->get_origin()->x() ; double y3 = h3->get_origin()->y() ; double z3 = h3->get_origin()->z() ; x2 -= x1 ; y2 -= y1 ; z2 -= z1 ; x3 -= x1 ; y3 -= y1 ; z3 -= z1 ; x = y2 * z3 - z2 * y3 ; y = z2 * x3 - x2 * z3 ; z = x2 * y3 - y2 * x3 ; double length = sqrt( ( x * x ) + ( y * y ) + ( z * z ) ) ; x /= length ; y /= length ; z /= length ; return ; }
void ppsfrompnt::PPSfromPNT::compute_vertex_normal_vector | ( | Vertex * | vertex, |
double & | x, | ||
double & | y, | ||
double & | z | ||
) | [private] |
Computes a unit vector at a given surface mesh vertex.
vertex | A pointer to a surface mesh vertex. |
x | A reference to the first component of the normal vector. |
y | A reference to the second component of the normal vector. |
z | A reference to the third component of the normal vector. |
Definition at line 208 of file ppsfrompnt.cpp.
References compute_face_normal_vector().
Referenced by build_pnt_surface().
{ unsigned i = 0 ; x = 0 ; y = 0 ; z = 0 ; Halfedge* h1 = vertex->get_halfedge() ; Halfedge* h2 = h1 ; do { double xaux ; double yaux ; double zaux ; compute_face_normal_vector( h2->get_face() , xaux , yaux , zaux ) ; x += xaux ; y += yaux ; z += zaux ; ++i ; h2 = h2->get_prev()->get_mate() ; } while ( h2 != h1 ) ; x /= double( i ) ; y /= double( i ) ; z /= double( i ) ; double length = sqrt( ( x * x ) + ( y * y ) + ( z * z ) ) ; x /= length ; y /= length ; z /= length ; return ; }
EdgeIterator ppsfrompnt::PPSfromPNT::edges_begin | ( | ) | const [inline, virtual] |
Returns an edge iterator set to the initial edge of an edge sequence of this PPS underlying mesh.
Implements pps::PPS< Mesh >.
Definition at line 521 of file ppsfrompnt.h.
References pps::PPS< Mesh >::get_mesh().
Referenced by PPSfromPNT().
{ return get_mesh()->edges_begin() ; }
void ppsfrompnt::PPSfromPNT::eval_surface | ( | Face * | face, |
double | u, | ||
double | v, | ||
double | w, | ||
double & | x, | ||
double & | y, | ||
double & | z | ||
) | const [virtual] |
Computes a point on the PN triangle patch associated with a given face of the PPS underlying triangle mesh.
face | Pointer to one face of the underlying mesh. |
u | First barycentric coordinate of a point on the face. |
v | Second barycentric coordinate of a point on the face. |
w | Third barycentric coordinate of a point on the face. |
x | First Cartesian coordinate of a point on the PPS image. |
y | Second Cartesian coordinate of a point on the PPS image. |
z | Third Cartesian coordinate of a point on the PPS image. |
Implements pps::PPS< Mesh >.
Definition at line 96 of file ppsfrompnt.cpp.
References ppsfrompnt::PNTriangle::point().
{ // // Make sure the face has a PN triangle associated with it. // PNTriangle* patch = face->get_attributes().get_patch() ; assert( patch != 0 ) ; // // Make sure the coordinates are non-negative and add up to 1. // assert( ( u >= 0 ) && ( u <= 1 ) && ( v >= 0 ) && ( v <= 1 ) && ( w >= 0 ) && ( w <= 1 ) && ( fabs( 1 - ( u + v + w ) ) <= 1e-15 ) ) ; // // Evaluate the patch. // patch->point( u , v , x , y , z ) ; }
FaceIterator ppsfrompnt::PPSfromPNT::faces_begin | ( | ) | const [inline, virtual] |
Returns a face iterator set to the initial face of a face sequence of this PPS underlying mesh.
Implements pps::PPS< Mesh >.
Definition at line 586 of file ppsfrompnt.h.
References pps::PPS< Mesh >::get_mesh().
Referenced by build_pnt_surface().
{ return get_mesh()->faces_begin() ; }
unsigned ppsfrompnt::PPSfromPNT::get_degree | ( | Vertex * | vertex | ) | const [inline, virtual] |
Returns the degree of a given vertex of this PPS underlying mesh. The degree of a vertex is the number of edges incident to the vertex.
vertex | Pointer to a vertex of this PPS underlying mesh. |
Implements pps::PPS< Mesh >.
Definition at line 408 of file ppsfrompnt.h.
{
return vertex->get_halfedge()->get_attributes().get_origin_vertex_degree() ;
}
Returns the destination vertex of a given half-edge of this PPS underlying mesh.
h | Pointer to a half-edge of this PPS underlying mesh. |
Implements pps::PPS< Mesh >.
Definition at line 272 of file ppsfrompnt.h.
{
return h->get_next()->get_origin() ;
}
Returns the edge a given half-edge of this PPS underlying mesh belongs to.
h | Pointer to a half-edge of this PPS underlying mesh. |
Implements pps::PPS< Mesh >.
Definition at line 288 of file ppsfrompnt.h.
Referenced by PPSfromPNT().
{
return h->get_edge() ;
}
Edge * ppsfrompnt::PPSfromPNT::get_edge | ( | const EdgeIterator & | iterator | ) | const [inline, virtual] |
Returns the current edge of a given edge iterator for an edge sequence of this PPS underlying mesh.
iterator | A reference to an edge iterator. |
Implements pps::PPS< Mesh >.
Definition at line 571 of file ppsfrompnt.h.
{
return *iterator ;
}
Returns the face a given half-edge of this PPS underlying mesh belongs to.
h | Pointer to a half-edge of this PPS underlying mesh. |
Implements pps::PPS< Mesh >.
Definition at line 304 of file ppsfrompnt.h.
Referenced by build_pnt_surface().
{
return h->get_face() ;
}
Face * ppsfrompnt::PPSfromPNT::get_face | ( | const FaceIterator & | iterator | ) | const [inline, virtual] |
Returns the current face of a given face iterator for a face sequence of this PPS underlying mesh.
iterator | A reference to a face iterator. |
Implements pps::PPS< Mesh >.
Definition at line 636 of file ppsfrompnt.h.
{
return *iterator ;
}
Returns one half-edge with origin at a given vertex of this PPS underlying mesh. It is assumed that this method will always return the same half-edge (as many half-edges may share the same origin vertex).
vertex | Pointer to a vertex of this PPS underlying mesh. |
Implements pps::PPS< Mesh >.
Definition at line 391 of file ppsfrompnt.h.
{
return vertex->get_halfedge() ;
}
Returns the first half-edge of the cycle of half-edges of a given face of this PPS underlying mesh.
face | Pointer to a face of this PPS underlying mesh. |
Implements pps::PPS< Mesh >.
Definition at line 372 of file ppsfrompnt.h.
{
return face->get_halfedge() ;
}
unsigned int ppsfrompnt::PPSfromPNT::get_id | ( | Halfedge * | h | ) | const [inline, virtual] |
Returns the identifier of a given half-edge.
h | Pointer to a half-edge. |
Reimplemented from pps::PPS< Mesh >.
Definition at line 239 of file ppsfrompnt.h.
{
return h->get_attributes().get_pps_id() ;
}
Returns the mate of a given half-edge of this PPS underlying mesh.
h | Pointer to a half-edge of this PPS underlying mesh. |
Implements pps::PPS< Mesh >.
Definition at line 356 of file ppsfrompnt.h.
{
return h->get_mate() ;
}
Returns the half-edge that succeeds a given half-edge of this PPS underlying mesh in the face cycle of half-edges that contains both half-edges.
h | Pointer to a half-edge of this PPS underlying mesh. |
Implements pps::PPS< Mesh >.
Definition at line 340 of file ppsfrompnt.h.
{
return h->get_next() ;
}
Returns the origin vertex of a given half-edge of this PPS underlying mesh.
h | Pointer to a half-edge of this PPS underlying mesh. |
Implements pps::PPS< Mesh >.
Definition at line 255 of file ppsfrompnt.h.
{
return h->get_origin() ;
}
Returns the half-edge that precedes a given half-edge of this PPS underlying mesh in the face cycle of half-edges that contains both half-edges.
h | Pointer to a half-edge of this PPS underlying mesh. |
Implements pps::PPS< Mesh >.
Definition at line 322 of file ppsfrompnt.h.
{
return h->get_prev() ;
}
Returns the shape function associated with a given vertex of this PPS underlying mesh. The shape function is a rectangular Bézier patch.
vertex | Pointer to a vertex of this PPS underlying mesh. |
Implements pps::PPS< Mesh >.
Definition at line 425 of file ppsfrompnt.h.
{
return vertex->get_attributes().get_patch() ;
}
Vertex * ppsfrompnt::PPSfromPNT::get_vertex | ( | const VertexIterator & | iterator | ) | const [inline, virtual] |
Returns the current vertex of a given vertex iterator for a vertex sequence of this PPS underlying mesh.
iterator | A reference to a vertex iterator. |
Implements pps::PPS< Mesh >.
Definition at line 506 of file ppsfrompnt.h.
{
return *iterator ;
}
bool ppsfrompnt::PPSfromPNT::is_done | ( | const VertexIterator & | iterator | ) | const [inline, virtual] |
Returns a logic value true if a given vertex iterator has reached the end of a vertex sequence of this PPS underlying mesh; otherwise, it returns the logic value false.
iterator | A vertex iterator. |
Implements pps::PPS< Mesh >.
Definition at line 474 of file ppsfrompnt.h.
References pps::PPS< Mesh >::get_mesh().
Referenced by build_pnt_surface(), and PPSfromPNT().
{ return iterator == get_mesh()->vertices_end() ; }
bool ppsfrompnt::PPSfromPNT::is_done | ( | const EdgeIterator & | iterator | ) | const [inline, virtual] |
Returns A logic value true if a given edge iterator has reached the end of an edge sequence of this PPS underlying mesh; otherwise, it returns the logic value false.
iterator | An edge iterator. |
Implements pps::PPS< Mesh >.
Definition at line 540 of file ppsfrompnt.h.
References pps::PPS< Mesh >::get_mesh().
{ return iterator == get_mesh()->edges_end() ; }
bool ppsfrompnt::PPSfromPNT::is_done | ( | const FaceIterator & | iterator | ) | const [inline, virtual] |
Returns A logic value true if a given face iterator has reached the end of a face sequence of this PPS underlying mesh; otherwise, it returns the logic value false.
iterator | A face iterator. |
Implements pps::PPS< Mesh >.
Definition at line 605 of file ppsfrompnt.h.
References pps::PPS< Mesh >::get_mesh().
{ return iterator == get_mesh()->faces_end() ; }
bool ppsfrompnt::PPSfromPNT::mesh_has_boundary | ( | ) | const [inline, virtual] |
Determines if the underlying mesh of this PPS has a non-empty boundary.
Implements pps::PPS< Mesh >.
Definition at line 209 of file ppsfrompnt.h.
{
return false ;
}
bool ppsfrompnt::PPSfromPNT::mesh_is_simplicial | ( | ) | const [inline, virtual] |
Determines if the underlying mesh of this PPS is a simplicial complex.
Implements pps::PPS< Mesh >.
Definition at line 224 of file ppsfrompnt.h.
{
return true ;
}
void ppsfrompnt::PPSfromPNT::move_forward | ( | FaceIterator & | iterator | ) | const [inline, virtual] |
Makes the iterator point to the face succeeding its current face in a face sequence of this PPS underlying mesh.
iterator | A reference to a face iterator. |
Implements pps::PPS< Mesh >.
Definition at line 619 of file ppsfrompnt.h.
{ ++iterator ; }
void ppsfrompnt::PPSfromPNT::move_forward | ( | VertexIterator & | iterator | ) | const [inline, virtual] |
Makes the iterator point to the vertex succeeding its current vertex in a vertex sequence of this PPS underlying mesh.
iterator | A reference to a vertex iterator. |
Implements pps::PPS< Mesh >.
Definition at line 489 of file ppsfrompnt.h.
Referenced by build_pnt_surface(), and PPSfromPNT().
{ ++iterator ; }
void ppsfrompnt::PPSfromPNT::move_forward | ( | EdgeIterator & | iterator | ) | const [inline, virtual] |
Makes the iterator point to the edge succeeding its current edge in an edge sequence of this PPS underlying mesh.
iterator | A reference to an edge iterator. |
Implements pps::PPS< Mesh >.
Definition at line 554 of file ppsfrompnt.h.
{ ++iterator ; }
void ppsfrompnt::PPSfromPNT::set_shape_function | ( | Vertex * | vertex, |
Bezier * | patch | ||
) | [inline, virtual] |
Assigns a shape function to a given vertex of this PPS underlying mesh.
vertex | Pointer to a vertex of this PPS underlying mesh. |
patch | Pointer to a shape function. |
Implements pps::PPS< Mesh >.
Definition at line 440 of file ppsfrompnt.h.
{ vertex->get_attributes().set_patch( patch ) ; }
VertexIterator ppsfrompnt::PPSfromPNT::vertices_begin | ( | ) | const [inline, virtual] |
Returns a vertex iterator set to the initial vertex of a vertex sequence of this PPS underlying mesh.
Implements pps::PPS< Mesh >.
Definition at line 455 of file ppsfrompnt.h.
References pps::PPS< Mesh >::get_mesh().
{ return get_mesh()->vertices_begin() ; }