Felt  3.1
Deformable surface library.
Felt Namespace Reference

Namespaces

 Impl
 

Classes

class  Polys
 Polygonisation for a spatially partitioned level set surface. More...
 
class  Surface
 Arbitrarily-dimensional sparse-field spatially partitioned level set surface. More...
 

Typedefs

using AccessImpl = Impl::Mixin::Grid::Access::ByValue< This >
 
using ActivateImpl = Impl::Mixin::Grid::Activate< This >
 
template<typename T >
using DataArray = std::vector< T >
 Array of grid data. More...
 
using DataImpl = Impl::Mixin::Grid::Data< This >
 
using Dim = int
 Grid dimension type. More...
 
using Distance = float
 Isogrid or other distance value. More...
 
using LayerId = int
 Layer ID (in -L, ..., +L) More...
 
using Leaf = typename Traits::Leaf
 
using ListIdx = std::size_t
 Index of an item in a tracking list. More...
 
using Lookup = typename Traits::Lookup
 
using LookupImpl = Impl::Mixin::Lookup::MultiList::SingleIdx< This >
 
using LookupInterfaceImpl = Impl::Mixin::Tracked::LookupInterface< This >
 
using NodeIdx = int
 Grid node position vector element. More...
 
using PosIdx = std::size_t
 Index of a position in a grid's data array. More...
 
using PosIdxList = std::vector< PosIdx >
 Array of position indices. More...
 
using SizeImpl = Impl::Mixin::Grid::Size< This >
 
using TrackedImpl = Impl::Mixin::Tracked::SingleList::ByValue< This >
 
template<Dim D, TupleIdx N>
using Traits = Impl::Traits< This >
 
template<typename T , TupleIdx N>
using Tuple = VecDT< T, N >
 Tuple of items. More...
 
using TupleIdx = int
 Index of an item in a tuple. More...
 
using Vec2f = VecDf< 2 >
 Shorthand for 2D float vector. More...
 
using Vec2i = VecDi< 2 >
 Shorthand for 2D integer vector. More...
 
using Vec2u = VecDu< 2 >
 Shorthand for 2D unsigned integer vector. More...
 
using Vec3f = VecDf< 3 >
 Shorthand for 3D float vector. More...
 
using Vec3i = VecDi< 3 >
 Shorthand for 3D integer vector. More...
 
using Vec3u = VecDu< 3 >
 Shorthand for 3D unsigned integer vector. More...
 
template<Dim D>
using VecDf = VecDT< Distance, D >
 Shorthand for D-dimensional Distance vector. More...
 
template<Dim D>
using VecDi = VecDT< NodeIdx, D >
 Shorthand for D-dimensional NodeIdx vector. More...
 
template<typename T , Dim D>
using VecDT = Eigen::Matrix< T, D, 1 >
 Shorthand for D-dimensional vector with elements of T type. More...
 
template<Dim D>
using VecDu = VecDT< unsigned, D >
 Shorthand for D-dimensional unsigned integer vector. More...
 

Functions

template<class Vec >
std::string format (const Vec &vec_)
 String format a vector (useful for logging). More...
 
template<Dim D>
PosIdx index (const VecDi< D > &pos_, const VecDi< D > &size_, const VecDi< D > &offset_)
 Get index in data array of position vector. More...
 
template<Dim D>
VecDi< D > index (PosIdx idx_, const VecDi< D > &size_, const VecDi< D > &offset_=VecDi< D >::Zero())
 Get position of index. More...
 
template<typename TPos , typename TBounds >
bool inside (const TPos &pos_, const TBounds &pos_min_, const TBounds &pos_max_)
 Test if a position is inside given bounds. More...
 
 MultiListSingleIdx (const VecDi &size, const VecDi &offset)
 
template<typename T >
auto sgn (T val_)
 Get the sign of a value (+/-1). More...
 
 SingleListSingleIdxByValue (const VecDi &size_, const VecDi &offset_, const Leaf background_)
 

Variables

static constexpr ListIdx null_idx = std::numeric_limits<ListIdx>::max()
 Value to store in lookup grid when a node doesn't reference any list. More...
 

Typedef Documentation

◆ AccessImpl

◆ ActivateImpl

◆ DataArray

template<typename T >
using Felt::DataArray = typedef std::vector<T>

Array of grid data.

◆ DataImpl

◆ Dim

using Felt::Dim = typedef int

Grid dimension type.

◆ Distance

using Felt::Distance = typedef float

Isogrid or other distance value.

◆ LayerId

using Felt::LayerId = typedef int

Layer ID (in -L, ..., +L)

◆ Leaf

typedef typename Traits::Leaf Felt::Leaf

◆ ListIdx

using Felt::ListIdx = typedef std::size_t

Index of an item in a tracking list.

◆ Lookup

using Felt::Lookup = typedef typename Traits::Lookup

◆ LookupImpl

using Felt::LookupImpl = typedef Impl::Mixin::Lookup::MultiList::SingleIdx<This>

◆ LookupInterfaceImpl

◆ NodeIdx

using Felt::NodeIdx = typedef int

Grid node position vector element.

◆ PosIdx

using Felt::PosIdx = typedef std::size_t

Index of a position in a grid's data array.

◆ PosIdxList

using Felt::PosIdxList = typedef std::vector<PosIdx>

Array of position indices.

◆ SizeImpl

◆ TrackedImpl

◆ Traits

template<Dim D, TupleIdx N>
using Felt::Traits = typedef Impl::Traits<This>

◆ Tuple

template<typename T , TupleIdx N>
using Felt::Tuple = typedef VecDT<T, N>

Tuple of items.

◆ TupleIdx

using Felt::TupleIdx = typedef int

Index of an item in a tuple.

◆ Vec2f

using Felt::Vec2f = typedef VecDf<2>

Shorthand for 2D float vector.

◆ Vec2i

using Felt::Vec2i = typedef VecDi<2>

Shorthand for 2D integer vector.

◆ Vec2u

using Felt::Vec2u = typedef VecDu<2>

Shorthand for 2D unsigned integer vector.

◆ Vec3f

using Felt::Vec3f = typedef VecDf<3>

Shorthand for 3D float vector.

◆ Vec3i

using Felt::Vec3i = typedef VecDi<3>

Shorthand for 3D integer vector.

◆ Vec3u

using Felt::Vec3u = typedef VecDu<3>

Shorthand for 3D unsigned integer vector.

◆ VecDf

template<Dim D>
using Felt::VecDf = typedef VecDT<Distance, D>

Shorthand for D-dimensional Distance vector.

◆ VecDi

template<Dim D>
typedef Felt::VecDi< Traits::t_dims > Felt::VecDi

Shorthand for D-dimensional NodeIdx vector.

◆ VecDT

template<typename T , Dim D>
using Felt::VecDT = typedef Eigen::Matrix<T, D, 1>

Shorthand for D-dimensional vector with elements of T type.

◆ VecDu

template<Dim D>
using Felt::VecDu = typedef VecDT<unsigned, D>

Shorthand for D-dimensional unsigned integer vector.

Function Documentation

◆ format()

template<class Vec >
std::string Felt::format ( const Vec &  vec_)

String format a vector (useful for logging).

Parameters
vec_vector to stringify.
Returns
formatted vector.

◆ index() [1/2]

template<Dim D>
PosIdx Felt::index ( const VecDi< D > &  pos_,
const VecDi< D > &  size_,
const VecDi< D > &  offset_ 
)

Get index in data array of position vector.

The grid is packed in a 1D array, so this method is required to get the index in that array of the D-dimensional position.

THEN("the index of a point in the data array is reported correctly")
{
CHECK(Felt::index<3>(Vec3i(1, 0, -1), size, offset) == 613);
CHECK(grid.index(Vec3i(1, 0, -1)) == 613);
}
THEN("the point represented by an index in the data array is reported correctly")
{
CHECK(grid.index(613) == Vec3i(1, 0, -1));
CHECK(Felt::index<3>(613, size, offset) == Vec3i(1, 0, -1));
}
Parameters
pos_position in grid.
size_size of grid.
offset_spatial offset of grid.
Returns
index in data array of pos in grid of given size and offset.

◆ index() [2/2]

template<Dim D>
VecDi<D> Felt::index ( PosIdx  idx_,
const VecDi< D > &  size_,
const VecDi< D > &  offset_ = VecDi<D>::Zero() 
)

Get position of index.

Given an index and the dimensions and offset of a grid, calculate the position vector that the index pertains to in a representative 1D array.

THEN("the index of a point in the data array is reported correctly")
{
CHECK(Felt::index<3>(Vec3i(1, 0, -1), size, offset) == 613);
CHECK(grid.index(Vec3i(1, 0, -1)) == 613);
}
THEN("the point represented by an index in the data array is reported correctly")
{
CHECK(grid.index(613) == Vec3i(1, 0, -1));
CHECK(Felt::index<3>(613, size, offset) == Vec3i(1, 0, -1));
}
Parameters
idx_index in to query.
size_size of grid.
offset_spatial offset of grid.
Returns
position that the given index would represent in a grid of given size and offset.

◆ inside()

template<typename TPos , typename TBounds >
bool Felt::inside ( const TPos &  pos_,
const TBounds &  pos_min_,
const TBounds &  pos_max_ 
)

Test if a position is inside given bounds.

Template Parameters
Posthe type of position vector (i.e. float vs. int).
Parameters
pos_position in grid to query.
pos_min_minimum allowed position.
pos_max_one more than the maximum allowed position.
Returns
true if position lies inside the grid, false otherwise.

◆ MultiListSingleIdx()

Felt::MultiListSingleIdx ( const VecDi size,
const VecDi offset 
)

◆ sgn()

template<typename T >
auto Felt::sgn ( val_)

Get the sign of a value (+/-1).

Parameters
val_value to get signum for.
Returns
-1 for negative, +1 for positive.

◆ SingleListSingleIdxByValue()

Felt::SingleListSingleIdxByValue ( const VecDi size_,
const VecDi offset_,
const Leaf  background_ 
)

Variable Documentation

◆ null_idx

constexpr ListIdx Felt::null_idx = std::numeric_limits<ListIdx>::max()
static

Value to store in lookup grid when a node doesn't reference any list.