Class ConvexHull
Represents a convex hull of points. Provides specialized methods for manipulating and querying convex hulls.
Implements
Inherited Members
Namespace: OpenSvg
Assembly: OpenSvg.dll
Syntax
public class ConvexHull : PointList, IReadOnlyList<Vector2>, IReadOnlyCollection<Vector2>, IEnumerable<Vector2>, IEnumerable, IEquatable<PointList>, IEquatable<ConvexHull>
Constructors
| Edit this page View SourceConvexHull(IEnumerable<ConvexHull>)
Initializes a new instance of the ConvexHull class by merging multiple convex hulls.
Declaration
public ConvexHull(IEnumerable<ConvexHull> convexHulls)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<ConvexHull> | convexHulls | The collection of convex hulls to merge. |
ConvexHull(IEnumerable<Vector2>)
Initializes a new instance of the ConvexHull class with the specified collection of points.
Declaration
public ConvexHull(IEnumerable<Vector2> points)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Vector2> | points | The collection of points. |
ConvexHull(ImmutableArray<Vector2>, SkipGrahamsScan)
Initializes a new instance of the ConvexHull class with a set of points known to form a convex hull.
Declaration
public ConvexHull(ImmutableArray<Vector2> points, ConvexHull.SkipGrahamsScan _)
Parameters
Type | Name | Description |
---|---|---|
ImmutableArray<Vector2> | points | A collection of points that are already in the form of a convex hull. |
ConvexHull.SkipGrahamsScan | _ | A non-used parameter to clarify that extraction of hull points is skipped. |
Remarks
This specialized constructor bypasses the Graham's scan algorithm. It is used in cases where it is known that the input points comprise a convex hull already. For instance is used when transforming an existing ConvexHull using affine transformations, that preservs its convex nature.
Fields
| Edit this page View SourceBoundingBox
Declaration
public readonly BoundingBox BoundingBox
Field Value
Type | Description |
---|---|
BoundingBox |
Methods
| Edit this page View SourceEquals(ConvexHull?)
Determines whether the specified object is equal to the current object.
Declaration
public bool Equals(ConvexHull? other)
Parameters
Type | Name | Description |
---|---|---|
ConvexHull | other | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool | true if the specified object is equal to the current object; otherwise, false. |
Equals(object?)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
| Edit this page View SourceGetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
| Edit this page View SourceIsConvexHull(IEnumerable<Vector2>)
Determines whether the specified collection of points forms a convex hull.
Declaration
public static bool IsConvexHull(IEnumerable<Vector2> points)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Vector2> | points | The collection of points to check. |
Returns
Type | Description |
---|---|
bool | True if the collection of points forms a convex hull, otherwise false. |
ToSvgPolygon()
Declaration
public SvgPolygon ToSvgPolygon()
Returns
Type | Description |
---|---|
SvgPolygon |
Transform(Transform)
Transforms the convex hull by applying the specified transform.
Declaration
public ConvexHull Transform(Transform transform)
Parameters
Type | Name | Description |
---|---|---|
Transform | transform | The transform to apply. |
Returns
Type | Description |
---|---|
ConvexHull | A new convex hull that is the result of applying the transform. |