Table of Contents

Class BBox

Namespace
SearchAThing.OpenGL.Core
Assembly
netcore-opengl-core.dll

Bounding box of a set of points.
It can be an oriented bounding box if created with custom coordinate system, WCS elsewhere is used as default.

public class BBox
Inheritance
BBox
Inherited Members
Extension Methods

Remarks

If a custom CS is given at the constructor min and max point of the bbox evaluates extension increments from the cs point of view.

Constructors

BBox(BBox)

Create a copy of given bbox.

public BBox(BBox other)

Parameters

other BBox

Other bbox to copy.

BBox(IEnumerable<BBox>)

Create a wcs bounding box adding given bboxes wcs extensions.

public BBox(IEnumerable<BBox> bboxes)

Parameters

bboxes IEnumerable<BBox>

BBox(IEnumerable<Vector3>)

Create a wcs bounding box of given points

public BBox(IEnumerable<Vector3> pts)

Parameters

pts IEnumerable<Vector3>

BBox(in Matrix4x4?)

Create bounding box object with optional coordinate system.

public BBox(in Matrix4x4? cs = null)

Parameters

cs Matrix4x4?

Optional coordinate system ( if null WCS is considered )

BBox(in Matrix4x4?, params Vector3[])

Create a cs oriented bounding box of given set of points.

public BBox(in Matrix4x4? cs, params Vector3[] pts)

Parameters

cs Matrix4x4?
pts Vector3[]

BBox(in Matrix4x4, IEnumerable<BBox>)

Create a cs oriented bounding box adding given bboxes wcs extensions.

public BBox(in Matrix4x4 cs, IEnumerable<BBox> bboxes)

Parameters

cs Matrix4x4
bboxes IEnumerable<BBox>

BBox(in Matrix4x4, IEnumerable<Vector3>)

Create a cs oriente bounding box of given set of points.

public BBox(in Matrix4x4 cs, IEnumerable<Vector3> pts)

Parameters

cs Matrix4x4
pts IEnumerable<Vector3>

BBox(params Vector3[])

Create a wcs bounding box of given set of points.

public BBox(params Vector3[] pts)

Parameters

pts Vector3[]

Properties

CS

Coordinate system related to the bounding box or null if WCS is considered.

public Matrix4x4? CS { get; }

Property Value

Matrix4x4?

IsEmpty

States if bounding box is empty. This is the default state at construct time and mean no point added yet.

public bool IsEmpty { get; }

Property Value

bool

Max

Maximum coordinate [wcs].

public Vector3 Max { get; }

Property Value

Vector3

MaxCS

Maximum coordinate [cs].

public Vector3 MaxCS { get; }

Property Value

Vector3

Middle

Bounding box middle coordinate [wcs].

public Vector3 Middle { get; }

Property Value

Vector3

Min

Minimum coordinate [wcs].

public Vector3 Min { get; }

Property Value

Vector3

MinCS

Minimum coordinate [cs].

public Vector3 MinCS { get; }

Property Value

Vector3

Points

Enumerate bounding box eight points.

public IEnumerable<Vector3> Points { get; }

Property Value

IEnumerable<Vector3>

Remarks

It doesn't check for duplicates.

Size

Bounding box size [wcs].

public Vector3 Size { get; }

Property Value

Vector3

SizeCS

Bounding box size [cs].

public Vector3 SizeCS { get; }

Property Value

Vector3

TolHint

Retrieve length comparision tolerance hint from bbox size.
If bbox empty a default tolerance DefaultTolerance will retrieved.

public float TolHint { get; }

Property Value

float

Methods

ApplyUnion(BBox)

(side effect) Modify current bounding box by adding given other bbox wcs extensions.

public bool ApplyUnion(BBox other)

Parameters

other BBox

Other bbox to add.

Returns

bool

True if bbox changed.

ApplyUnion(IEnumerable<Vector3>)

(side effect) Apply union of given wcs points. If bbox provided with custom CS then bbox aligned comparision will be done.

public bool ApplyUnion(IEnumerable<Vector3> pts)

Parameters

pts IEnumerable<Vector3>

Other points to add.

Returns

bool

True if bbox changed.

ApplyUnion(params Vector3[])

(side effect) Modify current bounding box by adding given other set ot wcs points.

public bool ApplyUnion(params Vector3[] pts)

Parameters

pts Vector3[]

Other wcs points to add.

Returns

bool

True if bbox changed.

Clear()

Reset bbox to empty state.

public void Clear()

Contains(float, BBox, bool, bool)

WCS tests if given other bounding box is contained (with tolerance) to this one.

public bool Contains(float tol, BBox other, bool strictly = false, bool testZ = true)

Parameters

tol float

Comparision tolerance.

other BBox

Other bbox to test if contained into this one.

strictly bool

If true, test will fails if one wcs ordinate of other bbox extensions equals to this one.

testZ bool

If false tests acts only for x, y bounding box extension components (Default: true).

Returns

bool

True if test succeeded.

EqualsTol(float, BBox)

States if this bbox equals (with tolerance) to another.

public bool EqualsTol(float tol, BBox other)

Parameters

tol float

Comparision tolerance.

other BBox

Other bbox to compare to this one.

Returns

bool

True if two bbox are equals (with tolerance).

Intersects(BBox)

Test if this bbox and the other given intersects.

public bool Intersects(BBox other)

Parameters

other BBox

Other bbox to test intersects with.

Returns

bool

True if one of two box have at least one point inside the other.
Returns false if one of the given boxes is empty.

Intersects(float, BBox)

Test if this bbox and the other given intersects.

public bool Intersects(float tol, BBox other)

Parameters

tol float

Comparision length tolerance.

other BBox

Other bbox to test intersects with.

Returns

bool

True if one of two box have at least one point inside the other.
Returns false if one of the given boxes is empty.

Move(in Vector3)

Create a new bounding box with Min, Max moved by the given wcs delta.

public BBox Move(in Vector3 delta)

Parameters

delta Vector3

WCS delta to apply.

Returns

BBox

Moved bounding box.

ToString()

public override string ToString()

Returns

string

Transform(Matrix4x4)

Create a new bbox that is the given one with extensions transformed by the given transform matrix.

public BBox Transform(Matrix4x4 m)

Parameters

m Matrix4x4

Transform matrix.

Returns

BBox

Transformed bbox.

Union(BBox)

Create a new bounding box that is the result of the current with addition of the extensions of given other bbox.

public BBox Union(BBox other)

Parameters

other BBox

Other bbox to add.

Returns

BBox

Extended bbox.

Union(IEnumerable<Vector3>)

Create a new bounding box that is the result of the current with addition of given wcs point set.

public BBox Union(IEnumerable<Vector3> pts)

Parameters

pts IEnumerable<Vector3>

WCS point set to add.

Returns

BBox

Extended bbox.

Union(in Vector3)

Create a new bounding box that is the result of the current with addition of given wcs point.

public BBox Union(in Vector3 p)

Parameters

p Vector3

WCS point to add.

Returns

BBox

Extended bbox.