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
BBox3Dsource bbox
BBox3D(Vector3D, double)
construct bbox that contains pt at center and with given radius
public BBox3D(Vector3D pt, double radius)
Parameters
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
Coords2D
build a 4 point bbox coords for 2D using Z=Min.Z
public IEnumerable<Vector3D> Coords2D { get; }
Property Value
Coords3D
build 8 coords 3d of current bbox
public IEnumerable<Vector3D> Coords3D { get; }
Property Value
Empty
public static BBox3D Empty { get; }
Property Value
IsEmpty
states if bbox empty
public bool IsEmpty { get; }
Property Value
Max
Max coord of bbox resulting by all inserted points
public Vector3D Max { get; }
Property Value
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
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
Size
Size of bbox as Max-Min point distance ( Zero if empty)
public Vector3D Size { get; }
Property Value
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
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
doubletolerance against Min, Max comparision
other
BBox3Dother bbox to check if contained in this
strictly
boolif true it checks this bbox is stricly contained into given other
testZ
boolif 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
doubletolerance against Min, Max comparision
p
Vector3Dpoint 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
doubletolerance against Min, Max comparision
p
Vector3Dpoint 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
DxfObjectlayer
Layer
Returns
- IEnumerable<Face3D>
EqualsTol(double, BBox3D)
states if this bbox equals to the other one
public bool EqualsTol(double tol, BBox3D other)
Parameters
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
Intersect(double, Line3D)
find intersection points of given ray to this bbox faces
public IEnumerable<Vector3D> Intersect(double tol, Line3D ray)
Parameters
Returns
- IEnumerable<Vector3D>
intersection points
Scale(Vector3D)
scale all bbox points Min,Max respect to the center
public BBox3D Scale(Vector3D factor)
Parameters
factor
Vector3Dscale 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
doublescale 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
Union(BBox3D)
union of this bbox with another
public BBox3D Union(BBox3D other)
Parameters
other
BBox3Dother 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
Vector3Dpoint to add to this bbox copy
Returns
- BBox3D
new bbox with given point added to