Table of Contents

Struct Quadrangle

Namespace
OmegaEngine.Foundation.Geometry
Assembly
OmegaEngine.Foundation.dll

A 2D polygon consisting of four points.

[TypeConverter(typeof(QuadrangleConverter))]
public struct Quadrangle : IEquatable<Quadrangle>
Implements
Inherited Members
Extension Methods

Constructors

Quadrangle(Vector2, Vector2, Vector2, Vector2)

Creates a new quadrangle. Counter-clockwise ordering is recommended.

public Quadrangle(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4)

Parameters

p1 Vector2
p2 Vector2
p3 Vector2
p4 Vector2

Quadrangle(RectangleF)

Creates a new quadrangle from a simple rectangle.

public Quadrangle(RectangleF rectangle)

Parameters

rectangle RectangleF

Quadrangle(float, float, float, float, float, float, float, float)

Creates a new quadrangle. Counter-clockwise ordering is recommended.

public Quadrangle(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y)

Parameters

p1X float
p1Y float
p2X float
p2Y float
p3X float
p3Y float
p4X float
p4Y float

Properties

Edge1

The edge from P1 to P2.

public Vector2Ray Edge1 { get; }

Property Value

Vector2Ray

Edge2

The edge from P2 to P3.

public Vector2Ray Edge2 { get; }

Property Value

Vector2Ray

Edge3

The edge from P3 to P4.

public Vector2Ray Edge3 { get; }

Property Value

Vector2Ray

Edge4

The edge from P4 to P1.

public Vector2Ray Edge4 { get; }

Property Value

Vector2Ray

P1

The coordinates of the first point; counter-clockwise ordering recommended.

public readonly Vector2 P1 { get; }

Property Value

Vector2

P2

The coordinates of the second point; counter-clockwise ordering recommended.

public readonly Vector2 P2 { get; }

Property Value

Vector2

P3

The coordinates of the third point; counter-clockwise ordering recommended.

public readonly Vector2 P3 { get; }

Property Value

Vector2

P4

The coordinates of the fourth point; counter-clockwise ordering recommended.

public readonly Vector2 P4 { get; }

Property Value

Vector2

Methods

Equals(Quadrangle)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Quadrangle other)

Parameters

other Quadrangle

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

IntersectCircle(float)

If the points are stored counter-clockwise and form a convex polygon, this will test if a circle with the origin (0;0) lies inside it.

public bool IntersectCircle(float radius)

Parameters

radius float

The rectangle to test for intersection.

Returns

bool

true if the circle lies within the quadrangle.

IntersectWith(Quadrangle)

This will test if two quadrangles intersect with each other. Only works if both quadrangles are counter-clockwise and form a convex polygon.

public bool IntersectWith(Quadrangle quadrangle)

Parameters

quadrangle Quadrangle

The other quadrangle to test for intersection.

Returns

bool

true if quadrangle intersects with this quadrangle.

IntersectWith(Vector2)

If the points are stored counter-clockwise and form a convex polygon, this will test if a point lies inside it.

public bool IntersectWith(Vector2 point)

Parameters

point Vector2

The point to test for intersection.

Returns

bool

true if point lies within the quadrangle.

IntersectWith(RectangleF)

If the points are stored counter-clockwise and form a convex polygon, this will test if a rectangle lies inside it.

public bool IntersectWith(RectangleF rectangle)

Parameters

rectangle RectangleF

The rectangle to test for intersection.

Returns

bool

true if rectangle lies within the quadrangle.

Offset(Vector2)

Returns a new Quadrangle shifted by distance.

public Quadrangle Offset(Vector2 distance)

Parameters

distance Vector2

This value is added to each corner position.

Returns

Quadrangle

The shifted Quadrangle.

Rotate(float)

Returns a new Quadrangle rotated by rotation around the origin.

public Quadrangle Rotate(float rotation)

Parameters

rotation float

The angle to rotate by in degrees.

Returns

Quadrangle

The rotated Quadrangle.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator ==(Quadrangle, Quadrangle)

public static bool operator ==(Quadrangle left, Quadrangle right)

Parameters

left Quadrangle
right Quadrangle

Returns

bool

operator !=(Quadrangle, Quadrangle)

public static bool operator !=(Quadrangle left, Quadrangle right)

Parameters

left Quadrangle
right Quadrangle

Returns

bool