Struct BoundingBox
Represents a bounding box defined by two points: the upper left and the lower right.
Implements
Inherited Members
Namespace: OpenSvg
Assembly: OpenSvg.dll
Syntax
public readonly record struct BoundingBox : IEquatable<BoundingBox>
Constructors
| Edit this page View SourceBoundingBox()
Initializes a new instance of the BoundingBox struct with zero size, starting at the origin.
Declaration
public BoundingBox()
BoundingBox(Vector2, Vector2)
Represents a bounding box defined by two points: the upper left and the lower right.
Declaration
public BoundingBox(Vector2 UpperLeft, Vector2 LowerRight)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | UpperLeft | The upper left point of the bounding box. |
Vector2 | LowerRight | The lower right point of the bounding box. |
BoundingBox(Vector2, float, float)
Initializes a new instance of the BoundingBox struct with the specified upper left point, width, and height.
Declaration
public BoundingBox(Vector2 upperLeft, float width, float height)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | upperLeft | The upper left point of the bounding box. |
float | width | The width of the bounding box. |
float | height | The height of the bounding box. |
Fields
| Edit this page View SourceNone
A static instance representing a bounding box with zero size, starting at the origin (0,0).
Declaration
public static readonly BoundingBox None
Field Value
Type | Description |
---|---|
BoundingBox |
Properties
| Edit this page View SourceHeight
Gets the height of the bounding box.
Declaration
public float Height { get; }
Property Value
Type | Description |
---|---|
float |
LowerRight
The lower right point of the bounding box.
Declaration
public Vector2 LowerRight { get; init; }
Property Value
Type | Description |
---|---|
Vector2 |
MaxX
Gets the maximum x coordinate of the bounding box.
Declaration
public float MaxX { get; }
Property Value
Type | Description |
---|---|
float |
MaxY
Gets the maximum y coordinate of the bounding box.
Declaration
public float MaxY { get; }
Property Value
Type | Description |
---|---|
float |
MidX
Gets the midpoint of the x coordinates of the bounding box.
Declaration
public float MidX { get; }
Property Value
Type | Description |
---|---|
float |
MidY
Gets the midpoint of the y coordinates of the bounding box.
Declaration
public float MidY { get; }
Property Value
Type | Description |
---|---|
float |
MinX
Gets the minimum x coordinate of the bounding box.
Declaration
public float MinX { get; }
Property Value
Type | Description |
---|---|
float |
MinY
Gets the minimum y coordinate of the bounding box.
Declaration
public float MinY { get; }
Property Value
Type | Description |
---|---|
float |
Size
Gets the size of the bounding box.
Declaration
public Size Size { get; }
Property Value
Type | Description |
---|---|
Size |
UpperLeft
The upper left point of the bounding box.
Declaration
public Vector2 UpperLeft { get; init; }
Property Value
Type | Description |
---|---|
Vector2 |
Width
Gets the width of the bounding box.
Declaration
public float Width { get; }
Property Value
Type | Description |
---|---|
float |
Methods
| Edit this page View SourceIntersects(BoundingBox)
Checks if this bounding box intersects with another bounding box.
Declaration
public bool Intersects(BoundingBox other)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | other | The other bounding box to check for intersection. |
Returns
Type | Description |
---|---|
bool |
|
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string representation of the bounding box, showing the upper left and lower right points. |
Overrides
| Edit this page View SourceUnionWith(BoundingBox)
Calculates the minimum bounding box that contains both this bounding box and another bounding box.
Declaration
public BoundingBox UnionWith(BoundingBox other)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | other | The other bounding box to include in the union. |
Returns
Type | Description |
---|---|
BoundingBox | The bounding box that represents the union of this and the other bounding box. |