OmegaEngine API  1.0.3
Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
OmegaEngine.Values.Quadrangle Struct Reference

A 2D polygon consisting of four points. More...

Inheritance diagram for OmegaEngine.Values.Quadrangle:

Public Member Functions

 Quadrangle (Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4)
 Creates a new quadrangle. Counter-clockwise ordering is recommended. More...
 
 Quadrangle (float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y)
 Creates a new quadrangle. Counter-clockwise ordering is recommended. More...
 
 Quadrangle (RectangleF rectangle)
 Creates a new quadrangle from a simple rectangle. More...
 
Quadrangle Offset (Vector2 distance)
 Returns a new Quadrangle shifted by distance . More...
 
Quadrangle Rotate (float rotation)
 Returns a new Quadrangle rotated by rotation around the origin. More...
 
bool IntersectWith (Vector2 point)
 If the points are stored counter-clockwise and form a convex polygon, this will test if a point lies inside it. More...
 
bool IntersectWith (RectangleF rectangle)
 If the points are stored counter-clockwise and form a convex polygon, this will test if a rectangle lies inside it. More...
 
bool IntersectWith (Quadrangle quadrangle)
 This will test if two quadrangles intersect with each other. Only works if both quadrangles are counter-clockwise and form a convex polygon. More...
 
bool IntersectCircle (float radius)
 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. More...
 
override string ToString ()
 
bool Equals (Quadrangle other)
 
override bool Equals (object obj)
 
override int GetHashCode ()
 

Static Public Member Functions

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

Public Attributes

Vector2Ray Edge1 => new Vector2Ray(P1, P2 - P1)
 The edge from P1 to P2. More...
 
Vector2Ray Edge2 => new Vector2Ray(P2, P3 - P2)
 The edge from P2 to P3. More...
 
Vector2Ray Edge3 => new Vector2Ray(P3, P4 - P3)
 The edge from P3 to P4. More...
 
Vector2Ray Edge4 => new Vector2Ray(P4, P1 - P4)
 The edge from P4 to P1. More...
 

Properties

Vector2 P1 [get]
 The coordinates of the first point; counter-clockwise ordering recommended. More...
 
Vector2 P2 [get]
 The coordinates of the second point; counter-clockwise ordering recommended. More...
 
Vector2 P3 [get]
 The coordinates of the third point; counter-clockwise ordering recommended. More...
 
Vector2 P4 [get]
 The coordinates of the fourth point; counter-clockwise ordering recommended. More...
 

Detailed Description

A 2D polygon consisting of four points.

Constructor & Destructor Documentation

◆ Quadrangle() [1/3]

OmegaEngine.Values.Quadrangle.Quadrangle ( Vector2  p1,
Vector2  p2,
Vector2  p3,
Vector2  p4 
)
inline

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

◆ Quadrangle() [2/3]

OmegaEngine.Values.Quadrangle.Quadrangle ( float  p1X,
float  p1Y,
float  p2X,
float  p2Y,
float  p3X,
float  p3Y,
float  p4X,
float  p4Y 
)
inline

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

◆ Quadrangle() [3/3]

OmegaEngine.Values.Quadrangle.Quadrangle ( RectangleF  rectangle)
inline

Creates a new quadrangle from a simple rectangle.

Member Function Documentation

◆ IntersectCircle()

bool OmegaEngine.Values.Quadrangle.IntersectCircle ( float  radius)
inline

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.

Parameters
radiusThe rectangle to test for intersection.
Returns
true if the circle lies within the quadrangle.

◆ IntersectWith() [1/3]

bool OmegaEngine.Values.Quadrangle.IntersectWith ( Vector2  point)
inline

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

Parameters
pointThe point to test for intersection.
Returns
true if point lies within the quadrangle.

◆ IntersectWith() [2/3]

bool OmegaEngine.Values.Quadrangle.IntersectWith ( RectangleF  rectangle)
inline

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

Parameters
rectangleThe rectangle to test for intersection.
Returns
true if rectangle lies within the quadrangle.

◆ IntersectWith() [3/3]

bool OmegaEngine.Values.Quadrangle.IntersectWith ( Quadrangle  quadrangle)

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

Parameters
quadrangleThe other quadrangle to test for intersection.
Returns
true if quadrangle intersects with this quadrangle.

◆ Offset()

Quadrangle OmegaEngine.Values.Quadrangle.Offset ( Vector2  distance)

Returns a new Quadrangle shifted by distance .

Parameters
distanceThis value is added to each corner position.
Returns
The shifted Quadrangle.

◆ Rotate()

Quadrangle OmegaEngine.Values.Quadrangle.Rotate ( float  rotation)

Returns a new Quadrangle rotated by rotation around the origin.

Parameters
rotationThe angle to rotate by in degrees.
Returns
The rotated Quadrangle.

Member Data Documentation

◆ Edge1

Vector2Ray OmegaEngine.Values.Quadrangle.Edge1 => new Vector2Ray(P1, P2 - P1)

The edge from P1 to P2.

◆ Edge2

Vector2Ray OmegaEngine.Values.Quadrangle.Edge2 => new Vector2Ray(P2, P3 - P2)

The edge from P2 to P3.

◆ Edge3

Vector2Ray OmegaEngine.Values.Quadrangle.Edge3 => new Vector2Ray(P3, P4 - P3)

The edge from P3 to P4.

◆ Edge4

Vector2Ray OmegaEngine.Values.Quadrangle.Edge4 => new Vector2Ray(P4, P1 - P4)

The edge from P4 to P1.

Property Documentation

◆ P1

Vector2 OmegaEngine.Values.Quadrangle.P1
get

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

◆ P2

Vector2 OmegaEngine.Values.Quadrangle.P2
get

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

◆ P3

Vector2 OmegaEngine.Values.Quadrangle.P3
get

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

◆ P4

Vector2 OmegaEngine.Values.Quadrangle.P4
get

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


The documentation for this struct was generated from the following file: