MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ compute_arc_length_table()

MAYAFLUX_API Eigen::VectorXd MayaFlux::Kinesis::compute_arc_length_table ( const Eigen::MatrixXd &  points)

Compute arc length parameterization table.

Parameters
pointsColumns are sequential points along curve
Returns
Vector of cumulative arc lengths

Definition at line 901 of file MotionCurves.cpp.

902{
903 const Eigen::Index n = points.cols();
904
905 Eigen::VectorXd arc_lengths(n);
906 if (n == 0) {
907 return arc_lengths;
908 }
909
910 arc_lengths(0) = 0.0;
911 if (n == 1) {
912 return arc_lengths;
913 }
914
915 if (n >= k_parallel_min_points) {
916 P::for_each(P::par_unseq,
917 std::views::iota(Eigen::Index { 1 }, n).begin(),
918 std::views::iota(Eigen::Index { 1 }, n).end(),
919 [&](Eigen::Index i) {
920 arc_lengths(i) = (points.col(i) - points.col(i - 1)).norm();
921 });
922 } else {
923 for (Eigen::Index i = 1; i < n; ++i) {
924 arc_lengths(i) = (points.col(i) - points.col(i - 1)).norm();
925 }
926 }
927
928 std::inclusive_scan(
929 arc_lengths.data() + 1,
930 arc_lengths.data() + n,
931 arc_lengths.data() + 1);
932
933 return arc_lengths;
934}
std::vector< glm::vec2 > * points

References compute_arc_length_table(), and points.

Referenced by compute_arc_length_table().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: