Back to top OpenSVG (c) Veridict AB, www.veridict.com
Edit this page

Class Polygon

Represents a polygon of points. Provides methods for generating bounding boxes and translating polygons using a specified transform.

Inheritance
object
PointList
Polygon
Implements
IReadOnlyList<Vector2>
IReadOnlyCollection<Vector2>
IEnumerable<Vector2>
IEnumerable
IEquatable<PointList>
IEquatable<Polygon>
Inherited Members
PointList.Points
PointList.Count
PointList.this[int]
PointList.Contains(Vector2)
PointList.PointAtDistance(float)
PointList.Equals(PointList)
PointList.ToXmlString()
PointList.ToString()
PointList.GetEnumerator()
object.Equals(object, object)
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: OpenSvg
Assembly: OpenSvg.dll
Syntax
public class Polygon : PointList, IReadOnlyList<Vector2>, IReadOnlyCollection<Vector2>, IEnumerable<Vector2>, IEnumerable, IEquatable<PointList>, IEquatable<Polygon>

Constructors

| Edit this page View Source

Polygon(IEnumerable<Vector2>)

Initializes a new instance of the Polygon class with the specified collection of points.

Declaration
public Polygon(IEnumerable<Vector2> points)
Parameters
Type Name Description
IEnumerable<Vector2> points

The collection of points.

Properties

| Edit this page View Source

BoundingBox

Declaration
public BoundingBox BoundingBox { get; }
Property Value
Type Description
BoundingBox
| Edit this page View Source

ConvexHull

Declaration
public ConvexHull ConvexHull { get; }
Property Value
Type Description
ConvexHull
| Edit this page View Source

Empty

Returns an empty polygon.

Declaration
public static Polygon Empty { get; }
Property Value
Type Description
Polygon

Methods

| Edit this page View Source

Equals(Polygon?)

Determines whether the specified object is equal to the current object.

Declaration
public bool Equals(Polygon? other)
Parameters
Type Name Description
Polygon 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.

| Edit this page View Source

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
PointList.Equals(object?)
| Edit this page View Source

FromXmlString(string)

Declaration
public static Polygon FromXmlString(string xmlString)
Parameters
Type Name Description
string xmlString
Returns
Type Description
Polygon
| Edit this page View Source

GetHashCode()

Serves as the default hash function.

Declaration
public override int GetHashCode()
Returns
Type Description
int

A hash code for the current object.

Overrides
PointList.GetHashCode()
| Edit this page View Source

IsOnEdge(Vector2)

Determines if the given point is on the edge of this polygon.

Declaration
public bool IsOnEdge(Vector2 point)
Parameters
Type Name Description
Vector2 point

The point to check.

Returns
Type Description
bool

True if the point is on the edge of this polygon, false otherwise.

| Edit this page View Source

RelationTo(Polygon)

Determines the relationship between two polygons.

Declaration
public PolygonRelation RelationTo(Polygon target)
Parameters
Type Name Description
Polygon target

The target polygon.

Returns
Type Description
PolygonRelation

A PolygonRelation value indicating the relationship between the polygons.

| Edit this page View Source

RelationTo(Vector2)

Calculates the PointRelation of a point to a polygon.

Declaration
public PointRelation RelationTo(Vector2 target)
Parameters
Type Name Description
Vector2 target

The point to check.

Returns
Type Description
PointRelation

The PointRelation of the point to the polygon. Either Inside or Disjoint.

| Edit this page View Source

ToPath()

Converts the Polygon to a Path.

Declaration
public Path ToPath()
Returns
Type Description
Path

The Polygon represented as a Path.

| Edit this page View Source

ToSvgPolygon()

Declaration
public SvgPolygon ToSvgPolygon()
Returns
Type Description
SvgPolygon

Implements

IReadOnlyList<T>
IReadOnlyCollection<T>
IEnumerable<T>
IEnumerable
IEquatable<T>
IEquatable<T>

Extension Methods

PointCollectionExtensions.Max(IEnumerable<Vector2>)
PointCollectionExtensions.Min(IEnumerable<Vector2>)