Class Polygon2d
Namespace: g3
Assembly: cs.temp.dll.dll
Syntax
public class Polygon2d : IDuplicatable<Polygon2d>
Constructors
Polygon2d()
Declaration
Polygon2d(Polygon2d)
Declaration
public Polygon2d(Polygon2d copy)
Parameters
Polygon2d(Vector2d[])
Declaration
public Polygon2d(Vector2d[] v)
Parameters
Polygon2d(VectorArray2d)
Declaration
public Polygon2d(VectorArray2d v)
Parameters
Polygon2d(IEnumerable<Vector2d>)
Declaration
public Polygon2d(IEnumerable<Vector2d> copy)
Parameters
Polygon2d(IList<Vector2d>)
Declaration
public Polygon2d(IList<Vector2d> copy)
Parameters
Polygon2d(Double[])
Declaration
public Polygon2d(double[] values)
Parameters
Type |
Name |
Description |
Double[] |
values |
|
Polygon2d(Func<Int32, Vector2d>, Int32)
Declaration
public Polygon2d(Func<int, Vector2d> SourceF, int N)
Parameters
Fields
Timestamp
Declaration
Field Value
vertices
Declaration
protected List<Vector2d> vertices
Field Value
Properties
ArcLength
Declaration
public double ArcLength { get; }
Property Value
Area
Declaration
public double Area { get; }
Property Value
AverageEdgeLength
Declaration
public double AverageEdgeLength { get; }
Property Value
Bounds
Declaration
public AxisAlignedBox2d Bounds { get; }
Property Value
IsClockwise
Declaration
public bool IsClockwise { get; }
Property Value
Item[Int32]
Declaration
public Vector2d this[int key] { get; set; }
Parameters
Type |
Name |
Description |
Int32 |
key |
|
Property Value
Perimeter
Declaration
public double Perimeter { get; }
Property Value
SignedArea
Declaration
public double SignedArea { get; }
Property Value
Start
Declaration
public Vector2d Start { get; }
Property Value
VertexCount
Declaration
public int VertexCount { get; }
Property Value
Vertices
Declaration
public ReadOnlyCollection<Vector2d> Vertices { get; }
Property Value
Type |
Description |
ReadOnlyCollection<Vector2d> |
|
Methods
AppendVertex(Vector2d)
Declaration
public void AppendVertex(Vector2d v)
Parameters
AppendVertices(IEnumerable<Vector2d>)
Declaration
public void AppendVertices(IEnumerable<Vector2d> v)
Parameters
Chamfer(Double, Double, Double)
Declaration
public void Chamfer(double chamfer_dist, double minConvexAngleDeg = 30, double minConcaveAngleDeg = 30)
Parameters
Type |
Name |
Description |
Double |
chamfer_dist |
|
Double |
minConvexAngleDeg |
|
Double |
minConcaveAngleDeg |
|
Contains(Polygon2d)
Declaration
public bool Contains(Polygon2d o)
Parameters
Returns
Contains(Segment2d)
Checks that all points on a segment are within the area defined by the Polygon2d.
Declaration
public bool Contains(Segment2d o)
Parameters
Returns
Contains(Vector2d)
Returns true if point inside polygon, using fast winding-number computation
Declaration
public bool Contains(Vector2d P)
Parameters
Returns
DistanceSquared(Vector2d)
Declaration
public double DistanceSquared(Vector2d p)
Parameters
Returns
DistanceSquared(Vector2d, out Int32, out Double)
Declaration
public double DistanceSquared(Vector2d p, out int iNearSeg, out double fNearSegT)
Parameters
Returns
Duplicate()
Declaration
public virtual Polygon2d Duplicate()
Returns
FindIntersections(Polygon2d)
Declaration
public List<Vector2d> FindIntersections(Polygon2d o)
Parameters
Returns
GetBounds()
Declaration
public AxisAlignedBox2d GetBounds()
Returns
GetNormal(Int32)
Normal at vertex i, which is perp to tangent direction, which is not so
intuitive if edges have very different lengths.
Points "inward" for clockwise polygon, outward for counter-clockwise
Declaration
public Vector2d GetNormal(int i)
Parameters
Type |
Name |
Description |
Int32 |
i |
|
Returns
GetNormal(Int32, Double)
Declaration
public Vector2d GetNormal(int iSeg, double segT)
Parameters
Returns
GetNormal_FaceAvg(Int32)
Construct normal at poly vertex by averaging face normals. This is
equivalent (?) to angle-based normal, ie is local/independent of segment lengths.
Points "inward" for clockwise polygon, outward for counter-clockwise
Declaration
public Vector2d GetNormal_FaceAvg(int i)
Parameters
Type |
Name |
Description |
Int32 |
i |
|
Returns
GetTangent(Int32)
Declaration
public Vector2d GetTangent(int i)
Parameters
Type |
Name |
Description |
Int32 |
i |
|
Returns
Intersects(Polygon2d)
Declaration
public bool Intersects(Polygon2d o)
Parameters
Returns
Intersects(Segment2d)
Checks if any point on a segment is within the area defined by the Polygon2d.
Declaration
public bool Intersects(Segment2d o)
Parameters
Returns
MakeCircle(Double, Int32, Double)
Declaration
public static Polygon2d MakeCircle(double fRadius, int nSteps, double angleShiftRad = 0)
Parameters
Returns
MakeRectangle(Vector2d, Double, Double)
Declaration
public static Polygon2d MakeRectangle(Vector2d center, double width, double height)
Parameters
Returns
MinimalBoundingBox(Double)
Return minimal bounding box of vertices, computed to epsilon tolerance
Declaration
public Box2d MinimalBoundingBox(double epsilon)
Parameters
Type |
Name |
Description |
Double |
epsilon |
|
Returns
NeighboursP(Int32, ref Vector2d, ref Vector2d)
Declaration
public void NeighboursP(int iVertex, ref Vector2d p0, ref Vector2d p1)
Parameters
NeighboursV(Int32, ref Vector2d, ref Vector2d, Boolean)
Declaration
public void NeighboursV(int iVertex, ref Vector2d v0, ref Vector2d v1, bool bNormalize = false)
Parameters
OpeningAngleDeg(Int32)
Declaration
public double OpeningAngleDeg(int iVertex)
Parameters
Type |
Name |
Description |
Int32 |
iVertex |
|
Returns
PointAt(Int32, Double)
Declaration
public Vector2d PointAt(int iSegment, double fSegT)
Parameters
Returns
PolyOffset(Double)
offset polygon by fixed distance, by offsetting and intersecting edges.
CCW polygon offsets "outwards", CW "inwards".
Declaration
public void PolyOffset(double dist)
Parameters
Type |
Name |
Description |
Double |
dist |
|
RemoveVertex(Int32)
Declaration
public void RemoveVertex(int idx)
Parameters
Type |
Name |
Description |
Int32 |
idx |
|
Reverse()
Declaration
Rotate(Matrix2d, Vector2d)
Declaration
public Polygon2d Rotate(Matrix2d rotation, Vector2d origin)
Parameters
Returns
Scale(Vector2d, Vector2d)
Declaration
public Polygon2d Scale(Vector2d scale, Vector2d origin)
Parameters
Returns
Segment(Int32)
Declaration
public Segment2d Segment(int iSegment)
Parameters
Type |
Name |
Description |
Int32 |
iSegment |
|
Returns
SegmentItr()
Declaration
public IEnumerable<Segment2d> SegmentItr()
Returns
SetVertices(List<Vector2d>, Boolean)
Declaration
public void SetVertices(List<Vector2d> newVertices, bool bTakeOwnership)
Parameters
Simplify(Double, Double, Boolean)
Declaration
public void Simplify(double clusterTol = 0.0001, double lineDeviationTol = 0.01, bool bSimplifyStraightLines = true)
Parameters
Declaration
public Polygon2d Transform(ITransform2 xform)
Parameters
Returns
Declaration
public Polygon2d Transform(Func<Vector2d, Vector2d> transformF)
Parameters
Returns
Translate(Vector2d)
Declaration
public Polygon2d Translate(Vector2d translate)
Parameters
Type |
Name |
Description |
Vector2d |
translate |
|
Returns
VerticesItr(Boolean)
Declaration
public IEnumerable<Vector2d> VerticesItr(bool bRepeatFirstAtEnd)
Parameters
Type |
Name |
Description |
Boolean |
bRepeatFirstAtEnd |
|
Returns
VtxNormalOffset(Double, Boolean)
Offset each point by dist along vertex normal direction (ie tangent-perp)
CCW polygon offsets "outwards", CW "inwards".
Declaration
public void VtxNormalOffset(double dist, bool bUseFaceAvg = false)
Parameters
WindingIntegral(Vector2d)
Compute winding integral at point P
Declaration
public double WindingIntegral(Vector2d P)
Parameters
Returns
Implements