Table of Contents

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

vector Vertex

The xy-coordinate.

Box2(in Vertex, in Vertex)

Initializes a new instance of the Box2 struct.

public Box2(in Vertex min, in Vertex max)

Parameters

min Vertex

The minimum xy-coordinate.

max Vertex

The maximum xy-coordinate.

Fields

Max

Gets the maximum xy-coordinate.

public readonly Vertex Max

Field Value

Vertex

Min

Gets the minimum xy-coordinate.

public readonly Vertex Min

Field Value

Vertex

Properties

Invalid

Gets an invalid bounds instance.

public static Box2 Invalid { get; }

Property Value

Box2

Methods

Add(in Box2)

Adds another bounding box to this instance.

public Box2 Add(in Box2 other)

Parameters

other Box2

The other box.

Returns

Box2

The summed Box2.

Contains(in Box2)

Returns true if the box contains another box.

public bool Contains(in Box2 bounds)

Parameters

bounds Box2

The other box.

Returns

bool

true if the box contains the other box; otherwise, false.

Contains(in Vertex)

Returns true if the point lies within the box.

public bool Contains(in Vertex point)

Parameters

point Vertex

The point to test.

Returns

bool

true if the point lies within the box; otherwise, false.

Equals(Box2)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Box2 other)

Parameters

other Box2

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and 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

bounds Box2

The other box.

Returns

bool

true if the boxes intersect; otherwise, false.

IsEmpty()

Returns true if the box is empty.

public bool IsEmpty()

Returns

bool

true if the box is empty; otherwise, false.

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

left Box2

The left Box2 object.

right Box2

The right Box2 object.

Returns

bool

true if 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

left Box2

The left Box2 object.

right Box2

The right Box2 object.

Returns

bool

true if the boxes are not equal; otherwise, false.