Class Contour
Inheritance
Inherited Members
Namespace: UnityEngine.Experimental.U2D.TriangleNet.Geometry
Syntax
public class Contour
Constructors
Contour(IEnumerable<Vertex>)
Initializes a new instance of the Contour class.
Declaration
public Contour(IEnumerable<Vertex> points)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Vertex> | points | The points that make up the contour. |
Contour(IEnumerable<Vertex>, Int32)
Initializes a new instance of the Contour class.
Declaration
public Contour(IEnumerable<Vertex> points, int marker)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Vertex> | points | The points that make up the contour. |
System.Int32 | marker | Contour marker. |
Contour(IEnumerable<Vertex>, Int32, Boolean)
Initializes a new instance of the Contour class.
Declaration
public Contour(IEnumerable<Vertex> points, int marker, bool convex)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Vertex> | points | The points that make up the contour. |
System.Int32 | marker | Contour marker. |
System.Boolean | convex | The hole is convex. |
Properties
Points
Gets or sets the list of points making up the contour.
Declaration
public List<Vertex> Points { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<Vertex> |
Methods
FindInteriorPoint(Int32, Double)
Try to find a point inside the contour.
Declaration
public Point FindInteriorPoint(int limit = 5, double eps = 2E-05)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | limit | The number of iterations on each segment (default = 5). |
System.Double | eps | Threshold for co-linear points (default = 2e-5). |
Returns
Type | Description |
---|---|
Point | Point inside the contour |
Remarks
For each corner (index i) of the contour, the 3 points with indices i-1, i and i+1 are considered and a search on the line through the corner vertex is started (either on the bisecting line, or, if CounterClockwise(Point, Point, Point) is less than eps, on the perpendicular line. A given number of points will be tested (limit), while the distance to the contour boundary will be reduced in each iteration (with a factor 1 / 2^i, i = 1 ... limit).
Exceptions
Type | Condition |
---|---|
System.Exception | Throws if no point could be found. |
GetSegments()
Declaration
public List<ISegment> GetSegments()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<ISegment> |