Programming Reference for VirtualLab Fusion  2022.1
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
SimplePolygon Class Reference

This class is subject to change. Programs using this class may require changes with a new version of VirtualLab.
Public class which defines a simple polygon (defined by an array of vertices). 'Simple' means, that there are no intersections of the vertices. More...

Inheritance diagram for SimplePolygon:
ElementaryRegion2D Region2D IRegion1D2D IDocument

Public Member Functions

override double CalculateDistanceOfPointToRegionBorder (VectorD point)
 Calculates the distance of a point to the border of this region. More...
 
VectorD[] CalculateIntersectionsOfHalfLineAndPolygon (VectorD startPositionOfHalfLine, VectorD directionOfHalfLine, string linesName, bool ignoreVirtualVertices, out string[] namesOfPoints)
 Method for calculating the intersection points of a given half line and this polygon More...
 
List<(VectorD intersectionPoint, string nameOfPoint)> CalculateIntersectionsOfLineAndPolygon (VectorD firstPointOnLine, VectorD secondPointOnLineOrDirectionOfLine, bool directionGivenInsteadOfSecondPointOnLine, string linesName, bool ignoreVirtualVertices, out List<(int edgeStart, int edgeEnd)> congruentEdges)
 // Method for calculating the intersection points of a given line and this polygon // More...
 
VectorD[] CalculateIntersectionsOfLineSegmentAndPolygon (VectorD startPositionOfSegment, VectorD endPositionOfSegment, string linesName, string nameOfSegmentStart, string nameOfSegmentEnd, bool ignoreVirtualVertices, out(string, string)[] namesOfPoints)
 Method for calculating the intersection points of a given line segment and this polygon More...
 
override object Clone ()
 Deep copy of the object. More...
 
override bool Equals (object obj, EqualityIntent equalityIntent)
 Equality operator. More...
 
void ExtrapolatedRegionBorders (RectanglePhysical boundingBox, out List< Tuple< bool, double > > leftBorders, out List< Tuple< bool, double > > topBorders, out List< Tuple< bool, double > > rightBorders, out List< Tuple< bool, double > > bottomBorders)
 Determine region borders that can be created by 'border continuation' extrapolation. //See ITN.064 for more information. More...
 
PolygonVertexList Get_EffectiveVertices ()
 Method which creates a new PolygonVertexList containing only effective vertices. More...
 
override InsideOutside GetInOutRelation (VectorD point, ExtrapolationInfo extrapolation2use=null)
 Method which checks whether or not a point lies inside or outside the 2D region or on its boundary. More...
 
InsideOutside InOutRelation_boundingBoxBorder_extrapolated (VectorD point, RectanglePhysical boundingBox, List< Tuple< bool, double > > leftBorders, List< Tuple< bool, double > > topBorders, List< Tuple< bool, double > > rightBorders, List< Tuple< bool, double > > bottomBorders, ExtrapolationInfo extrapolation2use)
 If a simple polygon is used inside a composed region, we may need a special handling for points near a given bounding box. If there are edges of neighbored vertices exactly on a border of the bounding box, the border may effectively disappear in case of 'periodic' or 'border continuation' extrapolation. See ITN.064 for more information on the mode 'border continuation'. More...
 
override void MayBeNonzeroOutside (out bool maybeNonZeroLeft, out bool maybeNonZeroRight, out bool maybeNonZeroBottom, out bool maybeNonZeroTop)
 Method which determines whether or not non zero values (i.e. 'inside' states) may appear outside the polygon in case of 'border continuation' extrapolation. More...
 
 SimplePolygon ()
 Default constructor, creating a triangle with an edge length of 5mm, centered at (0, 0), and with its base line parallel to the x-axis.
 
 SimplePolygon (bool useOnlyEffectiveVertices=true, VectorD[] vertices)
 Initializes a new instance of the SimplePolygon class out of a list of VectorD. Each vertex gets the name "Vertex" and a running number. More...
 
 SimplePolygon (PolygonVertexList vertices, bool boundaryIsInside=false, PhysicalProperty propertyOfCoordinatesX=PhysicalProperty.Length, PhysicalProperty propertyOfCoordinatesY=PhysicalProperty.Length, bool dontCheckConsistency=false, bool useOnlyEffectiveVertices=true)
 A constructor of the simple polygon class. Non-simple polygons (where at least two edges intersect) are not allowed. The constructor determines the type of the polygon. More...
 
 SimplePolygon (RectanglePhysical rectangle, bool boundaryIsInside=false)
 Constructor which gets a rectangle that shall be represented by a polygon. More...
 
 SimplePolygon (RectangularRegion rectangle)
 Constructor which gets a rectangular region which shall be represented by a polygon. More...
 
 SimplePolygon (SerializationInfo info, StreamingContext context)
 Deserialization constructor. See the ISerializable interface for more details. More...
 
 SimplePolygon (SimplePolygon polygon)
 copy constructor of the simple polygon class More...
 
override void UpdatePropertyOfCoordinates ()
 Method for handling update after change of the physical property of the coordinate
 
- Public Member Functions inherited from ElementaryRegion2D
abstract double CalculateDistanceOfPointToRegionBorder (VectorD point)
 Calculates the distance of a point to the border of this region. More...
 
 ElementaryRegion2D (bool boundariesAreInside, PhysicalProperty propertyOfCoordinatesX=PhysicalProperty.Length, PhysicalProperty propertyOfCoordinatesY=PhysicalProperty.Length)
 Constructor which gets the _boundariesAreInside flag. To be called from derived classes constructors. More...
 
 ElementaryRegion2D (ElementaryRegion2D region2bCopied)
 Copy constructor. More...
 
 ElementaryRegion2D (SerializationInfo info, StreamingContext context)
 Deserialization constructor. See the ISerializable interface for more details. More...
 
- Public Member Functions inherited from Region2D
override object Clone ()
 Clones the current object. More...
 
override bool Equals (object obj, EqualityIntent equalityIntent)
 Equality operation More...
 
abstract InsideOutside GetInOutRelation (VectorD point, ExtrapolationInfo extrapolation2use=null)
 Method which checks whether or not a point lies inside or outside the 2D region or on its boundary. More...
 
bool IsInside (double pointX, double pointY)
 Method which checks whether or not a point is inside the 2D region. More...
 
bool IsInside (VectorD point)
 Method which checks whether or not a point is inside the 2D region. More...
 
abstract void MayBeNonzeroOutside (out bool maybeNonZeroLeft, out bool maybeNonZeroRight, out bool maybeNonZeroBottom, out bool maybeNonZeroTop)
 Method which determines whether or not the region can provide "inside" state outside of its boundary interval. This is not the case for extrapolation mode 'ConstantZero', of course. More...
 
 Region2D (bool boundariesAreInside, PhysicalProperty propertyOfCoordinatesX=PhysicalProperty.Length, PhysicalProperty propertyOfCoordinatesY=PhysicalProperty.Length)
 Constructor which gets the _boundariesAreInside flag. To be called from derived classes constructors. More...
 
 Region2D (Region2D region2bCopied)
 Copy constructor. More...
 
 Region2D (SerializationInfo info, StreamingContext context)
 Deserialization constructor. See the ISerializable interface for more details. More...
 
virtual void UpdatePropertyOfCoordinates ()
 Method for handling update after change of the physical property of the coordinate
 
bool Equals (object otherObject, EqualityIntent equalityIntent)
 Determines whether the specified Object is equal to this instance. More...
 
- Public Member Functions inherited from IDocument
void Reload ()
 Reload function for the document
 

Static Public Member Functions

static double CalculateArea (SimplePolygon polygon)
 Calculates the area of a given polygon. Formula taken from Wikipedia. More...
 
static VectorD CalculateCentroid (SimplePolygon polygon)
 Calculates the centroid of a given polygon. Formula taken from Wikipedia. More...
 
static List< SimplePolygonCalculateIntersectionOfTwoPolygons (SimplePolygon polygon1, SimplePolygon polygon2, bool ignoreVirtualVertices)
 Method for calculating the intersection of two polygons. See ITN.067 for more information. More...
 
static SimplePolygon CalculateUnionOfTwoPolygons (SimplePolygon polygon1, SimplePolygon polygon2, bool ignoreVirtualVertices, out List< SimplePolygon > holes)
 Method for calculating the union of two polygons. See ITN.067 for more information. More...
 
static bool CheckPolygonalChainForConvexityAndMonotony (VectorD[] polygonalPoints, out bool monotone_inX, out bool monotone_inY, out RectangleD boundingBox, out List< int > minX_vertexIndices, out List< int > maxX_vertexIndices, out List< int > minY_vertexIndices, out List< int > maxY_vertexIndices)
 Check whether a polygonal chain is convex and monotone. More...
 
static SimplePolygon EnsureClockwisePolygon (SimplePolygon polygon2check)
 Method which checks whether the vertices of a polygon are given in clockwise order. If so, it will be returned unchanged. If not, a polygon with reversed vertex order is returned. More...
 
static SimplePolygon EnsureCounterClockwisePolygon (SimplePolygon polygon2check)
 Method which checks whether the vertices of a polygon are given in counterclockwise order. If so, it will be returned unchanged. If not, a polygon with reversed vertex order is returned. More...
 
static List<(long index, VectorD point)> ExtendConvexPolygonWithOutlyingPoint (SimplePolygon polygon, List< long > pointIndicesOfPolygonVertices, NamedPolygonVertex singlePoint, long pointIndexOfSinglePoint, out List< TriangulationTriangle2D > newTrianglesForExtension)
 Method which extends a convex polygon by a given point. The polygon is meant to be the convex hull of a triangulated point cloud as described in ITN.065. More...
 
static InsideOutside IsInsideTriangle (VectorD point, VectorD vertex1, VectorD vertex2, VectorD vertex3, bool useNumericalChecks=true)
 Fast method for checking whether a point lies inside a given triangle. Important: No check for collinearity is done (for performance reasons). More...
 
static bool IsSelfIntersecting (VectorD[] vertices, out bool counterClockwiseDefinition)
 Method which checks whether or not a polygon (for the given order of the vertices!) is self intersecting. More...
 
static bool operator!= (SimplePolygon o1, SimplePolygon o2)
 Unequals operator. More...
 
static bool operator== (SimplePolygon o1, SimplePolygon o2)
 Equals operator More...
 
static SimplePolygon RemoveVirtualVertices (SimplePolygon polygon)
 Method for creating a polygon without virtual vertices from an arbitrary polygon. More...
 
static SimplePolygon Rotate (SimplePolygon polygon, double angle, VectorD centerOfRotation)
 Static method for transforming a given polygon to another one which is rotated by an angle around a given rotation center. More...
 
static SimplePolygon TransformToTargetBox (SimplePolygon polygon, RectanglePhysical targetBoundingBox)
 Static method for transforming a given polygon to another one with defined position and size. More...
 
static SimplePolygon Translate (SimplePolygon polygon, VectorD translationVector)
 Static method for transforming a given polygon to another one which is translated by a given vector. More...
 
- Static Public Member Functions inherited from ElementaryRegion2D
static bool operator!= (ElementaryRegion2D o1, ElementaryRegion2D o2)
 Unequals operator. More...
 
static bool operator== (ElementaryRegion2D o1, ElementaryRegion2D o2)
 Equals operator More...
 
- Static Public Member Functions inherited from Region2D
static Region2D InvertRegion (Region2D region2Invert)
 Creates a new region with inverted in / out regions compared to this. More...
 
static Region2D Load (string fileName)
 Loads the specified file name. Works independently from whether the document has been saved without view settings (as prior to VL 6.0) or with view settings. More...
 
static bool operator!= (Region2D o1, Region2D o2)
 Unequals operator. More...
 
static bool operator== (Region2D o1, Region2D o2)
 Equals operator More...
 

Public Attributes

EventHandler PolygonChanged
 Event for changed vertices.
 
int startIndexOfNearestEdge
 Calculates the distance of a point to the border of this polygon. Important: This method will ignore all extrapolation settings! More...
 

Properties

override RectanglePhysical AxisAlignedBoundingBox [get]
 Gets the bounding box for the polygon. Its sides are parallel to the x- and y-axis resp. It is calculated during preprocessing.
 
bool CounterClockwise [get]
 Gets whether or not the polygon is defined counterclockwise. It is determined during preprocessing.
 
virtual List< Parameter > ParameterRunParameters [get]
 Gets all available parameters. For variable parameters (i.e. those double and int parameters which can be used in the Parameter Run, Parametric Optimization and so on) add a VaryParameterInfo object (derived from Parameter class) to the returned list.
 
PolygonType Type [get]
 Gets the type of the polygon. It is determined during preprocessing.
 
PolygonVertexList Vertices [get]
 public property to get the vertices of the polygon
 
- Properties inherited from Region2D
abstract RectanglePhysical AxisAlignedBoundingBox [get]
 Gets the bounding box for the 2D region. Its sides are parallel to the x- and y-axis resp.
 
bool BoundariesAreInside [get, set]
 Gets or sets whether or not the boundaries of the region belong to the inner region.
 
string CommentOfCoordinates_X [get, set]
 Gets and sets the comment for the x-coordinates.
 
string CommentOfCoordinates_Y [get, set]
 Gets and sets the comment for the y-coordinates.
 
ExtrapolationInfo ExtrapolationHandling [get, set]
 The extrapolation mode for this region. See ITN.064 for more information on the mode 'border continuation'.
 
bool IsOneD [get]
 Gets whether this IRegion1D2D is 1D or 2D
 
string Name [get, set]
 The name which can be given to the region by the user.
 
PhysicalProperty PropertyOfCoordinatesX [get, set]
 Physical property of the x-coordinates of the region
 
PhysicalProperty PropertyOfCoordinatesY [get, set]
 Physical property of the y-coordinates of the region
 
Region2DType RegionType [get]
 Gets the type of the region
 
SamplingParameters SamplingForUsageWithComplexFields [get, set]
 Sampling parameters which will be used for a coordinate rescaling in case of using the region with a complex field.
 
- Properties inherited from IRegion1D2D
bool BoundariesAreInside [get, set]
 Gets or sets whether or not the boundaries of the region belong to the inner region.
 
bool IsOneD [get]
 Gets whether this IRegion1D2D is 1D or 2D
 
string Name [get, set]
 The name which can be given to the region by the user.
 
SamplingParameters SamplingForUsageWithComplexFields [get, set]
 Sampling parameters which will be used for a coordinate rescaling in case of using the region with a complex field.
 
- Properties inherited from IDocument
VirtualLabSession Session [get, set]
 every documents need to be handled in a session ==> default is the VirtualLab Mainsession
 
NodeVLExplorer TreeStructure [get]
 every document should have a node (maybe with subnodes) in the VirtualLab Explorer
 
DocumentType TypeOfDocument [get]
 Gets an enum entry specifying the type of the document.
 

Additional Inherited Members

- Static Public Attributes inherited from Region2D
const string DefaultDocumentName
 The default document name (= type description) for an Order Collection.
 
static readonly string FileDialogFilterString
 The filter string used in "Open File" dialogs.
 
const string FileExtensionString
 The file extension for an Order Collection.
 

Detailed Description

This class is subject to change. Programs using this class may require changes with a new version of VirtualLab.
Public class which defines a simple polygon (defined by an array of vertices). 'Simple' means, that there are no intersections of the vertices.

Constructor & Destructor Documentation

◆ SimplePolygon() [1/6]

SimplePolygon ( bool  useOnlyEffectiveVertices = true,
VectorD[]  vertices 
)

Initializes a new instance of the SimplePolygon class out of a list of VectorD. Each vertex gets the name "Vertex" and a running number.

Parameters
verticesThe vertices of the polygon.
useOnlyEffectiveVerticesIf true, only effective vertices (instead of all defined vertices) will be used.
Exceptions
System.ArgumentExceptionAt least three vertices must be given.
System.ArgumentExceptionVertices have to be unique.

◆ SimplePolygon() [2/6]

SimplePolygon ( PolygonVertexList  vertices,
bool  boundaryIsInside = false,
PhysicalProperty  propertyOfCoordinatesX = PhysicalProperty.Length,
PhysicalProperty  propertyOfCoordinatesY = PhysicalProperty.Length,
bool  dontCheckConsistency = false,
bool  useOnlyEffectiveVertices = true 
)

A constructor of the simple polygon class. Non-simple polygons (where at least two edges intersect) are not allowed. The constructor determines the type of the polygon.

Parameters
verticesThe vertices that define the polygon. The order is important.
boundaryIsInsideFlag which says whether or not the boundary is part of the inner region or not.
propertyOfCoordinatesXPhysical property of the x-coordinate.
propertyOfCoordinatesYPhysical property of the y-coordinate.
dontCheckConsistencyIf true, no consistency check will be done. (Make sure that you know what you're doing!)

◆ SimplePolygon() [3/6]

copy constructor of the simple polygon class

Parameters
polygonthe polygon which shall be copied

◆ SimplePolygon() [4/6]

SimplePolygon ( RectanglePhysical  rectangle,
bool  boundaryIsInside = false 
)

Constructor which gets a rectangle that shall be represented by a polygon.

Parameters
rectangleRectangle to be converted to a polygon.
boundaryIsInsideFlag which says whether or not the boundary is part of the inner region or not.

◆ SimplePolygon() [5/6]

Constructor which gets a rectangular region which shall be represented by a polygon.

Parameters
rectangleRectangle to be converted to a polygon.

◆ SimplePolygon() [6/6]

SimplePolygon ( SerializationInfo  info,
StreamingContext  context 
)

Deserialization constructor. See the ISerializable interface for more details.

Parameters
infoSerializationInfo
contextStreamingContext

Member Function Documentation

◆ CalculateArea()

static double CalculateArea ( SimplePolygon  polygon)
static

Calculates the area of a given polygon. Formula taken from Wikipedia.

Parameters
polygonPolygon to calculate the area for.
Returns
The area for the given polygon.

◆ CalculateCentroid()

static VectorD CalculateCentroid ( SimplePolygon  polygon)
static

Calculates the centroid of a given polygon. Formula taken from Wikipedia.

Parameters
polygonPolygon to calculate the centroid for.
Returns
The centroid for the given polygon.

◆ CalculateDistanceOfPointToRegionBorder()

override double CalculateDistanceOfPointToRegionBorder ( VectorD  point)
virtual

Calculates the distance of a point to the border of this region.

Parameters
pointPoint to calculate the distance for.
Returns
The distance of the given point to the border of this region

Implements ElementaryRegion2D.

◆ CalculateIntersectionOfTwoPolygons()

static List< SimplePolygon > CalculateIntersectionOfTwoPolygons ( SimplePolygon  polygon1,
SimplePolygon  polygon2,
bool  ignoreVirtualVertices 
)
static

Method for calculating the intersection of two polygons. See ITN.067 for more information.

Parameters
polygon1First of the polygons to intersect.
polygon2Second of the polygons to intersect.
ignoreVirtualVerticesIf true, only effective vertices are used. That will be sufficient for most geometrical cases. If it is about triangulation, all vertices are needed instead.
Returns
A list of simple polygons representing the intersection(s) of the given polygons.

◆ CalculateIntersectionsOfHalfLineAndPolygon()

VectorD[] CalculateIntersectionsOfHalfLineAndPolygon ( VectorD  startPositionOfHalfLine,
VectorD  directionOfHalfLine,
string  linesName,
bool  ignoreVirtualVertices,
out string[]  namesOfPoints 
)

Method for calculating the intersection points of a given half line and this polygon

Parameters
startPositionOfHalfLineThe start position of the half line.
directionOfHalfLineThe direction of the half line.
linesNameName of the line to intersect with the polygon.
ignoreVirtualVerticesIf true, only effective vertices are used. That will be sufficient for most geometrical cases. If it is about triangulation, all vertices are needed instead.
namesOfPointsArray which contains the names of the intersection points.
Returns
The intersection points of a given half line and this polygon.

◆ CalculateIntersectionsOfLineAndPolygon()

List<(VectorD intersectionPoint, string nameOfPoint)> CalculateIntersectionsOfLineAndPolygon ( VectorD  firstPointOnLine,
VectorD  secondPointOnLineOrDirectionOfLine,
bool  directionGivenInsteadOfSecondPointOnLine,
string  linesName,
bool  ignoreVirtualVertices,
out List<(int edgeStart, int edgeEnd)>  congruentEdges 
)

// Method for calculating the intersection points of a given line and this polygon //

//

Parameters
basePointOnLineAn start or base point of the line.

//

Parameters
directionOfLineThe direction of the line.

//

Parameters
linesNameName of the line to intersect with the polygon.

//

Parameters
ignoreVirtualVerticesIf true, only effective vertices are used. That will be sufficient for most geometrical cases. If it is about triangulation, all vertices are needed instead.

//

Parameters
congruentEdgesA list of edge start and end indices of these edges which are congruent to the line to intersect.

//

Returns
A list of value tuples which give the found intersection points as well as the name of the point.

Method for calculating the intersection points of a given line and this polygon.

Parameters
firstPointOnLineOne point lying on the line to be intersecting.
secondPointOnLineOrDirectionOfLineEither a second point on the line or the direction of the line, depending on the flag directionGivenInsteadOfSecondPointOnLine.
directionGivenInsteadOfSecondPointOnLineIf true, the second VectorD is interpreted as line direction instead of a second point on the line.
linesNameName of the line to intersect with the polygon.
ignoreVirtualVerticesIf true, only effective vertices are used. That will be sufficient for most geometrical cases. If it is about triangulation, all vertices are needed instead.
congruentEdgesA list of edge start and end indices of these edges which are congruent to the line to intersect.
Returns
A list of value tuples which give the found intersection points as well as the name of the point.
Exceptions
ArgumentExceptionIf directionGivenInsteadOfSecondPointOnLine is true and the absolute value of secondPointOnLineOrDirectionOfLine, an exception is thrown.

◆ CalculateIntersectionsOfLineSegmentAndPolygon()

VectorD[] CalculateIntersectionsOfLineSegmentAndPolygon ( VectorD  startPositionOfSegment,
VectorD  endPositionOfSegment,
string  linesName,
string  nameOfSegmentStart,
string  nameOfSegmentEnd,
bool  ignoreVirtualVertices,
out(string, string)[]  namesOfPoints 
)

Method for calculating the intersection points of a given line segment and this polygon

Parameters
startPositionOfSegmentThe start position of the line segment.
endPositionOfSegmentThe end position of the line segment.
linesNameName of the line to intersect with the polygon.
nameOfSegmentStartName of the start point of the line segment to be intersected with the polygon.
nameOfSegmentEndName of the end point of the line segment to be intersected with the polygon.
ignoreVirtualVerticesIf true, only effective vertices are used. That will be sufficient for most geometrical cases. If it is about triangulation, all vertices are needed instead.
namesOfPointsArray which contains the names of the intersection points.
Returns
A list of tuples which give the found intersection points as well as a bool flag indicating whether or not the edge from the current intersection to the next one is congruent to the line segment.

◆ CalculateUnionOfTwoPolygons()

static SimplePolygon CalculateUnionOfTwoPolygons ( SimplePolygon  polygon1,
SimplePolygon  polygon2,
bool  ignoreVirtualVertices,
out List< SimplePolygon holes 
)
static

Method for calculating the union of two polygons. See ITN.067 for more information.

Parameters
polygon1First of the polygons to unite.
polygon2Second of the polygons to unite.
ignoreVirtualVerticesIf true, only effective vertices are used. That will be sufficient for most geometrical cases. If it is about triangulation, all vertices are needed instead.
holesA list of holes that do not belong to the mathematical union set but which can be not represented by the returned simple polygon.
Returns
A simple polygon representing the union of the given polygons. Null will be returned in case of the two given polygons being separate or touching in one single contact point at most.

◆ CheckPolygonalChainForConvexityAndMonotony()

static bool CheckPolygonalChainForConvexityAndMonotony ( VectorD[]  polygonalPoints,
out bool  monotone_inX,
out bool  monotone_inY,
out RectangleD  boundingBox,
out List< int >  minX_vertexIndices,
out List< int >  maxX_vertexIndices,
out List< int >  minY_vertexIndices,
out List< int >  maxY_vertexIndices 
)
static

Check whether a polygonal chain is convex and monotone.

Parameters
polygonalPointsPoints of the polygonal chain to check.
monotone_inXOut parameter which is true, if the polygon is monotone in x.
monotone_inYOut parameter which is true, if the polygon is monotone in y.
boundingBoxThe bounding box of the polygon.
minX_vertexIndicesOut parameter which is a list of the indices of those vertices which have the minimum x-coordinate.
maxX_vertexIndicesOut parameter which is a list of the indices of those vertices which have the maximum x-coordinate.
minY_vertexIndicesOut parameter which is a list of the indices of those vertices which have the minimum y-coordinate.
maxY_vertexIndicesOut parameter which is a list of the indices of those vertices which have the maximum y-coordinate.
Returns
True if the polygon which is described by the chain is convex.

◆ Clone()

override object Clone ( )

Deep copy of the object.

Returns
A deep copy of this.

◆ EnsureClockwisePolygon()

static SimplePolygon EnsureClockwisePolygon ( SimplePolygon  polygon2check)
static

Method which checks whether the vertices of a polygon are given in clockwise order. If so, it will be returned unchanged. If not, a polygon with reversed vertex order is returned.

Parameters
polygon2checkPolygon to check for clockwise vertex order.
Returns
Polygon with clockwise vertex order.

◆ EnsureCounterClockwisePolygon()

static SimplePolygon EnsureCounterClockwisePolygon ( SimplePolygon  polygon2check)
static

Method which checks whether the vertices of a polygon are given in counterclockwise order. If so, it will be returned unchanged. If not, a polygon with reversed vertex order is returned.

Parameters
polygon2checkPolygon to check for counterclockwise vertex order.
Returns
Polygon with counterclockwise vertex order.

◆ Equals()

override bool Equals ( object  obj,
EqualityIntent  equalityIntent 
)

Equality operator.

Parameters
obj
equalityIntentDefines what kind of equality you want to check when comparing two objects, for example all values or physical equality.
Returns

Implements IRegion1D2D.

◆ ExtendConvexPolygonWithOutlyingPoint()

static List<(long index, VectorD point)> ExtendConvexPolygonWithOutlyingPoint ( SimplePolygon  polygon,
List< long >  pointIndicesOfPolygonVertices,
NamedPolygonVertex  singlePoint,
long  pointIndexOfSinglePoint,
out List< TriangulationTriangle2D >  newTrianglesForExtension 
)
static

Method which extends a convex polygon by a given point. The polygon is meant to be the convex hull of a triangulated point cloud as described in ITN.065.

Parameters
polygonPolygon to be extended.
pointIndicesOfPolygonVerticesList of indices which correspond to the list of points the polygon is the convex hull for.
singlePointOutlying point to be a new vertex of the polygon.
pointIndexOfSinglePointIndex of the single point in the point cloud.
newTrianglesForExtensionAdding the new vertex will usually remove old edges which lie inside the new polygon now. This out parameters gives all triangle which are defined by the removed edge and the new point.
Returns
A polygonal chain which represents a new convex polygon, extended by the given point.

◆ ExtrapolatedRegionBorders()

void ExtrapolatedRegionBorders ( RectanglePhysical  boundingBox,
out List< Tuple< bool, double > >  leftBorders,
out List< Tuple< bool, double > >  topBorders,
out List< Tuple< bool, double > >  rightBorders,
out List< Tuple< bool, double > >  bottomBorders 
)

Determine region borders that can be created by 'border continuation' extrapolation. //See ITN.064 for more information.

Parameters
boundingBoxbounding box to limit the region
leftBordersleft horizontal extrapolated borders
topBorderstop vertical extrapolated borders
rightBordersright horizontal extrapolated borders
bottomBordersbottom vertical extrapolated borders

◆ Get_EffectiveVertices()

PolygonVertexList Get_EffectiveVertices ( )

Method which creates a new PolygonVertexList containing only effective vertices.

Returns

◆ GetInOutRelation()

override InsideOutside GetInOutRelation ( VectorD  point,
ExtrapolationInfo  extrapolation2use = null 
)
virtual

Method which checks whether or not a point lies inside or outside the 2D region or on its boundary.

Parameters
pointThe point to be checked whether it lies inside.
extrapolation2useExtrapolation info actually to be used.
Returns
Information where the point lies in relation to the region.

Implements Region2D.

◆ InOutRelation_boundingBoxBorder_extrapolated()

InsideOutside InOutRelation_boundingBoxBorder_extrapolated ( VectorD  point,
RectanglePhysical  boundingBox,
List< Tuple< bool, double > >  leftBorders,
List< Tuple< bool, double > >  topBorders,
List< Tuple< bool, double > >  rightBorders,
List< Tuple< bool, double > >  bottomBorders,
ExtrapolationInfo  extrapolation2use 
)

If a simple polygon is used inside a composed region, we may need a special handling for points near a given bounding box. If there are edges of neighbored vertices exactly on a border of the bounding box, the border may effectively disappear in case of 'periodic' or 'border continuation' extrapolation. See ITN.064 for more information on the mode 'border continuation'.

Parameters
pointPoint to get the InOut-relation for.
boundingBoxBounding box of the parenting composed region.
leftBordersHelp list of extrapolated horizontal borders left of the bounding box. The list has to be created in a previous preprocessing.
topBordersHelp list of extrapolated vertical borders above the top of the bounding box. The list has to be created in a previous preprocessing.
rightBordersHelp list of extrapolated horizontal borders right of the bounding box. The list has to be created in a previous preprocessing.
bottomBordersHelp list of extrapolated vertical borders right of the bounding box. The list has to be created in a previous preprocessing.
extrapolation2useExtrapolation info actually to be used.
Returns
The InOut-relation for the given point.

◆ IsInsideTriangle()

static InsideOutside IsInsideTriangle ( VectorD  point,
VectorD  vertex1,
VectorD  vertex2,
VectorD  vertex3,
bool  useNumericalChecks = true 
)
static

Fast method for checking whether a point lies inside a given triangle. Important: No check for collinearity is done (for performance reasons).

Parameters
pointPoint to check.
vertex1First triangle vertex.
vertex2Second triangle vertex.
vertex3Third triangle vertex.
useNumericalChecksIf true, NumericalChecks comparison is used in order to tolerate numerical errors.
Returns
InsideOutside state for the point.

◆ IsSelfIntersecting()

static bool IsSelfIntersecting ( VectorD[]  vertices,
out bool  counterClockwiseDefinition 
)
static

Method which checks whether or not a polygon (for the given order of the vertices!) is self intersecting.

Parameters
verticesVertices of the polygon to be checked. The order is important.
counterClockwiseDefinitionFlag indicating whether the polygon is defined counterclockwise or not.
Returns
true if the polygon is self intersecting.

◆ MayBeNonzeroOutside()

override void MayBeNonzeroOutside ( out bool  maybeNonZeroLeft,
out bool  maybeNonZeroRight,
out bool  maybeNonZeroBottom,
out bool  maybeNonZeroTop 
)
virtual

Method which determines whether or not non zero values (i.e. 'inside' states) may appear outside the polygon in case of 'border continuation' extrapolation.

Parameters
maybeNonZeroLeftAre inside states possible at the left?
maybeNonZeroRightAre inside states possible at the right?
maybeNonZeroBottomAre inside states possible at the bottom?
maybeNonZeroTopAre inside states possible at the top?

Implements Region2D.

◆ operator!=()

static bool operator!= ( SimplePolygon  o1,
SimplePolygon  o2 
)
static

Unequals operator.

Parameters
o1
o2
Returns

◆ operator==()

static bool operator== ( SimplePolygon  o1,
SimplePolygon  o2 
)
static

Equals operator

Parameters
o1
o2
Returns

◆ RemoveVirtualVertices()

static SimplePolygon RemoveVirtualVertices ( SimplePolygon  polygon)
static

Method for creating a polygon without virtual vertices from an arbitrary polygon.

Parameters
polygonPolygon which may contain virtual vertices.
Returns
A polygon without virtual vertices.

◆ Rotate()

static SimplePolygon Rotate ( SimplePolygon  polygon,
double  angle,
VectorD  centerOfRotation 
)
static

Static method for transforming a given polygon to another one which is rotated by an angle around a given rotation center.

Parameters
polygonThe polygon to be rotated.
angleThe angle to rotate the polygon with.
centerOfRotationThe center to rotate the polygon around.
Returns
The rotated polygon.

◆ TransformToTargetBox()

static SimplePolygon TransformToTargetBox ( SimplePolygon  polygon,
RectanglePhysical  targetBoundingBox 
)
static

Static method for transforming a given polygon to another one with defined position and size.

Parameters
polygonPolygon to be transformed.
targetBoundingBoxTarget position and size.
Returns
The transformed polygon.

◆ Translate()

static SimplePolygon Translate ( SimplePolygon  polygon,
VectorD  translationVector 
)
static

Static method for transforming a given polygon to another one which is translated by a given vector.

Parameters
polygonThe polygon to be shifted.
translationVectorThe shifting vector.
Returns
The translated polygon.

Member Data Documentation

◆ startIndexOfNearestEdge

int startIndexOfNearestEdge

Calculates the distance of a point to the border of this polygon. Important: This method will ignore all extrapolation settings!

Parameters
pointPoint to calculate the distance for.
ignoreVirtualVerticesIf set to true, virtua vertices will be ignored.
Returns
A named tuple containing the vertex indices of the edge with the smallest distance as well as the distance itself.