RotatedRectangle
Declaration
public struct Strawberry.Common.RotatedRectangle
Represents a floating-point rectangle defined by its X, Y, Width, and Height coordinates, with a rotation angle and origin point.
Constructors
RotatedRectangle
void RotatedRectangle(float x, float y, float width, float height, float angle, Vector2 origin)
Parameters:
| Name | Type | Description |
|---|---|---|
x |
System.Single |
|
y |
System.Single |
|
width |
System.Single |
|
height |
System.Single |
|
angle |
System.Single |
|
origin |
Strawberry.Math.Vector2 |
RotatedRectangle
void RotatedRectangle(float x, float y, float width, float height, float angle)
Parameters:
| Name | Type | Description |
|---|---|---|
x |
System.Single |
|
y |
System.Single |
|
width |
System.Single |
|
height |
System.Single |
|
angle |
System.Single |
RotatedRectangle
void RotatedRectangle(float x, float y, float width, float height)
Parameters:
| Name | Type | Description |
|---|---|---|
x |
System.Single |
|
y |
System.Single |
|
width |
System.Single |
|
height |
System.Single |
RotatedRectangle
void RotatedRectangle(Vector2 pos, Vector2 size)
Parameters:
| Name | Type | Description |
|---|---|---|
pos |
Strawberry.Math.Vector2 |
|
size |
Strawberry.Math.Vector2 |
RotatedRectangle
void RotatedRectangle(Vector2 pos, Vector2 size, float angle)
Parameters:
| Name | Type | Description |
|---|---|---|
pos |
Strawberry.Math.Vector2 |
|
size |
Strawberry.Math.Vector2 |
|
angle |
System.Single |
RotatedRectangle
void RotatedRectangle(Vector2 pos, Vector2 size, float angle, Vector2 origin)
Parameters:
| Name | Type | Description |
|---|---|---|
pos |
Strawberry.Math.Vector2 |
|
size |
Strawberry.Math.Vector2 |
|
angle |
System.Single |
|
origin |
Strawberry.Math.Vector2 |
RotatedRectangle
void RotatedRectangle(Vector4 xywh)
Parameters:
| Name | Type | Description |
|---|---|---|
xywh |
Strawberry.Math.Vector4 |
RotatedRectangle
void RotatedRectangle(Vector4 xywh, float angle)
Parameters:
| Name | Type | Description |
|---|---|---|
xywh |
Strawberry.Math.Vector4 |
|
angle |
System.Single |
RotatedRectangle
void RotatedRectangle(Vector4 xywh, float angle, Vector2 origin)
Parameters:
| Name | Type | Description |
|---|---|---|
xywh |
Strawberry.Math.Vector4 |
|
angle |
System.Single |
|
origin |
Strawberry.Math.Vector2 |
RotatedRectangle
void RotatedRectangle()
Properties
X
Gets or sets the X position of the rectangle.
float X { get set }
Y
Gets or sets the Y position of the rectangle.
float Y { get set }
Width
Gets or sets the width of the rectangle.
float Width { get set }
Height
Gets or sets the height of the rectangle.
float Height { get set }
Vertex1
Gets the upper-left vertex of the rectangle
Vector2 Vertex1 { get }
Vertex2
Gets the upper-right vertex of the rectangle
Vector2 Vertex2 { get }
Vertex3
Gets the bottom-right vertex of the rectangle
Vector2 Vertex3 { get }
Vertex4
Gets the bottom-left vertex of the rectangle
Vector2 Vertex4 { get }
Left
Gets or sets the left of the rectangle
float Left { get set }
Top
Gets or sets the top of the rectangle
float Top { get set }
Right
Gets the right of the rectangle
float Right { get }
Bottom
Gets the bottom of the rectangle
float Bottom { get }
Angle
Gets or sets the angle of the rectangle
float Angle { get set }
Origin
Gets or sets the origin of the rectangle around which the rectangle is rotated
Vector2 Origin { get set }
Methods
IsPointInside
Checks whether a point is inside the rotated rectangle.
bool IsPointInside(Vector2 point)
Parameters:
| Name | Type | Description |
|---|---|---|
point |
Strawberry.Math.Vector2 |
The position of the point |
Returns: Returns true if the point is inside, false otherwise
IsPointInside
Checks whether a point is inside the rotated rectangle.
bool IsPointInside(float x, float y)
Parameters:
| Name | Type | Description |
|---|---|---|
x |
System.Single |
The x coordinate of the point |
y |
System.Single |
The y coordinate of the point |
Returns: Returns true if the point is inside, false otherwise
Equals override
bool Equals(object obj)
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
System.Object |
GetHashCode override
int GetHashCode()
ToString override
string ToString()