KiCad PCB EDA Suite
hed::TTLtraits Struct Reference

Traits class (static struct) for the half-edge data structure. More...

#include <hetraits.h>

Public Types

typedef double REAL_TYPE
 The floating point type used in calculations involving scalar products and cross products. More...
 

Static Public Member Functions

Geometric Predicates
static REAL_TYPE ScalarProduct2D (const DART &aV1, const DART &aV2)
 Scalar product between two 2D vectors represented as darts. More...
 
static REAL_TYPE ScalarProduct2D (const DART &aV, const NODE_PTR &aP)
 Scalar product between two 2D vectors. More...
 
static REAL_TYPE CrossProduct2D (const DART &aV1, const DART &aV2)
 Cross product between two vectors in the plane represented as darts. More...
 
static REAL_TYPE CrossProduct2D (const DART &aV, const NODE_PTR &aP)
 Cross product between two vectors in the plane. More...
 
static REAL_TYPE Orient2D (const DART &aN1, const DART &aN2, const NODE_PTR &aP)
 Let n1 and n2 be the nodes associated with two darts, and let p be a point in the plane. More...
 
static REAL_TYPE Orient2D (const DART &aN1, const DART &aN2, const DART &aP)
 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. More...
 

Detailed Description

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.

See also
api

Definition at line 62 of file hetraits.h.

Member Typedef Documentation

typedef double hed::TTLtraits::REAL_TYPE

The floating point type used in calculations involving scalar products and cross products.

Definition at line 67 of file hetraits.h.

Member Function Documentation

static REAL_TYPE hed::TTLtraits::CrossProduct2D ( const DART aV1,
const DART aV2 
)
inlinestatic

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 110 of file hetraits.h.

References hed::DART::Alpha0(), ttl_util::CrossProduct2D(), hed::DART::X(), and hed::DART::Y().

111  {
112  DART v10 = aV1;
113  v10.Alpha0();
114 
115  DART v20 = aV2;
116  v20.Alpha0();
117 
118  return ttl_util::CrossProduct2D( v10.X() - aV1.X(), v10.Y() - aV1.Y(),
119  v20.X() - aV2.X(), v20.Y() - aV2.Y() );
120  }
REAL_TYPE CrossProduct2D(REAL_TYPE aDX1, REAL_TYPE aDY1, REAL_TYPE aDX2, REAL_TYPE aDY2)
Cross product between two 2D vectors.
Definition: ttl_util.h:102
static REAL_TYPE hed::TTLtraits::CrossProduct2D ( const DART aV,
const NODE_PTR aP 
)
inlinestatic

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 130 of file hetraits.h.

References hed::DART::Alpha0(), ttl_util::CrossProduct2D(), hed::DART::X(), and hed::DART::Y().

131  {
132  DART d0 = aV;
133  d0.Alpha0();
134 
135  return ttl_util::CrossProduct2D( d0.X() - aV.X(), d0.Y() - aV.Y(),
136  aP->GetX() - aV.X(), aP->GetY() - aV.Y() );
137  }
REAL_TYPE CrossProduct2D(REAL_TYPE aDX1, REAL_TYPE aDY1, REAL_TYPE aDX2, REAL_TYPE aDY2)
Cross product between two 2D vectors.
Definition: ttl_util.h:102
static REAL_TYPE hed::TTLtraits::Orient2D ( const DART aN1,
const DART aN2,
const NODE_PTR aP 
)
inlinestatic

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 145 of file hetraits.h.

References ttl_util::Orient2DFast(), hed::DART::X(), and hed::DART::Y().

146  {
147  REAL_TYPE pa[2];
148  REAL_TYPE pb[2];
149  REAL_TYPE pc[2];
150 
151  pa[0] = aN1.X();
152  pa[1] = aN1.Y();
153  pb[0] = aN2.X();
154  pb[1] = aN2.Y();
155  pc[0] = aP->GetX();
156  pc[1] = aP->GetY();
157 
158  return ttl_util::Orient2DFast( pa, pb, pc );
159  }
REAL_TYPE Orient2DFast(REAL_TYPE aPA[2], REAL_TYPE aPB[2], REAL_TYPE aPC[2])
Returns a positive value if the 2D nodes/points aPA, aPB, and aPC occur in counterclockwise order; a ...
Definition: ttl_util.h:117
double REAL_TYPE
The floating point type used in calculations involving scalar products and cross products.
Definition: hetraits.h:67
static REAL_TYPE hed::TTLtraits::Orient2D ( const DART aN1,
const DART aN2,
const DART aP 
)
inlinestatic

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 168 of file hetraits.h.

References ttl_util::Orient2DFast(), hed::DART::X(), and hed::DART::Y().

169  {
170  REAL_TYPE pa[2];
171  REAL_TYPE pb[2];
172  REAL_TYPE pc[2];
173 
174  pa[0] = aN1.X();
175  pa[1] = aN1.Y();
176  pb[0] = aN2.X();
177  pb[1] = aN2.Y();
178  pc[0] = aP.X();
179  pc[1] = aP.Y();
180 
181  return ttl_util::Orient2DFast( pa, pb, pc );
182  }
REAL_TYPE Orient2DFast(REAL_TYPE aPA[2], REAL_TYPE aPB[2], REAL_TYPE aPC[2])
Returns a positive value if the 2D nodes/points aPA, aPB, and aPC occur in counterclockwise order; a ...
Definition: ttl_util.h:117
double REAL_TYPE
The floating point type used in calculations involving scalar products and cross products.
Definition: hetraits.h:67
static REAL_TYPE hed::TTLtraits::ScalarProduct2D ( const DART aV1,
const DART aV2 
)
inlinestatic

Scalar product between two 2D vectors represented as darts.


ttl_util::scalarProduct2d can be used.

Definition at line 76 of file hetraits.h.

References hed::DART::Alpha0(), ttl_util::ScalarProduct2D(), hed::DART::X(), and hed::DART::Y().

77  {
78  DART v10 = aV1;
79  v10.Alpha0();
80 
81  DART v20 = aV2;
82  v20.Alpha0();
83 
84  return ttl_util::ScalarProduct2D( v10.X() - aV1.X(), v10.Y() - aV1.Y(),
85  v20.X() - aV2.X(), v20.Y() - aV2.Y() );
86  }
REAL_TYPE ScalarProduct2D(REAL_TYPE aDX1, REAL_TYPE aDY1, REAL_TYPE aDX2, REAL_TYPE aDY2)
Scalar product between two 2D vectors.
Definition: ttl_util.h:89
static REAL_TYPE hed::TTLtraits::ScalarProduct2D ( const DART aV,
const NODE_PTR aP 
)
inlinestatic

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 95 of file hetraits.h.

References hed::DART::Alpha0(), ttl_util::ScalarProduct2D(), hed::DART::X(), and hed::DART::Y().

96  {
97  DART d0 = aV;
98  d0.Alpha0();
99 
100  return ttl_util::ScalarProduct2D( d0.X() - aV.X(), d0.Y() - aV.Y(),
101  aP->GetX() - aV.X(), aP->GetY() - aV.Y() );
102  }
REAL_TYPE ScalarProduct2D(REAL_TYPE aDX1, REAL_TYPE aDY1, REAL_TYPE aDX2, REAL_TYPE aDY2)
Scalar product between two 2D vectors.
Definition: ttl_util.h:89

The documentation for this struct was generated from the following file: