50#ifndef LASS_GUARDIAN_OF_INCLUSION_PRIM_TRIANGLE_2D_H
51#define LASS_GUARDIAN_OF_INCLUSION_PRIM_TRIANGLE_2D_H
70 typedef Point2D<T> TPoint;
72 typedef typename TPoint::TVector TVector;
75 typedef typename TPoint::TValue TValue;
76 typedef typename TPoint::TParam TParam;
77 typedef typename TPoint::TReference TReference;
78 typedef typename TPoint::TConstReference TConstReference;
79 typedef typename TPoint::TNumTraits TNumTraits;
81 enum { dimension = TPoint::dimension };
83 template <
typename U>
struct Rebind
89 Triangle2D(
const TPoint& iA,
const TPoint& iB,
const TPoint& iC);
93 const TPoint&
at(
int iIndexOfVertex)
const;
94 TPoint&
at(
int iIndexOfVertex);
95 const TLineSegment
edge(
int iIndexOfTailVertex)
const;
96 const TVector
vector(
int iIndexOfTailVertex)
const;
109 bool isConcave()
const;
114 Side classify(
const TPoint& iP)
const;
121 bool isInRange(
size_t iIndexOfVertex)
const;
125 TPoint vertices_[size_];
128template <
typename T>
const T distance(
const Triangle2D<T>& triangle,
const Point2D<T>& point);
129template <
typename T>
bool intersects(
const Triangle2D<T>& a,
const Triangle2D<T>& b);
134std::ostream& operator<<(std::ostream& ioOStream,
const Triangle2D<T>& iTriangle);
137 const Triangle2D<T>& iTriangle);
140T partialVoronoiArea(
const Triangle2D<T> iT,
int iIndexOfVertex);
148#ifdef LASS_GUARDIAN_OF_INCLUSION_PRIM_AABB_2D_H
152#ifdef LASS_GUARDIAN_OF_INCLUSION_PRIM_RAY_2D_H
Output stream for writing a selection of geometric primitives to matlab M files.
Output stream for writing a selection of geometric primitives to XML files.
Triangle2D(const TPoint &iA, const TPoint &iB, const TPoint &iC)
Constructs a triangle through three points in positive sequence.
bool isSimple() const
return true if polygon is simple, false if not.
int size() const
return number of vertices
const TPoint & operator[](size_t iIndexOfVertex) const
return vertex of polygon by its index, not wrapped, no bounds check.
const TVector vector(int iIndexOfTailVertex) const
return the vector between vertices at(iIndex) and at(iIndex + 1)\
bool contains(const TPoint &iP) const
return true when a point is inside or on the edge of a triangle.
const TPointH vertexCentroid() const
return the barycenter of all vertices.
bool isReflex(int iIndexOfVertex) const
return true if inner angle of vertex is reflex (is > 180 degrees).
Orientation orientation() const
return orientation of polygon.
TPoint & operator[](size_t iIndexOfVertex)
return vertex of polygon by its index, not wrapped, no bounds check.
const TValue perimeter() const
return sum of the lengths of all edges
bool isEmpty() const
return true if polygon has no vertices
const TPoint & at(int iIndexOfVertex) const
return vertex of polygon by its index, but wrap around the bounds.
void flip()
flip orientation of polygon.
TPoint & at(int iIndexOfVertex)
return vertex of polygon by its index, but wrap around the bounds.
bool isConvex() const
return true if polygon is convex, false if not.
const TValue signedArea() const
return signed polygon area.
const TLineSegment edge(int iIndexOfTailVertex) const
return the edge of the polygon between vertices at(iIndex) and at(iIndex + 1).
Triangle2D()
constructs an empty triangle.
const TValue area() const
return area of the polygons surface.
const TPointH surfaceCentroid() const
return the barycenter of all vertices.
#define LASS_SIMD_ALIGN
if LASS_SIMD_ALIGNMENT is set, use LASS_SIMD_ALIGN to align some structures on SIMD alignment boundar...
set of geometrical primitives
Side
Different sides of a surface.
Orientation
enumeration of clockwise versus counterclockwise
Library for Assembled Shared Sources.