Traits class (static struct) for the half-edge data structure. More...
#include <ttl/halfedge/HeTraits.h>
Public Types | |
typedef double | real_type |
The floating point type used in calculations involving scalar products and cross products. | |
Static Public Member Functions | |
Geometric Predicates | |
static real_type | scalarProduct2d (const Dart &v1, const Dart &v2) |
Scalar product between two 2D vectors represented as darts. | |
static real_type | scalarProduct2d (const Dart &v, const Node &p) |
Scalar product between two 2D vectors. | |
static real_type | crossProduct2d (const Dart &v1, const Dart &v2) |
Cross product between two vectors in the plane represented as darts. | |
static real_type | crossProduct2d (const Dart &v, const Node &p) |
Cross product between two vectors in the plane. | |
static real_type | orient2d (const Dart &n1, const Dart &n2, const Node &p) |
Let n1 and n2 be the nodes associated with two darts, and let p be a point in the plane. | |
static real_type | orient2d (const Dart &n1, const Dart &n2, const Dart &p) |
This is the same predicate as represented with the function above, but with a slighty different interface: The last parameter is given as a dart where the source node of the dart represents a point in the plane. | |
Functions for Delaunay Triangulation | |
static void | swapEdge (Dart &dart) |
Swaps the edge associated with dart in the actual data structure. | |
static void | splitTriangle (Dart &dart, Node &point) |
Splits the triangle associated with dart in the actual data structure into three new triangles joining at point. | |
Functions for removing nodes | |
static void | reverse_splitTriangle (Dart &dart) |
The reverse operation of TTLtraits::splitTriangle. | |
static void | removeBoundaryTriangle (Dart &d) |
Removes a triangle with an edge at the boundary of the triangulation in the actual data structure. | |
Static Public Attributes | |
static Triangulation * | triang_ |
Traits class (static struct) for the half-edge data structure.
The member functions are those required by different function templates in the TTL. Documentation is given here to explain what actions should be carried out on the actual data structure as required by the functions in the ttl namespace.
The source code of HeTraits
.h shows how the traits class is implemented for the half-edge data structure.
Definition at line 56 of file HeTraits.h.
typedef double hed::TTLtraits::real_type |
The floating point type used in calculations involving scalar products and cross products.
Definition at line 64 of file HeTraits.h.
Cross product between two vectors in the plane.
The first vector is represented by a dart v, and the second vector has direction from the source node of v to the point p. The z-component of the cross product is returned.
ttl_util::crossProduct2d can be used.
Definition at line 123 of file HeTraits.h.
References hed::Dart::alpha0(), crossProduct2d(), hed::Node::x(), hed::Dart::x(), hed::Node::y(), and hed::Dart::y().
00123 { 00124 Dart d0 = v; d0.alpha0(); 00125 return ttl_util::crossProduct2d(d0.x() - v.x(), d0.y() - v.y(), 00126 p.x() - v.x(), p.y() - v.y()); 00127 }
static real_type hed::TTLtraits::crossProduct2d | ( | const Dart & | v1, | |
const Dart & | v2 | |||
) | [inline, static] |
Cross product between two vectors in the plane represented as darts.
The z-component of the cross product is returned.
ttl_util::crossProduct2d can be used.
Definition at line 107 of file HeTraits.h.
References hed::Dart::alpha0(), hed::Dart::x(), and hed::Dart::y().
Referenced by crossProduct2d().
00107 { 00108 Dart v10 = v1; v10.alpha0(); 00109 Dart v20 = v2; v20.alpha0(); 00110 return ttl_util::crossProduct2d(v10.x()-v1.x(), v10.y()-v1.y(), 00111 v20.x()-v2.x(), v20.y()-v2.y()); 00112 }
static real_type hed::TTLtraits::orient2d | ( | const Dart & | n1, | |
const Dart & | n2, | |||
const Dart & | p | |||
) | [inline, static] |
This is the same predicate as represented with the function above, but with a slighty different interface: The last parameter is given as a dart where the source node of the dart represents a point in the plane.
This function is required for constrained triangulation.
Definition at line 152 of file HeTraits.h.
References ttl_util::orient2dfast(), hed::Dart::x(), and hed::Dart::y().
00152 { 00153 real_type pa[2]; real_type pb[2]; real_type pc[2]; 00154 pa[0] = n1.x(); pa[1] = n1.y(); 00155 pb[0] = n2.x(); pb[1] = n2.y(); 00156 pc[0] = p.x(); pc[1] = p.y(); 00157 return ttl_util::orient2dfast(pa, pb, pc); 00158 }
static real_type hed::TTLtraits::orient2d | ( | const Dart & | n1, | |
const Dart & | n2, | |||
const Node & | p | |||
) | [inline, static] |
Let n1 and n2 be the nodes associated with two darts, and let p be a point in the plane.
Return a positive value if n1, n2, and p occur in counterclockwise order; a negative value if they occur in clockwise order; and zero if they are collinear.
Definition at line 136 of file HeTraits.h.
References ttl_util::orient2dfast(), hed::Node::x(), hed::Dart::x(), hed::Node::y(), and hed::Dart::y().
00136 { 00137 real_type pa[2]; real_type pb[2]; real_type pc[2]; 00138 pa[0] = n1.x(); pa[1] = n1.y(); 00139 pb[0] = n2.x(); pb[1] = n2.y(); 00140 pc[0] = p.x(); pc[1] = p.y(); 00141 return ttl_util::orient2dfast(pa, pb, pc); 00142 }
static void hed::TTLtraits::removeBoundaryTriangle | ( | Dart & | d | ) | [inline, static] |
Removes a triangle with an edge at the boundary of the triangulation in the actual data structure.
Definition at line 276 of file HeTraits.h.
References hed::Dart::getEdge(), hed::Triangulation::removeTriangle(), and triang_.
00276 { 00277 triang_->removeTriangle(*d.getEdge()); 00278 }
static void hed::TTLtraits::reverse_splitTriangle | ( | Dart & | dart | ) | [inline, static] |
The reverse operation of TTLtraits::splitTriangle.
This function is only required for functions that involve removal of interior nodes; see for example ttl::removeInteriorNode.
Definition at line 267 of file HeTraits.h.
References hed::Dart::getEdge(), hed::Triangulation::reverse_splitTriangle(), and triang_.
00267 { 00268 triang_->reverse_splitTriangle(*dart.getEdge()); 00269 }
static real_type hed::TTLtraits::scalarProduct2d | ( | const Dart & | v, | |
const Node & | p | |||
) | [inline, static] |
Scalar product between two 2D vectors.
The first vector is represented by a dart v, and the second vector has direction from the source node of v to the point p.
ttl_util::scalarProduct2d can be used.
Definition at line 94 of file HeTraits.h.
References hed::Dart::alpha0(), scalarProduct2d(), hed::Node::x(), hed::Dart::x(), hed::Node::y(), and hed::Dart::y().
00094 { 00095 Dart d0 = v; d0.alpha0(); 00096 return ttl_util::scalarProduct2d(d0.x() - v.x(), d0.y() - v.y(), 00097 p.x() - v.x(), p.y() - v.y()); 00098 }
static real_type hed::TTLtraits::scalarProduct2d | ( | const Dart & | v1, | |
const Dart & | v2 | |||
) | [inline, static] |
Scalar product between two 2D vectors represented as darts.
ttl_util::scalarProduct2d can be used.
Definition at line 79 of file HeTraits.h.
References hed::Dart::alpha0(), hed::Dart::x(), and hed::Dart::y().
Referenced by scalarProduct2d().
00079 { 00080 Dart v10 = v1; v10.alpha0(); 00081 Dart v20 = v2; v20.alpha0(); 00082 return ttl_util::scalarProduct2d(v10.x()-v1.x(), v10.y()-v1.y(), 00083 v20.x()-v2.x(), v20.y()-v2.y()); 00084 }
Splits the triangle associated with dart in the actual data structure into three new triangles joining at point.
dart | Output: A CCW dart incident with the new node; see the figure. |
Definition at line 243 of file HeTraits.h.
References hed::Dart::getEdge(), hed::Dart::init(), hed::Triangulation::splitTriangle(), and triang_.
00243 { 00244 Edge* edge = triang_->splitTriangle(*dart.getEdge(), point); 00245 dart.init(edge); 00246 }
static void hed::TTLtraits::swapEdge | ( | Dart & | dart | ) | [inline, static] |
Swaps the edge associated with dart in the actual data structure.
dart | Some of the functions require a dart as output. If this is required by the actual function, the dart should be delivered back in a position as seen if it was glued to the edge when swapping (rotating) the edge CCW; see the figure. |
swapEdge
is implemented such that darts outside the quadrilateral are not affected by the swap. Definition at line 227 of file HeTraits.h.
References hed::Dart::getEdge(), hed::Edge::isConstrained(), hed::Triangulation::swapEdge(), and triang_.
00227 { 00228 if (!dart.getEdge()->isConstrained()) triang_->swapEdge(*dart.getEdge()); 00229 }
Triangulation* hed::TTLtraits::triang_ [static] |
Definition at line 59 of file HeTraits.h.
Referenced by removeBoundaryTriangle(), reverse_splitTriangle(), splitTriangle(), and swapEdge().