org.jzy3d.maths
Class BoundingBox3d
- java.lang.Object
-
- org.jzy3d.maths.BoundingBox3d
-
public class BoundingBox3d extends java.lang.ObjectA BoundingBox3d stores a couple of maximal and minimal limit on each dimension (x, y, and z). It provides functions for enlarging the box by adding coordinates, Point3d, Polygon3d or an other BoundingBox3d (that is equivalent to computing the union of the current BoundingBox and another one).
-
-
Constructor Summary
Constructors Constructor and Description BoundingBox3d()Initialize a BoundingBox by calling its reset method, leaving the box in an inconsitent state, with minimums = Float.MAX_VALUE and maximums = -Float.MAX_VALUE.BoundingBox3d(BoundingBox3d box)BoundingBox3d(Coord3d center, float edgeLength)BoundingBox3d(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)Initialize a BoundingBox with raw values.BoundingBox3d(java.util.List<Coord3d> coords)BoundingBox3d(Polygon polygon)BoundingBox3d(Range xRange, Range yRange, Range zRange)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(BoundingBox3d b)Add a BoundingBox3d volume to the current one.voidadd(Coord3d c)Add a Coord3d to the BoundingBox3d.voidadd(float x, float y, float z)Adds an x,y,z point to the bounding box, and enlarge the bounding box if this points lies outside of it.voidadd(java.util.List<Point> pts)voidadd(Point p)Add a Point3d to the BoundingBox3d.voidadd(Polygon p)Add the points of a Polygon to the BoundingBox3d.BoundingBox3dclone()booleancontains(BoundingBox3d b2)Return true if b2 is contained by this.booleancontains(Coord3d c)booleanequals(java.lang.Object obj)Coord3dgetCenter()Compute and return the center point of the BoundingBox3ddoublegetRadius()Return the radius of the Sphere containing the Bounding Box, i.e., the distance between the center and the point (xmin, ymin, zmin).Coord3dgetTransformedCenter(SpaceTransformer transformers)doublegetTransformedRadius(SpaceTransformer transformers)java.util.List<Coord3d>getVertices()floatgetXmax()floatgetXmin()RangegetXRange()floatgetYmax()floatgetYmin()RangegetYRange()floatgetZmax()floatgetZmin()RangegetZRange()inthashCode()booleanintersect(BoundingBox3d b2)Return true if intersect b2.booleanisReset()BoundingBox3dmargin(float margin)static BoundingBox3dnewBoundsAtOrigin()voidreset()Initialize the bounding box with Float.MAX_VALUE as minimum value, and -Float.MAX_VALUE as maximum value for each dimension.BoundingBox3dscale(Coord3d scale)Return a copy of the current bounding box after scaling.BoundingBox3dselfMargin(float margin)voidsetXmax(float value)voidsetXmin(float value)voidsetYmax(float value)voidsetYmin(float value)voidsetZmax(float value)voidsetZmin(float value)BoundingBox3dshift(Coord3d offset)java.lang.StringtoString()java.lang.StringtoString(int depth)booleanvalid()
-
-
-
Constructor Detail
-
BoundingBox3d
public BoundingBox3d()
Initialize a BoundingBox by calling its reset method, leaving the box in an inconsitent state, with minimums = Float.MAX_VALUE and maximums = -Float.MAX_VALUE. In other words, calling box.valid() will return false.
-
BoundingBox3d
public BoundingBox3d(java.util.List<Coord3d> coords)
-
BoundingBox3d
public BoundingBox3d(Polygon polygon)
-
BoundingBox3d
public BoundingBox3d(Coord3d center, float edgeLength)
-
BoundingBox3d
public BoundingBox3d(BoundingBox3d box)
-
BoundingBox3d
public BoundingBox3d(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)Initialize a BoundingBox with raw values.
-
-
Method Detail
-
reset
public void reset()
Initialize the bounding box with Float.MAX_VALUE as minimum value, and -Float.MAX_VALUE as maximum value for each dimension.
-
isReset
public boolean isReset()
-
valid
public boolean valid()
-
add
public void add(float x, float y, float z)Adds an x,y,z point to the bounding box, and enlarge the bounding box if this points lies outside of it.- Parameters:
x-y-z-
-
add
public void add(Coord3d c)
Add a Coord3d to the BoundingBox3d. A shortcut for:add(c.x, c.y, c.z);- Parameters:
p-
-
add
public void add(java.util.List<Point> pts)
-
add
public void add(Point p)
Add a Point3d to the BoundingBox3d. A shortcut for:add(p.x, p.y, p.z);- Parameters:
p-
-
add
public void add(Polygon p)
Add the points of a Polygon to the BoundingBox3d.- Parameters:
p-
-
add
public void add(BoundingBox3d b)
Add a BoundingBox3d volume to the current one. A convenient shortcut for:add(b.xmin, b.ymin, b.zmin); add(b.xmax, b.ymax, b.zmax);- Parameters:
p-
-
getCenter
public Coord3d getCenter()
Compute and return the center point of the BoundingBox3d- Returns:
- the center.
-
getTransformedCenter
public Coord3d getTransformedCenter(SpaceTransformer transformers)
-
getRadius
public double getRadius()
Return the radius of the Sphere containing the Bounding Box, i.e., the distance between the center and the point (xmin, ymin, zmin).- Returns:
- the box radius.
-
getTransformedRadius
public double getTransformedRadius(SpaceTransformer transformers)
-
scale
public BoundingBox3d scale(Coord3d scale)
Return a copy of the current bounding box after scaling. Scaling does not modify the current bounding box.- Returns:
- the scaled bounding box
-
shift
public BoundingBox3d shift(Coord3d offset)
-
contains
public boolean contains(BoundingBox3d b2)
Return true if b2 is contained by this.
-
contains
public boolean contains(Coord3d c)
-
intersect
public boolean intersect(BoundingBox3d b2)
Return true if intersect b2.
-
margin
public BoundingBox3d margin(float margin)
-
selfMargin
public BoundingBox3d selfMargin(float margin)
-
getXRange
public Range getXRange()
-
getYRange
public Range getYRange()
-
getZRange
public Range getZRange()
-
getXmin
public float getXmin()
-
setXmin
public void setXmin(float value)
-
getXmax
public float getXmax()
-
setXmax
public void setXmax(float value)
-
getYmin
public float getYmin()
-
setYmin
public void setYmin(float value)
-
getYmax
public float getYmax()
-
setYmax
public void setYmax(float value)
-
getZmin
public float getZmin()
-
setZmin
public void setZmin(float value)
-
getZmax
public float getZmax()
-
setZmax
public void setZmax(float value)
-
getVertices
public java.util.List<Coord3d> getVertices()
-
newBoundsAtOrigin
public static BoundingBox3d newBoundsAtOrigin()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toString
public java.lang.String toString(int depth)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
clone
public BoundingBox3d clone()
- Overrides:
clonein classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG