Polygon.hpp

24 /// as seen from the front half-space (against the normal vectors direction) of the polygons plane.

25 /// 4. A polygon has at least three vertices and its plane is not degenerate, or it is the "null" polygon.

40 On =1, ///< The polygon has vertices in the plane. Note that this value alone is never returned by WhatSide().

48 InMirrored =9 ///< The polygon is in the mirrored version of the plane (opposite normal vectors).

55 /// The MinVertexDist value should be a good deal larger than the RoundEpsilon value, because *very* subtle problems

56 /// can easily arise whenever the "structural object size" is as small as the maximally permitted rounding error!

60 /// Returns the plane that contains the polygon edge defined by (VertexNr, VertexNr+1), that is orthogonal to the polygons

63 /// @param VertexNr The edge defined by (VertexNr, VertexNr+1) for which a plane should be created.

80 /// Determines whether this polygon has a vertex A, within Epsilon tolerance of the existing vertices.

86 /// @returns one of the values of SideT. Note however that SideT::On is never returned in favour of either SideT::InIdentical or SideT::InMirrored.

87 /// If this polygon has edges that are shorter than the plane thickness (==2*HalfPlaneThickness) and SideT::InIdentical or SideT::InMirrored

88 /// is returned, the result is inreliable and should not be trusted. (The polygon should then be considered as invalid and be discarded.)

92 /// That is, instead of FrontAndOn only Front is returned, instead of BackAndOn Back, and instead of BothAndOn Both is returned.

100 /// @param OtherPoly The polygon for which is determined whether it is overlapped by this polygon.

101 /// @param ReportTouchesAsOverlaps If true, an overlap is reported even if it has zero area, that is, even if the two polygons merely "touch"

102 /// within the thickness of the edges. If false, an overlap is only reported if it has a positive, non-zero area.

103 /// @param EdgeThickness describes both the "thickness" of the edges within which small gaps (i.e. non-overlaps)

105 /// @throws InvalidOperationE if an edge of this polygon or OtherPoly is shorter than EdgeThickness.

107 bool Overlaps(const Polygon3T<T>& OtherPoly, bool ReportTouchesAsOverlaps, const T EdgeThickness) const;

109 /// Determines whether this polygon entirely encloses OtherPoly (in the same or mirrored plane).

111 /// @param OtherPoly The polygon for which is determined whether it is enclosed by this polygon.

112 /// @param MayTouchEdges If true, OtherPoly may touch the edges of this polygon within EdgeThickness tolerance and is still being

113 /// considered enclosed. If false, OtherPoly must truly be inside this polygon, and it must not touch its edges.

114 /// @param EdgeThickness describes both the "thickness" of the edges of this polygon *and* the minimum length of the edges of this polygon and OtherPoly.

116 /// All edge lengths of this and OtherPoly should be longer than 2*EdgeThinkness, or else the result will be undefined.

122 /// This happens for example if the polygon is a sharp wedge whose top is cut of. If the wedge was sharp enough,

128 ArrayT< Polygon3T<T> > GetSplits(const Plane3T<T>& SplitPlane, const T HalfPlaneThickness) const;

131 /// The last polygon in NewPolys is the overlapping one (*), the front entries lie outside the polygon.

132 /// (If this polygon is contained in Poly (even then this->Overlaps(Poly) is true), NewPolys contains only a copy of this polygon.)

138 void GetChoppedUpAlong(const Polygon3T<T>& Poly, const T EdgeThickness, ArrayT< Polygon3T<T> >& NewPolys) const;

141 /// If poly builds t-junctions at this polygon, the according vertives are added to this polygon.

157 static Polygon3T<T> Merge(const Polygon3T<T>& Poly1, const Polygon3T<T>& Poly2, const T EdgeThickness);

162 /// WARNING: Degenerated inputs are also possible, e.g. the planes from a cube with one side missing.

163 /// Those cases can't be caught here as errors because this functionality is necessary for portal creation.

164 /// In this case polygons with fewer than 3 vertices are returned and an explicit validity check is necessary!

165 /// It is also possible that the input planes of a polygon for example specify a triangle where one edge is shorter than GeometryEpsilon.

166 /// In this case the vertices would be combined and a polygon with only 2 vertices would be the result!

168 /// Consequence: Check the returned polygon sets ALWAYS for validity, e.g. Polys[...].Vertices.Size()>=3 !

173 static void Complete(ArrayT< Polygon3T<T> >& Polys, const T HalfPlaneThickness, const Vector3T<T>& BoundingSphereCenter=Vector3T<T>(0, 0, 0), const T BoundingSphereRadius=10.0*1000.0*1000.0);

void FillTJunctions(const Polygon3T< T > &Poly, const T EdgeThickness)

If poly builds t-junctions at this polygon, the according vertives are added to this polygon...

SideT WhatSideSimple(const Plane3T< T > &P, const T HalfPlaneThickness) const

Like WhatSide(), but it integrates the "...AndOn" answers with the non-"AndOn" answers.

static Polygon3T< T > Merge(const Polygon3T< T > &Poly1, const Polygon3T< T > &Poly2, const T EdgeThickness)

Merge Poly1 and Poly2 under the following prerequisites:

ArrayT< Vector3T< T > > Vertices

Vertices of this polygon.

Polygon3T< T > GetMirror() const

Returns a mirrored copy of this polygon, with reversed plane and reversed order.

T GetArea() const

Determines the spatial area (Flächeninhalt) of this polygon.

void GetChoppedUpAlong(const Polygon3T< T > &Poly, const T EdgeThickness, ArrayT< Polygon3T< T > > &NewPolys) const

Cuts this polygon along the edges of Poly.

bool Encloses(const Polygon3T< T > &OtherPoly, bool MayTouchEdges, const T EdgeThickness) const

Determines whether this polygon entirely encloses OtherPoly (in the same or mirrored plane)...

The polygon has vertices in the plane. Note that this value alone is never returned by WhatSide()...

SideT

Describes on which side of a plane the polygon is.

The polygon has vertices on both sides of and in the plane.

SideT WhatSide(const Plane3T< T > &P, const T HalfPlaneThickness) const

Determines on what side of plane P this polygon is.

Plane3T< T > GetEdgePlane(unsigned long VertexNr, const T Epsilon) const

Returns the plane that contains the polygon edge defined by (VertexNr, VertexNr+1), that is orthogonal to the polygons plane and whose normal vector points towards the polygon center.

ArrayT< Polygon3T< T > > GetSplits(const Plane3T< T > &SplitPlane, const T HalfPlaneThickness) const

Splits the polygon along the passed plane.

The polygon is in the mirrored version of the plane (opposite normal vectors).

bool IsValid(const double RoundEpsilon, const double MinVertexDist) const

This methods returns whether a polygon is valid wrt.

bool Overlaps(const Polygon3T< T > &OtherPoly, bool ReportTouchesAsOverlaps, const T EdgeThickness) const

Determines whether this polygon overlaps OtherPoly (in the same plane).

static void Complete(ArrayT< Polygon3T< T > > &Polys, const T HalfPlaneThickness, const Vector3T< T > &BoundingSphereCenter=Vector3T< T >(0, 0, 0), const T BoundingSphereRadius=10.0 *1000.0 *1000.0)

Given a brush (here: array of polygons), from which only the planes are known.

The polygon has vertices on the back-side of and in the plane.

The polygon has vertices on the front-side of and in the plane.

bool HasVertex(const Vector3T< T > &A, const T Epsilon) const

Determines whether this polygon has a vertex A, within Epsilon tolerance of the existing vertices...