pymomentum-cpu 0.1.80.post1__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 +2 -2
- include/momentum/character_sequence_solver/state_sequence_error_function.h +9 -9
- include/momentum/character_sequence_solver/vertex_sequence_error_function.h +18 -23
- 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/character_solver/skinned_locator_triangle_error_function.h +4 -4
- 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/c3d_io.h +2 -1
- include/momentum/io/marker/marker_io.h +5 -3
- 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
- {lib64 → lib}/cmake/axel/axelTargets-release.cmake +2 -2
- {lib64 → lib}/cmake/axel/axelTargets.cmake +1 -1
- {lib64 → lib}/cmake/momentum/momentumTargets-release.cmake +50 -50
- lib/cmake/rerun_sdk/rerun_sdkConfig.cmake +3 -3
- lib/libarrow.a +0 -0
- lib/libarrow_bundled_dependencies.a +0 -0
- lib/libaxel.a +0 -0
- {lib64 → lib}/libmomentum_app_utils.a +0 -0
- {lib64 → lib}/libmomentum_character.a +0 -0
- {lib64 → lib}/libmomentum_character_sequence_solver.a +0 -0
- {lib64 → lib}/libmomentum_character_solver.a +0 -0
- {lib64 → lib}/libmomentum_common.a +0 -0
- {lib64 → lib}/libmomentum_diff_ik.a +0 -0
- {lib64 → lib}/libmomentum_io.a +0 -0
- {lib64 → lib}/libmomentum_io_common.a +0 -0
- lib/libmomentum_io_fbx.a +0 -0
- {lib64 → lib}/libmomentum_io_gltf.a +0 -0
- {lib64 → lib}/libmomentum_io_legacy_json.a +0 -0
- {lib64 → lib}/libmomentum_io_marker.a +0 -0
- {lib64 → lib}/libmomentum_io_motion.a +0 -0
- {lib64 → lib}/libmomentum_io_shape.a +0 -0
- {lib64 → lib}/libmomentum_io_skeleton.a +0 -0
- {lib64 → lib}/libmomentum_io_urdf.a +0 -0
- {lib64 → lib}/libmomentum_marker_tracker.a +0 -0
- {lib64 → lib}/libmomentum_math.a +0 -0
- lib/libmomentum_online_qr.a +0 -0
- {lib64 → lib}/libmomentum_process_markers.a +0 -0
- {lib64 → lib}/libmomentum_rerun.a +0 -0
- {lib64 → lib}/libmomentum_simd_constraints.a +0 -0
- {lib64 → lib}/libmomentum_simd_generalized_loss.a +0 -0
- {lib64 → lib}/libmomentum_skeleton.a +0 -0
- {lib64 → 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/torch/character.py +47 -0
- {pymomentum_cpu-0.1.80.post1.dist-info → pymomentum_cpu-0.1.83.post0.dist-info}/METADATA +7 -5
- {pymomentum_cpu-0.1.80.post1.dist-info → pymomentum_cpu-0.1.83.post0.dist-info}/RECORD +97 -97
- pymomentum_cpu.libs/libezc3d-48face0b.so +0 -0
- lib64/libaxel.a +0 -0
- lib64/libmomentum_io_fbx.a +0 -0
- lib64/libmomentum_online_qr.a +0 -0
- pymomentum_cpu.libs/libezc3d-4a95ab2c.so +0 -0
- {lib64 → lib}/cmake/axel/axel-config.cmake +0 -0
- {lib64 → lib}/cmake/momentum/Findre2.cmake +0 -0
- {lib64 → lib}/cmake/momentum/momentum-config.cmake +0 -0
- {lib64 → lib}/cmake/momentum/momentumTargets.cmake +0 -0
- {pymomentum_cpu-0.1.80.post1.dist-info → pymomentum_cpu-0.1.83.post0.dist-info}/WHEEL +0 -0
- {pymomentum_cpu-0.1.80.post1.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
|
|
|
@@ -126,7 +126,7 @@ class SequenceSolverFunctionT : public SolverFunctionT<T> {
|
|
|
126
126
|
std::atomic<size_t> numTotalPerFrameErrorFunctions_ = 0;
|
|
127
127
|
std::atomic<size_t> numTotalSequenceErrorFunctions_ = 0;
|
|
128
128
|
|
|
129
|
-
bool needsMesh_
|
|
129
|
+
std::atomic<bool> needsMesh_{false};
|
|
130
130
|
|
|
131
131
|
friend class SequenceSolverT<T>;
|
|
132
132
|
};
|
|
@@ -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,13 +60,17 @@ 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;
|
|
69
69
|
|
|
70
|
+
bool needsMesh() const final {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
|
|
70
74
|
[[nodiscard]] size_t getJacobianSize() const final;
|
|
71
75
|
|
|
72
76
|
/// Add a vertex velocity constraint.
|
|
@@ -98,31 +102,22 @@ class VertexSequenceErrorFunctionT : public SequenceErrorFunctionT<T> {
|
|
|
98
102
|
private:
|
|
99
103
|
/// Calculate gradient for a single vertex velocity constraint.
|
|
100
104
|
double calculateVelocityGradient(
|
|
101
|
-
|
|
105
|
+
std::span<const SkeletonStateT<T>> skelStates,
|
|
106
|
+
std::span<const MeshStateT<T>> meshStates,
|
|
102
107
|
const VertexVelocityConstraintT<T>& constraint,
|
|
103
108
|
Eigen::Ref<Eigen::VectorX<T>> gradient) const;
|
|
104
109
|
|
|
105
110
|
/// Calculate Jacobian for a single vertex velocity constraint.
|
|
106
111
|
double calculateVelocityJacobian(
|
|
107
|
-
|
|
112
|
+
std::span<const SkeletonStateT<T>> skelStates,
|
|
113
|
+
std::span<const MeshStateT<T>> meshStates,
|
|
108
114
|
const VertexVelocityConstraintT<T>& constraint,
|
|
109
115
|
Eigen::Ref<Eigen::MatrixX<T>> jacobian,
|
|
110
116
|
Eigen::Ref<Eigen::VectorX<T>> residual,
|
|
111
117
|
Eigen::Index startRow) const;
|
|
112
118
|
|
|
113
|
-
/// Update meshes for both frames.
|
|
114
|
-
void updateMeshes(
|
|
115
|
-
gsl::span<const ModelParametersT<T>> modelParameters,
|
|
116
|
-
gsl::span<const SkeletonStateT<T>> skelStates) const;
|
|
117
|
-
|
|
118
119
|
const Character& character_;
|
|
119
120
|
std::vector<VertexVelocityConstraintT<T>> constraints_;
|
|
120
|
-
|
|
121
|
-
// Meshes for the two frames
|
|
122
|
-
mutable std::unique_ptr<MeshT<T>> neutralMesh_;
|
|
123
|
-
mutable std::unique_ptr<MeshT<T>> restMesh_; // Single rest mesh used for both frames
|
|
124
|
-
mutable std::unique_ptr<MeshT<T>> posedMesh0_;
|
|
125
|
-
mutable std::unique_ptr<MeshT<T>> posedMesh1_;
|
|
126
121
|
};
|
|
127
122
|
|
|
128
123
|
} // namespace momentum
|
|
@@ -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;
|
|
@@ -109,23 +109,27 @@ class SkinnedLocatorTriangleErrorFunctionT : public SkeletonErrorFunctionT<T> {
|
|
|
109
109
|
|
|
110
110
|
double calculatePositionJacobian(
|
|
111
111
|
const ModelParametersT<T>& modelParameters,
|
|
112
|
+
const MeshStateT<T>& meshState,
|
|
112
113
|
const SkinnedLocatorTriangleConstraintT<T>& constr,
|
|
113
114
|
Ref<Eigen::MatrixX<T>> jac,
|
|
114
115
|
Ref<Eigen::VectorX<T>> res) const;
|
|
115
116
|
|
|
116
117
|
double calculatePlaneJacobian(
|
|
117
118
|
const ModelParametersT<T>& modelParameters,
|
|
119
|
+
const MeshStateT<T>& meshState,
|
|
118
120
|
const SkinnedLocatorTriangleConstraintT<T>& constr,
|
|
119
121
|
Ref<Eigen::MatrixX<T>> jac,
|
|
120
122
|
T& res) const;
|
|
121
123
|
|
|
122
124
|
double calculatePositionGradient(
|
|
123
125
|
const ModelParametersT<T>& modelParameters,
|
|
126
|
+
const MeshStateT<T>& meshState,
|
|
124
127
|
const SkinnedLocatorTriangleConstraintT<T>& constr,
|
|
125
128
|
Eigen::Ref<Eigen::VectorX<T>> gradient) const;
|
|
126
129
|
|
|
127
130
|
double calculatePlaneGradient(
|
|
128
131
|
const ModelParametersT<T>& modelParameters,
|
|
132
|
+
const MeshStateT<T>& meshState,
|
|
129
133
|
const SkinnedLocatorTriangleConstraintT<T>& constr,
|
|
130
134
|
Eigen::Ref<Eigen::VectorX<T>> gradient) const;
|
|
131
135
|
|
|
@@ -136,11 +140,7 @@ class SkinnedLocatorTriangleErrorFunctionT : public SkeletonErrorFunctionT<T> {
|
|
|
136
140
|
|
|
137
141
|
std::vector<SkinnedLocatorTriangleConstraintT<T>> constraints_;
|
|
138
142
|
|
|
139
|
-
std::unique_ptr<MeshT<T>> neutralMesh_; // Rest mesh without facial expression basis
|
|
140
|
-
std::unique_ptr<MeshT<T>> restMesh_; // Rest positions after shape basis is applied
|
|
141
|
-
|
|
142
143
|
const VertexConstraintType constraintType_;
|
|
143
|
-
void updateMeshes(const ModelParametersT<T>& modelParameters);
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
} // namespace momentum
|