23#ifndef LSST_SPHGEOM_BOX3D_H_
24#define LSST_SPHGEOM_BOX3D_H_
103 _enforceInvariants();
108 return _intervals[0] ==
b._intervals[0] &&
109 _intervals[1] ==
b._intervals[1] &&
110 _intervals[2] ==
b._intervals[2];
170 bool contains(
double x_,
double y_,
double z_)
const {
221 _enforceInvariants();
229 _enforceInvariants();
237 return Box3d(*this).clipTo(
b);
241 return Box3d(*this).clipTo(
b);
266 return Box3d(*this).expandTo(
b);
270 return Box3d(*this).expandTo(
b);
294 _enforceInvariants();
298 return Box3d(*this).dilateBy(
w, h, d);
318 return ((xr & yr & zr) & (CONTAINS | WITHIN)) |
319 ((xr | yr | zr) & DISJOINT);
324 void _enforceInvariants() {
334 Interval1d _intervals[3];
This file defines a class for representing intervals of ℝ.
This file declares a class for representing vectors in ℝ³.
Box3d represents a box in ℝ³.
Box3d & erodeBy(double w, double h, double d)
double getHeight() const
getHeight returns the height (y-axis extent) of this box.
bool isEmpty() const
isEmpty returns true if this box does not contain any points.
bool isFull() const
isFull returns true if this box contains all points in ℝ³.
Box3d erodedBy(double w, double h, double d) const
bool intersects(Vector3d const &b) const
Box3d erodedBy(double r) const
double getDepth() const
getDepth returns the depth (z-axis extent) of this box.
bool isDisjointFrom(Box3d const &b) const
bool contains(double x_, double y_, double z_) const
Relationship relate(Box3d const &b) const
bool operator==(Box3d const &b) const
Two 3D boxes are equal if they contain the same points.
Interval1d const & x() const
Box3d(Vector3d const &v1, Vector3d const &v2)
This constructor creates a box spanning the intervals [v1.x(), v2.x()], [v1.y(), v2....
Box3d & dilateBy(double r)
dilateBy minimally expands or shrinks this Box to include or remove all points within distance |r| of...
Box3d & clipTo(Box3d const &b)
Box3d dilatedBy(double w, double h, double d) const
Box3d(Vector3d const &v, double w, double h, double d)
This constructor creates a box with center v, half-width w, half-height h, and half-depth d.
Box3d & expandTo(Box3d const &b)
bool intersects(Box3d const &b) const
Box3d & dilateBy(double w, double h, double d)
dilateBy morphologically dilates or erodes the x, y, and z intervals of this box by w,...
Box3d & expandTo(Vector3d const &b)
Interval1d const & y() const
bool isDisjointFrom(Vector3d const &b) const
Interval1d operator()(int i) const
The function call operator returns the i-th interval of this box.
bool isWithin(Box3d const &b) const
bool isWithin(Vector3d const &b) const
Box3d & clipTo(Vector3d const &b)
Box3d()
This constructor creates an empty 3D box.
Box3d dilatedBy(double r) const
bool contains(Box3d const &b) const
bool operator==(Vector3d const &v) const
A box is equal to a point if it contains only that point.
Box3d clippedTo(Box3d const &b) const
Box3d expandedTo(Vector3d const &b) const
Box3d(Vector3d const &v)
This constructor creates a box containing a single point.
double getWidth() const
getWidth returns the width (x-axis extent) of this box.
Box3d & erodeBy(double r)
Box3d clippedTo(Vector3d const &b) const
static Box3d aroundUnitSphere()
aroundUnitSphere returns a minimal Box3d containing the unit sphere.
Vector3d getCenter() const
getCenter returns the center of this box.
Box3d expandedTo(Box3d const &b) const
Interval1d const & z() const
bool operator!=(Vector3d const &v) const
bool operator!=(Box3d const &b) const
bool contains(Vector3d const &b) const
Relationship relate(Vector3d const &v) const
Box3d(Interval1d const &x, Interval1d const &y, Interval1d const &z)
This constructor creates a box spanning the given x, y, and z intervals.
Interval1d represents closed intervals of ℝ.
bool isFull() const
isFull returns true if this interval = ℝ.
bool isWithin(Scalar x) const
Derived dilatedBy(Scalar x) const
Interval & dilateBy(Scalar x)
For positive x, dilateBy morphologically dilates this interval by [-x,x], which is equivalent to the ...
Scalar getSize() const
getSize returns the size (length, width) of this interval.
Interval & clipTo(Scalar x)
bool isEmpty() const
isEmpty returns true if this interval does not contain any points.
Relationship relate(Scalar x) const
bool intersects(Scalar x) const
Interval & expandTo(Scalar x)
bool contains(Scalar x) const
Vector3d is a vector in ℝ³ with components stored in double precision.
std::ostream & operator<<(std::ostream &, Angle const &)
This file provides a type alias for describing set relationships.