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

Struct BoundingBox

Represents a bounding box defined by two points: the upper left and the lower right.

Implements
IEquatable<BoundingBox>
Inherited Members
ValueType.Equals(object)
ValueType.GetHashCode()
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: OpenSvg
Assembly: OpenSvg.dll
Syntax
public readonly record struct BoundingBox : IEquatable<BoundingBox>

Constructors

| Edit this page View Source

BoundingBox()

Initializes a new instance of the BoundingBox struct with zero size, starting at the origin.

Declaration
public BoundingBox()
| Edit this page View Source

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.

| Edit this page View Source

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 Source

None

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 Source

Height

Gets the height of the bounding box.

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

LowerRight

The lower right point of the bounding box.

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

MaxX

Gets the maximum x coordinate of the bounding box.

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

MaxY

Gets the maximum y coordinate of the bounding box.

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

MidX

Gets the midpoint of the x coordinates of the bounding box.

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

MidY

Gets the midpoint of the y coordinates of the bounding box.

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

MinX

Gets the minimum x coordinate of the bounding box.

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

MinY

Gets the minimum y coordinate of the bounding box.

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

Size

Gets the size of the bounding box.

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

UpperLeft

The upper left point of the bounding box.

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

Width

Gets the width of the bounding box.

Declaration
public float Width { get; }
Property Value
Type Description
float

Methods

| Edit this page View Source

Intersects(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

true if the bounding boxes intersect, false otherwise.

| Edit this page View Source

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
ValueType.ToString()
| Edit this page View Source

UnionWith(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.

Implements

IEquatable<T>