Table of Contents

Class BBox3D

Namespace
SearchAThing.Sci
Assembly
netcore-sci.dll

Bounding Box. Initially empty, each added point will increase the extension if min or max exceed actual bbox limits. It works within wcs.

public class BBox3D
Inheritance
BBox3D
Inherited Members

Constructors

BBox3D()

construct empy bbox

public BBox3D()

BBox3D(BBox3D)

construct a copy of bbox

public BBox3D(BBox3D other)

Parameters

other BBox3D

source bbox

BBox3D(Vector3D, double)

construct bbox that contains pt at center and with given radius

public BBox3D(Vector3D pt, double radius)

Parameters

pt Vector3D
radius double

BBox3D(IEnumerable<Vector3D>)

construct bbox with given points

public BBox3D(IEnumerable<Vector3D> pts)

Parameters

pts IEnumerable<Vector3D>

points to add to the bbox

Properties

CadScript

script to paste in cad to draw bbox

public string CadScript { get; }

Property Value

string

Coords2D

build a 4 point bbox coords for 2D using Z=Min.Z

public IEnumerable<Vector3D> Coords2D { get; }

Property Value

IEnumerable<Vector3D>

Coords3D

build 8 coords 3d of current bbox

public IEnumerable<Vector3D> Coords3D { get; }

Property Value

IEnumerable<Vector3D>

Empty

public static BBox3D Empty { get; }

Property Value

BBox3D

IsEmpty

states if bbox empty

public bool IsEmpty { get; }

Property Value

bool

Max

Max coord of bbox resulting by all inserted points

public Vector3D Max { get; }

Property Value

Vector3D

Middle

middle point of bbox = (Min+Max)/2 ( Zero if empty )

public Vector3D Middle { get; }

Property Value

Vector3D

middle point of bbox

Min

Min coord of bbox resulting by all inserted points

public Vector3D Min { get; }

Property Value

Vector3D

Points

(not cached) retrieve ordered set of points for this bbox (0..4) first face (5..7) other face

  • [0] = (Min.X, Min.Y, Min.Z)
  • [1] = (Max.X, Min.Y, Min.Z)
  • [2] = (Max.X, Max.Y, Min.Z)
  • [3] = (Min.X, Max.Y, Min.Z)
  • [4] = (Min.X, Min.Y, Max.Z)
  • [5] = (Max.X, Min.Y, Max.Z)
  • [6] = (Max.X, Max.Y, Max.Z)
  • [7] = (Min.X, Max.Y, Max.Z)
public IReadOnlyList<Vector3D> Points { get; }

Property Value

IReadOnlyList<Vector3D>

Size

Size of bbox as Max-Min point distance ( Zero if empty)

public Vector3D Size { get; }

Property Value

Vector3D

Methods

AddMargin(Vector3D)

create new bbox extending by subtract margin to Min and by add to Max

public BBox3D AddMargin(Vector3D margin)

Parameters

margin Vector3D

Returns

BBox3D

ApplyUnion(params Vector3D[])

add given points to current bbox with side effects

public void ApplyUnion(params Vector3D[] pts)

Parameters

pts Vector3D[]

points to add

ApplyUnion(IEnumerable<Vector3D>)

add given points to current bbox with side effects

public void ApplyUnion(IEnumerable<Vector3D> pts)

Parameters

pts IEnumerable<Vector3D>

points to add

Clear()

reset to empty bbox

public void Clear()

Contains(double, BBox3D, bool, bool)

states if given other bbox contained in this

public bool Contains(double tol, BBox3D other, bool strictly = false, bool testZ = true)

Parameters

tol double

tolerance against Min, Max comparision

other BBox3D

other bbox to check if contained in this

strictly bool

if true it checks this bbox is stricly contained into given other

testZ bool

if false min,max test of Z isn't evaluated (useful for planar entities bboxes tests)

Returns

bool

true if given other bbox contained in this one

Contains(double, Vector3D)

states if given point contained in this bbox

public bool Contains(double tol, Vector3D p)

Parameters

tol double

tolerance against Min, Max comparision

p Vector3D

point to check if contained in this bbox

Returns

bool

true if given point contained in this bbox

Contains2D(double, Vector3D)

states if given point is contained in this bbox excluding Z evaluation

public bool Contains2D(double tol, Vector3D p)

Parameters

tol double

tolerance against Min, Max comparision

p Vector3D

point to check if contained in this bbox (Z ignored)

Returns

bool

true if given point (Z ignored) contained in this bbox

DrawCuboid(DxfObject, Layer?)

public IEnumerable<Face3D> DrawCuboid(DxfObject dxfObj, Layer? layer = null)

Parameters

dxfObj DxfObject
layer Layer

Returns

IEnumerable<Face3D>

EqualsTol(double, BBox3D)

states if this bbox equals to the other one

public bool EqualsTol(double tol, BBox3D other)

Parameters

tol double

tolerance against Min, Max comparision

other BBox3D

other bbox to compare for equality

Returns

bool

true if given bbox equals this one

Faces(double)

retrieve 6 faces (bottom, top, left, right, front, back) of bbox. (see Points property documentation for vertex enumeration), faces are:

public IEnumerable<Plane3DRegion> Faces(double tol)

Parameters

tol double

Returns

IEnumerable<Plane3DRegion>

Intersect(double, Line3D)

find intersection points of given ray to this bbox faces

public IEnumerable<Vector3D> Intersect(double tol, Line3D ray)

Parameters

tol double

length tolerance

ray Line3D

ray to test if intersect one or more of this bbox faces

Returns

IEnumerable<Vector3D>

intersection points

Scale(Vector3D)

scale all bbox points Min,Max respect to the center

public BBox3D Scale(Vector3D factor)

Parameters

factor Vector3D

scale factor

Returns

BBox3D

new bbox scaled

Scale(double)

scale all bbox points Min,Max respect to the center

public BBox3D Scale(double factor)

Parameters

factor double

scale factor

Returns

BBox3D

new bbox scaled

ToFace3DList()

public IEnumerable<Face3D> ToFace3DList()

Returns

IEnumerable<Face3D>

ToString()

stringify bbox as Max-Min=Size

public override string ToString()

Returns

string

Union(BBox3D)

union of this bbox with another

public BBox3D Union(BBox3D other)

Parameters

other BBox3D

other bbox to add to this

Returns

BBox3D

new bbox resulting from the union of this with given other one

Union(Vector3D)

union of this bbox with given point

public BBox3D Union(Vector3D p)

Parameters

p Vector3D

point to add to this bbox copy

Returns

BBox3D

new bbox with given point added to