Aardvark.Base


Polygon2dExtensions

Static members

Static memberDescription
ComputeArea(polygon)
Signature: polygon:Polygon2d -> float

Computes the area of the polygon according to "Fast Polygon Area and Newell Normal Computation" journal of graphics tools, 7(2):9-13, 2002. The absolute value is returned (i.e. area >= 0.0).

ComputeCentroid(polygon)
Signature: polygon:Polygon2d -> V2d

The geometric center of the polygon.

ComputeConvexHullIndexPolygon(polygon)
Signature: polygon:Polygon2d -> IndexPolygon2d

Returns convex hull of this polygon.

ComputeMinAreaEnclosingBoxRotation(...)
Signature: (polygon:Polygon2d * epsilon:float) -> M22d

Returns the rotation of the supplied counter clockwise enumerated convex polygon that results in the minimum area enclosing box. If multiple rotations are within epsilon in their area, the one that is closest to an axis-aligned rotation (0, 90, 180, 270) is returned. O(n).

ComputeOrientedBoundingBox(polygon)
Signature: polygon:Polygon2d -> Polygon2d

Gets oriented bounding box of this polygon

ComputePerimeter(polygon)
Signature: polygon:Polygon2d -> float
ComputeSignedArea(polygon)
Signature: polygon:Polygon2d -> float

Computes the area of the polygon according to "Fast Polygon Area and Newell Normal Computation" journal of graphics tools, 7(2):9-13, 2002

ComputeVertexCentroid(polygon)
Signature: polygon:Polygon2d -> V2d

The vertex centroid is the average of the vertex coordinates.

ComputeWindingNumber(polygon)
Signature: polygon:Polygon2d -> int

Computes the winding number of the polyon. The winding number is positive for counter- clockwise polygons, negative for clockwise polygons.

ConvexClipped(polygon, line, eps)
Signature: (polygon:Polygon2d * line:Plane2d * eps:float) -> Polygon2d

Clip the supplied polygon at the supplied line. The method should work with all non-selfintersecting polygons.

ConvexClipped(polygon, lines, eps)
Signature: (polygon:Polygon2d * lines:Plane2d [] * eps:float) -> Polygon2d

Returns the convex polygon clipped by the set of lines (defined as Plane2ds).

ConvexClipped(polygon, hull, eps)
Signature: (polygon:Polygon2d * hull:Hull2d * eps:float) -> Polygon2d

Returns the polygon clipped by the hull, i.e. all parts of the polygon that are at the positive side of the hull lines.

ConvexClipped(polygon, box, eps)
Signature: (polygon:Polygon2d * box:Box2d * eps:float) -> Polygon2d

TODO summary.

HasSelfIntersections(...)
Signature: (poly:Polygon2d * absoluteEpsilon:float) -> int

Returns: 1 if the Polygon created by poly has no self-intersections 0 if one point of the polygon lies close to a line (absoluteEpsilon) -1 if the Polygon created by poly has a real self-intersection

HasWinding(polygon, winding)
Signature: (polygon:Polygon2d * winding:Winding) -> bool

Check if a polygon has a specified winding.

IsCcw(polygon)
Signature: polygon:Polygon2d -> bool

Returns true if polygon points are oriented in counter-clockwise order.

IsConcave(polygon)
Signature: polygon:Polygon2d -> bool
IsConvex(polygon)
Signature: polygon:Polygon2d -> bool
IsFullyContainedInside(self, other)
Signature: (self:Polygon2d * other:Polygon2d) -> bool

Returns true if the 'other' polygon is fully contained inside this polygon.

MinDistanceTo(polygon, polygon1)
Signature: (polygon:Polygon2d * polygon1:Polygon2d) -> float

Returns the minimal distance between the polygon and the other supplied polygon. O(n).

MinDistanceTo(...)
Signature: (polygon:Polygon2d * polygon1:Polygon2d * pi0:byref<int> * pi1:byref<int> * lineOnThis:byref<bool>) -> float

Returns the minimal distance between the polygon and the non- overlapping other supplied polygon. The minimal distance is always computed as the distance between a line segment and a point. The indices of the minimal distance configuration are returned in the out parameter, as the indices of points on the two polygons, and wether the line segement was on this or the other polygon. O(n). The returned index of the line segment is the lower point index (except in case of wraparound).

RasterizeAsLabels(...)
Signature: (polygons:IEnumerable<Polygon2d> * resolution:V2i * bb:Box2d) -> Matrix<int>

Rasterizes an array of polygons into a matrix of given size. First polygon is rasterized with label 1, second polygon with label 2, and so on.

RasterizePolygon(...)
Signature: (polygon:Polygon2d * intoMatrix:Matrix<int> * value:int) -> unit

Rasterizes this polygon into a given matrix using the given value (label).

Scaled(polygon, scale)
Signature: (polygon:Polygon2d * scale:float) -> Polygon2d
Scaled(polygon, center, scale)
Signature: (polygon:Polygon2d * center:V2d * scale:float) -> Polygon2d
Scaled(polygon, scale)
Signature: (polygon:Polygon2d * scale:V2d) -> Polygon2d
Scaled(polygon, center, scale)
Signature: (polygon:Polygon2d * center:V2d * scale:V2d) -> Polygon2d
ScaledAboutVertexCentroid(...)
Signature: (polygon:Polygon2d * scale:float) -> Polygon2d
ScaledAboutVertexCentroid(...)
Signature: (polygon:Polygon2d * scale:V2d) -> Polygon2d
ToPolygon3d(polygon, point_copyFun)
Signature: (polygon:Polygon2d * point_copyFun:Func<V2d,V3d>) -> Polygon3d
ToPolygon3d(...)
Signature: (polygon:Polygon2d * point_index_copyFun:Func<V2d,int,V3d>) -> Polygon3d
Transformed(polygon, m)
Signature: (polygon:Polygon2d * m:M22d) -> Polygon2d
Transformed(polygon, m)
Signature: (polygon:Polygon2d * m:M33d) -> Polygon2d
WithoutMultiplePoints(polygon, eps)
Signature: (polygon:Polygon2d * eps:float) -> Polygon2d
Fork me on GitHub