Programming Reference for VirtualLab Fusion  2026.1
Loading...
Searching...
No Matches
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 void CalculateAxisAlignedBoundingBox ()
 Method for (re)calculating the axis aligned bounding box.
 
override double CalculateDistanceOfPointToRegionBorder (VectorD point)
 Calculates the distance of a point to the border of this region.
 
List< double > CalculateInternalAngles ()
 Method which calculates all internal angles of the polygon.
 
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.
 
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.
 
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.
 
override object Clone ()
 Deep copy of the object.
 
new void DeserializationPostProcessing (ref List< System.Reflection.FieldInfo > unfindableFields, RemainingData remainingData)
 Method for doing post-processing after XML deserialization. Especially, handling of fields which have been altered since the version the data were saved with. But also additional operations (like filling caching variables etc.) can be done here.
 
override bool Equals (object obj, EqualityIntent equalityIntent)
 Equality operator.
 
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.
 
PolygonVertexList Get_EffectiveVertices ()
 Method which creates a new PolygonVertexList containing only effective vertices.
 
override int GetHashCode ()
 
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.
 
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'.
 
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.
 
 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. The boundaries are regarded as being outside, which you can change with the BoundariesAreInside property.
 
 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.
 
 SimplePolygon (RectanglePhysical rectangle, bool boundaryIsInside=false)
 Constructor which gets a rectangle that shall be represented by a polygon.
 
 SimplePolygon (RectangularRegion rectangle)
 Constructor which gets a rectangular region which shall be represented by a polygon.
 
 SimplePolygon (SimplePolygon polygon)
 copy constructor of the simple polygon class
 
override void UpdatePropertyOfCoordinates ()
 Method for handling update after change of the physical property of the coordinate.
 
- Public Member Functions inherited from ElementaryRegion2D
double CalculateDistanceOfPointToRegionBorder (VectorD point)
 Calculates the distance of a point to the border of this region.
 
 ElementaryRegion2D (bool boundariesAreInside, PhysicalProperty propertyOfCoordinatesX=PhysicalProperty.Length, PhysicalProperty propertyOfCoordinatesY=PhysicalProperty.Length)
 Constructor which gets the _boundariesAreInside flag. To be called from derived classes constructors.
 
 ElementaryRegion2D (ElementaryRegion2D region2bCopied)
 Copy constructor.
 
- Public Member Functions inherited from Region2D
void CalculateAxisAlignedBoundingBox ()
 Method for (re)calculating the axis aligned bounding box.
 
override object Clone ()
 Clones the current object.
 
override bool Equals (object obj, EqualityIntent equalityIntent)
 Equality operation.
 
override int GetHashCode ()
 
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.
 
override FormDocument GetNewDocumentWindow (Form formMain, string fileName)
 Gets a new document window containing this document.
Parameters
formMainReference to the main form (= MDI parent). Can be null if this form will not be shown (e.g. if it is generated just to get the view settings.
fileNameFile name from which the document was opened for inserting into window caption. If this string is empty, the default document name is used.
Returns
A FormDocument containing this document.

 
bool IsInside (double pointX, double pointY)
 Method which checks whether or not a point is inside the 2D region.
 
bool IsInside (VectorD point)
 Method which checks whether or not a point is inside the 2D region.
 
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.
 
 Region2D (bool boundariesAreInside, PhysicalProperty propertyOfCoordinatesX=PhysicalProperty.Length, PhysicalProperty propertyOfCoordinatesY=PhysicalProperty.Length)
 Constructor which gets the _boundariesAreInside flag. To be called from derived classes constructors.
 
 Region2D (Region2D region2bCopied)
 Copy constructor.
 

Static Public Member Functions

static VectorD CalculateCentroid (SimplePolygon polygon)
 Calculates the centroid of a given polygon. Formula taken from Wikipedia.
 
static List< SimplePolygonCalculateIntersectionOfTwoPolygons (SimplePolygon polygon1, SimplePolygon polygon2, bool ignoreVirtualVertices)
 Method for calculating the intersection of two polygons. See ITN.067 for more information.
 
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.
 
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.
 
static ? List<(string nameOfVertex1, string nameOfVertex2, bool criticalX, bool criticalY)> CheckPolygonForCoordinateDifferencesWhichAreNumericalCritical (SimplePolygon polygon)
 Method which checks the vertices of a given SimplePolygon whether or not it contains (neighbored) vertices whose x- or y-coordinates are not identical but so close that numerical problems are probable.
 
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.
 
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.
 
static List<(long index, VectorD point)> ExtendConvexPolygonWithOutlyingPoint (SimplePolygon polygon, List< long > pointIndicesOfPolygonVertices, NamedPolygonVertex singlePoint, long pointIndexOfSinglePoint, out List< TriangulationTriangle2D > newTrianglesForExtension)
 // Calculates the area of a given polygon. Formula taken from Wikipedia. //
 
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).
 
static bool IsSelfIntersecting (VectorD[] vertices, out double areaWithSign)
 Method which checks whether or not a polygon (for the given order of the vertices!) is self intersecting.
 
static bool operator!= (SimplePolygon o1, SimplePolygon o2)
 Unequals operator.
 
static bool operator== (SimplePolygon o1, SimplePolygon o2)
 Equals operator.
 
static SimplePolygon RemoveVirtualVertices (SimplePolygon polygon)
 Method for creating a polygon without virtual vertices from an arbitrary polygon.
 
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.
 
static SimplePolygon Scale (SimplePolygon polygon, double factor)
 Static method for scaling a given polynom while keeping the center of its bounding box. See also the more general method TransformToTargetBox.
 
static SimplePolygon TransformToTargetBox (SimplePolygon polygon, RectanglePhysical targetBoundingBox)
 Static method for transforming a given polygon to another one with defined position and size.
 
static SimplePolygon Translate (SimplePolygon polygon, VectorD translationVector)
 Static method for transforming a given polygon to another one which is translated by a given vector.
 
- Static Public Member Functions inherited from ElementaryRegion2D
static bool operator!= (ElementaryRegion2D o1, ElementaryRegion2D o2)
 Unequals operator.
 
static bool operator== (ElementaryRegion2D o1, ElementaryRegion2D o2)
 Equals operator.
 
- Static Public Member Functions inherited from Region2D
static Region2D InvertRegion (Region2D region2Invert)
 Creates a new region with inverted in / out regions compared to this.
 
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.
 
static bool operator!= (Region2D o1, Region2D o2)
 Unequals operator.
 
static bool operator== (Region2D o1, Region2D o2)
 Equals operator.
 

Public Attributes

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

Static Public Attributes

const string NameOfRectanglesCorner_BL
 Vertex name of the bottom left corner of a rectangle which is represented as SimplePolygon.
 
const string NameOfRectanglesCorner_BR
 Vertex name of the botom right corner of a rectangle which is represented as SimplePolygon.
 
const string NameOfRectanglesCorner_TL
 Vertex name of the top left corner of a rectangle which is represented as SimplePolygon.
 
const string NameOfRectanglesCorner_TR
 Vertex name of the top right corner of a rectangle which is represented as SimplePolygon.
 
const double ThresholdForNumericalCriticalDifference
 Threshold below which a coordinate difference is considered critical. To be used by the method CheckPolygonForCoordinateDifferencesWhichAreNumericalCritical.
 
static List< NamedPolygonVertex > upperChain
 Method which decomposes a suitable polygon into two separate polygonal chains, an upper and a lower one.
 
- 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.
 

Properties

double Area [get]
 Gets the area of the polygon.
 
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
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 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.
 

Events

EventHandler? PolygonChanged
 Event for changed vertices.
 

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/5]

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. The boundaries are regarded as being outside, which you can change with the BoundariesAreInside property.

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/5]

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!)
useOnlyEffectiveVerticesIf true, only effective vertices (instead of all defined vertices) will be used.
Exceptions
System.ArgumentNullException
System.ArgumentExceptionNot enough vertices specified. or Duplicate vertices found.

◆ SimplePolygon() [3/5]

copy constructor of the simple polygon class

Parameters
polygonthe polygon which shall be copied

◆ SimplePolygon() [4/5]

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/5]

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

Parameters
rectangleRectangle to be converted to a polygon.

Member Function Documentation

◆ 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)

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

◆ CalculateInternalAngles()

List< double > CalculateInternalAngles ( )

Method which calculates all internal angles of the polygon.

Returns
A list of all internal angles. Negative values indicate concave vertices.

◆ 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
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.

◆ CheckPolygonForCoordinateDifferencesWhichAreNumericalCritical()

static ? List<(string nameOfVertex1, string nameOfVertex2, bool criticalX, bool criticalY)> CheckPolygonForCoordinateDifferencesWhichAreNumericalCritical ( SimplePolygon polygon)
static

Method which checks the vertices of a given SimplePolygon whether or not it contains (neighbored) vertices whose x- or y-coordinates are not identical but so close that numerical problems are probable.

Parameters
polygonSimplePolygon to check.
Returns
List of tuples of names of vertices whose coordinates are nearly equal in one dimension at least.

◆ Clone()

override object Clone ( )

Deep copy of the object.

Returns
A deep copy of this.

◆ DeserializationPostProcessing()

new void DeserializationPostProcessing ( ref List< System.Reflection.FieldInfo > unfindableFields,
RemainingData remainingData )

Method for doing post-processing after XML deserialization. Especially, handling of fields which have been altered since the version the data were saved with. But also additional operations (like filling caching variables etc.) can be done here.

Parameters
unfindableFieldsList of all those fields which are expected but could not be read from XML.
remainingDataData contained in XML but which haven't been read yet.

◆ 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

◆ ExtendConvexPolygonWithOutlyingPoint()

static List<(long index, VectorD point)> ExtendConvexPolygonWithOutlyingPoint ( SimplePolygon polygon,
List< long > pointIndicesOfPolygonVertices,
NamedPolygonVertex singlePoint,
long pointIndexOfSinglePoint,
out List< TriangulationTriangle2D > newTrianglesForExtension )
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.

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 )

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.

◆ 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 double areaWithSign )
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.
areaWithSignThe area of the polygon. It is signed because the sign informs about the orientation of the polygon.
Returns
true if the polygon is self intersecting.

◆ MayBeNonzeroOutside()

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.

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?

◆ 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 (given in radian).
centerOfRotationThe center to rotate the polygon around.
Returns
The rotated polygon.

◆ Scale()

static SimplePolygon Scale ( SimplePolygon polygon,
double factor )
static

Static method for scaling a given polynom while keeping the center of its bounding box. See also the more general method TransformToTargetBox.

Parameters
polygonPolygon to be transformed.
factorScale factor.
Returns
The scaled polygon. The center of its bounding box is kept constant.

◆ 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.

◆ upperChain

List<NamedPolygonVertex> upperChain
static

Method which decomposes a suitable polygon into two separate polygonal chains, an upper and a lower one.

Parameters
polygonPolygon to be decomposed which is at least monotone in x-direction.
Returns
Two polygonal chains.
Exceptions
ExceptionThrown if more than two vertices are found as left most or right most ones.
ArgumentExceptionThrown if a non-suitable polygon is given (not monotone in x).