|
PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
|
Common functionality. More...
Classes | |
| class | BinaryRadixTree |
| Binary radix tree implementation. More... | |
| class | BruteSet |
| Fixed-size brute-force set implementation. More... | |
| class | Heap |
| Fixed-size max heap. More... | |
| struct | Overloaded |
| C++20 feature to allow multiple inheritance of operator() for lambdas. More... | |
| class | Queue |
| Fixed-size queue implementation. More... | |
| class | Stack |
| Fixed-size stack implementation. More... | |
Concepts | |
| concept | CArithmetic |
| Concept for arithmetic types. | |
| concept | CIndex |
| Concept for integral types. | |
| concept | CFloatingPoint |
| Concept for floating-point types. | |
| concept | CIndexRange |
| Range of integer types. | |
| concept | CContiguousIndexRange |
| Contiguous range of integer types. | |
| concept | CArithmeticRange |
| Range of arithmetic types. | |
| concept | CContiguousArithmeticRange |
| Contiguous range of arithmetic types. | |
| concept | CContiguousArithmeticMatrixRange |
| Range of Eigen fixed-size matrix types. | |
Functions | |
| template<std::integral TIndex, class FLess> | |
| auto | ArgSort (TIndex n, FLess less) -> Eigen::Vector< TIndex, Eigen::Dynamic > |
| Computes the indices that would sort an array. | |
| template<class... Ts, class F> | |
| constexpr void | ForTypes (F &&f) |
| Compile-time for loop over types. | |
| template<auto... Xs, class F> | |
| constexpr void | ForValues (F &&f) |
| Compile-time for loop over values. | |
| template<auto Begin, auto End, typename F> | |
| constexpr void | ForRange (F &&f) |
| Compile-time for loop over a range of values. | |
| template<std::random_access_iterator TWorkBegin, std::random_access_iterator TWorkEnd, std::random_access_iterator TValuesBegin, std::random_access_iterator TValuesEnd, class FKey, class T = typename std::iterator_traits<TValuesBegin>::value_type, class TKey = typename std::invoke_result_t<FKey, T>> | |
| void | CountingSort (TWorkBegin wb, TWorkEnd we, TValuesBegin vb, TValuesEnd ve, TKey keyMin=std::numeric_limits< TKey >::max(), FKey fKey=[](T const &key) { return key;}) |
| Counting sort. | |
| template<std::random_access_iterator TValuesBegin, std::random_access_iterator TValuesEnd, std::random_access_iterator TWorkBegin, class FKey> | |
| void | PrefixSumFromSortedKeys (TValuesBegin vb, TValuesEnd ve, TWorkBegin wb, FKey fKey) |
| template<CContiguousArithmeticRange R> | |
| auto | ToEigen (R &&r) -> Eigen::Map< Eigen::Vector< std::ranges::range_value_t< R >, Eigen::Dynamic > const > |
| Map a range of scalars to an eigen vector of such scalars. | |
| template<std::ranges::random_access_range R> | |
| auto | Slice (R &&r) |
| Slice view over a range for Eigen advanced indexing. | |
| template<typename T> | |
| void | HashCombineAccumulate (std::size_t &seed, T const &val) |
| Incrementally combine hash values of multiple arguments. | |
| template<typename... Types> | |
| std::size_t | HashCombine (Types const &... args) |
| Combine hash values of multiple arguments. | |
| template<CIndexRange R, std::integral TIndex = std::ranges::range_value_t<R>> | |
| auto | CumSum (R &&sizes) -> Eigen::Vector< TIndex, Eigen::Dynamic > |
| Cumulative sum of a range of integers. | |
| template<std::integral TIndex> | |
| auto | Counts (auto begin, auto end, TIndex ncounts) -> Eigen::Vector< TIndex, Eigen::Dynamic > |
| Counts the number of occurrences of each integer in a contiguous range. | |
| template<std::integral TIndex> | |
| auto | Shuffle (TIndex begin, TIndex end) -> Eigen::Vector< TIndex, Eigen::Dynamic > |
| Randomly shuffle a range of integers. | |
| template<std::integral TIndexB, std::integral TIndexE, class Func, class TIndex = std::common_type_t<TIndexB, TIndexE>> | |
| auto | Filter (TIndexB begin, TIndexE end, Func &&f) -> Eigen::Vector< TIndex, Eigen::Dynamic > |
| Filters a range of integers based on a predicate function. | |
| template<class TDerivedX, class TDerivedR, class TScalar = typename TDerivedX::Scalar, std::integral TIndex = typename TDerivedR::Scalar> | |
| auto | Repeat (Eigen::DenseBase< TDerivedX > const &x, Eigen::DenseBase< TDerivedR > const &r) -> Eigen::Vector< TScalar, Eigen::Dynamic > |
| Repeats elements of a vector according to a repetition vector. | |
| auto | Modulo (auto a, auto b) |
| template<class FVisit, class FChild, class TIndex = Index, auto N = 2, auto kStackDepth = 64> | |
| PBAT_HOST_DEVICE void | TraverseNAryTreePseudoPreOrder (FVisit fVisit, FChild fChild, TIndex root=0) |
| Pre-order traversal over an n-ary tree starting from root. | |
| template<class FVisit, class FChild, class TIndex = Index, auto N = 2, auto kStackDepth = 64> | |
| PBAT_HOST_DEVICE void | TraverseNAryTreePseudoPostOrder (FVisit fVisit, FChild fChild, TIndex root=0) |
| Post-order traversal over an n-ary tree starting from root. | |
| template<std::random_access_iterator TValuesBegin, std::random_access_iterator TValuesEnd, std::random_access_iterator TPermutationBegin> | |
| void | Permute (TValuesBegin vb, TValuesEnd ve, TPermutationBegin pb) |
| Permute the values in-place according to the permutation. | |
Common functionality.
| auto pbat::common::ArgSort | ( | TIndex | n, |
| FLess | less ) -> Eigen::Vector<TIndex, Eigen::Dynamic> |
Computes the indices that would sort an array.
| TIndex | Coefficient type of returned vector |
| FLess | Callable with signature bool(TIndex, TIndex) |
| n | Number of elements |
| less | Less-than comparison function object |
|n| array of indices that would sort the input array | void pbat::common::CountingSort | ( | TWorkBegin | wb, |
| TWorkEnd | we, | ||
| TValuesBegin | vb, | ||
| TValuesEnd | ve, | ||
| TKey | keyMin = std::numeric_limits<TKey>::max(), | ||
| FKey | fKey = [](T const& key) { return key; } ) |
Counting sort.
| TWorkBegin | Iterator type to the beginning of the work array |
| TWorkEnd | Iterator type to the end of the work array |
| TValuesBegin | Iterator type to the beginning of the values |
| TValuesEnd | Iterator type to the end of the values |
| FKey | Key accessor callable with signature TKey(T) |
| T | Value type |
| TKey | Key type |
| wb | Iterator to the beginning of the work array |
| we | Iterator to the end of the work array |
| vb | Iterator to the beginning of values |
| ve | Iterator to the end of values |
| keyMin | Minimum key value |
| fKey | Key accessor callable |
*(wb+i) == 0 for all i in [0, std::distance(wb,we)) | auto pbat::common::Counts | ( | auto | begin, |
| auto | end, | ||
| TIndex | ncounts ) -> Eigen::Vector<TIndex, Eigen::Dynamic> |
Counts the number of occurrences of each integer in a contiguous range.
| TIndex | Integer type of counts |
| begin | Range begin |
| end | Range end (exclusive) |
| ncounts | Upper bound on values in range |
| auto pbat::common::CumSum | ( | R && | sizes | ) | -> Eigen::Vector<TIndex, Eigen::Dynamic> |
Cumulative sum of a range of integers.
| R | Integer range type |
| TIndex | Type of the integers |
| sizes | Range of integers |
| auto pbat::common::Filter | ( | TIndexB | begin, |
| TIndexE | end, | ||
| Func && | f ) -> Eigen::Vector<TIndex, Eigen::Dynamic> |
Filters a range of integers based on a predicate function.
| TIndexB | Type of the beginning index |
| TIndexE | Type of the ending index |
| Func | Predicate function type (TIndex -> bool) |
| TIndex | Common type of the indices |
| begin | Start of the range (inclusive) |
| end | End of the range (exclusive) |
| f | Predicate function to filter the range |
|
constexpr |
Compile-time for loop over a range of values.
| Begin | Starting loop index |
| End | Ending loop index (exclusive) |
| F | Callable with signature void operator()<decltype(Begin)>() |
| f | Function object to call |
|
constexpr |
Compile-time for loop over types.
| Ts | Types to loop over |
| F | Callable with signature void operator()<T>() |
| f | Function object to call |
|
constexpr |
Compile-time for loop over values.
| Xs | Values to loop over |
| F | Callable with signature void operator()<X>() |
| f | Function object to call |
| std::size_t pbat::common::HashCombine | ( | Types const &... | args | ) |
Combine hash values of multiple arguments.
| Types | Hashable types |
| args | Arguments to hash |
| void pbat::common::HashCombineAccumulate | ( | std::size_t & | seed, |
| T const & | val ) |
Incrementally combine hash values of multiple arguments.
| T | Hashable type |
| seed | Starting hash value |
| val | Value to hash |
| void pbat::common::Permute | ( | TValuesBegin | vb, |
| TValuesEnd | ve, | ||
| TPermutationBegin | pb ) |
Permute the values in-place according to the permutation.
Taken from SO
| TValuesBegin | Iterator type to the beginning of the values |
| TValuesEnd | Iterator type to the end of the values |
| TPermutationBegin | Iterator type to the beginning of the permutation |
| vb | Iterator to the beginning of values |
| ve | Iterator to the end of values |
| pb | Iterator to the beginning of permutation |
pb is un-modified. [vb, ve) are permuted according to the permutation. | void pbat::common::PrefixSumFromSortedKeys | ( | TValuesBegin | vb, |
| TValuesEnd | ve, | ||
| TWorkBegin | wb, | ||
| FKey | fKey ) |
| FKey | |
| TValuesBegin | |
| TValuesEnd | |
| TWorkBegin |
| vb | |
| ve | |
| wb | |
| fKey |
| auto pbat::common::Repeat | ( | Eigen::DenseBase< TDerivedX > const & | x, |
| Eigen::DenseBase< TDerivedR > const & | r ) -> Eigen::Vector<TScalar, Eigen::Dynamic> |
Repeats elements of a vector according to a repetition vector.
Similar to numpy.repeat
| TDerivedX | Eigen dense expression of the input vector |
| TDerivedR | Eigen dense expression of the repetition vector |
| TScalar | Scalar type of the input vector |
| TIndex | Integer type of the repetition vector |
| x | Values to repeat |
| r | Repetition vector |
| auto pbat::common::Shuffle | ( | TIndex | begin, |
| TIndex | end ) -> Eigen::Vector<TIndex, Eigen::Dynamic> |
Randomly shuffle a range of integers.
| TIndex | Integer type of the range |
| begin | Start of the range (inclusive) |
| end | End of the range (exclusive) |
| auto pbat::common::Slice | ( | R && | r | ) |
Slice view over a range for Eigen advanced indexing.
| R | Range type |
| r | Range |
| auto pbat::common::ToEigen | ( | R && | r | ) | -> Eigen::Map<Eigen::Vector<std::ranges::range_value_t<R>, Eigen::Dynamic> const> |
Map a range of scalars to an eigen vector of such scalars.
Map a range of scalar matrices to an eigen vector of such scalars.
| R | Range type |
| r | Range |
| R | Range type |
| r | Range |
| PBAT_HOST_DEVICE void pbat::common::TraverseNAryTreePseudoPostOrder | ( | FVisit | fVisit, |
| FChild | fChild, | ||
| TIndex | root = 0 ) |
Post-order traversal over an n-ary tree starting from root.
| FVisit | Function to visit a node |
| FChild | Function to get the child of a node |
| TIndex | Type of the index |
| N | Number of children per node |
| kStackDepth | Maximum depth of the traversal's stack. The actual stack depth will be N*kStackDepth. |
| fVisit | void(TIndex node) function to visit a node. |
| fChild | template <TIndex c> TIndex(TIndex node) function to get child c of a node. Returns the child index or -1 if no child. |
| root | Index of the root node to start the search from |
| PBAT_HOST_DEVICE void pbat::common::TraverseNAryTreePseudoPreOrder | ( | FVisit | fVisit, |
| FChild | fChild, | ||
| TIndex | root = 0 ) |
Pre-order traversal over an n-ary tree starting from root.
| FVisit | Function to visit a node |
| FChild | Function to get the child of a node |
| TIndex | Type of the index |
| N | Number of children per node |
| kStackDepth | Maximum depth of the traversal's stack |
| fVisit | bool(TIndex node) function to visit a node. Returns true if node's sub-tree should be visited. |
| fChild | template <TIndex c> TIndex(TIndex node) function to get child c of a node. Returns the child index or -1 if no child. |
| root | Index of the root node to start the search from |