The Parametric Pseudo-Manifold (PPS) Library 1.0
|
This class represents a Parametric Pseudo-Surface. More...
#include <pps.h>
Public Types | |
typedef Mesh::Vertex | Vertex |
Definition of a type name for the mesh vertices. | |
typedef Mesh::Halfedge | Halfedge |
Definition of a type name for the mesh half-edges. | |
typedef Mesh::Edge | Edge |
Definition of a type name for the mesh edges. | |
typedef Mesh::Face | Face |
Definition of a type name for the mesh faces. | |
typedef Mesh::VertexIterator | VertexIterator |
Definition of a type name for the vertex iterators. | |
typedef Mesh::EdgeIterator | EdgeIterator |
Definition of a type name for the edge iterators. | |
typedef Mesh::FaceIterator | FaceIterator |
Definition of a type name for the face iterators. | |
Public Member Functions | |
PPS (Mesh *mesh) | |
Creates an instance of this PPS class. | |
virtual | ~PPS () |
Virtual destructor. | |
void | build () |
Computes the parametrizations of this PPS, each of which is associated with one vertex of the underlying triangle mesh of the PPS. | |
void | eval_pps (Face *face, double u, double v, double w, double &x, double &y, double &z) const |
Computes a point on the image of this PPS. The resulting point is the image of a point in a p-domain that corresponds to a point (through an implicit homomorphism) in a face of the underlying mesh. | |
virtual void | eval_surface (Face *face, double u, double v, double w, double &x, double &y, double &z) const =0 |
Computes a point on the parametric patch associated with a given face of the PPS underlying triangle mesh. This method must be implemented by the user of the PPS library (i.e., in the concrete PPS class that inherits from this abstract PPS class. | |
Mesh * | get_mesh () const |
Returns a pointer to the underlying mesh of this PPS. | |
virtual VertexIterator | vertices_begin () const =0 |
Returns a vertex iterator set to the initial vertex of a vertex sequence of this PPS underlying mesh. | |
virtual bool | is_done (const VertexIterator &iterator) const =0 |
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. | |
virtual void | move_forward (VertexIterator &iterator) const =0 |
Makes the iterator point to the vertex succeeding its current vertex in a vertex sequence of this PPS underlying mesh. | |
virtual Vertex * | get_vertex (const VertexIterator &iterator) const =0 |
Returns the current vertex of a given vertex iterator for a vertex sequence of this PPS underlying mesh. | |
virtual EdgeIterator | edges_begin () const =0 |
Returns an edge iterator set to the initial edge of an edge sequence of this PPS underlying mesh. | |
virtual bool | is_done (const EdgeIterator &iterator) const =0 |
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. | |
virtual void | move_forward (EdgeIterator &iterator) const =0 |
Makes the iterator point to the edge succeeding its current edge in an edge sequence of this PPS underlying mesh. | |
virtual Edge * | get_edge (const EdgeIterator &iterator) const =0 |
Returns the current edge of a given edge iterator for an edge sequence of this PPS underlying mesh. | |
virtual FaceIterator | faces_begin () const =0 |
Returns a face iterator set to the initial face of a face sequence of this PPS underlying mesh. | |
virtual bool | is_done (const FaceIterator &iterator) const =0 |
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. | |
virtual void | move_forward (FaceIterator &iterator) const =0 |
Makes the iterator point to the face succeeding its current face in a face sequence of this PPS underlying mesh. | |
virtual Face * | get_face (const FaceIterator &iterator) const =0 |
Returns the current face of a given face iterator for a face sequence of this PPS underlying mesh. | |
Protected Member Functions | |
void | build_shape_functions () |
Creates the shape functions associated with the p-domains. | |
void | build_one_shape_function (Vertex *vertex) |
Creates the shape function associated with a given vertex of this PPS underlying mesh. This method samples the p-domain associated with the vertex and computes the points in 3D that are images of the p-domain points under the generic patch defined by the method pps::PPS::eval_surface. Those p-domain points and their corresponding image points are used to set up a linear system (the normal equations of a least squares problem), whose solution yields the control points of the shape function. This method relies on the implementation of pps::PPS::eval_surface. | |
unsigned | get_shape_function_degree (unsigned D) const |
Returns the bi-degree of the rectangular Bezier patch defining a shape function. This bi-digree is heuristically defined as the maximum between the number seven and one plus the degree of the vertex associated with the shape function. | |
unsigned | get_number_of_parameter_points (unsigned D) const |
Returns the number of points used to sample a p-domain. This number is heuristically defined as twice the bi-degree of the shape function associated with the p-domain. | |
unsigned | get_degree (Halfedge *h) const |
Returns the degree of the origin vertex of a given half-edge. | |
bool | find_triangle (Halfedge *&h, double x, double y, double &u, double &v, double &w) const |
Finds the triangle of the canonical triangulation of a p-domain that contains a given point (if such a triangle exists). The p-domain is specified by a pointer to a half-edge, i. e., the p-domain is the one associated with the origin vertex of the given half-edge. | |
void | get_barycentric_coordinates (double x0, double y0, double x1, double y1, double x2, double y2, double xp, double yp, double &u, double &v, double &w) const |
Computes the barycentric coordinates of a given point (in Cartesian coordinates) with respect to a given reference triangle. | |
void | eval_pps (Halfedge *h, double u, double v, double w, double &x, double &y, double &z) const |
Computes a point on the image of this PPS. The resulting point is the image of a point in a p-domain. The p-domain is specified by a half-edge, whose origin vertex is the vertex associated with the p-domain. The point is supposed to be in the face that contains the given half-edge in the underlying mesh of this PPS. We are given the barycentric coordinates of the point, which are the same coordinates of the point in the upper triangle of the canonical domain. | |
void | select_pdomain (Face *face, double &u, double &v, double &w, Halfedge *&h) const |
Finds one p-domain that contains the parameter point that is the image of a given point in a face of this PPS underlying mesh. | |
void | from_barycentric_to_Cartesian (double u, double v, double w, double x0, double y0, double x1, double y1, double x2, double y2, double &x, double &y) const |
Converts the barycentric coordinates of a point, with respect to a reference triangle, to Cartesian coordinates. | |
void | compute_pdomain_contribution (Halfedge *h, double u, double v, double &weight, double &x, double &y, double &z) const |
Computes the contribution of the shape function associated with a given p-domain at a given point. The p-domain is specified by a given half-edge whose origin vertex is the vertex associated with the p-domain. The given point is expected to be in the canonical triangulation triangle corresponding to the face that contains the given half-edge. | |
void | gfunction (Halfedge *h, double x, double y, double &u, double &v) const |
Computes the Cartesian coordinates of the image of a point under the transition map from one gluing domain to another. The source and target p-domains are specified by a given half-edge. The source gluing domain is the one associated with the origin vertex of the half-edge, while the target gluing domain is the one associated with the destination vertex of the given half-edge. | |
void | to_canonical_domain (Halfedge *h, double x, double y, double &u, double &v) const |
Maps a point in a p-domain to a point in the canonical lens. The p-domain is specified by a half-edge whose origin vertex is the one associated with the p-domain. | |
void | from_canonical_domain (Halfedge *h, double x, double y, double &u, double &v) const |
Maps a point in the canonical lens to a p-domain. The p-domain is specified by a half-edge whose origin vertex is the one associated with the p-domain. | |
void | rot_2d (double x, double y, double ang, double &u, double &v) const |
Computes the location of a given point after a rotation around the origin by a given angle. | |
virtual unsigned int | get_id (Halfedge *h) const |
Returns the identifier of a given half-edge. The identifier of a half-edge is a number ranging from 0 to N - 1, where N is the degree of the origin vertex of the half-edge. Each such a number represents the position of one half-edge in the sequence defined by a counterclockwise traversal of all half-edges with origin at the same vertex. The first half-edge visited in this traversal gets the identifier 0, the second half-edge gets the identifier 1, and so on so forth. | |
double | weight_function (double x, double y, double R) const |
Evaluates the weight function at a given point. | |
double | eta_function (double s, double d1, double d2) const |
Evaluates the eta blending function at a given parameter value. | |
virtual bool | mesh_has_boundary () const =0 |
Determines if the underlying mesh of this PPS has a non-empty boundary. | |
virtual bool | mesh_is_simplicial () const =0 |
Determines if the underlying mesh of this PPS is a simplicial complex. | |
virtual Vertex * | get_org (Halfedge *h) const =0 |
Returns the origin vertex of a given half-edge of this PPS underlying mesh. | |
virtual Vertex * | get_dst (Halfedge *h) const =0 |
Returns the destination vertex of a given half-edge of this PPS underlying mesh. | |
virtual Edge * | get_edge (Halfedge *h) const =0 |
Returns the edge a given half-edge of this PPS underlying mesh belongs to. | |
virtual Face * | get_face (Halfedge *h) const =0 |
Returns the face a given half-edge of this PPS underlying mesh belongs to. | |
virtual Halfedge * | get_prev (Halfedge *h) const =0 |
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. | |
virtual Halfedge * | get_next (Halfedge *h) const =0 |
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. | |
virtual Halfedge * | get_mate (Halfedge *h) const =0 |
Returns the mate of a given half-edge of this PPS underlying mesh. | |
virtual Halfedge * | get_halfedge (Face *face) const =0 |
Returns the first half-edge of the cycle of half-edges of a given face of this PPS underlying mesh. | |
virtual Halfedge * | get_halfedge (Vertex *vertex) const =0 |
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). | |
virtual unsigned int | get_degree (Vertex *vertex) const =0 |
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. | |
virtual Bezier * | get_shape_function (Vertex *vertex) const =0 |
Returns the shape function associated with a given vertex of this PPS underlying mesh. The shape function is a rectangular Bézier patch. | |
virtual void | set_shape_function (Vertex *vertex, Bezier *patch)=0 |
Assigns a shape function to a given vertex of this PPS underlying mesh. | |
Protected Attributes | |
Mesh * | _mesh |
A pointer to a triangle mesh of type Mesh. | |
const double | _MYPI |
The constant PI. |
This class represents a Parametric Pseudo-Surface.
The Mesh type is expected to be a triangle mesh. To use the PPS class one must implement twenty-five pure virtual methods. All but one of these methods ( "eval_surface" ) are related to mesh topological operations. The method "eval_surface" computes a point on a generic parametric patch associated with a given mesh face.
If one does not intend to use the PPS class with her/his own mesh class, one can always use the default mesh class that accompanies the PPS class. For an example of the use of the PPS class with the default mesh class, take a look at the classes PPSfromPNT and PPSfromLOOP, both of which accompanies the PPS class code. The former class implements the "eval_surface" method as a PN triangle patch, while the latter implements the method as a Loop surface patch.
void pps::PPS< Mesh >::build_one_shape_function | ( | Vertex * | vertex | ) | [protected] |
Creates the shape function associated with a given vertex of this PPS underlying mesh. This method samples the p-domain associated with the vertex and computes the points in 3D that are images of the p-domain points under the generic patch defined by the method pps::PPS::eval_surface. Those p-domain points and their corresponding image points are used to set up a linear system (the normal equations of a least squares problem), whose solution yields the control points of the shape function. This method relies on the implementation of pps::PPS::eval_surface.
Creates the shape function associated with a given vertex of this PPS underlying mesh. This method samples the p-domain associated with the vertex and computes the points in 3D that are images of the p-domain points under the generic patch defined by the method PPS< Mesh >::eval_surface. Those p-domain points and their corresponding image points are used to set up a linear system (the normal equations of a least squares problem), whose solution yields the control points of the shape function.
vertex,: | pointer to the vertex associated with the p-domain. |
vertex,: | pointer to the vertex associated with the p-domain. |
Definition at line 1283 of file pps.h.
{ #ifdef DEBUGMODE assert ( vertex != 0 ) ; #endif /* * Get one halfedge with origin at vertex \var vertex. */ Halfedge* h = get_halfedge( vertex ) ; #ifdef DEBUGMODE assert ( h != 0 ) ; #endif unsigned int nu = get_degree( h ) ; #ifdef DEBUGMODE assert ( nu >= 3 ) ; #endif /* * Generate a rectangular grid with (N + 1) * (N + 1) parameter * points. */ const unsigned int D = get_shape_function_degree( nu ) ; const unsigned int N = get_number_of_parameter_points( D ) ; const double R = cos( _MYPI / nu ) ; /* * Coordinates of the lower leftmost point of the grid. */ const double x0 = -R ; const double y0 = -R ; /* * Spacing between two consecutives points in both X and Y * directions. */ const double dd = ( 2 * R ) / N ; /* * Initialize the Y direction spacing counter. */ double dy = 0 ; std::vector< double > param_pts ; // Array of parameter points. std::vector< double > patch_pts ; // Array of surface points. for (unsigned int j = 0 ; j <= N ; j++ ) { /* Y coordinate of the point. */ double y = y0 + dy ; /* * Initialize the X direction spacing counter. */ double dx = 0 ; for ( unsigned int i = 0 ; i <= N ; i++ ) { /* X coordinate of the point. */ double x = x0 + dx ; /* * If this parameter point is inside the P-polygon the * P-domain is inscribed in, then we can compute a point on * the given generic patch. */ double u ; double v ; double w ; Halfedge* haux = h ; if ( find_triangle( haux , x , y , u , v , w ) ) { /* * Store the coordinates of the parameter point. */ param_pts.push_back( x ) ; param_pts.push_back( y ) ; /* * Compute the corresponding point in the generic surface * patch. */ #ifdef DEBUGMODE assert( haux != 0 ) ; #endif /* Get the face the half-edge haux belongs to. */ Face* face = get_face( haux ) ; #ifdef DEBUGMODE assert( face != 0 ) ; #endif double pt[ 3 ] ; if ( haux == get_halfedge( face ) ) { eval_surface( face , u , v , w , pt[ 0 ] , pt[ 1 ] , pt[ 2 ] ) ; } else if ( get_next( haux ) == get_halfedge( face ) ) { eval_surface( face , v , w , u , pt[ 0 ] , pt[ 1 ] , pt[ 2 ] ) ; } else { eval_surface( face , w , u , v , pt[ 0 ] , pt[ 1 ] , pt[ 2 ] ) ; } /* * Store the coordinates of the point on the generic surface * patch. */ patch_pts.push_back( pt[0] ) ; patch_pts.push_back( pt[1] ) ; patch_pts.push_back( pt[2] ) ; } /* Increment X direction spacing counter. */ dx += dd ; } /* Increment Y direction spacing counter. */ dy += dd ; } /* Creates the shape function. */ set_shape_function( vertex , new Bezier( ¶m_pts[0] , &patch_pts[0] , param_pts.size() >> 1 , D , D , -R , -R , R , R ) ) ; return ; }
void pps::PPS< Mesh >::build_shape_functions | ( | ) | [protected] |
Creates the shape functions associated with the p-domains.
Creates the shape functions associated with the p-domains. This method relies on the implementation of eval_surface().
Definition at line 1238 of file pps.h.
{ /* * For each vertex "v" of the underlying mesh, sample the * P-polygon associated with it, and then compute the * corresponding points in the generic parametric patch. These * points are then used to compute the control points of the shape * functions. */ for ( VertexIterator vi = vertices_begin() ; !is_done( vi ) ; move_forward( vi ) ) { /* * Get the current vertex. */ Vertex* vertex = get_vertex( vi ); /* * Compute the shape function corresponding to the current * vertex. */ build_one_shape_function( vertex ) ; } return ; }
void pps::PPS< Mesh >::compute_pdomain_contribution | ( | Halfedge * | h, |
double | u, | ||
double | v, | ||
double & | weight, | ||
double & | x, | ||
double & | y, | ||
double & | z | ||
) | const [protected] |
Computes the contribution of the shape function associated with a given p-domain at a given point. The p-domain is specified by a given half-edge whose origin vertex is the vertex associated with the p-domain. The given point is expected to be in the canonical triangulation triangle corresponding to the face that contains the given half-edge.
h | Pointer to a given half-edge. |
u | First Cartesian coordinate of the given point in a p-domain. |
v | Second Cartesian coordinate of the given point in a p-domain. |
weight | accumulator of the sum of weights. |
x | First Cartesian coordinate of the point representing the contribution of the shape function. |
y | Second Cartesian coordinate of the point representing the contribution of the shape function. |
z | Third Cartesian coordinate of the point representing the contribution of the shape function. |
Definition at line 2019 of file pps.h.
References pps::Bezier::point().
{ /* * Get the degree of the origin vertex of the given half-edge. */ unsigned int nu = get_degree( h ) ; /* * Get the radius of the boundary circumference of the p-domain * associated with the origin vertex of the given half-edge. */ const double R = cos( _MYPI / nu ) ; /* * Compute the squared distance of the point (u,v) to the origin * of the local coordinate system of the p-domain associated with * the given half-edge. */ double ll = u * u + v * v ; /* * If the point (u,v) is inside the p-domain, then compute the * contribution of the shape function associated with the origin * vertex of the given half-edge. */ if ( ll < R * R ) { /* * Compute the weight of the contribution. */ double w = weight_function( u , v , R ) ; weight += w ; /* * Get the shape function associated with the origin vertex of * the given half-edge. */ Bezier* patch = get_shape_function( get_org( h ) ) ; #ifdef DEBUGMODE assert( patch != 0 ) ; #endif /* * Compute a point on the patch corresponding to the shape * function. */ double fx , fy , fz ; patch->point( u , v , fx , fy , fz ) ; /* * Weight the contribution of the shape function. */ x += w * fx ; y += w * fy ; z += w * fz ; } return ; }
EdgeIterator pps::PPS< Mesh >::edges_begin | ( | ) | const [pure virtual] |
Returns an edge iterator set to the initial edge of an edge sequence of this PPS underlying mesh.
Implemented in ppsfrompnt::PPSfromPNT.
double pps::PPS< Mesh >::eta_function | ( | double | s, |
double | d1, | ||
double | d2 | ||
) | const [protected] |
Evaluates the eta blending function at a given parameter value.
s | Parameter value. |
d1 | Lower bound for the extent of the blending region. |
d2 | Upper bound for the extent of the blending region |
Definition at line 2449 of file pps.h.
{ #ifdef DEBUGMODE assert( d2 > d1 ) ; assert( d1 > 0 ) ; assert( d2 < 1 ) ; #endif double res ; if ( s <= d1 ) { res = 1 ; } else if ( s < d2 ) { double h1 = ( s - d1 ) / ( d2 - d1 ) ; double h2 = 1 / sqrt( 1 - h1 ) ; h1 = 1 / sqrt( h1 ) ; h2 = exp( h2 - h1 ) ; res = 1 / ( 1 + ( h2 * h2 ) ) ; } else { res = 0 ; } return res ; }
void pps::PPS< Mesh >::eval_pps | ( | Face * | face, |
double | u, | ||
double | v, | ||
double | w, | ||
double & | x, | ||
double & | y, | ||
double & | z | ||
) | const |
Computes a point on the image of this PPS. The resulting point is the image of a point in a p-domain that corresponds to a point (through an implicit homomorphism) in a face of the underlying 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. |
Definition at line 1151 of file pps.h.
{ /* * The barycentric coordinates must define a point in the face. */ assert( ( u >= 0 ) && ( u <= 1 ) ); assert( ( v >= 0 ) && ( v <= 1 ) ); assert( ( w >= 0 ) && ( w <= 1 ) ); assert( fabs( 1 - ( u + v + w ) ) <= 1e-15 ) ; /* * We choose the p-domain whose distance from the given point is * the smallest. */ Halfedge* h ; double uaux = u ; double vaux = v ; double waux = w ; select_pdomain( face , uaux , vaux , waux , h ) ; /* * Evaluate the PPS using the chosen p-domain. */ eval_pps( h , uaux , vaux , waux , x , y , z ) ; return ; }
void pps::PPS< Mesh >::eval_pps | ( | Halfedge * | h, |
double | u, | ||
double | v, | ||
double | w, | ||
double & | x, | ||
double & | y, | ||
double & | z | ||
) | const [protected] |
Computes a point on the image of this PPS. The resulting point is the image of a point in a p-domain. The p-domain is specified by a half-edge, whose origin vertex is the vertex associated with the p-domain. The point is supposed to be in the face that contains the given half-edge in the underlying mesh of this PPS. We are given the barycentric coordinates of the point, which are the same coordinates of the point in the upper triangle of the canonical domain.
h | Pointer to a halfedge of the face of this PPS underlying mesh. |
u | First barycentric coordinate of point in the canonical domain. |
v | Second barycentric coordinate of a point in the canonical p-domain. |
w | Third barycentric coordinate of a point in the canonical p-domain. |
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. |
Compute the value of the shape function.
Definition at line 1674 of file pps.h.
References pps::Bezier::point().
{ #ifdef DEBUGMODE assert( h != 0 ) ; #endif /* * Computes the Cartesian coordinates of the given point with * respect to the upper triangle of the canonical domain * (quadrilateral). */ double xc ; double yc ; from_barycentric_to_Cartesian( u , v , w , 0. , 0. , 1. , 0. , 0.5 , 0.5 * sqrt( 3. ) , xc , yc ) ; /* * Map the point from the canonical domain to the p-domain * associated with the origin vertex of h. */ double xr ; double yr ; from_canonical_domain( h , xc , yc , xr , yr ) ; /* Get the degree of the origin vertex of the given half-edge. */ unsigned int nu = get_degree( h ) ; /* * Compute the radius of the p-domain associated with the origin * vertex of the given half-edge. */ const double R = cos( _MYPI / nu ) ; double ll = ( xr * xr ) + ( yr * yr ) ; /* * The given point must belong to the p-domain. */ assert( ll < R * R ) ; /* * Initialize the accumulator of the sum of weight function values * and the accumulator of the contribution of p-domain shape * functions. */ double sw = 0 ; double sf[ 3 ] = { 0. , 0. , 0. } ; /* * Computes the contribution of the p-domain associated with the * origin vertex of h. */ /* Compute the value of the weight function. */ sw = weight_function( xr , yr , R ) ; /* * The weight of the given point can never be zero. */ assert( sw >= 1e-16 ) ; Vertex* vertex = get_org( h ) ; #ifdef DEBUGMODE assert( vertex != 0 ) ; #endif /* * Get the shape function associated with the origin vertex of the * given half-edge. */ Bezier* patch = get_shape_function( vertex ) ; #ifdef DEBUGMODE assert( patch != 0 ) ; #endif /* * Compute a point on the patch corresponding to the shape * function. */ patch->point( xr , yr , sf[ 0 ] , sf[ 1 ] , sf[ 2 ] ) ; sf[ 0 ] = sw * sf[ 0 ] ; sf[ 1 ] = sw * sf[ 1 ] ; sf[ 2 ] = sw * sf[ 2 ] ; /* * Compute the contribution of the other two p-domains (if any). */ if ( ( u != 1 ) && ( v != 1 ) && ( w != 1 ) ) { /* * If the point lies on an edge, then we can consider only one * more p-domain. */ if ( w == 0 ) { double ur ; double vr ; gfunction( h , xr , yr , ur , vr ) ; compute_pdomain_contribution( get_mate( h ) , ur , vr , sw , sf[ 0 ] , sf[ 1 ] , sf[ 2 ] ) ; } else if ( v == 0 ) { double ur ; double vr ; Halfedge* h2 = get_mate( get_prev( h ) ) ; gfunction( h2 , xr , yr , ur , vr ) ; compute_pdomain_contribution( get_mate( h2 ) , ur , vr , sw , sf[ 0 ] , sf[ 1 ] , sf[ 2 ] ) ; } else { double ur ; double vr ; gfunction( h , xr , yr , ur , vr ) ; compute_pdomain_contribution( get_mate( h ) , ur , vr , sw , sf[ 0 ] , sf[ 1 ] , sf[ 2 ] ) ; Halfedge* h2 = get_mate( get_prev( h ) ) ; gfunction( h2 , xr , yr , ur , vr ) ; compute_pdomain_contribution( get_mate( h2 ) , ur , vr , sw , sf[ 0 ] , sf[ 1 ] , sf[ 2 ] ) ; } } /* * Compute the point on the PPS after weighting the contribution * of the three p-domains. */ x = sf[ 0 ] / sw ; y = sf[ 1 ] / sw ; z = sf[ 2 ] / sw ; return ; }
void pps::PPS< Mesh >::eval_surface | ( | Face * | face, |
double | u, | ||
double | v, | ||
double | w, | ||
double & | x, | ||
double & | y, | ||
double & | z | ||
) | const [pure virtual] |
Computes a point on the parametric patch associated with a given face of the PPS underlying triangle mesh. This method must be implemented by the user of the PPS library (i.e., in the concrete PPS class that inherits from this abstract PPS class.
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. |
Implemented in ppsfrompnt::PPSfromPNT.
FaceIterator pps::PPS< Mesh >::faces_begin | ( | ) | const [pure virtual] |
Returns a face iterator set to the initial face of a face sequence of this PPS underlying mesh.
Implemented in ppsfrompnt::PPSfromPNT.
bool pps::PPS< Mesh >::find_triangle | ( | Halfedge *& | h, |
double | x, | ||
double | y, | ||
double & | u, | ||
double & | v, | ||
double & | w | ||
) | const [protected] |
Finds the triangle of the canonical triangulation of a p-domain that contains a given point (if such a triangle exists). The p-domain is specified by a pointer to a half-edge, i. e., the p-domain is the one associated with the origin vertex of the given half-edge.
h | Pointer to a half-edge. The canonical triangulation associated with the p-domain defined by the origin vertex of h is expected to contain the given point. If so, the parameter h will contain the half-edge whose origin vertex is associated with the p-domain corresponding to the first vertex of the triangle found by the method. |
x | First Cartesian coordinate of the given point. |
y | Second Cartesian coordinate of the given point. |
u | First barycentric coordinate of the given point with respect to the triangle that contains it (if any). |
v | Second barycentric coordinate of the given point with respect to the triangle that contains it (if any). |
w | Third barycentric coordinate of the given point with respect to the triangle that contains it (if any). |
Definition at line 1470 of file pps.h.
{ /* * Get the degree of the vertex associated with the P-polygon. */ unsigned int nu = get_degree( h ) ; /* * Loop over all triangles of the canonical triangulation of the * P-polygon associated with the origin vertex of halfedge h. For * each triangle, checks if the given point belongs to it. If so, * compute the barycentric coordinates of the point with respect * to the triangle. */ Halfedge* haux = h ; do { #ifdef DEBUGMODE assert( haux != 0 ) ; #endif /* * Get the identifier of the current half-edge. */ unsigned int id = get_id( haux ) ; /* * Compute the vertices of the P-polygon canonical triangulation * triangle associated with the face that contains the half-edge * haux. */ const double ang = 2 * ( _MYPI / nu ) ; double x1 = cos( id * ang ) ; double y1 = sin( id * ang ) ; double x2 = cos( ( id + 1 ) * ang ) ; double y2 = sin( ( id + 1 ) * ang ) ; /* * Compute the barycentric coordinates of the given point with * respect to the triangle given by the vertices ( 0 , 0 ) , ( * x1 , y1 ) , and ( x2 , y2 ). */ get_barycentric_coordinates( 0. , 0. , x1 , y1 , x2 , y2 , x , y , u , v , w ) ; /* * If all barycentric coordinates are equal to or greater than * zero, then the triangle contains the given point and the * search ends. Otherwise, keep looking for a triangle that * contains the point. */ if ( ( u >= 0 ) && ( u <= 1 ) && ( v >= 0 ) && ( v <= 1 ) && ( w >= 0 ) && ( w <= 1 ) ) { h = haux; return true; } else { haux = get_mate( get_prev( haux ) ) ; } } while ( haux != h ); /* * If the code reached this point, then no triangle contains the * given point. */ return false; }
void pps::PPS< Mesh >::from_barycentric_to_Cartesian | ( | double | u, |
double | v, | ||
double | w, | ||
double | x0, | ||
double | y0, | ||
double | x1, | ||
double | y1, | ||
double | x2, | ||
double | y2, | ||
double & | x, | ||
double & | y | ||
) | const [protected] |
Converts the barycentric coordinates of a point, with respect to a reference triangle, to Cartesian coordinates.
u | First barycentric coordinate of the point. |
v | Second barycentric coordinate of the point. |
w | Third barycentric coordinate of the point. |
x0 | First Cartesian coordinate of the first vertex of the reference triangle. |
y0 | Second Cartesian coordinate of the first vertex of the reference triangle. |
x1 | First Cartesian coordinate of the second vertex of the reference triangle. |
y1 | Second Cartesian coordinate of the second vertex of the reference triangle. |
x2 | First coordinate of the third vertex of the reference triangle. |
y2 | Second coordinate of the third vertex of the reference triangle. |
x | First Cartesian coordinate of the resulting point. |
y | Second Cartesian coordinate of the resulting point. |
Definition at line 1973 of file pps.h.
{ x = ( u * x0 ) + ( v * x1 ) + ( w * x2 ) ; y = ( u * y0 ) + ( v * y1 ) + ( w * y2 ) ; }
void pps::PPS< Mesh >::from_canonical_domain | ( | Halfedge * | h, |
double | x, | ||
double | y, | ||
double & | u, | ||
double & | v | ||
) | const [protected] |
Maps a point in the canonical lens to a p-domain. The p-domain is specified by a half-edge whose origin vertex is the one associated with the p-domain.
h | Pointer to a half-edge. |
x | First Cartesian coordinate of the given point. |
y | Second Cartesian coordinate of the given point. |
u | First Cartesian coordinate of the image of the given point under the map. |
v | Second Cartesian coordinate of the image of the given point under the map. |
Definition at line 2262 of file pps.h.
{ #ifdef DEBUGMODE assert( h != 0 ) ; #endif /* * Get the degree of the origin vertex of the given half-edge. */ const unsigned int nu = get_degree( h ) ; /* * Get the rotation angle associated with the given half-edge. */ const double au = ( 2 * _MYPI ) / nu ; /* * Get the identifier of the given half-edge. */ const unsigned i = get_id( h ) ; /* * Change from Cartesian to polar coordinates. */ double rr = sqrt( ( x * x ) + ( y * y ) ) ; if ( fabs( rr ) > 1e-16 ) { double aa; if ( x < 0 ) { if ( y >= 0 ) { aa = _MYPI - acos( fabs( x ) / rr ) ; } else { aa = -_MYPI + acos( fabs( x ) / rr ) ; } } else { if ( y >= 0 ) { aa = asin( y / rr ) ; } else { aa = -asin( fabs( y ) / rr ) ; } } aa *= ( 6. / double( nu ) ) ; rr *= ( cos( _MYPI / nu ) / cos( _MYPI / 6 ) ) ; u = rr * cos( aa ) ; v = rr * sin( aa ) ; } else { u = v = 0.; } /* * Perform a 2D rotation by i * au around the origin of the * p-domain associated with the origin vertex of the given * half-edge. */ rot_2d( u , v , ( i * au ) , u , v ) ; if ( fabs( u ) < 1e-15 ) u =0. ; if ( fabs( v ) < 1e-15 ) v = 0. ; if ( fabs( 1 - u ) < 1e-15 ) u = 1. ; if ( fabs( 1 - v ) < 1e-15 ) v = 1. ; return ; }
void pps::PPS< Mesh >::get_barycentric_coordinates | ( | double | x0, |
double | y0, | ||
double | x1, | ||
double | y1, | ||
double | x2, | ||
double | y2, | ||
double | xp, | ||
double | yp, | ||
double & | u, | ||
double & | v, | ||
double & | w | ||
) | const [protected] |
Computes the barycentric coordinates of a given point (in Cartesian coordinates) with respect to a given reference triangle.
x0 | First Cartesian coordinate of the first vertex of the reference triangle. |
y0 | Second Cartesian coordinate of the first vertex of the reference triangle. |
x1 | First Cartesian coordinate of the second vertex of the reference triangle. |
y1 | Second Cartesian coordinate of the second vertex of the reference triangle. |
x2 | First Cartesian coordinate of the third vertex of the reference triangle. |
y2 | Second Cartesian coordinate of the third vertex of the reference triangle. |
xp | First Cartesian coordinate of the point. |
yp | Second Cartesian coordinate of the point. |
u | First barycentric coordinate of the point. |
v | Second barycentric coordinate of the point. |
w | Third barycentric coordinate of the point. |
Definition at line 1581 of file pps.h.
{ /* * Compute the determinant. */ double dd = ( x1 * y0 ) - ( x2 * y0 ) - ( x0 * y1 ) + ( x2 * y1 ) + ( x0 * y2 ) - ( x1 * y2 ) ; /* * The determinant cannot be zero. */ assert( fabs( dd ) > 1e-16 ) ; /* * Compute the barycentric coordinates. */ u = ( x2 * y1 ) - ( xp * y1 ) - ( x1 * y2 ) + ( xp * y2 ) + ( x1 * yp ) - ( x2 * yp ) ; u /= dd ; v = ( xp * y0 ) - ( x2 * y0 ) + ( x0 * y2 ) - ( xp * y2 ) - ( x0 * yp ) + ( x2 * yp ) ; v /= dd ; if ( fabs( u ) < 1e-14 ) { u = 0 ; } else if ( fabs( 1 - u ) < 1e-14 ) { u = 1 ; } if ( fabs( v ) < 1e-14 ) { v = 0 ; } else if ( fabs( 1 - v ) < 1e-14 ) { v = 1 ; } w = 1 - u - v ; if ( fabs( w ) < 1e-14 ) { w = 0 ; } else if ( fabs( 1 - w ) < 1e-14 ) { w = 1 ; } return ; }
unsigned int pps::PPS< Mesh >::get_degree | ( | Vertex * | vertex | ) | const [protected, pure 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. |
Implemented in ppsfrompnt::PPSfromPNT.
unsigned pps::PPS< Mesh >::get_degree | ( | Halfedge * | h | ) | const [inline, protected] |
Returns the degree of the origin vertex of a given half-edge.
h | A pointer to a halfedge of this PPS underlying mesh. |
Definition at line 341 of file pps.h.
References pps::PPS< Mesh >::get_org().
{ return get_degree( get_org( h ) ) ; }
Vertex * pps::PPS< Mesh >::get_dst | ( | Halfedge * | h | ) | const [protected, pure virtual] |
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. |
Implemented in ppsfrompnt::PPSfromPNT.
Edge * pps::PPS< Mesh >::get_edge | ( | const EdgeIterator & | iterator | ) | const [pure 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. |
Implemented in ppsfrompnt::PPSfromPNT.
Edge * pps::PPS< Mesh >::get_edge | ( | Halfedge * | h | ) | const [protected, pure virtual] |
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. |
Implemented in ppsfrompnt::PPSfromPNT.
Face * pps::PPS< Mesh >::get_face | ( | const FaceIterator & | iterator | ) | const [pure 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. |
Implemented in ppsfrompnt::PPSfromPNT.
Face * pps::PPS< Mesh >::get_face | ( | Halfedge * | h | ) | const [protected, pure virtual] |
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. |
Implemented in ppsfrompnt::PPSfromPNT.
Halfedge * pps::PPS< Mesh >::get_halfedge | ( | Vertex * | vertex | ) | const [protected, pure virtual] |
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. |
Implemented in ppsfrompnt::PPSfromPNT.
Halfedge * pps::PPS< Mesh >::get_halfedge | ( | Face * | face | ) | const [protected, pure virtual] |
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. |
Implemented in ppsfrompnt::PPSfromPNT.
unsigned int pps::PPS< Mesh >::get_id | ( | Halfedge * | h | ) | const [protected, virtual] |
Returns the identifier of a given half-edge. The identifier of a half-edge is a number ranging from 0 to N - 1, where N is the degree of the origin vertex of the half-edge. Each such a number represents the position of one half-edge in the sequence defined by a counterclockwise traversal of all half-edges with origin at the same vertex. The first half-edge visited in this traversal gets the identifier 0, the second half-edge gets the identifier 1, and so on so forth.
h | Pointer to a half-edge. |
Reimplemented in ppsfrompnt::PPSfromPNT.
Definition at line 2396 of file pps.h.
{ #ifdef DEBUGMODE assert( h != 0 ) ; #endif unsigned int i = 0 ; Halfedge* h2 = get_halfedge( get_org( h ) ) ; while ( h2 != h ) { ++i; h2 = get_mate( get_prev( h2 ) ) ; } return i; }
Halfedge * pps::PPS< Mesh >::get_mate | ( | Halfedge * | h | ) | const [protected, pure virtual] |
Returns the mate of a given half-edge of this PPS underlying mesh.
h | Pointer to a half-edge of this PPS underlying mesh. |
Implemented in ppsfrompnt::PPSfromPNT.
Mesh * pps::PPS< Mesh >::get_mesh | ( | ) | const [inline] |
Returns a pointer to the underlying mesh of this PPS.
Definition at line 244 of file pps.h.
References pps::PPS< Mesh >::_mesh.
Referenced by ppsfrompnt::PPSfromPNT::edges_begin(), ppsfrompnt::PPSfromPNT::faces_begin(), ppsfrompnt::PPSfromPNT::is_done(), and ppsfrompnt::PPSfromPNT::vertices_begin().
{ return _mesh; }
Halfedge * pps::PPS< Mesh >::get_next | ( | Halfedge * | h | ) | const [protected, pure virtual] |
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. |
Implemented in ppsfrompnt::PPSfromPNT.
unsigned pps::PPS< Mesh >::get_number_of_parameter_points | ( | unsigned | D | ) | const [inline, protected] |
Returns the number of points used to sample a p-domain. This number is heuristically defined as twice the bi-degree of the shape function associated with the p-domain.
D | bi-degree ( D , D ) of the shape function associated with a p-domain. |
Definition at line 324 of file pps.h.
{
return ( D << 1 ) ;
}
Vertex * pps::PPS< Mesh >::get_org | ( | Halfedge * | h | ) | const [protected, pure virtual] |
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. |
Implemented in ppsfrompnt::PPSfromPNT.
Referenced by pps::PPS< Mesh >::get_degree().
Halfedge * pps::PPS< Mesh >::get_prev | ( | Halfedge * | h | ) | const [protected, pure virtual] |
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. |
Implemented in ppsfrompnt::PPSfromPNT.
Bezier * pps::PPS< Mesh >::get_shape_function | ( | Vertex * | vertex | ) | const [protected, pure virtual] |
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. |
Implemented in ppsfrompnt::PPSfromPNT.
unsigned pps::PPS< Mesh >::get_shape_function_degree | ( | unsigned | D | ) | const [inline, protected] |
Returns the bi-degree of the rectangular Bezier patch defining a shape function. This bi-digree is heuristically defined as the maximum between the number seven and one plus the degree of the vertex associated with the shape function.
D | The degree of the vertex associated with the shape function. |
Definition at line 305 of file pps.h.
{
return ( D > 6 ) ? 7 : ( D + 1 ) ;
}
Vertex * pps::PPS< Mesh >::get_vertex | ( | const VertexIterator & | iterator | ) | const [pure 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. |
Implemented in ppsfrompnt::PPSfromPNT.
void pps::PPS< Mesh >::gfunction | ( | Halfedge * | h, |
double | x, | ||
double | y, | ||
double & | u, | ||
double & | v | ||
) | const [protected] |
Computes the Cartesian coordinates of the image of a point under the transition map from one gluing domain to another. The source and target p-domains are specified by a given half-edge. The source gluing domain is the one associated with the origin vertex of the half-edge, while the target gluing domain is the one associated with the destination vertex of the given half-edge.
h | Pointer to a half-edge. |
x | First Cartesian coordinate of the given point. |
y | Second Cartesian coordinate of the given point. |
u | First Cartesian coordinate of the image of the given point under the transition map. |
v | Second Cartesian coordinate of the image of the given point under the transition map. |
Definition at line 2111 of file pps.h.
{ #ifdef DEBUGMODE assert( h != 0 ) ; #endif /* * Map the point in the source gluing domain to the canonical * lens. */ double utemp ; double vtemp ; to_canonical_domain( h , x , y , utemp , vtemp ) ; /* * Apply the reflection in the canonical quadrilateral. */ utemp = 1 - utemp ; vtemp = - vtemp ; /* * Map the point in the canonical lens to the target p-domain. */ from_canonical_domain( get_mate( h ) , utemp , vtemp , u , v ) ; }
bool pps::PPS< Mesh >::is_done | ( | const VertexIterator & | iterator | ) | const [pure 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. |
Implemented in ppsfrompnt::PPSfromPNT.
bool pps::PPS< Mesh >::is_done | ( | const EdgeIterator & | iterator | ) | const [pure 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. |
Implemented in ppsfrompnt::PPSfromPNT.
bool pps::PPS< Mesh >::is_done | ( | const FaceIterator & | iterator | ) | const [pure 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. |
Implemented in ppsfrompnt::PPSfromPNT.
bool pps::PPS< Mesh >::mesh_has_boundary | ( | ) | const [protected, pure virtual] |
Determines if the underlying mesh of this PPS has a non-empty boundary.
Implemented in ppsfrompnt::PPSfromPNT.
bool pps::PPS< Mesh >::mesh_is_simplicial | ( | ) | const [protected, pure virtual] |
Determines if the underlying mesh of this PPS is a simplicial complex.
Implemented in ppsfrompnt::PPSfromPNT.
void pps::PPS< Mesh >::move_forward | ( | EdgeIterator & | iterator | ) | const [pure 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. |
Implemented in ppsfrompnt::PPSfromPNT.
void pps::PPS< Mesh >::move_forward | ( | FaceIterator & | iterator | ) | const [pure 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. |
Implemented in ppsfrompnt::PPSfromPNT.
void pps::PPS< Mesh >::move_forward | ( | VertexIterator & | iterator | ) | const [pure 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. |
Implemented in ppsfrompnt::PPSfromPNT.
void pps::PPS< Mesh >::rot_2d | ( | double | x, |
double | y, | ||
double | ang, | ||
double & | u, | ||
double & | v | ||
) | const [protected] |
Computes the location of a given point after a rotation around the origin by a given angle.
x | First Cartesian coordinate of the given point. |
y | Second Cartesian coordinate of the given point. |
ang | A given rotation angle. |
u | First Cartesian coordinate of the point resulting from the rotation of (x,y) by ang around the origin. |
v | Second Cartesian coordinate of the point resulting from the rotation of (x,y) by ang around the origin. |
Definition at line 2363 of file pps.h.
{ u = ( x * cos( ang ) ) - ( y * sin( ang ) ) ; v = ( x * sin( ang ) ) + ( y * cos( ang ) ) ; }
void pps::PPS< Mesh >::select_pdomain | ( | Face * | face, |
double & | u, | ||
double & | v, | ||
double & | w, | ||
Halfedge *& | h | ||
) | const [protected] |
Finds one p-domain that contains the parameter point that is the image of a given point in a face of this PPS underlying 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. |
h | A reference to a pointer to a half-edge. |
Definition at line 1870 of file pps.h.
{ #ifdef DEBUGMODE assert( face != 0 ) ; #endif /* * Find out which P-domain contains the given point after mapping * the point to the canonical quadrilateral. */ double xc ; double yc ; from_barycentric_to_Cartesian( u , v , w , 0. , 0. , 1. , 0. , 0.5 , 0.5 * sqrt( 3. ) , xc , yc ) ; /* * We choose the p-domain whose distance from the given point is * the smallest. */ double l1 = ( xc * xc ) + ( yc * yc ) ; double x2 = xc - 1 ; double l2 = ( x2 * x2 ) + ( yc * yc ) ; double x3 = xc - 0.5 ; double y3 = yc - ( 0.5 * sqrt( 3. ) ) ; double l3 = ( x3 * x3 ) + ( y3 * y3 ) ; if ( ( l1 <= l2 ) && ( l1 <= l3 ) ) { /* * We pick the p-domain associated with the origin vertex of the * first half-edge of the given face. */ h = get_halfedge( face ) ; } else if ( l2 <= l3 ) { /* * We pick the p-domain associated with the origin vertex of the * second half-edge of the given face. */ h = get_next( get_halfedge( face ) ) ; double uaux = u ; u = v ; v = w ; w = uaux ; } else { /* * We pick the p-domain associated with the origin vertex of the * third half-edge of the given face. */ h = get_prev( get_halfedge( face ) ) ; double uaux = u ; u = w ; w = v ; v = uaux ; } return ; }
void pps::PPS< Mesh >::set_shape_function | ( | Vertex * | vertex, |
Bezier * | patch | ||
) | [protected, pure 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. |
Implemented in ppsfrompnt::PPSfromPNT.
void pps::PPS< Mesh >::to_canonical_domain | ( | Halfedge * | h, |
double | x, | ||
double | y, | ||
double & | u, | ||
double & | v | ||
) | const [protected] |
Maps a point in a p-domain to a point in the canonical lens. The p-domain is specified by a half-edge whose origin vertex is the one associated with the p-domain.
Maps a point in a p-domain to a point in the canonical domain. The p-domain is specified by a half-edge whose origin vertex is the one associated with the p-domain.
h | Pointer to a half-edge. |
x | First Cartesian coordinate of the given point. |
y | Second Cartesian coordinate of the given point. |
u | First Cartesian coordinate of the image of the given point under the map. |
v | Second Cartesian coordinate of the image of the given point under the map. |
Definition at line 2164 of file pps.h.
{ /* * Get the degree of the origin vertex of the given half-edge. */ const unsigned int nu = get_degree( h ) ; /* * Get the rotation angle associated with the given half-edge. */ const double au = ( 2 * _MYPI ) / nu ; /* * Get the identifier of the given half-edge. */ const unsigned i = get_id( h ) ; /* * Perform a 2D rotation by -i * au around the origin of the * p-domain associated with the origin vertex of the given * half-edge. */ rot_2d( x , y , -( i * au ) , u , v ) ; /* * Change from Cartesian to polar coordinates. */ double rr = sqrt( ( u * u ) + ( v * v ) ) ; if ( fabs( rr ) > 1e-16 ) { double aa ; if ( u < 0 ) { if ( v >= 0 ) { aa = _MYPI - acos( fabs( u ) / rr ) ; } else { aa = -_MYPI + acos( fabs( u ) / rr ) ; } } else { if ( v >= 0 ) { aa = asin( v / rr ) ; } else { aa = -asin( fabs( v ) / rr ) ; } } aa *= ( nu / 6. ) ; rr *= ( cos( _MYPI / 6. ) / cos( _MYPI / nu ) ) ; u = rr * cos( aa ) ; v = rr * sin( aa ) ; } else { u = v = 0. ; } if ( fabs( u ) < 1e-15 ) u = 0. ; if ( fabs( v ) < 1e-15 ) v = 0. ; if ( fabs( 1 - u ) < 1e-15 ) u = 1. ; if ( fabs( 1 - v ) < 1e-15 ) v = 1. ; return ; }
VertexIterator pps::PPS< Mesh >::vertices_begin | ( | ) | const [pure virtual] |
Returns a vertex iterator set to the initial vertex of a vertex sequence of this PPS underlying mesh.
Implemented in ppsfrompnt::PPSfromPNT.
double pps::PPS< Mesh >::weight_function | ( | double | x, |
double | y, | ||
double | R | ||
) | const [protected] |
Evaluates the weight function at a given point.
x | First Cartesian coordinate of the given point. |
y | Second Cartesian coordinate of the given point. |
R | Radius of the circular support of the function. |
Definition at line 2427 of file pps.h.
{ double ll = sqrt( ( x * x ) + ( y * y ) ) ; return eta_function( ll , 0.25 * R , R ) ; }