Felt  3.1
Deformable surface library.
Felt::Surface< D, L > Class Template Reference

Arbitrarily-dimensional sparse-field spatially partitioned level set surface. More...

#include <Surface.hpp>

Classes

struct  Stats
 Store approximate statistics of the number of spatial partitions using up memory. More...
 

Public Types

using IsoGrid = Impl::Partitioned::Tracked::Numeric< Distance, D, s_num_layers >
 A level set embedding isogrid grid, with active grid points (the narrow band) tracked. More...
 
using Line = Eigen::ParametrizedLine< Distance, D >
 D-dimensional parameterised line, for raycasting. More...
 
using Plane = Eigen::Hyperplane< Distance, D >
 D-dimensional hyperplane type (using Eigen library), for raycasting. More...
 

Public Member Functions

 Surface (const VecDi &size_, const VecDi &size_partition_=VecDi::Constant(8))
 Construct a level set embedding of size size. More...
 
const AffectedLookupGrid & affected () const
 Get points affected by most recent update, in the form of a lookup grid. More...
 
void delta (const VecDi &pos_, Distance val_)
 Update delta isogrid grid, tracking to tracking list if not already tracked. More...
 
const PosIdxListdelta (const TupleIdx layer_idx_) const
 Get list of spatial partitions where iso values were updated in last update. More...
 
bool is_intersected (const PosIdx pos_idx_child)
 Check if child spatial partition contains zero-layer points. More...
 
const IsoGridisogrid () const
 Get reference to isogrid grid. More...
 
VecDf ray (const VecDf &pos_origin_, const VecDf &dir_) const
 Cast a ray to the zero layer. More...
 
void save (std::ostream &output_stream_) const
 Save isogrid to given output stream. More...
 
void seed (const VecDi &pos_centre_)
 Create a single singularity seed point in the isogrid grid. More...
 
Stats stats () const
 Gather statistics about the current state of the surface. More...
 
const PosIdxListstatus_change (const TupleIdx layer_idx_) const
 Get list of spatial partitions where layer status change occurred in last update. More...
 
template<typename Fn >
void update (Fn &&fn_)
 Perform a full update of the narrow band. More...
 
template<typename Fn >
void update (const VecDi &pos_leaf_lower_, const VecDi &pos_leaf_upper_, Fn &&fn_)
 Perform a bounded update of the narrow band. More...
 
void update_end ()
 Update zero layer then update distance transform for affected points in each layer. More...
 
void update_start ()
 Reset delta isogrid to zero and clear update lists. More...
 

Static Public Member Functions

static constexpr TupleIdx layer_idx (const LayerId id_)
 Get narrow band layer index of ID for indexing into arrays. More...
 
static This load (std::istream &input_stream_)
 Load isogrid from given input stream and construct surface. More...
 

Static Public Attributes

static const VecDf ray_miss
 Get vector representing a raycast miss. More...
 

Detailed Description

template<Dim D, LayerId L>
class Felt::Surface< D, L >

Arbitrarily-dimensional sparse-field spatially partitioned level set surface.

Template Parameters
Dthe number of dimensions of the surface.
Lthe number of narrow band layers surrounding the zero-layer (surface).

Class Documentation

◆ Felt::Surface::Stats

struct Felt::Surface::Stats

template<Dim D, LayerId L>
struct Felt::Surface< D, L >::Stats

Store approximate statistics of the number of spatial partitions using up memory.

Class Members
ListIdx active_delta_partitions Number of delta isogrid partitions currently active.
ListIdx active_isogrid_partitions Number of isogrid partitions currently active.

Member Typedef Documentation

◆ IsoGrid

template<Dim D, LayerId L>
using Felt::Surface< D, L >::IsoGrid = Impl::Partitioned::Tracked::Numeric<Distance, D, s_num_layers>

A level set embedding isogrid grid, with active grid points (the narrow band) tracked.

◆ Line

template<Dim D, LayerId L>
using Felt::Surface< D, L >::Line = Eigen::ParametrizedLine<Distance, D>

D-dimensional parameterised line, for raycasting.

◆ Plane

template<Dim D, LayerId L>
using Felt::Surface< D, L >::Plane = Eigen::Hyperplane<Distance, D>

D-dimensional hyperplane type (using Eigen library), for raycasting.

Constructor & Destructor Documentation

◆ Surface()

template<Dim D, LayerId L>
Felt::Surface< D, L >::Surface ( const VecDi &  size_,
const VecDi &  size_partition_ = VecDi::Constant(8) 
)
inline

Construct a level set embedding of size size.

All points will be marked as outside the surface (i.e. no surface).

Parameters
size_size of the isogrid.
size_partition_size of each spatial partition of the isogrid.

Member Function Documentation

◆ affected()

template<Dim D, LayerId L>
const AffectedLookupGrid& Felt::Surface< D, L >::affected ( ) const
inline

Get points affected by most recent update, in the form of a lookup grid.

Returns
the affected lookup grid.

◆ delta() [1/2]

template<Dim D, LayerId L>
void Felt::Surface< D, L >::delta ( const VecDi &  pos_,
Distance  val_ 
)
inline

Update delta isogrid grid, tracking to tracking list if not already tracked.

Parameters
posposition to update.
valvalue to set at given position.

◆ delta() [2/2]

template<Dim D, LayerId L>
const PosIdxList& Felt::Surface< D, L >::delta ( const TupleIdx  layer_idx_) const
inline

Get list of spatial partitions where iso values were updated in last update.

Parameters
layer_idx_index of layer list to get.
Returns
list of position indices.

◆ is_intersected()

template<Dim D, LayerId L>
bool Felt::Surface< D, L >::is_intersected ( const PosIdx  pos_idx_child)
inline

Check if child spatial partition contains zero-layer points.

Parameters
pos_idx_childposition index of child partition.
Returns
true if zero-curve cuts through partition, false otherwise.

◆ isogrid()

template<Dim D, LayerId L>
const IsoGrid& Felt::Surface< D, L >::isogrid ( ) const
inline

Get reference to isogrid grid.

Returns
signed distance isogrid embedding the level set surface.

◆ layer_idx()

template<Dim D, LayerId L>
static constexpr TupleIdx Felt::Surface< D, L >::layer_idx ( const LayerId  id_)
inlinestatic

Get narrow band layer index of ID for indexing into arrays.

Internally we can of course not have negative array indices, so must convert to an index first.

Parameters
idnarrow band layer ID.
Returns
index to use to get given layer in narrow band array.

◆ load()

template<Dim D, LayerId L>
static This Felt::Surface< D, L >::load ( std::istream &  input_stream_)
inlinestatic

Load isogrid from given input stream and construct surface.

Parameters
input_stream_stream to load from.
Returns
new Surface instance.

◆ ray()

template<Dim D, LayerId L>
VecDf Felt::Surface< D, L >::ray ( const VecDf &  pos_origin_,
const VecDf &  dir_ 
) const
inline

Cast a ray to the zero layer.

Parameters
pos_origin_originating point of ray
dir_normal vector in direction of ray
Returns
zero curve hit location or NULL_POS.

◆ save()

template<Dim D, LayerId L>
void Felt::Surface< D, L >::save ( std::ostream &  output_stream_) const
inline

Save isogrid to given output stream.

Parameters
output_stream_stream to save to.

◆ seed()

template<Dim D, LayerId L>
void Felt::Surface< D, L >::seed ( const VecDi &  pos_centre_)
inline

Create a single singularity seed point in the isogrid grid.

NOTE: does not handle overwriting of points currently already on the surface/in the volume.

Parameters
pos_centre

◆ stats()

template<Dim D, LayerId L>
Stats Felt::Surface< D, L >::stats ( ) const
inline

Gather statistics about the current state of the surface.

Returns
statistics object with values for the number of active spatial partitions.

◆ status_change()

template<Dim D, LayerId L>
const PosIdxList& Felt::Surface< D, L >::status_change ( const TupleIdx  layer_idx_) const
inline

Get list of spatial partitions where layer status change occurred in last update.

Parameters
layer_idx_index of layer list to get.
Returns
list of position indices.

◆ update() [1/2]

template<Dim D, LayerId L>
template<typename Fn >
void Felt::Surface< D, L >::update ( Fn &&  fn_)
inline

Perform a full update of the narrow band.

Lambda function passed will be given the position to process and a reference to the isogrid grid, and is expected to return delta isogrid to apply.

Each spatial partition is processed in parallel.

Parameters
fn_(pos, isogrid) -> float

◆ update() [2/2]

template<Dim D, LayerId L>
template<typename Fn >
void Felt::Surface< D, L >::update ( const VecDi &  pos_leaf_lower_,
const VecDi &  pos_leaf_upper_,
Fn &&  fn_ 
)
inline

Perform a bounded update of the narrow band.

Lambda function passed will be given the position to process and a reference to the isogrid grid, and is expected to return delta isogrid to apply.

Each spatial partition is processed in parallel.

Parameters
pos_leaf_lower_region selection from.
pos_leaf_upper_region selection to.
fn_(pos, isogrid) -> float.

◆ update_end()

template<Dim D, LayerId L>
void Felt::Surface< D, L >::update_end ( )
inline

Update zero layer then update distance transform for affected points in each layer.

◆ update_start()

template<Dim D, LayerId L>
void Felt::Surface< D, L >::update_start ( )
inline

Reset delta isogrid to zero and clear update lists.

Member Data Documentation

◆ ray_miss

template<Dim D, LayerId L>
const Surface< D, L >::VecDf Felt::Surface< D, L >::ray_miss
static
Initial value:
=
VecDf::Constant(std::numeric_limits<Distance>::max())

Get vector representing a raycast miss.


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