Go to the documentation of this file.
7 #ifndef INCLUDE_JET_BOUNDING_BOX2_H_
8 #define INCLUDE_JET_BOUNDING_BOX2_H_
117 template <
typename T>
134 #include "detail/bounding_box2-inl.h"
136 #endif // INCLUDE_JET_BOUNDING_BOX2_H_
BoundingBox2< float > BoundingBox2F
Float-type 2-D BoundingBox.
Definition: bounding_box2.h:121
Vector2< T > upperCorner
Upper corner of the bounding box.
Definition: bounding_box2.h:47
void reset()
Resets this box to initial state (min=infinite, max=-infinite).
T diagonalLengthSquared() const
Returns squared diagonal length of this box.
BoundingBoxRayIntersection2< double > BoundingBoxRayIntersection2D
Double-type 2-D box-ray intersection result.
Definition: bounding_box2.h:130
Point2< T > max(const Point2< T > &a, const Point2< T > &b)
Returns element-wise max point: (max(a.x, b.x), max(a.y, b.y)).
bool contains(const Vector2< T > &point) const
Returns true if the input point is inside of this box.
Vector2< T > clamp(const Vector2< T > &pt) const
Returns the clamped point.
Class for 2-D ray.
Definition: ray2.h:21
BoundingBox(const Vector2< T > &point1, const Vector2< T > &point2)
Constructs a box that tightly covers two points.
BoundingBox2< double > BoundingBox2D
Double-type 2-D BoundingBox.
Definition: bounding_box2.h:124
bool isEmpty() const
Returns true if the box is empty.
T tNear
Distance to the first intersection point.
Definition: bounding_box2.h:28
T length(size_t axis)
Returns length of the box in given axis.
Definition: advection_solver2.h:18
T width() const
Returns width of the box.
T height() const
Returns height of the box.
BoundingBox()
Default constructor.
void merge(const BoundingBox &other)
Merges this and other box.
2-D vector class.
Definition: vector2.h:24
Vector2< T > midPoint() const
Returns the mid-point of this box.
bool overlaps(const BoundingBox &other) const
Returns true of this box and other box overlaps.
Vector2< T > lowerCorner
Lower corner of the bounding box.
Definition: bounding_box2.h:44
2-D box-ray intersection result.
Definition: bounding_box2.h:23
Vector2< T > corner(size_t idx) const
Returns corner position. Index starts from x-first order.
bool isIntersecting
True if the box and ray intersects.
Definition: bounding_box2.h:25
Generic N-D axis-aligned bounding box class.
Definition: bounding_box.h:21
2-D axis-aligned bounding box class.
Definition: bounding_box2.h:41
void merge(const Vector2< T > &point)
Merges this and other point.
bool intersects(const Ray2< T > &ray) const
Returns true if the input ray is intersecting with this box.
BoundingBoxRayIntersection2< T > closestIntersection(const Ray2< T > &ray) const
BoundingBoxRayIntersection2< float > BoundingBoxRayIntersection2F
Float-type 2-D box-ray intersection result.
Definition: bounding_box2.h:127
T tFar
Distance to the second (and the last) intersection point.
Definition: bounding_box2.h:31
T diagonalLength() const
Returns diagonal length of this box.
BoundingBox(const BoundingBox &other)
Constructs a box with other box instance.