Show / Hide Table of Contents

    Class Polygon

    A closed planar polygon. Parameterization of the curve is 0->n-1 where n is the number of vertices..

    Examples
    // Create a polygon.
    var star = Polygon.Star(5, 3, 5);
    
    Inheritance
    System.Object
    Curve
    BoundedCurve
    IndexedPolycurve
    Polyline
    Polygon
    Implements
    ICurve
    ITransformable<Curve>
    IBoundedCurve
    System.Collections.Generic.IEnumerable<BoundedCurve>
    System.Collections.IEnumerable
    System.IEquatable<IndexedPolycurve>
    Inherited Members
    Polyline.TransformAt(Double)
    Polyline.TransformedPolyline(Transform)
    Polyline.TransformSegment(Transform, Int32, Boolean, Boolean)
    Polyline.CreateMiterTransform(Int32, Vector3, Vector3)
    Polyline.OffsetOnSide(Double, Boolean)
    Polyline.OffsetOpen(Double)
    Polyline.OffsetWithAcuteAngle(Double)
    Polyline.SharedSegments(Polyline, Polyline, Boolean)
    Polyline.Split(IList<Vector3>, Boolean)
    Polyline.GetParameterAt(Vector3)
    Polyline.Intersects(Line, List<Vector3>, Boolean, Boolean)
    Polyline.Intersects(Polygon, List<Polyline>)
    Polyline.GetSubsegment(Vector3, Vector3)
    Polyline.ForceAngleCompliance(IEnumerable<Double>, Vector3, Double, NormalizationType)
    Polyline.ForceAngleCompliance(IEnumerable<Double>, Vector3, NormalizationType)
    IndexedPolycurve.Start
    IndexedPolycurve.CurveIndices
    IndexedPolycurve.Vertices
    IndexedPolycurve.Bounds()
    IndexedPolycurve.GetSubdivisionParameters(Double, Double)
    IndexedPolycurve.ArcLength(Double, Double)
    IndexedPolycurve.ParameterAtDistanceFromParameter(Double, Double)
    IndexedPolycurve.PointAt(Double)
    IndexedPolycurve.PointAtInternal(Double, Int32)
    IndexedPolycurve.TransformedPolycurve(Transform)
    IndexedPolycurve.Equals(IndexedPolycurve)
    IndexedPolycurve.ToPolygon()
    IndexedPolycurve.CheckCoincidenceAndThrow(IList<Vector3>)
    IndexedPolycurve.GetEnumerator()
    IndexedPolycurve.IEnumerable.GetEnumerator()
    BoundedCurve.DefaultMinimumChordLength
    BoundedCurve.Mid()
    BoundedCurve.ToPolyline(Int32)
    BoundedCurve.PointAtNormalized(Double)
    BoundedCurve.TransformAtNormalized(Double)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Elements.Geometry
    Assembly: Hypar.Elements.dll
    Syntax
    public class Polygon : Polyline, ICurve, ITransformable<Curve>, IBoundedCurve, IEnumerable<BoundedCurve>, IEnumerable, IEquatable<IndexedPolycurve>

    Constructors

    Polygon(Vector3[])

    Construct a polygon from points. This is a convenience constructor that can be used like this: new Polygon((0,0,0), (10,0,0), (10,10,0))

    Declaration
    public Polygon(params Vector3[] vertices)
    Parameters
    Type Name Description
    Vector3[] vertices

    The vertices of the polygon.

    Polygon(Boolean, Vector3[])

    Construct a polygon from points.

    Declaration
    public Polygon(bool disableValidation, params Vector3[] vertices)
    Parameters
    Type Name Description
    System.Boolean disableValidation

    Should self-intersection testing be disabled?

    Vector3[] vertices

    The vertices of the polygon.

    Polygon(IList<Vector3>)

    Construct a polygon.

    Declaration
    [JsonConstructor]
    public Polygon(IList<Vector3> vertices)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<Vector3> vertices

    A collection of vertex locations.

    Polygon(IList<Vector3>, Boolean)

    Construct a polygon.

    Declaration
    public Polygon(IList<Vector3> vertices, bool disableValidation = false)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<Vector3> vertices

    A collection of vertex locations.

    System.Boolean disableValidation

    Should self-intersection testing be disabled?

    Properties

    Domain

    The domain of the curve.

    Declaration
    [JsonIgnore]
    public override Domain1d Domain { get; }
    Property Value
    Type Description
    Domain1d
    Overrides
    Polyline.Domain

    End

    The end of the polyline.

    Declaration
    [JsonIgnore]
    public override Vector3 End { get; }
    Property Value
    Type Description
    Vector3
    Overrides
    IndexedPolycurve.End

    IsClosedForRendering

    Should the curve be considered closed for rendering?

    Declaration
    public override bool IsClosedForRendering { get; }
    Property Value
    Type Description
    System.Boolean
    Overrides
    BoundedCurve.IsClosedForRendering

    Methods

    Area(Boolean)

    Calculate the polygon's area in 3D.

    Declaration
    public double Area(bool signed = false)
    Parameters
    Type Name Description
    System.Boolean signed

    When true will return a signed area, counter-clockwise polygons will yield a positive area, while clockwise polygons will yield a negative area.

    Returns
    Type Description
    System.Double

    A double representing the signed or absolute value of this Polygon's area.

    Center()

    Calculate the center of the polygon as the average of vertices.

    Declaration
    public Vector3 Center()
    Returns
    Type Description
    Vector3

    Centroid()

    Calculate the centroid of the polygon.

    Declaration
    public Vector3 Centroid()
    Returns
    Type Description
    Vector3

    Circle(Double, Int32)

    Create a circle.

    Declaration
    [Obsolete("Please use Elements.Geometry.Circle.ToPolygon() instead.")]
    public static Polygon Circle(double radius = 1, int divisions = 10)
    Parameters
    Type Name Description
    System.Double radius

    The radius of the circle.

    System.Int32 divisions

    The number of divisions of the circle.

    Returns
    Type Description
    Polygon

    A circle as a Polygon tessellated into the specified number of divisions.

    CollinearPointsRemoved(Double)

    Remove collinear points from this Polygon.

    Declaration
    public Polygon CollinearPointsRemoved(double tolerance = 1E-05)
    Parameters
    Type Name Description
    System.Double tolerance
    Returns
    Type Description
    Polygon

    New Polygon without collinear points.

    Contains(Polygon)

    Tests if the supplied Polygon is within this Polygon without coincident edges when compared on a shared plane.

    Declaration
    public bool Contains(Polygon polygon)
    Parameters
    Type Name Description
    Polygon polygon

    The Polygon to compare to this Polygon.

    Returns
    Type Description
    System.Boolean

    Returns true if every vertex of the supplied Polygon is within this Polygon when compared on a shared plane. Returns false if the supplied Polygon is not entirely within this Polygon, or if the supplied Polygon is null.

    Contains(Vector3)

    Tests if the supplied Vector3 is within this Polygon in 3D without coincidence with an edge or vertex when compared on a shared plane.

    Declaration
    public bool Contains(Vector3 point)
    Parameters
    Type Name Description
    Vector3 point

    The point to compare to this polygon.

    Returns
    Type Description
    System.Boolean

    Returns true if the supplied point is within this polygon when compared on a shared plane.

    Contains(Vector3, out Containment)

    Tests if the supplied point is within this polygon in 3D, using a 2D method.

    Declaration
    public bool Contains(Vector3 point, out Containment containment)
    Parameters
    Type Name Description
    Vector3 point

    The point to compare to this polygon.

    Containment containment

    Whether the point is inside, outside, at an edge, or at a vertex.

    Returns
    Type Description
    System.Boolean

    Returns true if the supplied point is within this polygon when compared on a shared plane.

    Contains3D(Polygon, out Containment)

    Tests if the supplied polygon is within this Polygon or coincident with an edge.

    Declaration
    public bool Contains3D(Polygon polygon, out Containment containment)
    Parameters
    Type Name Description
    Polygon polygon

    The polygon we want to know is inside this polygon.

    Containment containment

    The containment status.

    Returns
    Type Description
    System.Boolean

    Returns false if any part of the polygon is entirely outside of this polygon.

    Covers(Polygon)

    Tests if the supplied Polygon is within this Polygon with or without edge coincident vertices when compared on a shared plane.

    Declaration
    public bool Covers(Polygon polygon)
    Parameters
    Type Name Description
    Polygon polygon

    The Polygon to compare to this Polygon.

    Returns
    Type Description
    System.Boolean

    Returns true if every edge of the provided polygon is on or within this polygon when compared on a shared plane. Returns false if any edge of the supplied Polygon is outside this Polygon, or if the supplied Polygon is null.

    Covers(Vector3)

    Tests if the supplied Vector3 is within this Polygon or coincident with an edge when compared on the XY plane.

    Declaration
    public bool Covers(Vector3 vector)
    Parameters
    Type Name Description
    Vector3 vector

    The Vector3 to compare to this Polygon.

    Returns
    Type Description
    System.Boolean

    Returns true if the supplied Vector3 is within this Polygon or coincident with an edge when compared in the XY shared plane. Returns false if the supplied Vector3 is outside this Polygon, or if the supplied Vector3 is null.

    Difference(Polygon, Double)

    Constructs the geometric difference between this Polygon and the supplied Polygon.

    Declaration
    public IList<Polygon> Difference(Polygon polygon, double tolerance = 1E-05)
    Parameters
    Type Name Description
    Polygon polygon

    The intersecting Polygon.

    System.Double tolerance

    An optional tolerance value.

    Returns
    Type Description
    System.Collections.Generic.IList<Polygon>

    Returns a list of Polygons representing the subtraction of the supplied Polygon from this Polygon. Returns null if the area of this Polygon is entirely subtracted. Returns a list containing a representation of the perimeter of this Polygon if the two Polygons do not intersect.

    Difference(Polygon[])

    Constructs the geometric difference between this Polygon and one or more supplied Polygons, using the default tolerance.

    Declaration
    public IList<Polygon> Difference(params Polygon[] polygons)
    Parameters
    Type Name Description
    Polygon[] polygons

    The intersecting Polygons.

    Returns
    Type Description
    System.Collections.Generic.IList<Polygon>

    Returns a list of Polygons representing the subtraction of the supplied Polygons from this Polygon. Returns null if the area of this Polygon is entirely subtracted. Returns a list containing a representation of the perimeter of this Polygon if the Polygons do not intersect.

    Difference(IList<Polygon>, IList<Polygon>, Double)

    Constructs the geometric difference between two sets of polygons.

    Declaration
    public static IList<Polygon> Difference(IList<Polygon> firstSet, IList<Polygon> secondSet, double tolerance = 1E-05)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<Polygon> firstSet

    First set of polygons

    System.Collections.Generic.IList<Polygon> secondSet

    Second set of polygons

    System.Double tolerance

    An optional tolerance.

    Returns
    Type Description
    System.Collections.Generic.IList<Polygon>

    Returns a list of Polygons representing the subtraction of the second set of polygons from the first set.

    Difference(IList<Polygon>, Double)

    Constructs the geometric difference between this Polygon and the supplied Polygons.

    Declaration
    public IList<Polygon> Difference(IList<Polygon> difPolys, double tolerance = 1E-05)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<Polygon> difPolys

    The list of intersecting Polygons.

    System.Double tolerance

    An optional tolerance value.

    Returns
    Type Description
    System.Collections.Generic.IList<Polygon>

    Returns a list of Polygons representing the subtraction of the supplied Polygons from this Polygon. Returns null if the area of this Polygon is entirely subtracted. Returns a list containing a representation of the perimeter of this Polygon if the two Polygons do not intersect.

    Disjoint(Polygon)

    Tests if the supplied Polygon and this Polygon are coincident in any way when compared on a shared plane.

    Declaration
    public bool Disjoint(Polygon polygon)
    Parameters
    Type Name Description
    Polygon polygon

    The Polygon to compare to this Polygon.

    Returns
    Type Description
    System.Boolean

    Returns true if the supplied Polygon do not intersect or touch this Polygon when compared on a shared plane or if the supplied Polygon is null.

    Disjoint(Vector3)

    Tests if the supplied Vector3 is outside this Polygon when compared on a shared plane.

    Declaration
    public bool Disjoint(Vector3 vector)
    Parameters
    Type Name Description
    Vector3 vector

    The Vector3 to compare to this Polygon.

    Returns
    Type Description
    System.Boolean

    Returns true if the supplied Vector3 is outside this Polygon when compared on a shared plane or if the supplied Vector3 is null.

    Equals(Object)

    Is this polygon equal to the provided polygon?

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj
    Returns
    Type Description
    System.Boolean
    Overrides
    System.Object.Equals(System.Object)

    Fillet(Double)

    Fillet all corners on this polygon.

    Declaration
    public IndexedPolycurve Fillet(double radius)
    Parameters
    Type Name Description
    System.Double radius

    The fillet radius.

    Returns
    Type Description
    IndexedPolycurve

    A contour containing trimmed edge segments and fillets.

    Frames(Double, Double, Double)

    Get a collection of Transforms which represent frames along this curve.

    Declaration
    public override Transform[] Frames(double startSetback = 0, double endSetback = 0, double additionalRotation = 0)
    Parameters
    Type Name Description
    System.Double startSetback
    System.Double endSetback
    System.Double additionalRotation

    An additional rotation of the frame at each point.

    Returns
    Type Description
    Transform[]

    A collection of Transforms.

    Overrides
    Polyline.Frames(Double, Double, Double)

    FromAlignedBoundingBox2d(IEnumerable<Vector3>)

    Find the minimum-area rotated rectangle containing a set of points, calculated without regard for Z coordinate.

    Declaration
    public static Polygon FromAlignedBoundingBox2d(IEnumerable<Vector3> points)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<Vector3> points

    The points to contain within the rectangle

    Returns
    Type Description
    Polygon

    A rectangular polygon that contains all input points

    FromAlignedBoundingBox2d(IEnumerable<Vector3>, Vector3, Double)

    Find the rectangle along axis containing a set of points, calculated without regard for Z coordinate, located at the height of points minimum Z coordinate.

    Declaration
    public static Polygon FromAlignedBoundingBox2d(IEnumerable<Vector3> points, Vector3 axis, double minSideSize = 0.1)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<Vector3> points

    The points to contain within the rectangle.

    Vector3 axis

    The axis along which the rectangle is built. Must be a non-zero vector.

    System.Double minSideSize

    The minimum size of a side of a polygon when all points lie on the same line and polygon cannot be constructed. Must be greater than 0.

    Returns
    Type Description
    Polygon

    GetHashCode()

    Get the hash code for the polygon.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    System.Object.GetHashCode()

    Intersection(Polygon, Double)

    Constructs the Polygon intersections between this Polygon and the supplied Polygon.

    Declaration
    public IList<Polygon> Intersection(Polygon polygon, double tolerance = 1E-05)
    Parameters
    Type Name Description
    Polygon polygon

    The intersecting Polygon.

    System.Double tolerance

    An optional tolerance.

    Returns
    Type Description
    System.Collections.Generic.IList<Polygon>

    Returns a list of Polygons representing the intersection of this Polygon with the supplied Polygon. Returns null if the two Polygons do not intersect.

    Intersection(IList<Polygon>, IList<Polygon>, Double)

    Constructs the Polygon intersections between two sets of polygons.

    Declaration
    public static IList<Polygon> Intersection(IList<Polygon> firstSet, IList<Polygon> secondSet, double tolerance = 1E-05)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<Polygon> firstSet

    First set of polygons

    System.Collections.Generic.IList<Polygon> secondSet

    Second set of polygons

    System.Double tolerance

    An optional tolerance.

    Returns
    Type Description
    System.Collections.Generic.IList<Polygon>

    Returns a list of Polygons representing the intersection of the first set of Polygons with the second set. Returns null if the Polygons do not intersect.

    Intersects(Plane, out List<Vector3>, Boolean, Boolean)

    Does this polygon intersect the provided plane?

    Declaration
    public bool Intersects(Plane plane, out List<Vector3> results, bool distinct = true, bool sort = true)
    Parameters
    Type Name Description
    Plane plane

    The intersection plane.

    System.Collections.Generic.List<Vector3> results

    A collection of intersection results sorted along the plane.

    System.Boolean distinct

    Should the intersection results that are returned be distinct?

    System.Boolean sort

    Should the intersection results be sorted along the plane?

    Returns
    Type Description
    System.Boolean

    True if the plane intersects the polygon, otherwise false.

    Intersects(Polygon)

    Tests if the supplied Polygon shares one or more areas with this Polygon when compared on a shared plane.

    Declaration
    public bool Intersects(Polygon polygon)
    Parameters
    Type Name Description
    Polygon polygon

    The Polygon to compare with this Polygon.

    Returns
    Type Description
    System.Boolean

    Returns true if the supplied Polygon shares one or more areas with this Polygon when compared on a shared plane. Returns false if the supplied Polygon does not share an area with this Polygon or if the supplied Polygon is null.

    IsAlmostEqualTo(Polygon, Double, Boolean)

    Test if this polygon has the same vertex count and shape as another, within tolerance.

    Declaration
    public bool IsAlmostEqualTo(Polygon other, double tolerance = 1E-05, bool ignoreWinding = false)
    Parameters
    Type Name Description
    Polygon other

    The other polygon.

    System.Double tolerance

    The optional tolerance value to use. If not supplied, the global tolerance will be used.

    System.Boolean ignoreWinding

    If true, polygons with opposite winding will be considered as equal.

    Returns
    Type Description
    System.Boolean

    IsClockWise()

    Calculates whether this polygon is configured clockwise. This method only works for 2D polygons. For 3D polygons, you will need to transform your polygon into the XY plane, then run this method on that polygon.

    Declaration
    public bool IsClockWise()
    Returns
    Type Description
    System.Boolean

    True if this polygon is oriented clockwise.

    L(Double, Double, Double)

    Create an L.

    Declaration
    public static Polygon L(double width, double length, double thickness)
    Parameters
    Type Name Description
    System.Double width

    The width of the L.

    System.Double length

    The length of the L.

    System.Double thickness

    The thickness of the L.

    Returns
    Type Description
    Polygon

    An L shaped polygon with the origin at the outer corner of the bend in the L.

    Length()

    Calculate the length of the polygon.

    Declaration
    public override double Length()
    Returns
    Type Description
    System.Double
    Overrides
    Polyline.Length()

    Ngon(Int32, Double)

    Create an ngon.

    Declaration
    public static Polygon Ngon(int sides, double radius = 0.5)
    Parameters
    Type Name Description
    System.Int32 sides

    The number of side of the Polygon.

    System.Double radius

    The radius of the circle in which the Ngon is inscribed.

    Returns
    Type Description
    Polygon

    A Polygon with the specified number of sides.

    Normal()

    The normal of this polygon, according to Newell's Method.

    Declaration
    public Vector3 Normal()
    Returns
    Type Description
    Vector3

    The unitized sum of the cross products of each pair of edges.

    NormalsAtVertices()

    Get the normal of each vertex on the polygon.

    Declaration
    protected override Vector3[] NormalsAtVertices()
    Returns
    Type Description
    Vector3[]

    A collection of unit vectors, each corresponding to a single vertex.

    Overrides
    Polyline.NormalsAtVertices()
    Remarks

    All normals will be the same since polygons are coplanar by definition.

    Offset(Double, EndType, Double)

    Offset this polygon by the specified amount.

    Declaration
    public override Polygon[] Offset(double offset, EndType endType = EndType.ClosedPolygon, double tolerance = 1E-05)
    Parameters
    Type Name Description
    System.Double offset

    The amount to offset.

    EndType endType

    The type of closure used for the offset polygon.

    System.Double tolerance

    An optional tolerance.

    Returns
    Type Description
    Polygon[]

    A new Polygon offset by offset.

    Overrides
    Polyline.Offset(Double, EndType, Double)

    Plane()

    Compute the plane of the Polygon.

    Declaration
    public override Plane Plane()
    Returns
    Type Description
    Plane

    A Plane.

    Overrides
    Polyline.Plane()

    PointInternal()

    Find a point that is guaranteed to be internal to the polygon.

    Declaration
    public Vector3 PointInternal()
    Returns
    Type Description
    Vector3

    Project(Plane)

    Project this polygon onto the plane.

    Declaration
    public Polygon Project(Plane plane)
    Parameters
    Type Name Description
    Plane plane

    The plane of the returned polygon.

    Returns
    Type Description
    Polygon

    ProjectAlong(Vector3, Plane)

    Project this Polygon onto a Plane along a vector.

    Declaration
    public Polygon ProjectAlong(Vector3 direction, Plane p)
    Parameters
    Type Name Description
    Vector3 direction

    The projection vector.

    Plane p

    The Plane onto which to project the Polygon.

    Returns
    Type Description
    Polygon

    A Polygon projected onto the Plane.

    Rectangle(Vector3, Vector3, Plane, Nullable<Vector3>)

    Create a rectangle.

    Declaration
    public static Polygon Rectangle(Vector3 min, Vector3 max, Plane plane, Vector3? alignment = null)
    Parameters
    Type Name Description
    Vector3 min

    The minimum coordinate.

    Vector3 max

    The maximum coordinate.

    Plane plane

    The plane to project the rectangle on.

    System.Nullable<Vector3> alignment

    The alignment reference to construct the rectangle from.

    Returns
    Type Description
    Polygon

    A rectangular Polygon with its lower left corner projected from min and its upper right corner projected from max onto a plane with a sided alignment.

    Rectangle(Vector3, Vector3, Transform)

    Create a rectangle.

    Declaration
    public static Polygon Rectangle(Vector3 min, Vector3 max, Transform transform = null)
    Parameters
    Type Name Description
    Vector3 min

    The minimum coordinate.

    Vector3 max

    The maximum coordinate.

    Transform transform

    The transform reference to construct the rectangle from.

    Returns
    Type Description
    Polygon

    A rectangular Polygon with its lower left corner projected from min and its upper right corner projected from max onto a transform.

    Rectangle(Double, Double, Plane)

    Create a rectangle.

    Declaration
    public static Polygon Rectangle(double width, double height, Plane plane = null)
    Parameters
    Type Name Description
    System.Double width

    The width of the rectangle.

    System.Double height

    The height of the rectangle.

    Plane plane

    The plane to draw the rectangle on.

    Returns
    Type Description
    Polygon

    A rectangular Polygon centered around origin.

    RemoveVerticesNearCurve(Curve, out List<Vector3>, Double)

    Trim vertices from a polygon that lie near a given curve.

    Declaration
    public Polygon RemoveVerticesNearCurve(Curve curve, out List<Vector3> removed, double tolerance = 1E-05)
    Parameters
    Type Name Description
    Curve curve

    The curve used to trim the polygon

    System.Collections.Generic.List<Vector3> removed

    The vertices that were removed.

    System.Double tolerance

    Optional tolerance value.

    Returns
    Type Description
    Polygon

    Reversed()

    Reverse the direction of a polygon.

    Declaration
    public Polygon Reversed()
    Returns
    Type Description
    Polygon

    Returns a new Polygon whose vertices are reversed.

    Segments()

    Get a collection a line segments which connect the vertices of this polyline.

    Declaration
    public override Line[] Segments()
    Returns
    Type Description
    Line[]

    A collection of Lines.

    Overrides
    Polyline.Segments()

    Split(Polyline[])

    Split this polygon with one or more open polylines.

    Declaration
    public List<Polygon> Split(params Polyline[] polylines)
    Parameters
    Type Name Description
    Polyline[] polylines

    The polylines with which to split.

    Returns
    Type Description
    System.Collections.Generic.List<Polygon>

    Split(IEnumerable<Polyline>)

    Split this polygon with a collection of open polylines.

    Declaration
    public List<Polygon> Split(IEnumerable<Polyline> polylines)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<Polyline> polylines

    The polylines with which to split.

    Returns
    Type Description
    System.Collections.Generic.List<Polygon>

    Split(IList<Vector3>)

    Insert a point into the polygon if it lies along one of the polyline's segments.

    Declaration
    public override void Split(IList<Vector3> points)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<Vector3> points

    The points at which to split the polygon.

    Overrides
    Polyline.Split(IList<Vector3>)

    Star(Double, Double, Int32)

    Create a star.

    Declaration
    public static Polygon Star(double outerRadius, double innerRadius, int points)
    Parameters
    Type Name Description
    System.Double outerRadius

    The outer radius.

    System.Double innerRadius

    The inner radius.

    System.Int32 points

    The number of points.

    Returns
    Type Description
    Polygon

    A star shaped polygon with the specified number of points along the outer radius and their compliment along the inner radius.

    ToString()

    The string representation of the Polygon.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    A string containing the string representations of this Polygon's vertices.

    Overrides
    IndexedPolycurve.ToString()

    ToTransform()

    Construct a transform in the plane of this polygon, with its Z axis along the polygon's normal.

    Declaration
    public Transform ToTransform()
    Returns
    Type Description
    Transform

    Touches(Polygon, Double)

    Tests if at least one point of an edge of the supplied Polygon is shared with an edge of this Polygon without the Polygons interesecting when compared on a shared plane.

    Declaration
    public bool Touches(Polygon polygon, double tolerance = 1E-05)
    Parameters
    Type Name Description
    Polygon polygon

    The Polygon to compare to this Polygon.

    System.Double tolerance

    An optional tolerance.

    Returns
    Type Description
    System.Boolean

    Returns true if the supplied Polygon shares at least one edge point with this Polygon without the Polygons intersecting when compared on a shared plane. Returns false if the Polygons intersect, are disjoint, or if the supplied Polygon is null.

    Touches(Vector3, Double)

    Tests if the supplied Vector3 is coincident with an edge of this Polygon when compared on a shared plane.

    Declaration
    public bool Touches(Vector3 vector, double tolerance = 1E-05)
    Parameters
    Type Name Description
    Vector3 vector

    The Vector3 to compare to this Polygon.

    System.Double tolerance

    An optional tolerance.

    Returns
    Type Description
    System.Boolean

    Returns true if the supplied Vector3 coincides with an edge of this Polygon when compared on a shared plane. Returns false if the supplied Vector3 is not coincident with an edge of this Polygon, or if the supplied Vector3 is null.

    Transform(Transform)

    Transform this polygon in place.

    Declaration
    public void Transform(Transform t)
    Parameters
    Type Name Description
    Transform t

    The transform.

    Transformed(Transform)

    Create a transformed copy of this curve. Use of non-affine transforms (i.e. scale) will result in unpredictable results for curve methods such as Length().

    Declaration
    public override Curve Transformed(Transform transform)
    Parameters
    Type Name Description
    Transform transform

    The transform to apply.

    Returns
    Type Description
    Curve
    Overrides
    Polyline.Transformed(Transform)

    TransformedPolygon(Transform)

    Construct a transformed copy of this Polygon.

    Declaration
    public Polygon TransformedPolygon(Transform transform)
    Parameters
    Type Name Description
    Transform transform

    The transform to apply.

    Returns
    Type Description
    Polygon

    TransformSegment(Transform, Int32)

    Transform a specified segment of this polygon in place.

    Declaration
    public void TransformSegment(Transform t, int i)
    Parameters
    Type Name Description
    Transform t

    The transform. If it is not within the polygon plane, then an exception will be thrown.

    System.Int32 i

    The segment to transform. If it does not exist, then no work will be done.

    Trimmed(Plane, Boolean)

    Trim the polygon with a plane. Everything on the "back" side of the plane will be trimmed.

    Declaration
    public List<Polygon> Trimmed(Plane plane, bool flip = false)
    Parameters
    Type Name Description
    Plane plane

    The trimming plane.

    System.Boolean flip

    Should the plane be flipped?

    Returns
    Type Description
    System.Collections.Generic.List<Polygon>

    A collection of new polygons, trimmed by the plane, or null if no trimming occurred.

    TrimmedTo(IList<Polygon>, LocalClassification)

    Trim the polygon with a collection of polygons that intersect it in 3d. Portions of the intersected polygon on the "outside" (normal-facing side) of the trimming polygons will remain. Portions inside the trimming polygons will be discarded.

    Declaration
    public List<Polygon> TrimmedTo(IList<Polygon> polygons, LocalClassification inOut = LocalClassification.Outside)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<Polygon> polygons

    The trimming polygons.

    LocalClassification inOut

    A classification indicating which trim area should be returned.

    Returns
    Type Description
    System.Collections.Generic.List<Polygon>

    A collection of polygons resulting from the trim or null if no trim occurred.

    TrimmedTo(IList<Polygon>, out List<Vector3>, out List<(Vector3 from, Vector3 to, Nullable<Int32> index)>, LocalClassification)

    Trim the polygon with a collection of polygons that intersect it in 3d. Portions of the intersected polygon on the "outside" (normal-facing side) of the trimming polygons will remain. Portions inside the trimming polygons will be discarded.

    Declaration
    public List<Polygon> TrimmedTo(IList<Polygon> polygons, out List<Vector3> intersections, out List<(Vector3 from, Vector3 to, int? index)> trimEdges, LocalClassification inOut = LocalClassification.Outside)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<Polygon> polygons

    The trimming polygons.

    System.Collections.Generic.List<Vector3> intersections

    A collection of intersection locations.

    System.Collections.Generic.List<System.ValueTuple<Vector3, Vector3, System.Nullable<System.Int32>>> trimEdges

    A collection of vertex pairs representing all edges in the timming graph.

    LocalClassification inOut

    A classification indicating which trim area should be returned.

    Returns
    Type Description
    System.Collections.Generic.List<Polygon>

    A collection of polygons resulting from the trim or null if no trim occurred.

    U(Double, Double, Double)

    Create a U.

    Declaration
    public static Polygon U(double width, double length, double thickness)
    Parameters
    Type Name Description
    System.Double width

    The width of the U.

    System.Double length

    The length of the U.

    System.Double thickness

    The thickness of the U.

    Returns
    Type Description
    Polygon

    A U shaped polygon with the origin at the center of the inside bend of the U.

    Union(Polygon, Double)

    Constructs the geometric union between this Polygon and the supplied Polygon.

    Declaration
    public Polygon Union(Polygon polygon, double tolerance = 1E-05)
    Parameters
    Type Name Description
    Polygon polygon

    The Polygon to be combined with this Polygon.

    System.Double tolerance

    An optional tolerance.

    Returns
    Type Description
    Polygon

    Returns a single Polygon from a successful union. Returns null if a union cannot be performed on the two Polygons.

    Union(Polygon[])

    Constructs the geometric union between this Polygon and one or more supplied polygons, using the default tolerance.

    Declaration
    public Polygon Union(params Polygon[] polygons)
    Parameters
    Type Name Description
    Polygon[] polygons

    The Polygons to be combined with this Polygon.

    Returns
    Type Description
    Polygon

    Returns a single Polygon from a successful union. Returns null if a union cannot be performed on the complete list of Polygons.

    Union(IList<Polygon>, IList<Polygon>, Double)

    Constructs the geometric union of two sets of polygons.

    Declaration
    [Obsolete("Please use UnionAll, which takes a single list of polygons.")]
    public static IList<Polygon> Union(IList<Polygon> firstSet, IList<Polygon> secondSet, double tolerance = 1E-05)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<Polygon> firstSet

    First set of polygons

    System.Collections.Generic.IList<Polygon> secondSet

    Second set of polygons

    System.Double tolerance

    An optional tolerance.

    Returns
    Type Description
    System.Collections.Generic.IList<Polygon>

    Returns a list of Polygons representing the union of both sets of polygons.

    Union(IList<Polygon>, Double)

    Constructs the geometric union between this Polygon and the supplied list of Polygons.

    Declaration
    public Polygon Union(IList<Polygon> polygons, double tolerance = 1E-05)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<Polygon> polygons

    The list of Polygons to be combined with this Polygon.

    System.Double tolerance

    An optional tolerance.

    Returns
    Type Description
    Polygon

    Returns a single Polygon from a successful union. Returns null if a union cannot be performed on the complete list of Polygons.

    UnionAll(Polygon[])

    Constructs the geometric union of a set of polygons, using default tolerance.

    Declaration
    public static IList<Polygon> UnionAll(params Polygon[] polygons)
    Parameters
    Type Name Description
    Polygon[] polygons

    The polygons to union

    Returns
    Type Description
    System.Collections.Generic.IList<Polygon>

    Returns a list of Polygons representing the union of all polygons.

    UnionAll(IList<Polygon>, Double)

    Constructs the geometric union of a set of polygons.

    Declaration
    public static IList<Polygon> UnionAll(IList<Polygon> polygons, double tolerance = 1E-05)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<Polygon> polygons

    The polygons to union

    System.Double tolerance

    An optional tolerance.

    Returns
    Type Description
    System.Collections.Generic.IList<Polygon>

    Returns a list of Polygons representing the union of all polygons.

    ValidateVertices()

    Validate that this Polygon's vertices are coplanar, clean up any duplicate vertices, and fix any overlapping edges.

    Declaration
    protected override void ValidateVertices()
    Overrides
    IndexedPolycurve.ValidateVertices()

    XOR(Polygon, Double)

    Returns Polygons representing the symmetric difference between this Polygon and the supplied Polygon.

    Declaration
    public IList<Polygon> XOR(Polygon polygon, double tolerance = 1E-05)
    Parameters
    Type Name Description
    Polygon polygon

    The intersecting polygon.

    System.Double tolerance

    An optional tolerance.

    Returns
    Type Description
    System.Collections.Generic.IList<Polygon>

    Returns a list of Polygons representing the symmetric difference of this Polygon and the supplied Polygon. Returns a representation of this Polygon and the supplied Polygon if the Polygons do not intersect.

    XOR(IList<Polygon>, IList<Polygon>, Double)

    Returns Polygons representing the symmetric difference between two sets of polygons.

    Declaration
    public static IList<Polygon> XOR(IList<Polygon> firstSet, IList<Polygon> secondSet, double tolerance = 1E-05)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<Polygon> firstSet

    First set of polygons

    System.Collections.Generic.IList<Polygon> secondSet

    Second set of polygons

    System.Double tolerance

    An optional tolerance.

    Returns
    Type Description
    System.Collections.Generic.IList<Polygon>

    Returns a list of Polygons representing the symmetric difference of these two sets of polygons. Returns a representation of all polygons if they do not intersect.

    Operators

    Implicit(Polygon to Element)

    Implicitly convert a Polygon to a ModelCurve Element.

    Declaration
    public static implicit operator Element(Polygon c)
    Parameters
    Type Name Description
    Polygon c

    The curve to convert.

    Returns
    Type Description
    Element

    Implicit(Polygon to Profile)

    Implicitly convert a polygon to a profile.

    Declaration
    public static implicit operator Profile(Polygon p)
    Parameters
    Type Name Description
    Polygon p

    The polygon to convert.

    Returns
    Type Description
    Profile

    Implements

    ICurve
    ITransformable<T>
    IBoundedCurve
    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable
    System.IEquatable<T>