geolib2
|
A geometric description of a shape as a union of other shapes. More...
#include <CompositeShape.h>
Public Member Functions | |
void | addShape (const Shape &shape, const Pose3D &pose) |
add a shape to the composite More... | |
CompositeShape * | clone () const |
CompositeShape () | |
bool | contains (const Vector3 &p) const |
Determines whether a point p lies within the shape. More... | |
Box | getBoundingBox () const |
Returns the smallest box which includes all mesh points. Box is not rotated, but matches the axis of the Shape. More... | |
double | getMaxRadius () const |
Calculate the maximum distance from the origin of the shape to any point of the shape. More... | |
const std::vector< std::pair< ShapePtr, Transform > > & | getShapes () const |
Get all the child shapes and their inverse pose relative to the "origin" of the CompositeShape. 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 | ~CompositeShape () |
![]() | |
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 Attributes | |
Box | bb_ |
Vector3 | max_ |
double | max_radius_ |
Vector3 | min_ |
std::vector< std::pair< ShapePtr, Transform > > | shapes_ |
![]() | |
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 geometric description of a shape as a union of other shapes.
Definition at line 16 of file CompositeShape.h.
geo::CompositeShape::CompositeShape | ( | ) |
Definition at line 9 of file CompositeShape.cpp.
|
virtual |
Definition at line 12 of file CompositeShape.cpp.
add a shape to the composite
shape | child shape to be added |
pose | pose of the origin of the child shape relative to the origin of the composite shape |
Definition at line 86 of file CompositeShape.cpp.
|
virtual |
Reimplemented from geo::Shape.
Definition at line 15 of file CompositeShape.cpp.
|
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.
Definition at line 64 of file CompositeShape.cpp.
|
virtual |
Returns the smallest box which includes all mesh points. Box is not rotated, but matches the axis of the Shape.
Reimplemented from geo::Shape.
Definition at line 115 of file CompositeShape.cpp.
|
virtual |
Calculate the maximum distance from the origin of the shape to any point of the shape.
Reimplemented from geo::Shape.
Definition at line 82 of file CompositeShape.cpp.
const std::vector< std::pair< ShapePtr, Transform > > & geo::CompositeShape::getShapes | ( | ) | const |
Get all the child shapes and their inverse pose relative to the "origin" of the CompositeShape.
Definition at line 119 of file CompositeShape.cpp.
|
virtual |
intersect: currently always throws a logic error
r | |
t0 | |
t1 | |
distance |
Reimplemented from geo::Shape.
Definition at line 19 of file CompositeShape.cpp.
|
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.
Definition at line 50 of file CompositeShape.cpp.
|
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.
Definition at line 123 of file CompositeShape.cpp.
|
protected |
Definition at line 65 of file CompositeShape.h.
|
protected |
Definition at line 63 of file CompositeShape.h.
|
protected |
Definition at line 59 of file CompositeShape.h.
|
protected |
Definition at line 61 of file CompositeShape.h.
|
protected |
Pairs of child shapes and the transform from the origin of the child shape to the origin of the composite shape
Definition at line 57 of file CompositeShape.h.