Physsim::ADF Class Reference

An adaptively-sampled distance field using an octree representation. More...

#include <ADF.h>

List of all members.

Public Member Functions

 ADF ()
 Constructs an adaptively-sampled distance field (ADF) with a recursion level of 0.
 ADF (boost::shared_ptr< ADF > parent, unsigned recursion_level, const Vector3 &lo_bounds, const Vector3 &hi_bounds)
 Constructs an octree with the specified parent, recursion level, and bounds.
 ADF (boost::shared_ptr< ADF > parent, unsigned recursion_level, const std::vector< Vector3ConstPtr > &vertices)
 Constructs an ADF with the specified parent, recursion level, and vertices.
Real calc_signed_distance (const Vector3 &point) const
 Computes the signed distance using this ADF cell using trilinear interpolation.
const std::vector< Vector3ConstPtr > & get_vertices () const
void set_distances (const std::vector< Real > &distances)
 Sets the vector of distances for this cell.
template<class ForwardIterator>
void set_distances (ForwardIterator first, ForwardIterator last)
 Computes the signed distances for each corner of the ADF cell using a given triangle mesh.
void get_samples (std::vector< Vector3 > &samples) const
 Gets 19 points sampled over this cell.
void reset ()
void simplify (Real epsilon)
 Simplifies an ADF by coalescing cells.
void get_bounds (Vector3 &lo, Vector3 &hi) const
 Gets the bounds for this ADF cell.
void set_bounds (const Vector3 &lo_bound, const Vector3 &hi_bound)
 (Re)sets the bounds for this ADF cell
const std::vector< Real > & get_distances () const
bool contains (const Vector3 &point) const
 Determines whether the given point is within this ADF's bounding box.
unsigned count_cells () const
 Counts the number of cells within this ADF.
bool generate_iso_sample (Vector3 &sample, Real epsilon) const
 Determines a sample on the iso-surface of the ADF.
void get_all_leaf_nodes (std::list< boost::shared_ptr< ADF > > &leafs) const
 Gets all leaf nodes in the sub-tree rooted at this cell.
void get_all_cells (std::list< boost::shared_ptr< ADF > > &cells) const
 Gets all cells in the sub-tree rooted at this cell.
void determine_normal (const Vector3 &point, Vector3 &normal) const
 Determines the normal to the surface at a point.
bool intersect_seg_iso_surface (const std::pair< Vector3, Vector3 > &seg, Vector3 &isect) const
 Intersects a line segment with the iso-surface within this ADF.
void set_parent (boost::shared_ptr< ADF > parent)
 Sets the parent of this octree.
boost::shared_ptr< ADFget_parent () const
 Gets the parent of this octree.
bool is_leaf () const
 Determines whether this ADF node is a leaf.
unsigned get_recursion_level () const
 Gets the current level of recursion of this ADF.
void set_recursion_level (unsigned level)
 Sets the current level of recursion of this ADF.
void subdivide ()
 Subdivides this ADF cell into eight cells.
const std::vector< boost::shared_ptr<
ADF > > & 
get_children () const
 Gets the set of children of this ADF cell.

Static Public Member Functions

static boost::shared_ptr<
ADF
build_ADF_iso_inside_focus (const std::vector< TriangleConstPtr > &mesh, unsigned max_recursion, Real epsilon)
 Builds an ADF from a triangle mesh.
static boost::shared_ptr<
ADF
intersect (boost::shared_ptr< ADF > adf1, boost::shared_ptr< ADF > adf2, Real epsilon, unsigned recursion_limit)
 Intersects two ADFs and returns the new ADF.


Detailed Description

An adaptively-sampled distance field using an octree representation.


Constructor & Destructor Documentation

ADF::ADF (  ) 

Constructs an adaptively-sampled distance field (ADF) with a recursion level of 0.

The bounds of the ADF are set to -/+ infinity and the distances are set to positive infinity.

ADF::ADF ( boost::shared_ptr< ADF parent,
unsigned  recursion_level,
const Vector3 lo_bounds,
const Vector3 hi_bounds 
)

Constructs an octree with the specified parent, recursion level, and bounds.

The bounds of the ADF are set to -/+ infinity and the distances are set to positive infinity.

ADF::ADF ( boost::shared_ptr< ADF parent,
unsigned  recursion_level,
const std::vector< Vector3ConstPtr > &  vertices 
)

Constructs an ADF with the specified parent, recursion level, and vertices.

The vertices are expected to be in the following order: 6---7 /| /| 3---5 | | 2-|-4 |/ |/ 0---1


Member Function Documentation

void ADF::set_distances ( const std::vector< Real > &  distances  ) 

Sets the vector of distances for this cell.

Parameters:
distances a 8-dimension vector of distances corresponding to each vertex of the cell. The distances must correspond to the following:
6---7 /| /| 3---5 | | 2-|-4 |/ |/ 0---1

where '0' and '7' correspond to the bounds of this cell.

template<class ForwardIterator>
void Physsim::ADF::set_distances ( ForwardIterator  first,
ForwardIterator  last 
)

Computes the signed distances for each corner of the ADF cell using a given triangle mesh.

Parameters:
first an iterator to the first of a set of TriangleConstPtr / TrianglePtr elements
last an iterator to the last of a set of TriangleConstPtr / TrianglePtr elements

void ADF::get_samples ( std::vector< Vector3 > &  samples  )  const

Gets 19 points sampled over this cell.

The 19 points are: the center of the cell, the center of each face (6), and the center of each edge (12).

Note:
the passed vector is not cleared

boost::shared_ptr< ADF > ADF::build_ADF_iso_inside_focus ( const std::vector< TriangleConstPtr > &  mesh,
unsigned  max_recursion,
Real  epsilon 
) [static]

Builds an ADF from a triangle mesh.

This method builds an adaptively-sampled distance field, concentrating on accurately representing the iso-surface and the inside of the shape.

Parameters:
mesh the triangle mesh
max_recursion the maximum recursion level within the ADF octree
epsilon the tolerance below which subdivision stops
Returns:
a shared pointer to the constructed ADF octree

boost::shared_ptr< ADF > ADF::intersect ( boost::shared_ptr< ADF adf1,
boost::shared_ptr< ADF adf2,
Real  epsilon,
unsigned  recursion_limit 
) [static]

Intersects two ADFs and returns the new ADF.

Parameters:
adf1 the first ADF
adf2 the second ADF
epsilon the tolerance to the true distance below which further recursion is terminated
recursion_limit the maximum number of levels of the ADF octree
Returns:
a smart pointer to the new ADF
Note:
closest triangles to samples in ADF cells are not preserved

void ADF::get_all_leaf_nodes ( std::list< boost::shared_ptr< ADF > > &  leafs  )  const

Gets all leaf nodes in the sub-tree rooted at this cell.

Note:
the list is not cleared before this operation

cells are not inserted into the list in any order

void ADF::get_all_cells ( std::list< boost::shared_ptr< ADF > > &  cells  )  const

Gets all cells in the sub-tree rooted at this cell.

Note:
the list is not cleared before this operation

the list is ordered as a pre-order

void ADF::determine_normal ( const Vector3 point,
Vector3 normal 
) const

Determines the normal to the surface at a point.

Note:
this uses the method defined by Frisken et al. [2000]

bool ADF::intersect_seg_iso_surface ( const std::pair< Vector3, Vector3 > &  seg,
Vector3 isect 
) const

Intersects a line segment with the iso-surface within this ADF.

Returns:
true if able to intersect the iso-surface, false otherwise
Note:
this will only return at most one point of intersection if the line segment intersects the iso-surface at many places


The documentation for this class was generated from the following files:
Generated on Wed Oct 24 14:54:22 2007 for Physsim by  doxygen 1.5.1