The Parametric Pseudo-Manifold (PPS) Library 1.0
|
This class represents a set of attributes of a half-edge of the underlying triangle surface mesh of a PPS constructed from a PN triangle surface. More...
#include <halfedge_attribute.h>
Public Types | |
typedef dcel::Halfedge < VertexAttribute, FaceAttribute, int, HalfedgeAttribute > | Halfedge |
Defines Halfedge as an alias for dcel::Halfedge< VertexAttribute, FaceAttribute , int , HalfedgeAttribute > | |
Public Member Functions | |
HalfedgeAttribute () | |
Creates an instance of this class. | |
HalfedgeAttribute (Halfedge *h) | |
Creates an instance of this class. | |
HalfedgeAttribute (HalfedgeAttribute &a) | |
Creates an instance of this class from another instance. | |
~HalfedgeAttribute () | |
Destroys an instance of this class. | |
Halfedge * | get_owner () const |
Returns a pointer to the half-edge that owns this attribute. | |
void | set_owner (Halfedge *h) |
Assigns an address to the pointer to the half-edge that owns this attribute. | |
unsigned | get_pps_id () |
Returns the PPS identifier (ID) of this half-edge. This identifier is a number from 0 to N-1, where N is the degree of the origin vertex of this halfedge. The number assigned to this half-edge is its position in a counterclockwise traversal of all half-edges incident to the origin vertex of this half-edge. The first half-edge of this traversal is the half-edge associated with the vertex and its ID is equal to 0. The second half-edge gets the ID 1, and so on. This method is a modifier, as the ID is computed and stored in a data member the first time the method is invoked. | |
void | set_pps_id (unsigned id) |
Assigns a value to the data member representing the PPS identifier of this half-edge. | |
bool | get_pps_id_flag () const |
Returns the logic value true if the PPS identifier of this half-edge has already been computed; otherwise, returns the logic value false. | |
void | set_pps_id_flag (bool flag) |
Assigns a logic value (true or false) to the flag that indicates if the PPS identifier of this half-edge has already been computed. | |
unsigned | get_origin_vertex_degree () |
Returns the degree of the origin vertex of this half-edge. If the degree has not been computed yet, computes and returns the degree, which means that this method is a modifier. | |
void | set_origin_vertex_degree (unsigned degree) |
Assigns a value to the data member representing the degree of the origin vertex of this half-edge. | |
bool | get_degree_flag () const |
Returns the logic value true if the degree of the origin vertex of this half-edge has already been computed; otherwise, returns the logic value false. | |
void | set_degree_flag (bool flag) |
Assigns a logic value (true or false) to the flag that indicates if the degree of the origin vertex of this half-edge has already been computed. | |
Private Member Functions | |
unsigned | compute_pps_id () const |
Computes and returns the PPS identifier (ID) of this half-edge. | |
unsigned | compute_origin_vertex_degree () const |
Computes and returns the degree of the origin vertex of this half-edge. | |
Private Attributes | |
Halfedge * | _owner |
Pointer to the half-edge that owns this attribute.. | |
unsigned | _id |
PPS identifier of the half-edge that owns this attribute. | |
bool | _id_flag |
PPS identifier flag of the half-edge that owns this attribute.. | |
unsigned | _degree |
Degree of the origin vertex of the half-edge that owns this attribute. | |
bool | _degree_flag |
Degree flag of the half-edge that owns this attribute. |
This class represents a set of attributes of a half-edge of the underlying triangle surface mesh of a PPS constructed from a PN triangle surface.
Definition at line 65 of file halfedge_attribute.h.
ppsfrompnt::HalfedgeAttribute::HalfedgeAttribute | ( | Halfedge * | h | ) | [inline] |
Creates an instance of this class.
h | A pointer to the halfedge that owns this attribute. |
Definition at line 116 of file halfedge_attribute.h.
References set_degree_flag(), set_origin_vertex_degree(), set_owner(), set_pps_id(), and set_pps_id_flag().
{ set_owner( h ) ; set_pps_id( 0 ) ; set_pps_id_flag( false ) ; set_origin_vertex_degree( 0 ) ; set_degree_flag( false ) ; }
ppsfrompnt::HalfedgeAttribute::HalfedgeAttribute | ( | HalfedgeAttribute & | a | ) | [inline] |
Creates an instance of this class from another instance.
a | A given instance of this class. |
Definition at line 133 of file halfedge_attribute.h.
References get_degree_flag(), get_origin_vertex_degree(), get_owner(), get_pps_id(), get_pps_id_flag(), set_degree_flag(), set_origin_vertex_degree(), set_owner(), set_pps_id(), and set_pps_id_flag().
{ set_owner( a.get_owner() ) ; set_pps_id( a.get_pps_id() ) ; set_pps_id_flag( a.get_pps_id_flag() ) ; set_origin_vertex_degree( a.get_origin_vertex_degree() ) ; set_degree_flag( a.get_degree_flag() ) ; }
unsigned ppsfrompnt::HalfedgeAttribute::compute_origin_vertex_degree | ( | ) | const [private] |
Computes and returns the degree of the origin vertex of this half-edge.
Definition at line 86 of file halfedge_attribute.cpp.
References dcel::Halfedge< VAttrib, FAttrib, EAttrib, HAttrib >::get_mate(), get_owner(), and dcel::Halfedge< VAttrib, FAttrib, EAttrib, HAttrib >::get_prev().
Referenced by get_origin_vertex_degree().
unsigned ppsfrompnt::HalfedgeAttribute::compute_pps_id | ( | ) | const [private] |
Computes and returns the PPS identifier (ID) of this half-edge.
Definition at line 58 of file halfedge_attribute.cpp.
References dcel::Halfedge< VAttrib, FAttrib, EAttrib, HAttrib >::get_mate(), dcel::Halfedge< VAttrib, FAttrib, EAttrib, HAttrib >::get_origin(), get_owner(), and dcel::Halfedge< VAttrib, FAttrib, EAttrib, HAttrib >::get_prev().
Referenced by get_pps_id().
{ // // This attribute must be owned by some half-edge. // assert( get_owner() != 0 ) ; unsigned i = 0 ; Halfedge* h = get_owner()->get_origin()->get_halfedge() ; while ( h != get_owner() ) { i++ ; h = h->get_prev()->get_mate() ; } return i ; }
bool ppsfrompnt::HalfedgeAttribute::get_degree_flag | ( | ) | const [inline] |
Returns the logic value true if the degree of the origin vertex of this half-edge has already been computed; otherwise, returns the logic value false.
Definition at line 322 of file halfedge_attribute.h.
References _degree_flag.
Referenced by get_origin_vertex_degree(), and HalfedgeAttribute().
{ return _degree_flag ; }
unsigned ppsfrompnt::HalfedgeAttribute::get_origin_vertex_degree | ( | ) | [inline] |
Returns the degree of the origin vertex of this half-edge. If the degree has not been computed yet, computes and returns the degree, which means that this method is a modifier.
To speed up computation, compute the degree only once and store it in a data member. Since the PPS is static, this optimization is safe.
Definition at line 277 of file halfedge_attribute.h.
References _degree, compute_origin_vertex_degree(), get_degree_flag(), set_degree_flag(), and set_origin_vertex_degree().
Referenced by HalfedgeAttribute().
{ if ( get_degree_flag() ) { return _degree ; } set_origin_vertex_degree( compute_origin_vertex_degree() ) ; set_degree_flag( true ) ; return _degree ; }
Halfedge * ppsfrompnt::HalfedgeAttribute::get_owner | ( | ) | const [inline] |
Returns a pointer to the half-edge that owns this attribute.
Definition at line 163 of file halfedge_attribute.h.
References _owner.
Referenced by compute_origin_vertex_degree(), compute_pps_id(), and HalfedgeAttribute().
{ return _owner ; }
unsigned ppsfrompnt::HalfedgeAttribute::get_pps_id | ( | ) | [inline] |
Returns the PPS identifier (ID) of this half-edge. This identifier is a number from 0 to N-1, where N is the degree of the origin vertex of this halfedge. The number assigned to this half-edge is its position in a counterclockwise traversal of all half-edges incident to the origin vertex of this half-edge. The first half-edge of this traversal is the half-edge associated with the vertex and its ID is equal to 0. The second half-edge gets the ID 1, and so on. This method is a modifier, as the ID is computed and stored in a data member the first time the method is invoked.
To speed up computation, compute the ID only once and store it in a data member. Since the PPS is static, this optimization is safe.
Definition at line 199 of file halfedge_attribute.h.
References _id, compute_pps_id(), get_pps_id_flag(), set_pps_id(), and set_pps_id_flag().
Referenced by HalfedgeAttribute().
{ if ( get_pps_id_flag() ) { return _id ; } set_pps_id( compute_pps_id() ) ; set_pps_id_flag( true ) ; return _id ; }
bool ppsfrompnt::HalfedgeAttribute::get_pps_id_flag | ( | ) | const [inline] |
Returns the logic value true if the PPS identifier of this half-edge has already been computed; otherwise, returns the logic value false.
Definition at line 245 of file halfedge_attribute.h.
References _id_flag.
Referenced by get_pps_id(), and HalfedgeAttribute().
{ return _id_flag ; }
void ppsfrompnt::HalfedgeAttribute::set_degree_flag | ( | bool | flag | ) | [inline] |
Assigns a logic value (true or false) to the flag that indicates if the degree of the origin vertex of this half-edge has already been computed.
flag | A logic value ( true or false ) to be assigned to the degree flag of this half-edge. |
Definition at line 338 of file halfedge_attribute.h.
References _degree_flag.
Referenced by get_origin_vertex_degree(), and HalfedgeAttribute().
{ _degree_flag = flag ; }
void ppsfrompnt::HalfedgeAttribute::set_origin_vertex_degree | ( | unsigned | degree | ) | [inline] |
Assigns a value to the data member representing the degree of the origin vertex of this half-edge.
degree | An unsigned integer representing a vertex degree. |
Definition at line 305 of file halfedge_attribute.h.
References _degree.
Referenced by get_origin_vertex_degree(), and HalfedgeAttribute().
{ _degree = degree ; }
void ppsfrompnt::HalfedgeAttribute::set_owner | ( | Halfedge * | h | ) | [inline] |
Assigns an address to the pointer to the half-edge that owns this attribute.
h | A pointer to a half-edge. |
Definition at line 177 of file halfedge_attribute.h.
References _owner.
Referenced by HalfedgeAttribute(), and ~HalfedgeAttribute().
{ _owner = h ; }
void ppsfrompnt::HalfedgeAttribute::set_pps_id | ( | unsigned | id | ) | [inline] |
Assigns a value to the data member representing the PPS identifier of this half-edge.
id | An unsigned integer representing a half-edge PPS identifier. |
Definition at line 228 of file halfedge_attribute.h.
References _id.
Referenced by get_pps_id(), and HalfedgeAttribute().
{ _id = id ; }
void ppsfrompnt::HalfedgeAttribute::set_pps_id_flag | ( | bool | flag | ) | [inline] |
Assigns a logic value (true or false) to the flag that indicates if the PPS identifier of this half-edge has already been computed.
flag | A logic value ( true or false ) to be assigned to the PPS identifier flag of this half-edge. |
Definition at line 261 of file halfedge_attribute.h.
References _id_flag.
Referenced by get_pps_id(), and HalfedgeAttribute().
{ _id_flag = flag ; }