Struct Box2
- Namespace
- SixLabors.PolygonClipper
- Assembly
- SixLabors.PolygonClipper.dll
Represents a bounding box.
public readonly struct Box2 : IEquatable<Box2>
- Implements
- Inherited Members
Constructors
Box2(in Vertex)
Initializes a new instance of the Box2 struct.
public Box2(in Vertex vector)
Parameters
vectorVertexThe xy-coordinate.
Box2(in Vertex, in Vertex)
Initializes a new instance of the Box2 struct.
public Box2(in Vertex min, in Vertex max)
Parameters
Fields
Max
Gets the maximum xy-coordinate.
public readonly Vertex Max
Field Value
Min
Gets the minimum xy-coordinate.
public readonly Vertex Min
Field Value
Properties
Invalid
Gets an invalid bounds instance.
public static Box2 Invalid { get; }
Property Value
Methods
Add(in Box2)
Adds another bounding box to this instance.
public Box2 Add(in Box2 other)
Parameters
otherBox2The other box.
Returns
Contains(in Box2)
Returns true if the box contains another box.
public bool Contains(in Box2 bounds)
Parameters
boundsBox2The other box.
Returns
Contains(in Vertex)
Returns true if the point lies within the box.
public bool Contains(in Vertex point)
Parameters
pointVertexThe point to test.
Returns
Equals(Box2)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Box2 other)
Parameters
otherBox2An object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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.
Intersects(in Box2)
Returns true if the boxes intersect.
public bool Intersects(in Box2 bounds)
Parameters
boundsBox2The other box.
Returns
IsEmpty()
Returns true if the box is empty.
public bool IsEmpty()
Returns
MidPoint()
Returns the midpoint of the box.
public Vertex MidPoint()
Returns
- Vertex
The midpoint.
Operators
operator ==(in Box2, in Box2)
Compares two Box2 instances for equality.
public static bool operator ==(in Box2 left, in Box2 right)
Parameters
Returns
- bool
trueif both boxes are equal; otherwise,false.
operator !=(in Box2, in Box2)
Determines whether two Box2 instances are not equal.
public static bool operator !=(in Box2 left, in Box2 right)
Parameters
Returns
- bool
trueif the boxes are not equal; otherwise,false.