geolib2
Public Member Functions | Protected Attributes | Friends | List of all members
geo::Octree Class Reference

#include <Octree.h>

Inheritance diagram for geo::Octree:
Inheritance graph
[legend]

Public Member Functions

void add (const Vector3 &p)
 
void clear ()
 
virtual Octreeclone () const
 
bool contains (const Vector3 &p) const
 Determines whether a point p lies within the shape. More...
 
void getCubes (std::vector< Box > &cubes) const
 
double getMaxRadius () const
 Calculate the maximum distance from the origin of the shape to any point of the shape. More...
 
const MeshgetMesh () const
 return the mesh defining the shape More...
 
double getResolution () const
 
bool intersect (const Box &b) const
 
bool intersect (const Ray &r, float t0, float t1, double &distance) const
 intersect: currently always throws a logic error More...
 
 Octree (const Octree &orig)
 
 Octree (double size, double resolution=0.1)
 
void raytrace (const Ray &r, float t0, float t1)
 
double setResolution (double resolution)
 
virtual ~Octree ()
 
- Public Member Functions inherited from geo::Shape
virtual bool empty () const
 empty Test whether the shape(mesh) is empty. More...
 
virtual Box getBoundingBox () const
 Returns the smallest box which includes all mesh points. Box is not rotated, but matches the axis of the Shape. More...
 
virtual bool intersect (const Vector3 &p, const double radius) const
 Determines whether the shape intersects a sphere with center p. More...
 
virtual 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...
 
 Shape ()
 
virtual bool write (std::ostream &output) const
 write, serialise the shape More...
 
virtual ~Shape ()
 

Protected Attributes

Vector3 max_
 
Mesh mesh_
 
Vector3 offset_
 
double resolution_
 
OctreeNoderoot_
 
double size_
 
- Protected Attributes inherited from geo::Shape
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...
 

Friends

class OctreeNode
 

Additional Inherited Members

- Static Public Member Functions inherited from geo::Shape
static ShapePtr read (std::istream &input)
 read serialised data from an input stream and create a shape More...
 
- Static Public Attributes inherited from geo::Shape
static const std::string TYPE = "mesh"
 

Detailed Description

Definition at line 12 of file Octree.h.

Constructor & Destructor Documentation

◆ Octree() [1/2]

geo::Octree::Octree ( double  size,
double  resolution = 0.1 
)

Definition at line 6 of file Octree.cpp.

◆ Octree() [2/2]

geo::Octree::Octree ( const Octree orig)

Definition at line 11 of file Octree.cpp.

◆ ~Octree()

geo::Octree::~Octree ( )
virtual

Definition at line 15 of file Octree.cpp.

Member Function Documentation

◆ add()

void geo::Octree::add ( const Vector3 p)

Definition at line 29 of file Octree.cpp.

◆ clear()

void geo::Octree::clear ( )

Definition at line 23 of file Octree.cpp.

◆ clone()

Octree * geo::Octree::clone ( ) const
virtual

Reimplemented from geo::Shape.

Definition at line 19 of file Octree.cpp.

◆ contains()

bool geo::Octree::contains ( const Vector3 p) const
virtual

Determines whether a point p lies within the shape.

Parameters
ppoint to test
Returns
True means point p lies inside the shape

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 85 of file Octree.cpp.

◆ getCubes()

void geo::Octree::getCubes ( std::vector< Box > &  cubes) const

Definition at line 34 of file Octree.cpp.

◆ getMaxRadius()

double geo::Octree::getMaxRadius ( ) const
virtual

Calculate the maximum distance from the origin of the shape to any point of the shape.

Returns
Maximum radius found.

Reimplemented from geo::Shape.

Definition at line 64 of file Octree.cpp.

◆ getMesh()

const Mesh & geo::Octree::getMesh ( ) const
virtual

return the mesh defining the shape

Returns
a constant reference to the mesh of the shape

Reimplemented from geo::Shape.

Definition at line 110 of file Octree.cpp.

◆ getResolution()

double geo::Octree::getResolution ( ) const

Definition at line 46 of file Octree.cpp.

◆ intersect() [1/2]

bool geo::Octree::intersect ( const Box b) const

Definition at line 94 of file Octree.cpp.

◆ intersect() [2/2]

bool geo::Octree::intersect ( const Ray r,
float  t0,
float  t1,
double &  distance 
) const
virtual

intersect: currently always throws a logic error

Parameters
r
t0
t1
distance
Returns
true when the ray intersects the shape

Reimplemented from geo::Shape.

Definition at line 50 of file Octree.cpp.

◆ raytrace()

void geo::Octree::raytrace ( const Ray r,
float  t0,
float  t1 
)

Definition at line 68 of file Octree.cpp.

◆ setResolution()

double geo::Octree::setResolution ( double  resolution)

Definition at line 38 of file Octree.cpp.

Friends And Related Function Documentation

◆ OctreeNode

friend class OctreeNode
friend

Definition at line 14 of file Octree.h.

Member Data Documentation

◆ max_

Vector3 geo::Octree::max_
protected

Definition at line 54 of file Octree.h.

◆ mesh_

Mesh geo::Octree::mesh_
mutableprotected

Definition at line 60 of file Octree.h.

◆ offset_

Vector3 geo::Octree::offset_
protected

Definition at line 52 of file Octree.h.

◆ resolution_

double geo::Octree::resolution_
protected

Definition at line 50 of file Octree.h.

◆ root_

OctreeNode* geo::Octree::root_
protected

Definition at line 58 of file Octree.h.

◆ size_

double geo::Octree::size_
protected

Definition at line 56 of file Octree.h.


The documentation for this class was generated from the following files: