MayaFlux 1.0.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 1041 of file MotionCurves.cpp.

1042{
1043 const Eigen::Index n = points.cols();
1044
1045 Eigen::VectorXd arc_lengths(n);
1046 if (n == 0) {
1047 return arc_lengths;
1048 }
1049
1050 arc_lengths(0) = 0.0;
1051 if (n == 1) {
1052 return arc_lengths;
1053 }
1054
1055 if (n >= k_parallel_min_points) {
1056 std::for_each(std::execution::par_unseq,
1057 std::views::iota(Eigen::Index { 1 }, n).begin(),
1058 std::views::iota(Eigen::Index { 1 }, n).end(),
1059 [&](Eigen::Index i) {
1060 arc_lengths(i) = (points.col(i) - points.col(i - 1)).norm();
1061 });
1062 } else {
1063 for (Eigen::Index i = 1; i < n; ++i) {
1064 arc_lengths(i) = (points.col(i) - points.col(i - 1)).norm();
1065 }
1066 }
1067
1068 std::inclusive_scan(
1069 arc_lengths.data() + 1,
1070 arc_lengths.data() + n,
1071 arc_lengths.data() + 1);
1072
1073 return arc_lengths;
1074}
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: