geolib2
|
#include <Box.h>
Public Member Functions | |
Box (const Vector3 &min, const Vector3 &max) | |
Box * | clone () const |
bool | contains (const Vector3 &p) const |
Determines whether a point p lies within the shape. More... | |
void | enclose (const Box &box, const Pose3D &pose) |
Box | getBoundingBox () const |
Returns the smallest box which includes all mesh points. Box is not rotated, but matches the axis of the Shape. More... | |
Vector3 | getCenter () const |
Determine the center of the box with respect to the origin of the box. More... | |
const Vector3 & | getMax () const |
get vertex of the box with maximum coordinates More... | |
double | getMaxRadius () const |
Calculate the maximum distance from the origin of the shape to any point of the shape. More... | |
const Vector3 & | getMin () const |
get vertex of the box with minimum coordinates More... | |
Vector3 | getSize () const |
get the size of the box along all axes More... | |
bool | intersect (const Box &other) const |
Determines whether this Box intersects with another box. More... | |
bool | intersect (const Ray &r, float t0, float t1, double &distance) const |
intersect: currently always throws a logic error More... | |
bool | intersect (const Vector3 &p, const double radius) const |
Determines whether the shape intersects a sphere with center p. More... | |
void | setMesh (const Mesh &mesh) |
set the Mesh Any child classes should throw a std::logic_error in case the mesh should not be changed via setMesh. More... | |
![]() | |
virtual bool | empty () const |
empty Test whether the shape(mesh) is empty. More... | |
virtual const Mesh & | getMesh () const |
return the mesh defining the shape More... | |
Shape () | |
virtual bool | write (std::ostream &output) const |
write, serialise the shape More... | |
virtual | ~Shape () |
Protected Member Functions | |
void | generate_mesh_ () |
Should be called any time bounds is changed. More... | |
Protected Attributes | |
Vector3 | bounds [2] |
double | max_radius_ |
![]() | |
Mesh | mesh_ |
Should not be read or written to directly in general. Use setMesh and getMesh to write respectively read the mesh. In a few exceptions, the mesh can be written direcly. Make sure that mesh keeps consistent with other member variables. More... | |
Additional Inherited Members | |
![]() | |
static ShapePtr | read (std::istream &input) |
read serialised data from an input stream and create a shape More... | |
![]() | |
static const std::string | TYPE = "mesh" |
A class describing a box geometry
The box is defined by two vectors. Its origin is therefore not in the center of the box
|
virtual |
Reimplemented from geo::Shape.
|
virtual |
Determines whether a point p lies within the shape.
p | point to test |
Let the line segment P connect points p and an arbitrary point p_out outside of the shape We count the number of intersections between P and the shape. A positive number means point p is inside the shape. We use plucker coordinates to determine whether or not a triangle intersects line segment P. more details https://members.loria.fr/SLazard/ARC-Visi3D/Pant-project/files/Line_Segment_Triangle.html
Reimplemented from geo::Shape.
|
protected |
|
virtual |
Returns the smallest box which includes all mesh points. Box is not rotated, but matches the axis of the Shape.
Return a bounding box, which is the same as the object itself.
Reimplemented from geo::Shape.
Vector3 geo::Box::getCenter | ( | ) | const |
const Vector3 & geo::Box::getMax | ( | ) | const |
|
virtual |
Calculate the maximum distance from the origin of the shape to any point of the shape.
Reimplemented from geo::Shape.
const Vector3 & geo::Box::getMin | ( | ) | const |
Vector3 geo::Box::getSize | ( | ) | const |
bool geo::Box::intersect | ( | const Box & | other | ) | const |
|
virtual |
intersect: currently always throws a logic error
r | |
t0 | |
t1 | |
distance |
Reimplemented from geo::Shape.
|
virtual |
Determines whether the shape intersects a sphere with center p.
p | center of the sphere |
radius | radius of the sphere |
Main logic: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.49.9172&rep=rep1&type=pdf Projection in triangle logic: https://www.baeldung.com/cs/check-if-point-is-in-2d-triangle#1-mathematical-idea-2
Reimplemented from geo::Shape.
|
virtual |
set the Mesh Any child classes should throw a std::logic_error in case the mesh should not be changed via setMesh.
mesh | mesh to set |
Reimplemented from geo::Shape.