pymomentum-cpu 0.1.82.post0__cp313-cp313-manylinux_2_39_x86_64.whl → 0.1.83.post0__cp313-cp313-manylinux_2_39_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pymomentum-cpu might be problematic. Click here for more details.
- include/axel/DualContouring.h +1 -1
- include/axel/MeshToSdf.h +10 -10
- include/axel/SimdKdTree.h +19 -19
- include/axel/math/CoplanarityCheck.h +4 -4
- include/axel/math/MeshHoleFilling.h +9 -9
- include/momentum/character/blend_shape.h +4 -4
- include/momentum/character/blend_shape_base.h +1 -1
- include/momentum/character/character_utility.h +1 -1
- include/momentum/character/linear_skinning.h +2 -2
- include/momentum/character/parameter_transform.h +2 -2
- include/momentum/character_sequence_solver/model_parameters_sequence_error_function.h +9 -9
- include/momentum/character_sequence_solver/multipose_solver_function.h +1 -1
- include/momentum/character_sequence_solver/sequence_error_function.h +9 -9
- include/momentum/character_sequence_solver/sequence_solver_function.h +1 -1
- include/momentum/character_sequence_solver/state_sequence_error_function.h +9 -9
- include/momentum/character_sequence_solver/vertex_sequence_error_function.h +14 -14
- include/momentum/character_solver/constraint_error_function.h +2 -2
- include/momentum/character_solver/pose_prior_error_function.h +1 -1
- include/momentum/character_solver/skeleton_solver_function.h +2 -2
- include/momentum/gui/rerun/logger.h +6 -6
- include/momentum/io/character_io.h +3 -3
- include/momentum/io/common/gsl_utils.h +2 -2
- include/momentum/io/common/stream_utils.h +4 -4
- include/momentum/io/fbx/fbx_io.h +59 -12
- include/momentum/io/fbx/fbx_memory_stream.h +3 -3
- include/momentum/io/fbx/openfbx_loader.h +10 -3
- include/momentum/io/fbx/polygon_data.h +3 -3
- include/momentum/io/gltf/gltf_builder.h +2 -2
- include/momentum/io/gltf/gltf_io.h +6 -6
- include/momentum/io/gltf/utils/accessor_utils.h +6 -6
- include/momentum/io/legacy_json/legacy_json_io.h +2 -2
- include/momentum/io/marker/marker_io.h +1 -1
- include/momentum/io/motion/mmo_io.h +7 -7
- include/momentum/io/skeleton/locator_io.h +2 -2
- include/momentum/io/skeleton/mppca_io.h +2 -2
- include/momentum/io/skeleton/parameter_transform_io.h +3 -3
- include/momentum/io/urdf/urdf_io.h +3 -3
- include/momentum/io/usd/usd_io.h +2 -2
- include/momentum/marker_tracking/app_utils.h +1 -1
- include/momentum/marker_tracking/marker_tracker.h +8 -8
- include/momentum/marker_tracking/tracker_utils.h +2 -2
- include/momentum/math/mppca.h +1 -1
- include/momentum/math/online_householder_qr.h +5 -5
- include/momentum/math/transform.h +2 -2
- include/momentum/math/types.h +10 -10
- include/momentum/math/utility.h +2 -2
- include/momentum/rasterizer/rasterizer.h +24 -24
- lib/cmake/axel/axelTargets.cmake +1 -1
- lib/libarrow.a +0 -0
- lib/libarrow_bundled_dependencies.a +0 -0
- lib/libaxel.a +0 -0
- lib/libmomentum_app_utils.a +0 -0
- lib/libmomentum_character.a +0 -0
- lib/libmomentum_character_sequence_solver.a +0 -0
- lib/libmomentum_character_solver.a +0 -0
- lib/libmomentum_common.a +0 -0
- lib/libmomentum_diff_ik.a +0 -0
- lib/libmomentum_io.a +0 -0
- lib/libmomentum_io_common.a +0 -0
- lib/libmomentum_io_fbx.a +0 -0
- lib/libmomentum_io_gltf.a +0 -0
- lib/libmomentum_io_legacy_json.a +0 -0
- lib/libmomentum_io_marker.a +0 -0
- lib/libmomentum_io_motion.a +0 -0
- lib/libmomentum_io_shape.a +0 -0
- lib/libmomentum_io_skeleton.a +0 -0
- lib/libmomentum_io_urdf.a +0 -0
- lib/libmomentum_marker_tracker.a +0 -0
- lib/libmomentum_math.a +0 -0
- lib/libmomentum_online_qr.a +0 -0
- lib/libmomentum_process_markers.a +0 -0
- lib/libmomentum_rerun.a +0 -0
- lib/libmomentum_simd_constraints.a +0 -0
- lib/libmomentum_simd_generalized_loss.a +0 -0
- lib/libmomentum_skeleton.a +0 -0
- lib/libmomentum_solver.a +0 -0
- lib/librerun_sdk.a +0 -0
- pymomentum/axel.cpython-313-x86_64-linux-gnu.so +0 -0
- pymomentum/geometry.cpython-313-x86_64-linux-gnu.so +0 -0
- pymomentum/marker_tracking.cpython-313-x86_64-linux-gnu.so +0 -0
- pymomentum/solver.cpython-313-x86_64-linux-gnu.so +0 -0
- pymomentum/solver2.cpython-313-x86_64-linux-gnu.so +0 -0
- {pymomentum_cpu-0.1.82.post0.dist-info → pymomentum_cpu-0.1.83.post0.dist-info}/METADATA +6 -4
- {pymomentum_cpu-0.1.82.post0.dist-info → pymomentum_cpu-0.1.83.post0.dist-info}/RECORD +86 -86
- {pymomentum_cpu-0.1.82.post0.dist-info → pymomentum_cpu-0.1.83.post0.dist-info}/WHEEL +0 -0
- {pymomentum_cpu-0.1.82.post0.dist-info → pymomentum_cpu-0.1.83.post0.dist-info}/licenses/LICENSE +0 -0
include/axel/DualContouring.h
CHANGED
include/axel/MeshToSdf.h
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#include <vector>
|
|
13
13
|
|
|
14
14
|
#include <Eigen/Core>
|
|
15
|
-
#include <
|
|
15
|
+
#include <span>
|
|
16
16
|
|
|
17
17
|
#include "axel/BoundingBox.h"
|
|
18
18
|
#include "axel/SignedDistanceField.h"
|
|
@@ -53,8 +53,8 @@ struct MeshToSdfConfig {
|
|
|
53
53
|
*/
|
|
54
54
|
template <typename ScalarType>
|
|
55
55
|
SignedDistanceField<ScalarType> meshToSdf(
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
std::span<const Eigen::Vector3<ScalarType>> vertices,
|
|
57
|
+
std::span<const Eigen::Vector3i> triangles,
|
|
58
58
|
const BoundingBox<ScalarType>& bounds,
|
|
59
59
|
const Eigen::Vector3<Index>& resolution,
|
|
60
60
|
const MeshToSdfConfig<ScalarType>& config = {});
|
|
@@ -71,8 +71,8 @@ SignedDistanceField<ScalarType> meshToSdf(
|
|
|
71
71
|
*/
|
|
72
72
|
template <typename ScalarType>
|
|
73
73
|
SignedDistanceField<ScalarType> meshToSdf(
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
std::span<const Eigen::Vector3<ScalarType>> vertices,
|
|
75
|
+
std::span<const Eigen::Vector3i> triangles,
|
|
76
76
|
const Eigen::Vector3<Index>& resolution,
|
|
77
77
|
ScalarType padding = ScalarType{0.1},
|
|
78
78
|
const MeshToSdfConfig<ScalarType>& config = {});
|
|
@@ -88,8 +88,8 @@ namespace detail {
|
|
|
88
88
|
*/
|
|
89
89
|
template <typename ScalarType>
|
|
90
90
|
void initializeNarrowBand(
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
std::span<const Eigen::Vector3<ScalarType>> vertices,
|
|
92
|
+
std::span<const Eigen::Vector3i> triangles,
|
|
93
93
|
SignedDistanceField<ScalarType>& sdf,
|
|
94
94
|
ScalarType bandWidth);
|
|
95
95
|
|
|
@@ -105,14 +105,14 @@ void fastMarchingPropagate(SignedDistanceField<ScalarType>& sdf);
|
|
|
105
105
|
template <typename ScalarType>
|
|
106
106
|
void applySignsToDistanceField(
|
|
107
107
|
SignedDistanceField<ScalarType>& sdf,
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
std::span<const Eigen::Vector3<ScalarType>> vertices,
|
|
109
|
+
std::span<const Eigen::Vector3i> triangles);
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
112
|
* Compute mesh bounding box from vertex spans.
|
|
113
113
|
*/
|
|
114
114
|
template <typename ScalarType>
|
|
115
|
-
BoundingBox<ScalarType> computeMeshBounds(
|
|
115
|
+
BoundingBox<ScalarType> computeMeshBounds(std::span<const Eigen::Vector3<ScalarType>> vertices);
|
|
116
116
|
|
|
117
117
|
} // namespace detail
|
|
118
118
|
|
include/axel/SimdKdTree.h
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
#include <Eigen/Core>
|
|
14
14
|
#include <Eigen/Geometry>
|
|
15
|
-
#include <
|
|
15
|
+
#include <span>
|
|
16
16
|
|
|
17
17
|
#ifdef AXEL_ENABLE_AVX
|
|
18
18
|
#include <immintrin.h>
|
|
@@ -60,9 +60,9 @@ class SimdKdTreef {
|
|
|
60
60
|
|
|
61
61
|
/// Constructs k-d tree from points, normals, and colors.
|
|
62
62
|
explicit SimdKdTreef(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
std::span<const Vec> points = std::span<Vec>{},
|
|
64
|
+
std::span<const Vec> normals = std::span<Vec>{},
|
|
65
|
+
std::span<const Col> colors = std::span<Col>{});
|
|
66
66
|
|
|
67
67
|
/// Destructor.
|
|
68
68
|
virtual ~SimdKdTreef();
|
|
@@ -147,8 +147,8 @@ class SimdKdTreef {
|
|
|
147
147
|
/// Returns the index of that new node.
|
|
148
148
|
SizeType split(
|
|
149
149
|
std::vector<std::pair<SizeType, Vec>>& points,
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
std::span<const Vec> normals,
|
|
151
|
+
std::span<const Col> colors,
|
|
152
152
|
SizeType start,
|
|
153
153
|
SizeType end,
|
|
154
154
|
SizeType depth);
|
|
@@ -156,8 +156,8 @@ class SimdKdTreef {
|
|
|
156
156
|
/// Creates a leaf node when the number of points is equal to or greater than 8 SIMD blocks.
|
|
157
157
|
virtual SizeType createLeafNode(
|
|
158
158
|
std::vector<std::pair<SizeType, Vec>>& points,
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
std::span<const Vec> normals,
|
|
160
|
+
std::span<const Col> colors,
|
|
161
161
|
SizeType start,
|
|
162
162
|
SizeType end,
|
|
163
163
|
const Box& box);
|
|
@@ -227,9 +227,9 @@ class SimdKdTreef {
|
|
|
227
227
|
private:
|
|
228
228
|
/// Initializes the k-d tree. This function is intended to be only called by the constructor.
|
|
229
229
|
void init(
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
230
|
+
std::span<const Vec> points_in,
|
|
231
|
+
std::span<const Vec> normals_in,
|
|
232
|
+
std::span<const Col> colors_in);
|
|
233
233
|
|
|
234
234
|
/// PIMPL idiom to hide the SIMD specific implementation.
|
|
235
235
|
struct Implementation;
|
|
@@ -267,9 +267,9 @@ class SimdKdTreeAvxf : public SimdKdTreef<nDim> {
|
|
|
267
267
|
|
|
268
268
|
/// Constructs k-d tree from points, normals, and colors
|
|
269
269
|
explicit SimdKdTreeAvxf(
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
270
|
+
std::span<const Vec> points = std::span<Vec>{},
|
|
271
|
+
std::span<const Vec> normals = std::span<Vec>{},
|
|
272
|
+
std::span<const Col> colors = std::span<Col>{});
|
|
273
273
|
|
|
274
274
|
/// Destructor
|
|
275
275
|
~SimdKdTreeAvxf() override;
|
|
@@ -350,8 +350,8 @@ class SimdKdTreeAvxf : public SimdKdTreef<nDim> {
|
|
|
350
350
|
// Documentation inherited
|
|
351
351
|
SizeType createLeafNode(
|
|
352
352
|
std::vector<std::pair<SizeType, Vec>>& points,
|
|
353
|
-
|
|
354
|
-
|
|
353
|
+
std::span<const Vec> normals,
|
|
354
|
+
std::span<const Col> colors,
|
|
355
355
|
SizeType start,
|
|
356
356
|
SizeType end,
|
|
357
357
|
const Box& box) override;
|
|
@@ -380,9 +380,9 @@ class SimdKdTreeAvxf : public SimdKdTreef<nDim> {
|
|
|
380
380
|
|
|
381
381
|
/// Initializes the k-d tree. This function is intended to be only called by the constructor.
|
|
382
382
|
void init(
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
383
|
+
std::span<const Vec> points_in,
|
|
384
|
+
std::span<const Vec> normals_in,
|
|
385
|
+
std::span<const Col> colors_in);
|
|
386
386
|
|
|
387
387
|
std::vector<PointBlock> pointBlocks_;
|
|
388
388
|
std::vector<NormalBlock> normalBlocks_;
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
#include <Eigen/Core>
|
|
11
|
-
#include <
|
|
11
|
+
#include <span>
|
|
12
12
|
|
|
13
13
|
namespace axel {
|
|
14
14
|
|
|
15
|
-
int solveP3(
|
|
16
|
-
int solveP2(
|
|
15
|
+
int solveP3(std::span<double, 3> x, double a, double b, double c);
|
|
16
|
+
int solveP2(std::span<double, 2> x, double a, double b, double c);
|
|
17
17
|
|
|
18
18
|
/* Find times when the four points with given velocities are coplanar in 3D space */
|
|
19
19
|
int timesCoplanar(
|
|
20
|
-
|
|
20
|
+
std::span<double, 3> t,
|
|
21
21
|
const Eigen::Vector3d& x1,
|
|
22
22
|
const Eigen::Vector3d& x2,
|
|
23
23
|
const Eigen::Vector3d& x3,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
#include <Eigen/Core>
|
|
15
15
|
#include <Eigen/Geometry>
|
|
16
|
-
#include <
|
|
16
|
+
#include <span>
|
|
17
17
|
|
|
18
18
|
#include "axel/common/Types.h"
|
|
19
19
|
|
|
@@ -64,8 +64,8 @@ struct HoleFillingResult {
|
|
|
64
64
|
* @return List of detected hole boundaries
|
|
65
65
|
*/
|
|
66
66
|
std::vector<HoleBoundary> detectMeshHoles(
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
std::span<const Eigen::Vector3f> vertices,
|
|
68
|
+
std::span<const Eigen::Vector3i> triangles);
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* Fill holes in a triangle mesh using advancing front method.
|
|
@@ -79,8 +79,8 @@ std::vector<HoleBoundary> detectMeshHoles(
|
|
|
79
79
|
*/
|
|
80
80
|
template <typename ScalarType>
|
|
81
81
|
HoleFillingResult fillMeshHoles(
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
std::span<const Eigen::Vector3<ScalarType>> vertices,
|
|
83
|
+
std::span<const Eigen::Vector3i> triangles);
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
86
|
* Convenience function that fills holes and returns complete mesh.
|
|
@@ -92,8 +92,8 @@ HoleFillingResult fillMeshHoles(
|
|
|
92
92
|
template <typename ScalarType>
|
|
93
93
|
std::pair<std::vector<Eigen::Vector3<ScalarType>>, std::vector<Eigen::Vector3i>>
|
|
94
94
|
fillMeshHolesComplete(
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
std::span<const Eigen::Vector3<ScalarType>> vertices,
|
|
96
|
+
std::span<const Eigen::Vector3i> triangles);
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
99
|
* Apply Laplacian smoothing to mesh vertices with optional masking.
|
|
@@ -108,8 +108,8 @@ fillMeshHolesComplete(
|
|
|
108
108
|
*/
|
|
109
109
|
template <typename ScalarType, typename FaceType>
|
|
110
110
|
std::vector<Eigen::Vector3<ScalarType>> smoothMeshLaplacian(
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
std::span<const Eigen::Vector3<ScalarType>> vertices,
|
|
112
|
+
std::span<const FaceType> faces,
|
|
113
113
|
const std::vector<bool>& vertex_mask = {},
|
|
114
114
|
Index iterations = 1,
|
|
115
115
|
ScalarType step = ScalarType{0.5});
|
|
@@ -22,9 +22,9 @@ struct BlendShape : public BlendShapeBase {
|
|
|
22
22
|
|
|
23
23
|
/// @param baseShape Base shape vertices
|
|
24
24
|
/// @param numShapes Number of blend shapes
|
|
25
|
-
BlendShape(
|
|
25
|
+
BlendShape(std::span<const Vector3f> baseShape, size_t numShapes);
|
|
26
26
|
|
|
27
|
-
void setBaseShape(
|
|
27
|
+
void setBaseShape(std::span<const Vector3f> baseShape) {
|
|
28
28
|
baseShape_.assign(baseShape.begin(), baseShape.end());
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -67,7 +67,7 @@ struct BlendShape : public BlendShapeBase {
|
|
|
67
67
|
/// @param weights Optional per-vertex importance weights
|
|
68
68
|
/// @return Estimated blend shape coefficients
|
|
69
69
|
[[nodiscard]] VectorXf estimateCoefficients(
|
|
70
|
-
|
|
70
|
+
std::span<const Vector3f> vertices,
|
|
71
71
|
float regularization = 1.0f,
|
|
72
72
|
const VectorXf& weights = VectorXf()) const;
|
|
73
73
|
|
|
@@ -75,7 +75,7 @@ struct BlendShape : public BlendShapeBase {
|
|
|
75
75
|
///
|
|
76
76
|
/// @param index Index of the shape vector to set
|
|
77
77
|
/// @param shapeVector Vector of vertex offsets
|
|
78
|
-
void setShapeVector(size_t index,
|
|
78
|
+
void setShapeVector(size_t index, std::span<const Vector3f> shapeVector);
|
|
79
79
|
|
|
80
80
|
/// Compares all components of two blend shapes
|
|
81
81
|
///
|
|
@@ -52,7 +52,7 @@ struct BlendShapeBase {
|
|
|
52
52
|
|
|
53
53
|
/// @param index Index of the shape vector to set
|
|
54
54
|
/// @param shapeVector Vector of vertex offsets
|
|
55
|
-
void setShapeVector(size_t index,
|
|
55
|
+
void setShapeVector(size_t index, std::span<const Vector3f> shapeVector);
|
|
56
56
|
|
|
57
57
|
[[nodiscard]] Eigen::Index shapeSize() const {
|
|
58
58
|
return shapeVectors_.cols();
|
|
@@ -62,7 +62,7 @@ namespace momentum {
|
|
|
62
62
|
/// specified joints.
|
|
63
63
|
[[nodiscard]] Character removeJoints(
|
|
64
64
|
const Character& character,
|
|
65
|
-
|
|
65
|
+
std::span<const size_t> jointsToRemove);
|
|
66
66
|
|
|
67
67
|
/// Maps the input ModelParameter motion to a target character by matching model parameter names.
|
|
68
68
|
/// Mismatched names will be discarded (source) or set to zero (target).
|
|
@@ -116,7 +116,7 @@ Affine3f getInverseSSDTransformation(
|
|
|
116
116
|
std::vector<Vector3f> applyInverseSSD(
|
|
117
117
|
const TransformationList& inverseBindPose,
|
|
118
118
|
const SkinWeights& skin,
|
|
119
|
-
|
|
119
|
+
std::span<const Vector3f> points,
|
|
120
120
|
const SkeletonState& state);
|
|
121
121
|
|
|
122
122
|
/// Applies inverse SSD to points, storing results in a mesh
|
|
@@ -132,7 +132,7 @@ std::vector<Vector3f> applyInverseSSD(
|
|
|
132
132
|
void applyInverseSSD(
|
|
133
133
|
const TransformationList& inverseBindPose,
|
|
134
134
|
const SkinWeights& skin,
|
|
135
|
-
|
|
135
|
+
std::span<const Vector3f> points,
|
|
136
136
|
const SkeletonState& state,
|
|
137
137
|
Mesh& mesh);
|
|
138
138
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
#include <momentum/character/types.h>
|
|
12
12
|
#include <momentum/math/utility.h>
|
|
13
13
|
|
|
14
|
-
#include <
|
|
14
|
+
#include <span>
|
|
15
15
|
|
|
16
16
|
#include <string>
|
|
17
17
|
#include <unordered_map>
|
|
@@ -102,7 +102,7 @@ struct ParameterTransformT {
|
|
|
102
102
|
|
|
103
103
|
/// Return a ParameterTransform object where the model parameters are identical to the joint
|
|
104
104
|
/// parameters.
|
|
105
|
-
[[nodiscard]] static ParameterTransformT<T> identity(
|
|
105
|
+
[[nodiscard]] static ParameterTransformT<T> identity(std::span<const std::string> jointNames);
|
|
106
106
|
|
|
107
107
|
/// Compute activeJointParams based on the transform and the input ParameterSet.
|
|
108
108
|
[[nodiscard]] VectorX<bool> computeActiveJointParams(const ParameterSet& ps = allParams()) const;
|
|
@@ -24,13 +24,13 @@ class ModelParametersSequenceErrorFunctionT : public SequenceErrorFunctionT<T> {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
double getError(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
std::span<const ModelParametersT<T>> modelParameters,
|
|
28
|
+
std::span<const SkeletonStateT<T>> skelStates,
|
|
29
|
+
std::span<const MeshStateT<T>> meshStates) const final;
|
|
30
30
|
double getGradient(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
std::span<const ModelParametersT<T>> modelParameters,
|
|
32
|
+
std::span<const SkeletonStateT<T>> skelStates,
|
|
33
|
+
std::span<const MeshStateT<T>> meshStates,
|
|
34
34
|
Eigen::Ref<Eigen::VectorX<T>> gradient) const final;
|
|
35
35
|
|
|
36
36
|
// modelParameters: [numFrames() * parameterTransform] parameter vector
|
|
@@ -38,9 +38,9 @@ class ModelParametersSequenceErrorFunctionT : public SequenceErrorFunctionT<T> {
|
|
|
38
38
|
// jacobian: [getJacobianSize()] x [numFrames() * parameterTransform] Jacobian matrix
|
|
39
39
|
// residual: [getJacobianSize()] residual vector.
|
|
40
40
|
double getJacobian(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
std::span<const ModelParametersT<T>> modelParameters,
|
|
42
|
+
std::span<const SkeletonStateT<T>> skelStates,
|
|
43
|
+
std::span<const MeshStateT<T>> meshStates,
|
|
44
44
|
Eigen::Ref<Eigen::MatrixX<T>> jacobian,
|
|
45
45
|
Eigen::Ref<Eigen::VectorX<T>> residual,
|
|
46
46
|
int& usedRows) const final;
|
|
@@ -22,7 +22,7 @@ class MultiposeSolverFunctionT : public SolverFunctionT<T> {
|
|
|
22
22
|
MultiposeSolverFunctionT(
|
|
23
23
|
const Skeleton* skel,
|
|
24
24
|
const ParameterTransformT<T>* parameterTransform,
|
|
25
|
-
|
|
25
|
+
std::span<const int> universal,
|
|
26
26
|
size_t frames);
|
|
27
27
|
~MultiposeSolverFunctionT() override;
|
|
28
28
|
|
|
@@ -46,9 +46,9 @@ class SequenceErrorFunctionT {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
[[nodiscard]] virtual double getError(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
std::span<const ModelParametersT<T>> /* modelParameters */,
|
|
50
|
+
std::span<const SkeletonStateT<T>> /* skelStates */,
|
|
51
|
+
std::span<const MeshStateT<T>> /* meshStates */) const {
|
|
52
52
|
return 0.0f;
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -58,9 +58,9 @@ class SequenceErrorFunctionT {
|
|
|
58
58
|
// meshStates: [numFrames()] array of mesh states
|
|
59
59
|
// gradient: [numFrames() * parameterTransform] gradient vector
|
|
60
60
|
virtual double getGradient(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
std::span<const ModelParametersT<T>> /* modelParameters */,
|
|
62
|
+
std::span<const SkeletonStateT<T>> /* skelStates */,
|
|
63
|
+
std::span<const MeshStateT<T>> /* meshStates */,
|
|
64
64
|
Eigen::Ref<Eigen::VectorX<T>> /* gradient */) const {
|
|
65
65
|
return 0.0f;
|
|
66
66
|
}
|
|
@@ -71,9 +71,9 @@ class SequenceErrorFunctionT {
|
|
|
71
71
|
// jacobian: [getJacobianSize()] x [numFrames() * parameterTransform] Jacobian matrix
|
|
72
72
|
// residual: [getJacobianSize()] residual vector.
|
|
73
73
|
virtual double getJacobian(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
std::span<const ModelParametersT<T>> /* modelParameters */,
|
|
75
|
+
std::span<const SkeletonStateT<T>> /* skelStates */,
|
|
76
|
+
std::span<const MeshStateT<T>> /* meshStates */,
|
|
77
77
|
Eigen::Ref<Eigen::MatrixX<T>> /* jacobian */,
|
|
78
78
|
Eigen::Ref<Eigen::VectorX<T>> /* residual */,
|
|
79
79
|
int& usedRows) const {
|
|
@@ -79,7 +79,7 @@ class SequenceSolverFunctionT : public SolverFunctionT<T> {
|
|
|
79
79
|
///
|
|
80
80
|
/// @return An Eigen::VectorX<T> object containing the joined parameter vector of all frames.
|
|
81
81
|
[[nodiscard]] Eigen::VectorX<T> getJoinedParameterVectorFromFrameParameters(
|
|
82
|
-
|
|
82
|
+
std::span<const ModelParametersT<T>> frameParameters) const;
|
|
83
83
|
|
|
84
84
|
void setJoinedParameterVector(const Eigen::VectorX<T>& joinedParameters);
|
|
85
85
|
|
|
@@ -28,13 +28,13 @@ class StateSequenceErrorFunctionT : public SequenceErrorFunctionT<T> {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
double getError(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
std::span<const ModelParametersT<T>> modelParameters,
|
|
32
|
+
std::span<const SkeletonStateT<T>> skelStates,
|
|
33
|
+
std::span<const MeshStateT<T>> /* meshStates */) const final;
|
|
34
34
|
double getGradient(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
std::span<const ModelParametersT<T>> modelParameters,
|
|
36
|
+
std::span<const SkeletonStateT<T>> skelStates,
|
|
37
|
+
std::span<const MeshStateT<T>> /* meshStates */,
|
|
38
38
|
Eigen::Ref<Eigen::VectorX<T>> gradient) const final;
|
|
39
39
|
|
|
40
40
|
// modelParameters: [numFrames() * parameterTransform] parameter vector
|
|
@@ -42,9 +42,9 @@ class StateSequenceErrorFunctionT : public SequenceErrorFunctionT<T> {
|
|
|
42
42
|
// jacobian: [getJacobianSize()] x [numFrames() * parameterTransform] Jacobian matrix
|
|
43
43
|
// residual: [getJacobianSize()] residual vector.
|
|
44
44
|
double getJacobian(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
std::span<const ModelParametersT<T>> modelParameters,
|
|
46
|
+
std::span<const SkeletonStateT<T>> skelStates,
|
|
47
|
+
std::span<const MeshStateT<T>> /* meshStates */,
|
|
48
48
|
Eigen::Ref<Eigen::MatrixX<T>> jacobian,
|
|
49
49
|
Eigen::Ref<Eigen::VectorX<T>> residual,
|
|
50
50
|
int& usedRows) const final;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
#include <momentum/character_solver/vertex_error_function.h>
|
|
15
15
|
#include <momentum/math/mesh.h>
|
|
16
16
|
|
|
17
|
-
#include <
|
|
17
|
+
#include <span>
|
|
18
18
|
|
|
19
19
|
namespace momentum {
|
|
20
20
|
|
|
@@ -46,13 +46,13 @@ class VertexSequenceErrorFunctionT : public SequenceErrorFunctionT<T> {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
double getError(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
std::span<const ModelParametersT<T>> modelParameters,
|
|
50
|
+
std::span<const SkeletonStateT<T>> skelStates,
|
|
51
|
+
std::span<const MeshStateT<T>> meshStates) const final;
|
|
52
52
|
double getGradient(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
std::span<const ModelParametersT<T>> modelParameters,
|
|
54
|
+
std::span<const SkeletonStateT<T>> skelStates,
|
|
55
|
+
std::span<const MeshStateT<T>> meshStates,
|
|
56
56
|
Eigen::Ref<Eigen::VectorX<T>> gradient) const final;
|
|
57
57
|
|
|
58
58
|
// modelParameters: [numFrames() * parameterTransform] parameter vector
|
|
@@ -60,9 +60,9 @@ class VertexSequenceErrorFunctionT : public SequenceErrorFunctionT<T> {
|
|
|
60
60
|
// jacobian: [getJacobianSize()] x [numFrames() * parameterTransform] Jacobian matrix
|
|
61
61
|
// residual: [getJacobianSize()] residual vector.
|
|
62
62
|
double getJacobian(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
std::span<const ModelParametersT<T>> modelParameters,
|
|
64
|
+
std::span<const SkeletonStateT<T>> skelStates,
|
|
65
|
+
std::span<const MeshStateT<T>> meshStates,
|
|
66
66
|
Eigen::Ref<Eigen::MatrixX<T>> jacobian,
|
|
67
67
|
Eigen::Ref<Eigen::VectorX<T>> residual,
|
|
68
68
|
int& usedRows) const final;
|
|
@@ -102,15 +102,15 @@ class VertexSequenceErrorFunctionT : public SequenceErrorFunctionT<T> {
|
|
|
102
102
|
private:
|
|
103
103
|
/// Calculate gradient for a single vertex velocity constraint.
|
|
104
104
|
double calculateVelocityGradient(
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
std::span<const SkeletonStateT<T>> skelStates,
|
|
106
|
+
std::span<const MeshStateT<T>> meshStates,
|
|
107
107
|
const VertexVelocityConstraintT<T>& constraint,
|
|
108
108
|
Eigen::Ref<Eigen::VectorX<T>> gradient) const;
|
|
109
109
|
|
|
110
110
|
/// Calculate Jacobian for a single vertex velocity constraint.
|
|
111
111
|
double calculateVelocityJacobian(
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
std::span<const SkeletonStateT<T>> skelStates,
|
|
113
|
+
std::span<const MeshStateT<T>> meshStates,
|
|
114
114
|
const VertexVelocityConstraintT<T>& constraint,
|
|
115
115
|
Eigen::Ref<Eigen::MatrixX<T>> jacobian,
|
|
116
116
|
Eigen::Ref<Eigen::VectorX<T>> residual,
|
|
@@ -177,14 +177,14 @@ class ConstraintErrorFunctionT : public SkeletonErrorFunctionT<T> {
|
|
|
177
177
|
/// Appends a list of constraints
|
|
178
178
|
///
|
|
179
179
|
/// @param[in] constrs: a list of constraints to be added
|
|
180
|
-
void addConstraints(
|
|
180
|
+
void addConstraints(std::span<const Data> constrs) {
|
|
181
181
|
constraints_.insert(constraints_.end(), constrs.begin(), constrs.end());
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
/// Replace the current list of constraints with the input
|
|
185
185
|
///
|
|
186
186
|
/// @param[in] constrs: the new list of constraints
|
|
187
|
-
void setConstraints(
|
|
187
|
+
void setConstraints(std::span<const Data> constrs) {
|
|
188
188
|
constraints_.assign(constrs.begin(), constrs.end());
|
|
189
189
|
}
|
|
190
190
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
#include <momentum/character/types.h>
|
|
14
14
|
#include <momentum/character_solver/fwd.h>
|
|
15
15
|
#include <momentum/solver/solver_function.h>
|
|
16
|
-
#include <
|
|
16
|
+
#include <span>
|
|
17
17
|
|
|
18
18
|
namespace momentum {
|
|
19
19
|
|
|
@@ -23,7 +23,7 @@ class SkeletonSolverFunctionT : public SolverFunctionT<T> {
|
|
|
23
23
|
SkeletonSolverFunctionT(
|
|
24
24
|
const Character& character,
|
|
25
25
|
const ParameterTransformT<T>& parameterTransform,
|
|
26
|
-
|
|
26
|
+
std::span<const std::shared_ptr<SkeletonErrorFunctionT<T>>> errorFunctions = {});
|
|
27
27
|
~SkeletonSolverFunctionT() override;
|
|
28
28
|
|
|
29
29
|
double getError(const Eigen::VectorX<T>& parameters) final;
|
|
@@ -37,7 +37,7 @@ void logJoints(
|
|
|
37
37
|
void logMarkers(
|
|
38
38
|
const rerun::RecordingStream& rec,
|
|
39
39
|
const std::string& streamName,
|
|
40
|
-
|
|
40
|
+
std::span<const Marker> markers);
|
|
41
41
|
|
|
42
42
|
void logLocators(
|
|
43
43
|
const rerun::RecordingStream& rec,
|
|
@@ -50,7 +50,7 @@ void logMarkerLocatorCorrespondence(
|
|
|
50
50
|
const std::string& streamName,
|
|
51
51
|
const std::map<std::string, size_t>& locatorLookup,
|
|
52
52
|
const LocatorState& locatorState,
|
|
53
|
-
|
|
53
|
+
std::span<const Marker> markers,
|
|
54
54
|
float kPositionErrorThreshold);
|
|
55
55
|
|
|
56
56
|
void logBvh(
|
|
@@ -77,26 +77,26 @@ void logModelParams(
|
|
|
77
77
|
const rerun::RecordingStream& rec,
|
|
78
78
|
const std::string& worldPrefix,
|
|
79
79
|
const std::string& posePrefix,
|
|
80
|
-
|
|
80
|
+
std::span<const std::string> names,
|
|
81
81
|
const Eigen::VectorXf& params);
|
|
82
82
|
|
|
83
83
|
void logJointParams(
|
|
84
84
|
const rerun::RecordingStream& rec,
|
|
85
85
|
const std::string& worldPrefix,
|
|
86
86
|
const std::string& posePrefix,
|
|
87
|
-
|
|
87
|
+
std::span<const std::string> names,
|
|
88
88
|
const Eigen::VectorXf& params);
|
|
89
89
|
|
|
90
90
|
void logModelParamNames(
|
|
91
91
|
const rerun::RecordingStream& rec,
|
|
92
92
|
const std::string& worldPrefix,
|
|
93
93
|
const std::string& posePrefix,
|
|
94
|
-
|
|
94
|
+
std::span<const std::string> names);
|
|
95
95
|
|
|
96
96
|
void logJointParamNames(
|
|
97
97
|
const rerun::RecordingStream& rec,
|
|
98
98
|
const std::string& worldPrefix,
|
|
99
99
|
const std::string& posePrefix,
|
|
100
|
-
|
|
100
|
+
std::span<const std::string> names);
|
|
101
101
|
|
|
102
102
|
} // namespace momentum
|
|
@@ -49,8 +49,8 @@ enum class CharacterFormat : uint8_t {
|
|
|
49
49
|
/// @return The loaded Character object.
|
|
50
50
|
[[nodiscard]] Character loadFullCharacterFromBuffer(
|
|
51
51
|
CharacterFormat format,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
std::span<const std::byte> characterBuffer,
|
|
53
|
+
std::span<const std::byte> paramBuffer = std::span<const std::byte>(),
|
|
54
|
+
std::span<const std::byte> locBuffer = std::span<const std::byte>());
|
|
55
55
|
|
|
56
56
|
} // namespace momentum
|
|
@@ -23,7 +23,7 @@ namespace momentum {
|
|
|
23
23
|
///
|
|
24
24
|
/// @return A span of the new type, with the same number of elements as the original span
|
|
25
25
|
template <typename T>
|
|
26
|
-
[[nodiscard]]
|
|
26
|
+
[[nodiscard]] std::span<T> cast_span(std::span<std::byte> bs) {
|
|
27
27
|
auto ptr = reinterpret_cast<T*>(bs.data());
|
|
28
28
|
auto tsize = gsl::narrow<decltype(bs)::size_type>(sizeof(T));
|
|
29
29
|
return {ptr, bs.size_bytes() / tsize};
|
|
@@ -41,7 +41,7 @@ template <typename T>
|
|
|
41
41
|
///
|
|
42
42
|
/// @return A span of the new type, with the same number of elements as the original span
|
|
43
43
|
template <typename T>
|
|
44
|
-
[[nodiscard]]
|
|
44
|
+
[[nodiscard]] std::span<const T> cast_span(std::span<const std::byte> bs) {
|
|
45
45
|
auto ptr = reinterpret_cast<const T*>(bs.data());
|
|
46
46
|
auto tsize = gsl::narrow<decltype(bs)::size_type>(sizeof(T));
|
|
47
47
|
return {ptr, bs.size_bytes() / tsize};
|