pymomentum-cpu 0.1.77.post30__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.

Files changed (555) hide show
  1. include/axel/BoundingBox.h +58 -0
  2. include/axel/Bvh.h +708 -0
  3. include/axel/BvhBase.h +75 -0
  4. include/axel/BvhCommon.h +43 -0
  5. include/axel/BvhEmbree.h +86 -0
  6. include/axel/BvhFactory.h +34 -0
  7. include/axel/Checks.h +21 -0
  8. include/axel/DualContouring.h +79 -0
  9. include/axel/KdTree.h +199 -0
  10. include/axel/Log.h +22 -0
  11. include/axel/MeshToSdf.h +123 -0
  12. include/axel/Profile.h +64 -0
  13. include/axel/Ray.h +45 -0
  14. include/axel/SignedDistanceField.h +248 -0
  15. include/axel/SimdKdTree.h +515 -0
  16. include/axel/TriBvh.h +157 -0
  17. include/axel/TriBvhEmbree.h +57 -0
  18. include/axel/common/Constants.h +27 -0
  19. include/axel/common/Types.h +21 -0
  20. include/axel/common/VectorizationTypes.h +58 -0
  21. include/axel/math/BoundingBoxUtils.h +54 -0
  22. include/axel/math/ContinuousCollisionDetection.h +48 -0
  23. include/axel/math/CoplanarityCheck.h +30 -0
  24. include/axel/math/EdgeEdgeDistance.h +31 -0
  25. include/axel/math/MeshHoleFilling.h +117 -0
  26. include/axel/math/PointTriangleProjection.h +34 -0
  27. include/axel/math/PointTriangleProjectionDefinitions.h +209 -0
  28. include/axel/math/RayTriangleIntersection.h +36 -0
  29. include/momentum/character/blend_shape.h +91 -0
  30. include/momentum/character/blend_shape_base.h +70 -0
  31. include/momentum/character/blend_shape_skinning.h +96 -0
  32. include/momentum/character/character.h +272 -0
  33. include/momentum/character/character_state.h +108 -0
  34. include/momentum/character/character_utility.h +128 -0
  35. include/momentum/character/collision_geometry.h +80 -0
  36. include/momentum/character/collision_geometry_state.h +130 -0
  37. include/momentum/character/fwd.h +262 -0
  38. include/momentum/character/inverse_parameter_transform.h +58 -0
  39. include/momentum/character/joint.h +82 -0
  40. include/momentum/character/joint_state.h +241 -0
  41. include/momentum/character/linear_skinning.h +139 -0
  42. include/momentum/character/locator.h +82 -0
  43. include/momentum/character/locator_state.h +43 -0
  44. include/momentum/character/marker.h +48 -0
  45. include/momentum/character/mesh_state.h +71 -0
  46. include/momentum/character/parameter_limits.h +144 -0
  47. include/momentum/character/parameter_transform.h +250 -0
  48. include/momentum/character/pose_shape.h +65 -0
  49. include/momentum/character/skeleton.h +85 -0
  50. include/momentum/character/skeleton_state.h +181 -0
  51. include/momentum/character/skeleton_utility.h +38 -0
  52. include/momentum/character/skin_weights.h +67 -0
  53. include/momentum/character/skinned_locator.h +80 -0
  54. include/momentum/character/types.h +202 -0
  55. include/momentum/character_sequence_solver/fwd.h +200 -0
  56. include/momentum/character_sequence_solver/model_parameters_sequence_error_function.h +65 -0
  57. include/momentum/character_sequence_solver/multipose_solver.h +65 -0
  58. include/momentum/character_sequence_solver/multipose_solver_function.h +82 -0
  59. include/momentum/character_sequence_solver/sequence_error_function.h +104 -0
  60. include/momentum/character_sequence_solver/sequence_solver.h +144 -0
  61. include/momentum/character_sequence_solver/sequence_solver_function.h +134 -0
  62. include/momentum/character_sequence_solver/state_sequence_error_function.h +109 -0
  63. include/momentum/character_sequence_solver/vertex_sequence_error_function.h +128 -0
  64. include/momentum/character_solver/aim_error_function.h +112 -0
  65. include/momentum/character_solver/collision_error_function.h +92 -0
  66. include/momentum/character_solver/collision_error_function_stateless.h +75 -0
  67. include/momentum/character_solver/constraint_error_function-inl.h +324 -0
  68. include/momentum/character_solver/constraint_error_function.h +248 -0
  69. include/momentum/character_solver/distance_error_function.h +77 -0
  70. include/momentum/character_solver/error_function_utils.h +60 -0
  71. include/momentum/character_solver/fixed_axis_error_function.h +139 -0
  72. include/momentum/character_solver/fwd.h +924 -0
  73. include/momentum/character_solver/gauss_newton_solver_qr.h +64 -0
  74. include/momentum/character_solver/limit_error_function.h +57 -0
  75. include/momentum/character_solver/model_parameters_error_function.h +64 -0
  76. include/momentum/character_solver/normal_error_function.h +73 -0
  77. include/momentum/character_solver/orientation_error_function.h +74 -0
  78. include/momentum/character_solver/plane_error_function.h +102 -0
  79. include/momentum/character_solver/point_triangle_vertex_error_function.h +141 -0
  80. include/momentum/character_solver/pose_prior_error_function.h +80 -0
  81. include/momentum/character_solver/position_error_function.h +75 -0
  82. include/momentum/character_solver/projection_error_function.h +93 -0
  83. include/momentum/character_solver/simd_collision_error_function.h +99 -0
  84. include/momentum/character_solver/simd_normal_error_function.h +157 -0
  85. include/momentum/character_solver/simd_plane_error_function.h +164 -0
  86. include/momentum/character_solver/simd_position_error_function.h +165 -0
  87. include/momentum/character_solver/skeleton_error_function.h +151 -0
  88. include/momentum/character_solver/skeleton_solver_function.h +94 -0
  89. include/momentum/character_solver/skinned_locator_error_function.h +166 -0
  90. include/momentum/character_solver/skinned_locator_triangle_error_function.h +146 -0
  91. include/momentum/character_solver/skinning_weight_iterator.h +80 -0
  92. include/momentum/character_solver/state_error_function.h +94 -0
  93. include/momentum/character_solver/transform_pose.h +80 -0
  94. include/momentum/character_solver/trust_region_qr.h +80 -0
  95. include/momentum/character_solver/vertex_error_function.h +155 -0
  96. include/momentum/character_solver/vertex_projection_error_function.h +126 -0
  97. include/momentum/character_solver/vertex_vertex_distance_error_function.h +151 -0
  98. include/momentum/common/aligned.h +155 -0
  99. include/momentum/common/checks.h +27 -0
  100. include/momentum/common/exception.h +70 -0
  101. include/momentum/common/filesystem.h +20 -0
  102. include/momentum/common/fwd.h +27 -0
  103. include/momentum/common/log.h +173 -0
  104. include/momentum/common/log_channel.h +17 -0
  105. include/momentum/common/memory.h +71 -0
  106. include/momentum/common/profile.h +79 -0
  107. include/momentum/common/progress_bar.h +37 -0
  108. include/momentum/common/string.h +52 -0
  109. include/momentum/diff_ik/ceres_utility.h +73 -0
  110. include/momentum/diff_ik/fully_differentiable_body_ik.h +58 -0
  111. include/momentum/diff_ik/fully_differentiable_distance_error_function.h +69 -0
  112. include/momentum/diff_ik/fully_differentiable_motion_error_function.h +46 -0
  113. include/momentum/diff_ik/fully_differentiable_orientation_error_function.h +114 -0
  114. include/momentum/diff_ik/fully_differentiable_pose_prior_error_function.h +76 -0
  115. include/momentum/diff_ik/fully_differentiable_position_error_function.h +138 -0
  116. include/momentum/diff_ik/fully_differentiable_projection_error_function.h +65 -0
  117. include/momentum/diff_ik/fully_differentiable_skeleton_error_function.h +160 -0
  118. include/momentum/diff_ik/fully_differentiable_state_error_function.h +54 -0
  119. include/momentum/diff_ik/fwd.h +385 -0
  120. include/momentum/diff_ik/union_error_function.h +67 -0
  121. include/momentum/gui/rerun/eigen_adapters.h +70 -0
  122. include/momentum/gui/rerun/logger.h +102 -0
  123. include/momentum/gui/rerun/logging_redirect.h +27 -0
  124. include/momentum/io/character_io.h +56 -0
  125. include/momentum/io/common/gsl_utils.h +50 -0
  126. include/momentum/io/common/stream_utils.h +65 -0
  127. include/momentum/io/fbx/fbx_io.h +109 -0
  128. include/momentum/io/fbx/fbx_memory_stream.h +66 -0
  129. include/momentum/io/fbx/openfbx_loader.h +49 -0
  130. include/momentum/io/fbx/polygon_data.h +60 -0
  131. include/momentum/io/gltf/gltf_builder.h +132 -0
  132. include/momentum/io/gltf/gltf_file_format.h +19 -0
  133. include/momentum/io/gltf/gltf_io.h +148 -0
  134. include/momentum/io/gltf/utils/accessor_utils.h +299 -0
  135. include/momentum/io/gltf/utils/coordinate_utils.h +60 -0
  136. include/momentum/io/gltf/utils/json_utils.h +102 -0
  137. include/momentum/io/legacy_json/legacy_json_io.h +70 -0
  138. include/momentum/io/marker/c3d_io.h +29 -0
  139. include/momentum/io/marker/conversions.h +57 -0
  140. include/momentum/io/marker/coordinate_system.h +30 -0
  141. include/momentum/io/marker/marker_io.h +54 -0
  142. include/momentum/io/marker/trc_io.h +27 -0
  143. include/momentum/io/motion/mmo_io.h +97 -0
  144. include/momentum/io/shape/blend_shape_io.h +70 -0
  145. include/momentum/io/shape/pose_shape_io.h +21 -0
  146. include/momentum/io/skeleton/locator_io.h +41 -0
  147. include/momentum/io/skeleton/mppca_io.h +26 -0
  148. include/momentum/io/skeleton/parameter_limits_io.h +25 -0
  149. include/momentum/io/skeleton/parameter_transform_io.h +41 -0
  150. include/momentum/io/skeleton/parameters_io.h +20 -0
  151. include/momentum/io/urdf/urdf_io.h +26 -0
  152. include/momentum/io/usd/usd_io.h +36 -0
  153. include/momentum/marker_tracking/app_utils.h +62 -0
  154. include/momentum/marker_tracking/marker_tracker.h +213 -0
  155. include/momentum/marker_tracking/process_markers.h +58 -0
  156. include/momentum/marker_tracking/tracker_utils.h +90 -0
  157. include/momentum/math/constants.h +82 -0
  158. include/momentum/math/covariance_matrix.h +84 -0
  159. include/momentum/math/fmt_eigen.h +23 -0
  160. include/momentum/math/fwd.h +132 -0
  161. include/momentum/math/generalized_loss.h +61 -0
  162. include/momentum/math/intersection.h +32 -0
  163. include/momentum/math/mesh.h +84 -0
  164. include/momentum/math/mppca.h +67 -0
  165. include/momentum/math/online_householder_qr.h +516 -0
  166. include/momentum/math/random-inl.h +404 -0
  167. include/momentum/math/random.h +310 -0
  168. include/momentum/math/simd_generalized_loss.h +40 -0
  169. include/momentum/math/transform.h +229 -0
  170. include/momentum/math/types.h +461 -0
  171. include/momentum/math/utility.h +251 -0
  172. include/momentum/rasterizer/camera.h +453 -0
  173. include/momentum/rasterizer/fwd.h +102 -0
  174. include/momentum/rasterizer/geometry.h +83 -0
  175. include/momentum/rasterizer/image.h +18 -0
  176. include/momentum/rasterizer/rasterizer.h +583 -0
  177. include/momentum/rasterizer/tensor.h +140 -0
  178. include/momentum/rasterizer/utility.h +268 -0
  179. include/momentum/simd/simd.h +221 -0
  180. include/momentum/solver/fwd.h +131 -0
  181. include/momentum/solver/gauss_newton_solver.h +136 -0
  182. include/momentum/solver/gradient_descent_solver.h +65 -0
  183. include/momentum/solver/solver.h +155 -0
  184. include/momentum/solver/solver_function.h +126 -0
  185. include/momentum/solver/subset_gauss_newton_solver.h +109 -0
  186. include/rerun/archetypes/annotation_context.hpp +157 -0
  187. include/rerun/archetypes/arrows2d.hpp +271 -0
  188. include/rerun/archetypes/arrows3d.hpp +257 -0
  189. include/rerun/archetypes/asset3d.hpp +262 -0
  190. include/rerun/archetypes/asset_video.hpp +275 -0
  191. include/rerun/archetypes/bar_chart.hpp +261 -0
  192. include/rerun/archetypes/boxes2d.hpp +293 -0
  193. include/rerun/archetypes/boxes3d.hpp +369 -0
  194. include/rerun/archetypes/capsules3d.hpp +333 -0
  195. include/rerun/archetypes/clear.hpp +180 -0
  196. include/rerun/archetypes/depth_image.hpp +425 -0
  197. include/rerun/archetypes/ellipsoids3d.hpp +384 -0
  198. include/rerun/archetypes/encoded_image.hpp +250 -0
  199. include/rerun/archetypes/geo_line_strings.hpp +166 -0
  200. include/rerun/archetypes/geo_points.hpp +177 -0
  201. include/rerun/archetypes/graph_edges.hpp +152 -0
  202. include/rerun/archetypes/graph_nodes.hpp +206 -0
  203. include/rerun/archetypes/image.hpp +434 -0
  204. include/rerun/archetypes/instance_poses3d.hpp +221 -0
  205. include/rerun/archetypes/line_strips2d.hpp +289 -0
  206. include/rerun/archetypes/line_strips3d.hpp +270 -0
  207. include/rerun/archetypes/mesh3d.hpp +387 -0
  208. include/rerun/archetypes/pinhole.hpp +385 -0
  209. include/rerun/archetypes/points2d.hpp +333 -0
  210. include/rerun/archetypes/points3d.hpp +369 -0
  211. include/rerun/archetypes/recording_properties.hpp +132 -0
  212. include/rerun/archetypes/scalar.hpp +170 -0
  213. include/rerun/archetypes/scalars.hpp +153 -0
  214. include/rerun/archetypes/segmentation_image.hpp +305 -0
  215. include/rerun/archetypes/series_line.hpp +274 -0
  216. include/rerun/archetypes/series_lines.hpp +271 -0
  217. include/rerun/archetypes/series_point.hpp +265 -0
  218. include/rerun/archetypes/series_points.hpp +251 -0
  219. include/rerun/archetypes/tensor.hpp +213 -0
  220. include/rerun/archetypes/text_document.hpp +200 -0
  221. include/rerun/archetypes/text_log.hpp +211 -0
  222. include/rerun/archetypes/transform3d.hpp +925 -0
  223. include/rerun/archetypes/video_frame_reference.hpp +295 -0
  224. include/rerun/archetypes/view_coordinates.hpp +393 -0
  225. include/rerun/archetypes.hpp +43 -0
  226. include/rerun/arrow_utils.hpp +32 -0
  227. include/rerun/as_components.hpp +90 -0
  228. include/rerun/blueprint/archetypes/background.hpp +113 -0
  229. include/rerun/blueprint/archetypes/container_blueprint.hpp +259 -0
  230. include/rerun/blueprint/archetypes/dataframe_query.hpp +178 -0
  231. include/rerun/blueprint/archetypes/entity_behavior.hpp +130 -0
  232. include/rerun/blueprint/archetypes/force_center.hpp +115 -0
  233. include/rerun/blueprint/archetypes/force_collision_radius.hpp +141 -0
  234. include/rerun/blueprint/archetypes/force_link.hpp +136 -0
  235. include/rerun/blueprint/archetypes/force_many_body.hpp +124 -0
  236. include/rerun/blueprint/archetypes/force_position.hpp +132 -0
  237. include/rerun/blueprint/archetypes/line_grid3d.hpp +178 -0
  238. include/rerun/blueprint/archetypes/map_background.hpp +104 -0
  239. include/rerun/blueprint/archetypes/map_zoom.hpp +103 -0
  240. include/rerun/blueprint/archetypes/near_clip_plane.hpp +109 -0
  241. include/rerun/blueprint/archetypes/panel_blueprint.hpp +95 -0
  242. include/rerun/blueprint/archetypes/plot_legend.hpp +118 -0
  243. include/rerun/blueprint/archetypes/scalar_axis.hpp +116 -0
  244. include/rerun/blueprint/archetypes/tensor_scalar_mapping.hpp +146 -0
  245. include/rerun/blueprint/archetypes/tensor_slice_selection.hpp +167 -0
  246. include/rerun/blueprint/archetypes/tensor_view_fit.hpp +95 -0
  247. include/rerun/blueprint/archetypes/view_blueprint.hpp +170 -0
  248. include/rerun/blueprint/archetypes/view_contents.hpp +142 -0
  249. include/rerun/blueprint/archetypes/viewport_blueprint.hpp +200 -0
  250. include/rerun/blueprint/archetypes/visible_time_ranges.hpp +116 -0
  251. include/rerun/blueprint/archetypes/visual_bounds2d.hpp +109 -0
  252. include/rerun/blueprint/archetypes/visualizer_overrides.hpp +113 -0
  253. include/rerun/blueprint/archetypes.hpp +29 -0
  254. include/rerun/blueprint/components/active_tab.hpp +82 -0
  255. include/rerun/blueprint/components/apply_latest_at.hpp +79 -0
  256. include/rerun/blueprint/components/auto_layout.hpp +77 -0
  257. include/rerun/blueprint/components/auto_views.hpp +77 -0
  258. include/rerun/blueprint/components/background_kind.hpp +66 -0
  259. include/rerun/blueprint/components/column_share.hpp +78 -0
  260. include/rerun/blueprint/components/component_column_selector.hpp +81 -0
  261. include/rerun/blueprint/components/container_kind.hpp +65 -0
  262. include/rerun/blueprint/components/corner2d.hpp +64 -0
  263. include/rerun/blueprint/components/enabled.hpp +77 -0
  264. include/rerun/blueprint/components/filter_by_range.hpp +74 -0
  265. include/rerun/blueprint/components/filter_is_not_null.hpp +77 -0
  266. include/rerun/blueprint/components/force_distance.hpp +82 -0
  267. include/rerun/blueprint/components/force_iterations.hpp +82 -0
  268. include/rerun/blueprint/components/force_strength.hpp +82 -0
  269. include/rerun/blueprint/components/grid_columns.hpp +78 -0
  270. include/rerun/blueprint/components/grid_spacing.hpp +78 -0
  271. include/rerun/blueprint/components/included_content.hpp +86 -0
  272. include/rerun/blueprint/components/lock_range_during_zoom.hpp +82 -0
  273. include/rerun/blueprint/components/map_provider.hpp +64 -0
  274. include/rerun/blueprint/components/near_clip_plane.hpp +82 -0
  275. include/rerun/blueprint/components/panel_state.hpp +61 -0
  276. include/rerun/blueprint/components/query_expression.hpp +89 -0
  277. include/rerun/blueprint/components/root_container.hpp +77 -0
  278. include/rerun/blueprint/components/row_share.hpp +78 -0
  279. include/rerun/blueprint/components/selected_columns.hpp +76 -0
  280. include/rerun/blueprint/components/tensor_dimension_index_slider.hpp +90 -0
  281. include/rerun/blueprint/components/timeline_name.hpp +76 -0
  282. include/rerun/blueprint/components/view_class.hpp +76 -0
  283. include/rerun/blueprint/components/view_fit.hpp +61 -0
  284. include/rerun/blueprint/components/view_maximized.hpp +79 -0
  285. include/rerun/blueprint/components/view_origin.hpp +81 -0
  286. include/rerun/blueprint/components/viewer_recommendation_hash.hpp +82 -0
  287. include/rerun/blueprint/components/visible_time_range.hpp +77 -0
  288. include/rerun/blueprint/components/visual_bounds2d.hpp +74 -0
  289. include/rerun/blueprint/components/visualizer_override.hpp +86 -0
  290. include/rerun/blueprint/components/zoom_level.hpp +78 -0
  291. include/rerun/blueprint/components.hpp +41 -0
  292. include/rerun/blueprint/datatypes/component_column_selector.hpp +61 -0
  293. include/rerun/blueprint/datatypes/filter_by_range.hpp +59 -0
  294. include/rerun/blueprint/datatypes/filter_is_not_null.hpp +61 -0
  295. include/rerun/blueprint/datatypes/selected_columns.hpp +62 -0
  296. include/rerun/blueprint/datatypes/tensor_dimension_index_slider.hpp +63 -0
  297. include/rerun/blueprint/datatypes.hpp +9 -0
  298. include/rerun/c/arrow_c_data_interface.h +111 -0
  299. include/rerun/c/compiler_utils.h +10 -0
  300. include/rerun/c/rerun.h +627 -0
  301. include/rerun/c/sdk_info.h +28 -0
  302. include/rerun/collection.hpp +496 -0
  303. include/rerun/collection_adapter.hpp +43 -0
  304. include/rerun/collection_adapter_builtins.hpp +138 -0
  305. include/rerun/compiler_utils.hpp +61 -0
  306. include/rerun/component_batch.hpp +163 -0
  307. include/rerun/component_column.hpp +111 -0
  308. include/rerun/component_descriptor.hpp +142 -0
  309. include/rerun/component_type.hpp +35 -0
  310. include/rerun/components/aggregation_policy.hpp +76 -0
  311. include/rerun/components/albedo_factor.hpp +74 -0
  312. include/rerun/components/annotation_context.hpp +102 -0
  313. include/rerun/components/axis_length.hpp +74 -0
  314. include/rerun/components/blob.hpp +73 -0
  315. include/rerun/components/class_id.hpp +71 -0
  316. include/rerun/components/clear_is_recursive.hpp +75 -0
  317. include/rerun/components/color.hpp +99 -0
  318. include/rerun/components/colormap.hpp +99 -0
  319. include/rerun/components/depth_meter.hpp +84 -0
  320. include/rerun/components/draw_order.hpp +79 -0
  321. include/rerun/components/entity_path.hpp +83 -0
  322. include/rerun/components/fill_mode.hpp +72 -0
  323. include/rerun/components/fill_ratio.hpp +79 -0
  324. include/rerun/components/gamma_correction.hpp +80 -0
  325. include/rerun/components/geo_line_string.hpp +63 -0
  326. include/rerun/components/graph_edge.hpp +75 -0
  327. include/rerun/components/graph_node.hpp +79 -0
  328. include/rerun/components/graph_type.hpp +57 -0
  329. include/rerun/components/half_size2d.hpp +91 -0
  330. include/rerun/components/half_size3d.hpp +95 -0
  331. include/rerun/components/image_buffer.hpp +86 -0
  332. include/rerun/components/image_format.hpp +84 -0
  333. include/rerun/components/image_plane_distance.hpp +77 -0
  334. include/rerun/components/interactive.hpp +76 -0
  335. include/rerun/components/keypoint_id.hpp +74 -0
  336. include/rerun/components/lat_lon.hpp +89 -0
  337. include/rerun/components/length.hpp +77 -0
  338. include/rerun/components/line_strip2d.hpp +73 -0
  339. include/rerun/components/line_strip3d.hpp +73 -0
  340. include/rerun/components/magnification_filter.hpp +63 -0
  341. include/rerun/components/marker_shape.hpp +82 -0
  342. include/rerun/components/marker_size.hpp +74 -0
  343. include/rerun/components/media_type.hpp +157 -0
  344. include/rerun/components/name.hpp +83 -0
  345. include/rerun/components/opacity.hpp +77 -0
  346. include/rerun/components/pinhole_projection.hpp +94 -0
  347. include/rerun/components/plane3d.hpp +75 -0
  348. include/rerun/components/pose_rotation_axis_angle.hpp +73 -0
  349. include/rerun/components/pose_rotation_quat.hpp +71 -0
  350. include/rerun/components/pose_scale3d.hpp +102 -0
  351. include/rerun/components/pose_transform_mat3x3.hpp +87 -0
  352. include/rerun/components/pose_translation3d.hpp +96 -0
  353. include/rerun/components/position2d.hpp +86 -0
  354. include/rerun/components/position3d.hpp +90 -0
  355. include/rerun/components/radius.hpp +98 -0
  356. include/rerun/components/range1d.hpp +75 -0
  357. include/rerun/components/resolution.hpp +88 -0
  358. include/rerun/components/rotation_axis_angle.hpp +72 -0
  359. include/rerun/components/rotation_quat.hpp +71 -0
  360. include/rerun/components/scalar.hpp +76 -0
  361. include/rerun/components/scale3d.hpp +102 -0
  362. include/rerun/components/series_visible.hpp +76 -0
  363. include/rerun/components/show_labels.hpp +79 -0
  364. include/rerun/components/stroke_width.hpp +74 -0
  365. include/rerun/components/tensor_data.hpp +94 -0
  366. include/rerun/components/tensor_dimension_index_selection.hpp +77 -0
  367. include/rerun/components/tensor_height_dimension.hpp +71 -0
  368. include/rerun/components/tensor_width_dimension.hpp +71 -0
  369. include/rerun/components/texcoord2d.hpp +101 -0
  370. include/rerun/components/text.hpp +83 -0
  371. include/rerun/components/text_log_level.hpp +110 -0
  372. include/rerun/components/timestamp.hpp +76 -0
  373. include/rerun/components/transform_mat3x3.hpp +92 -0
  374. include/rerun/components/transform_relation.hpp +66 -0
  375. include/rerun/components/translation3d.hpp +96 -0
  376. include/rerun/components/triangle_indices.hpp +85 -0
  377. include/rerun/components/value_range.hpp +78 -0
  378. include/rerun/components/vector2d.hpp +92 -0
  379. include/rerun/components/vector3d.hpp +96 -0
  380. include/rerun/components/video_timestamp.hpp +120 -0
  381. include/rerun/components/view_coordinates.hpp +346 -0
  382. include/rerun/components/visible.hpp +74 -0
  383. include/rerun/components.hpp +77 -0
  384. include/rerun/config.hpp +52 -0
  385. include/rerun/datatypes/angle.hpp +76 -0
  386. include/rerun/datatypes/annotation_info.hpp +76 -0
  387. include/rerun/datatypes/blob.hpp +67 -0
  388. include/rerun/datatypes/bool.hpp +57 -0
  389. include/rerun/datatypes/channel_datatype.hpp +87 -0
  390. include/rerun/datatypes/class_description.hpp +92 -0
  391. include/rerun/datatypes/class_description_map_elem.hpp +69 -0
  392. include/rerun/datatypes/class_id.hpp +62 -0
  393. include/rerun/datatypes/color_model.hpp +68 -0
  394. include/rerun/datatypes/dvec2d.hpp +76 -0
  395. include/rerun/datatypes/entity_path.hpp +60 -0
  396. include/rerun/datatypes/float32.hpp +62 -0
  397. include/rerun/datatypes/float64.hpp +62 -0
  398. include/rerun/datatypes/image_format.hpp +107 -0
  399. include/rerun/datatypes/keypoint_id.hpp +63 -0
  400. include/rerun/datatypes/keypoint_pair.hpp +65 -0
  401. include/rerun/datatypes/mat3x3.hpp +105 -0
  402. include/rerun/datatypes/mat4x4.hpp +119 -0
  403. include/rerun/datatypes/pixel_format.hpp +142 -0
  404. include/rerun/datatypes/plane3d.hpp +60 -0
  405. include/rerun/datatypes/quaternion.hpp +110 -0
  406. include/rerun/datatypes/range1d.hpp +59 -0
  407. include/rerun/datatypes/range2d.hpp +55 -0
  408. include/rerun/datatypes/rgba32.hpp +94 -0
  409. include/rerun/datatypes/rotation_axis_angle.hpp +67 -0
  410. include/rerun/datatypes/tensor_buffer.hpp +529 -0
  411. include/rerun/datatypes/tensor_data.hpp +100 -0
  412. include/rerun/datatypes/tensor_dimension_index_selection.hpp +58 -0
  413. include/rerun/datatypes/tensor_dimension_selection.hpp +56 -0
  414. include/rerun/datatypes/time_int.hpp +62 -0
  415. include/rerun/datatypes/time_range.hpp +55 -0
  416. include/rerun/datatypes/time_range_boundary.hpp +175 -0
  417. include/rerun/datatypes/uint16.hpp +62 -0
  418. include/rerun/datatypes/uint32.hpp +62 -0
  419. include/rerun/datatypes/uint64.hpp +62 -0
  420. include/rerun/datatypes/utf8.hpp +76 -0
  421. include/rerun/datatypes/utf8pair.hpp +62 -0
  422. include/rerun/datatypes/uuid.hpp +60 -0
  423. include/rerun/datatypes/uvec2d.hpp +76 -0
  424. include/rerun/datatypes/uvec3d.hpp +80 -0
  425. include/rerun/datatypes/uvec4d.hpp +59 -0
  426. include/rerun/datatypes/vec2d.hpp +76 -0
  427. include/rerun/datatypes/vec3d.hpp +80 -0
  428. include/rerun/datatypes/vec4d.hpp +84 -0
  429. include/rerun/datatypes/video_timestamp.hpp +67 -0
  430. include/rerun/datatypes/view_coordinates.hpp +87 -0
  431. include/rerun/datatypes/visible_time_range.hpp +57 -0
  432. include/rerun/datatypes.hpp +51 -0
  433. include/rerun/demo_utils.hpp +75 -0
  434. include/rerun/entity_path.hpp +20 -0
  435. include/rerun/error.hpp +180 -0
  436. include/rerun/half.hpp +10 -0
  437. include/rerun/image_utils.hpp +187 -0
  438. include/rerun/indicator_component.hpp +59 -0
  439. include/rerun/loggable.hpp +54 -0
  440. include/rerun/recording_stream.hpp +960 -0
  441. include/rerun/rerun_sdk_export.hpp +25 -0
  442. include/rerun/result.hpp +86 -0
  443. include/rerun/rotation3d.hpp +33 -0
  444. include/rerun/sdk_info.hpp +20 -0
  445. include/rerun/spawn.hpp +21 -0
  446. include/rerun/spawn_options.hpp +57 -0
  447. include/rerun/string_utils.hpp +16 -0
  448. include/rerun/third_party/cxxopts.hpp +2198 -0
  449. include/rerun/time_column.hpp +288 -0
  450. include/rerun/timeline.hpp +38 -0
  451. include/rerun/type_traits.hpp +40 -0
  452. include/rerun.hpp +86 -0
  453. lib/cmake/rerun_sdk/rerun_sdkConfig.cmake +70 -0
  454. lib/cmake/rerun_sdk/rerun_sdkConfigVersion.cmake +83 -0
  455. lib/cmake/rerun_sdk/rerun_sdkTargets-release.cmake +19 -0
  456. lib/cmake/rerun_sdk/rerun_sdkTargets.cmake +108 -0
  457. lib/libarrow.a +0 -0
  458. lib/libarrow_bundled_dependencies.a +0 -0
  459. lib/librerun_c__linux_x64.a +0 -0
  460. lib/librerun_sdk.a +0 -0
  461. lib64/cmake/axel/axel-config.cmake +45 -0
  462. lib64/cmake/axel/axelTargets-release.cmake +19 -0
  463. lib64/cmake/axel/axelTargets.cmake +108 -0
  464. lib64/cmake/momentum/Findre2.cmake +52 -0
  465. lib64/cmake/momentum/momentum-config.cmake +67 -0
  466. lib64/cmake/momentum/momentumTargets-release.cmake +259 -0
  467. lib64/cmake/momentum/momentumTargets.cmake +377 -0
  468. lib64/libaxel.a +0 -0
  469. lib64/libmomentum_app_utils.a +0 -0
  470. lib64/libmomentum_character.a +0 -0
  471. lib64/libmomentum_character_sequence_solver.a +0 -0
  472. lib64/libmomentum_character_solver.a +0 -0
  473. lib64/libmomentum_common.a +0 -0
  474. lib64/libmomentum_diff_ik.a +0 -0
  475. lib64/libmomentum_io.a +0 -0
  476. lib64/libmomentum_io_common.a +0 -0
  477. lib64/libmomentum_io_fbx.a +0 -0
  478. lib64/libmomentum_io_gltf.a +0 -0
  479. lib64/libmomentum_io_legacy_json.a +0 -0
  480. lib64/libmomentum_io_marker.a +0 -0
  481. lib64/libmomentum_io_motion.a +0 -0
  482. lib64/libmomentum_io_shape.a +0 -0
  483. lib64/libmomentum_io_skeleton.a +0 -0
  484. lib64/libmomentum_io_urdf.a +0 -0
  485. lib64/libmomentum_marker_tracker.a +0 -0
  486. lib64/libmomentum_math.a +0 -0
  487. lib64/libmomentum_online_qr.a +0 -0
  488. lib64/libmomentum_process_markers.a +0 -0
  489. lib64/libmomentum_rerun.a +0 -0
  490. lib64/libmomentum_simd_constraints.a +0 -0
  491. lib64/libmomentum_simd_generalized_loss.a +0 -0
  492. lib64/libmomentum_skeleton.a +0 -0
  493. lib64/libmomentum_solver.a +0 -0
  494. pymomentum/axel.cpython-313-x86_64-linux-gnu.so +0 -0
  495. pymomentum/backend/__init__.py +16 -0
  496. pymomentum/backend/skel_state_backend.py +614 -0
  497. pymomentum/backend/trs_backend.py +871 -0
  498. pymomentum/backend/utils.py +224 -0
  499. pymomentum/geometry.cpython-313-x86_64-linux-gnu.so +0 -0
  500. pymomentum/marker_tracking.cpython-313-x86_64-linux-gnu.so +0 -0
  501. pymomentum/quaternion.py +740 -0
  502. pymomentum/skel_state.py +514 -0
  503. pymomentum/solver.cpython-313-x86_64-linux-gnu.so +0 -0
  504. pymomentum/solver2.cpython-313-x86_64-linux-gnu.so +0 -0
  505. pymomentum/torch/character.py +809 -0
  506. pymomentum/torch/parameter_limits.py +494 -0
  507. pymomentum/torch/utility.py +20 -0
  508. pymomentum/trs.py +535 -0
  509. pymomentum_cpu-0.1.77.post30.dist-info/METADATA +208 -0
  510. pymomentum_cpu-0.1.77.post30.dist-info/RECORD +555 -0
  511. pymomentum_cpu-0.1.77.post30.dist-info/WHEEL +5 -0
  512. pymomentum_cpu-0.1.77.post30.dist-info/licenses/LICENSE +21 -0
  513. pymomentum_cpu.libs/libabsl_base-86f3b38c.so.2505.0.0 +0 -0
  514. pymomentum_cpu.libs/libabsl_city-31b65ca2.so.2505.0.0 +0 -0
  515. pymomentum_cpu.libs/libabsl_debugging_internal-38680253.so.2505.0.0 +0 -0
  516. pymomentum_cpu.libs/libabsl_decode_rust_punycode-750652c3.so.2505.0.0 +0 -0
  517. pymomentum_cpu.libs/libabsl_demangle_internal-9a0351a3.so.2505.0.0 +0 -0
  518. pymomentum_cpu.libs/libabsl_demangle_rust-71629506.so.2505.0.0 +0 -0
  519. pymomentum_cpu.libs/libabsl_examine_stack-57661ecd.so.2505.0.0 +0 -0
  520. pymomentum_cpu.libs/libabsl_hash-8c523b7e.so.2505.0.0 +0 -0
  521. pymomentum_cpu.libs/libabsl_hashtablez_sampler-b5c3e343.so.2505.0.0 +0 -0
  522. pymomentum_cpu.libs/libabsl_int128-295bfed5.so.2505.0.0 +0 -0
  523. pymomentum_cpu.libs/libabsl_kernel_timeout_internal-29296ac1.so.2505.0.0 +0 -0
  524. pymomentum_cpu.libs/libabsl_log_globals-6cfa8af5.so.2505.0.0 +0 -0
  525. pymomentum_cpu.libs/libabsl_log_internal_format-a5c79460.so.2505.0.0 +0 -0
  526. pymomentum_cpu.libs/libabsl_log_internal_globals-481e9a7c.so.2505.0.0 +0 -0
  527. pymomentum_cpu.libs/libabsl_log_internal_log_sink_set-ac08f942.so.2505.0.0 +0 -0
  528. pymomentum_cpu.libs/libabsl_log_internal_message-7dfe150a.so.2505.0.0 +0 -0
  529. pymomentum_cpu.libs/libabsl_log_internal_nullguard-883adc72.so.2505.0.0 +0 -0
  530. pymomentum_cpu.libs/libabsl_log_internal_proto-a5da8c75.so.2505.0.0 +0 -0
  531. pymomentum_cpu.libs/libabsl_log_internal_structured_proto-e601fd9b.so.2505.0.0 +0 -0
  532. pymomentum_cpu.libs/libabsl_log_sink-894261b2.so.2505.0.0 +0 -0
  533. pymomentum_cpu.libs/libabsl_low_level_hash-a3284638.so.2505.0.0 +0 -0
  534. pymomentum_cpu.libs/libabsl_malloc_internal-814569de.so.2505.0.0 +0 -0
  535. pymomentum_cpu.libs/libabsl_raw_hash_set-922d64ad.so.2505.0.0 +0 -0
  536. pymomentum_cpu.libs/libabsl_raw_logging_internal-477f78ec.so.2505.0.0 +0 -0
  537. pymomentum_cpu.libs/libabsl_spinlock_wait-8b85a473.so.2505.0.0 +0 -0
  538. pymomentum_cpu.libs/libabsl_stacktrace-7369e71d.so.2505.0.0 +0 -0
  539. pymomentum_cpu.libs/libabsl_str_format_internal-98de729d.so.2505.0.0 +0 -0
  540. pymomentum_cpu.libs/libabsl_strerror-39a52998.so.2505.0.0 +0 -0
  541. pymomentum_cpu.libs/libabsl_strings-a57d5127.so.2505.0.0 +0 -0
  542. pymomentum_cpu.libs/libabsl_strings_internal-ed8c7c0d.so.2505.0.0 +0 -0
  543. pymomentum_cpu.libs/libabsl_symbolize-eba17dd1.so.2505.0.0 +0 -0
  544. pymomentum_cpu.libs/libabsl_synchronization-2f8cf326.so.2505.0.0 +0 -0
  545. pymomentum_cpu.libs/libabsl_time-066c0dde.so.2505.0.0 +0 -0
  546. pymomentum_cpu.libs/libabsl_time_zone-72867365.so.2505.0.0 +0 -0
  547. pymomentum_cpu.libs/libabsl_tracing_internal-021e37ee.so.2505.0.0 +0 -0
  548. pymomentum_cpu.libs/libabsl_utf8_for_code_point-de2a4d4a.so.2505.0.0 +0 -0
  549. pymomentum_cpu.libs/libconsole_bridge-f26e11cc.so.1.0 +0 -0
  550. pymomentum_cpu.libs/libdeflate-577b71e3.so.0 +0 -0
  551. pymomentum_cpu.libs/libdispenso-67ac1721.so.1.4.0 +0 -0
  552. pymomentum_cpu.libs/libezc3d-4a95ab2c.so +0 -0
  553. pymomentum_cpu.libs/libre2-985fb83c.so.11 +0 -0
  554. pymomentum_cpu.libs/libtinyxml2-8d10763c.so.11.0.0 +0 -0
  555. pymomentum_cpu.libs/liburdfdom_model-7b26ae88.so.4.0 +0 -0
@@ -0,0 +1,809 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ # pyre-strict
7
+
8
+ from typing import Tuple
9
+
10
+ import pymomentum.geometry as pym_geometry
11
+ import pymomentum.quaternion as pym_quaternion
12
+ import pymomentum.skel_state as pym_skel_state
13
+ import pymomentum.trs as pym_trs
14
+ import torch
15
+
16
+ from pymomentum.backend import skel_state_backend, trs_backend, utils as backend_utils
17
+
18
+ from pymomentum.torch.parameter_limits import ParameterLimits
19
+ from pymomentum.torch.utility import _unsqueeze_joint_params
20
+
21
+
22
+ class Skeleton(torch.nn.Module):
23
+ def __init__(
24
+ self,
25
+ character: pym_geometry.Character,
26
+ *,
27
+ dtype: torch.dtype = torch.float32,
28
+ ) -> None:
29
+ super().__init__()
30
+
31
+ self.register_buffer(
32
+ "joint_translation_offsets",
33
+ torch.tensor(character.skeleton.offsets, dtype=dtype).clone().detach(),
34
+ )
35
+ self.register_buffer(
36
+ "joint_prerotations",
37
+ torch.tensor(character.skeleton.pre_rotations, dtype=dtype)
38
+ .clone()
39
+ .detach(),
40
+ )
41
+
42
+ prefix_multiplication_indices = (
43
+ backend_utils.calc_fk_prefix_multiplication_indices(
44
+ joint_parents=torch.tensor(
45
+ character.skeleton.joint_parents, dtype=torch.int32
46
+ )
47
+ )
48
+ )
49
+
50
+ self.register_buffer("pmi", torch.concat(prefix_multiplication_indices, dim=1))
51
+ self._pmi_buffer_sizes: list[int] = [
52
+ t.shape[1] for t in prefix_multiplication_indices
53
+ ]
54
+
55
+ self.joint_names: list[str] = character.skeleton.joint_names
56
+ self.register_buffer(
57
+ "joint_parents",
58
+ torch.tensor(character.skeleton.joint_parents, dtype=torch.int32),
59
+ )
60
+
61
+ def joint_parameters_to_local_skeleton_state(
62
+ self, joint_parameters: torch.Tensor
63
+ ) -> torch.Tensor:
64
+ if not hasattr(self, "joint_prerotations"):
65
+ raise RuntimeError("Character has no skeleton")
66
+
67
+ joint_parameters = _unsqueeze_joint_params(joint_parameters)
68
+
69
+ joint_translation_offsets = self.joint_translation_offsets
70
+ while joint_translation_offsets.ndim < joint_parameters.ndim:
71
+ joint_translation_offsets = joint_translation_offsets.unsqueeze(0)
72
+
73
+ joint_prerotations = self.joint_prerotations
74
+ while joint_prerotations.ndim < joint_parameters.ndim:
75
+ joint_prerotations = joint_prerotations.unsqueeze(0)
76
+
77
+ local_state_t = (
78
+ joint_parameters[..., :3] + self.joint_translation_offsets[None, :]
79
+ )
80
+ local_state_q = pym_quaternion.euler_xyz_to_quaternion(
81
+ joint_parameters[..., 3:6]
82
+ )
83
+ local_state_q = pym_quaternion.multiply_assume_normalized(
84
+ self.joint_prerotations[None],
85
+ local_state_q,
86
+ )
87
+ # exp2 is not supported by all of our export formats, so we have to implement
88
+ # it using exp and natural log instead. The constant here is ln(2.0)
89
+ local_state_s = torch.exp(0.6931471824645996 * joint_parameters[..., 6:])
90
+ return torch.cat([local_state_t, local_state_q, local_state_s], dim=-1)
91
+
92
+ def joint_parameters_to_local_trs(
93
+ self, joint_parameters: torch.Tensor
94
+ ) -> pym_trs.TRSTransform:
95
+ """
96
+ Convert joint parameters to local TRS (Translation-Rotation-Scale) state.
97
+
98
+ This function takes joint parameters and converts them to the TRS representation
99
+ as a tuple, consistent with the pymomentum.trs module interface.
100
+ The TRS format is useful for applications that need explicit access to individual
101
+ transformation components and can be more efficient than the skeleton state format.
102
+
103
+ Args:
104
+ joint_parameters: Joint parameters tensor of shape (batch_size, num_joints * 7)
105
+ or (batch_size, num_joints, 7). Each joint has 7 parameters:
106
+ - [0:3] translation offset
107
+ - [3:6] euler xyz rotation angles
108
+ - [6] log2 scale factor
109
+
110
+ Returns:
111
+ TRS transform tuple (translation, rotation_matrix, scale) where:
112
+ - translation: Local joint translations, shape (batch_size, num_joints, 3)
113
+ - rotation_matrix: Local joint rotations as 3x3 matrices, shape (batch_size, num_joints, 3, 3)
114
+ - scale: Local joint scales, shape (batch_size, num_joints, 1)
115
+
116
+ Raises:
117
+ RuntimeError: If the character has no skeleton
118
+
119
+ Note:
120
+ This function is equivalent to joint_parameters_to_local_skeleton_state() but
121
+ returns the TRS format instead of the 8-parameter skeleton state format.
122
+ It uses the TRS backend for efficient computation.
123
+ """
124
+ if not hasattr(self, "joint_prerotations"):
125
+ raise RuntimeError("Character has no skeleton")
126
+
127
+ joint_parameters = _unsqueeze_joint_params(joint_parameters)
128
+
129
+ # Convert joint_prerotations from quaternions to rotation matrices
130
+ joint_rotation_matrices = pym_quaternion.to_rotation_matrix(
131
+ self.joint_prerotations
132
+ )
133
+
134
+ # Use the TRS backend for efficient conversion
135
+ return trs_backend.get_local_state_from_joint_params(
136
+ joint_params=joint_parameters,
137
+ joint_offset=self.joint_translation_offsets,
138
+ joint_rotation=joint_rotation_matrices,
139
+ )
140
+
141
+ def joint_parameters_to_trs(
142
+ self, joint_parameters: torch.Tensor
143
+ ) -> pym_trs.TRSTransform:
144
+ """
145
+ Convert joint parameters directly to global TRS (Translation-Rotation-Scale) state.
146
+
147
+ This function performs the full forward kinematics pipeline using the TRS backend,
148
+ converting joint parameters to local TRS state and then to global TRS state in
149
+ a single call. This is more efficient than calling the two-step process separately.
150
+
151
+ Args:
152
+ joint_parameters: Joint parameters tensor of shape (batch_size, num_joints * 7)
153
+ or (batch_size, num_joints, 7). Each joint has 7 parameters:
154
+ - [0:3] translation offset
155
+ - [3:6] euler xyz rotation angles
156
+ - [6] log2 scale factor
157
+
158
+ Returns:
159
+ TRS transform tuple (translation, rotation_matrix, scale) where:
160
+ - translation: Global joint translations, shape (batch_size, num_joints, 3)
161
+ - rotation_matrix: Global joint rotations as 3x3 matrices, shape (batch_size, num_joints, 3, 3)
162
+ - scale: Global joint scales, shape (batch_size, num_joints, 1)
163
+
164
+ Raises:
165
+ RuntimeError: If the character has no skeleton
166
+
167
+ Note:
168
+ This is equivalent to calling joint_parameters_to_local_trs() followed by
169
+ local_trs_to_global_trs(), but more efficient as it avoids intermediate steps.
170
+ """
171
+ # Get local TRS state from joint parameters
172
+ local_trs = self.joint_parameters_to_local_trs(joint_parameters)
173
+ local_state_t, local_state_r, local_state_s = local_trs
174
+
175
+ # Convert local TRS to global TRS using forward kinematics
176
+ return trs_backend.global_trs_state_from_local_trs_state(
177
+ local_state_t=local_state_t,
178
+ local_state_r=local_state_r,
179
+ local_state_s=local_state_s,
180
+ prefix_mul_indices=list(
181
+ self.pmi.split(
182
+ split_size=self._pmi_buffer_sizes,
183
+ dim=1,
184
+ )
185
+ ),
186
+ )
187
+
188
+ def local_trs_to_global_trs(
189
+ self,
190
+ local_trs: pym_trs.TRSTransform,
191
+ ) -> pym_trs.TRSTransform:
192
+ """
193
+ Convert local TRS state to global TRS state using forward kinematics.
194
+
195
+ This function performs forward kinematics on the local TRS transformations
196
+ to compute the global joint transformations. This is useful when you have
197
+ local TRS states from other sources and need to convert them to global states.
198
+
199
+ Args:
200
+ local_trs: Local TRS transform tuple (translation, rotation_matrix, scale) where:
201
+ - translation: Local joint translations, shape (batch_size, num_joints, 3)
202
+ - rotation_matrix: Local joint rotations as 3x3 matrices, shape (batch_size, num_joints, 3, 3)
203
+ - scale: Local joint scales, shape (batch_size, num_joints, 1)
204
+
205
+ Returns:
206
+ TRS transform tuple (translation, rotation_matrix, scale) where:
207
+ - translation: Global joint translations, shape (batch_size, num_joints, 3)
208
+ - rotation_matrix: Global joint rotations as 3x3 matrices, shape (batch_size, num_joints, 3, 3)
209
+ - scale: Global joint scales, shape (batch_size, num_joints, 1)
210
+
211
+ Note:
212
+ This function uses the TRS backend for efficient forward kinematics computation.
213
+ """
214
+ local_state_t, local_state_r, local_state_s = local_trs
215
+ return trs_backend.global_trs_state_from_local_trs_state(
216
+ local_state_t=local_state_t,
217
+ local_state_r=local_state_r,
218
+ local_state_s=local_state_s,
219
+ prefix_mul_indices=list(
220
+ self.pmi.split(
221
+ split_size=self._pmi_buffer_sizes,
222
+ dim=1,
223
+ )
224
+ ),
225
+ )
226
+
227
+ def local_skeleton_state_to_skeleton_state(
228
+ self, local_skel_state: torch.Tensor
229
+ ) -> torch.Tensor:
230
+ return skel_state_backend.global_skel_state_from_local_skel_state(
231
+ local_skel_state=local_skel_state,
232
+ prefix_mul_indices=list(
233
+ self.pmi.split(
234
+ split_size=self._pmi_buffer_sizes,
235
+ dim=1,
236
+ )
237
+ ),
238
+ )
239
+
240
+ def skeleton_state_to_local_skeleton_state(
241
+ self, skel_state: torch.Tensor
242
+ ) -> torch.Tensor:
243
+ joint_parents = self.joint_parents
244
+ parent_skel_states = skel_state.index_select(
245
+ -2, torch.clamp(joint_parents, min=0)
246
+ )
247
+ # global = parent * local
248
+ local_skel_states = pym_skel_state.multiply(
249
+ pym_skel_state.inverse(parent_skel_states), skel_state
250
+ )
251
+ while joint_parents.ndim + 1 < local_skel_states.ndim:
252
+ joint_parents = joint_parents[None, ...]
253
+
254
+ local_skel_states = torch.where(
255
+ (joint_parents >= 0)[..., None], local_skel_states, skel_state
256
+ )
257
+
258
+ return local_skel_states
259
+
260
+ def local_skeleton_state_to_joint_parameters(
261
+ self,
262
+ local_skel_state: torch.Tensor,
263
+ ) -> torch.Tensor:
264
+ joint_translation_offsets = self.joint_translation_offsets
265
+ joint_prerotations = self.joint_prerotations
266
+
267
+ # Compute translation joint parameters
268
+ translation_params = local_skel_state[..., :3] - joint_translation_offsets[None]
269
+
270
+ # Invert out the pre-rotations:
271
+ local_rotations = local_skel_state[..., 3:7]
272
+ adjusted_rotations = pym_quaternion.multiply(
273
+ pym_quaternion.inverse(joint_prerotations[None]),
274
+ local_rotations,
275
+ )
276
+
277
+ # Use the pymomentum.quaternion implementation instead of real_lbs_quaternion's implementation
278
+ # because it's more numerically stable. This is important for backpropagating through this
279
+ # function.
280
+ rotation_joint_params = pym_quaternion.quaternion_to_xyz_euler(
281
+ adjusted_rotations, eps=1e-6
282
+ )
283
+
284
+ # Compute scale joint parameters
285
+ scale_joint_params = torch.log2(local_skel_state[..., 7:8])
286
+
287
+ return torch.cat(
288
+ [translation_params, rotation_joint_params, scale_joint_params], dim=-1
289
+ ).flatten(-2, -1)
290
+
291
+ def skeleton_state_to_joint_parameters(
292
+ self, skel_state: torch.Tensor
293
+ ) -> torch.Tensor:
294
+ return self.local_skeleton_state_to_joint_parameters(
295
+ self.skeleton_state_to_local_skeleton_state(skel_state)
296
+ )
297
+
298
+ def forward(self, joint_parameters: torch.Tensor) -> torch.Tensor:
299
+ if joint_parameters.ndim == 1:
300
+ joint_parameters = joint_parameters[None, :]
301
+ return self.local_skeleton_state_to_skeleton_state(
302
+ self.joint_parameters_to_local_skeleton_state(joint_parameters)
303
+ )
304
+
305
+
306
+ class LinearBlendSkinning(torch.nn.Module):
307
+ def __init__(
308
+ self,
309
+ character: pym_geometry.Character,
310
+ *,
311
+ dtype: torch.dtype = torch.float32,
312
+ ) -> None:
313
+ super().__init__()
314
+
315
+ self.register_buffer(
316
+ "inverse_bind_pose",
317
+ pym_skel_state.from_matrix(
318
+ torch.tensor(character.inverse_bind_pose, dtype=dtype)
319
+ )
320
+ .detach()
321
+ .clone(),
322
+ )
323
+
324
+ self.num_vertices: int = character.skin_weights.index.shape[0]
325
+
326
+ (
327
+ skin_indices_flattened,
328
+ skin_weights_flattened,
329
+ vert_indices_flattened,
330
+ ) = backend_utils.flatten_skinning_weights_and_indices(
331
+ skin_weights=torch.tensor(character.skin_weights.weight, dtype=dtype),
332
+ skin_indices=torch.tensor(character.skin_weights.index, dtype=torch.int32),
333
+ )
334
+
335
+ self.register_buffer(
336
+ "skin_indices_flattened", skin_indices_flattened.detach().clone()
337
+ )
338
+ self.register_buffer(
339
+ "skin_weights_flattened", skin_weights_flattened.detach().clone()
340
+ )
341
+ self.register_buffer(
342
+ "vert_indices_flattened", vert_indices_flattened.detach().clone()
343
+ )
344
+
345
+ def forward(
346
+ self,
347
+ skel_state: torch.Tensor,
348
+ rest_vertex_positions: torch.Tensor,
349
+ ) -> torch.Tensor:
350
+ assert rest_vertex_positions.shape[-1] == 3
351
+ assert rest_vertex_positions.shape[-2] == self.num_vertices
352
+
353
+ inverse_bind_pose = self.inverse_bind_pose
354
+ while inverse_bind_pose.ndim < skel_state.ndim:
355
+ inverse_bind_pose = inverse_bind_pose.unsqueeze(0)
356
+
357
+ return skel_state_backend.skin_points_from_skel_state(
358
+ template=rest_vertex_positions,
359
+ global_skel_state=skel_state,
360
+ binded_skel_state_inv=inverse_bind_pose,
361
+ skin_indices_flattened=self.skin_indices_flattened,
362
+ skin_weights_flattened=self.skin_weights_flattened,
363
+ vert_indices_flattened=self.vert_indices_flattened,
364
+ )
365
+
366
+ def skin_with_trs(
367
+ self,
368
+ global_trs: pym_trs.TRSTransform,
369
+ rest_vertex_positions: torch.Tensor,
370
+ ) -> torch.Tensor:
371
+ """
372
+ Apply skinning using global TRS state (Translation-Rotation-Scale).
373
+
374
+ This method takes global TRS state as a tuple and applies linear blend skinning
375
+ using the TRS backend. This is useful when working directly with TRS representations
376
+ or when you want to avoid conversions to skeleton state format.
377
+
378
+ Args:
379
+ global_trs: Global TRS transform tuple (translation, rotation_matrix, scale) where:
380
+ - translation: Global joint translations, shape (batch_size, num_joints, 3)
381
+ - rotation_matrix: Global joint rotations as 3x3 matrices, shape (batch_size, num_joints, 3, 3)
382
+ - scale: Global joint scales, shape (batch_size, num_joints, 1)
383
+ rest_vertex_positions: Rest vertex positions, shape (batch_size, num_vertices, 3)
384
+ or (num_vertices, 3) which will be expanded to batch size
385
+
386
+ Returns:
387
+ skinned_vertices: Skinned vertex positions, shape (batch_size, num_vertices, 3)
388
+
389
+ Note:
390
+ This method uses the TRS backend skinning function for efficient computation.
391
+ """
392
+ global_state_t, global_state_r, global_state_s = global_trs
393
+
394
+ inv_bind_pose_rot: torch.Tensor = pym_quaternion.to_rotation_matrix(
395
+ self.inverse_bind_pose[..., 3:7]
396
+ )
397
+ inv_bind_pose_trans: torch.Tensor = self.inverse_bind_pose[..., 0:3]
398
+
399
+ return trs_backend.skinning(
400
+ template=rest_vertex_positions,
401
+ t=global_state_t,
402
+ r=global_state_r,
403
+ s=global_state_s,
404
+ t0=inv_bind_pose_trans,
405
+ r0=inv_bind_pose_rot,
406
+ skin_indices_flattened=self.skin_indices_flattened,
407
+ skin_weights_flattened=self.skin_weights_flattened,
408
+ vert_indices_flattened=self.vert_indices_flattened,
409
+ )
410
+
411
+ def skin_with_transforms(
412
+ self,
413
+ global_state_t: torch.Tensor,
414
+ global_state_r: torch.Tensor,
415
+ global_state_s: torch.Tensor,
416
+ rest_vertex_positions: torch.Tensor,
417
+ ) -> torch.Tensor:
418
+ """
419
+ Apply skinning using individual global TRS tensors (legacy interface).
420
+
421
+ This method provides backward compatibility for code that passes individual
422
+ tensors instead of the TRS tuple format. Internally, it creates a tuple
423
+ and delegates to skin_with_trs().
424
+
425
+ Args:
426
+ global_state_t: Global joint translations, shape (batch_size, num_joints, 3)
427
+ global_state_r: Global joint rotations as 3x3 matrices, shape (batch_size, num_joints, 3, 3)
428
+ global_state_s: Global joint scales, shape (batch_size, num_joints, 1)
429
+ rest_vertex_positions: Rest vertex positions, shape (batch_size, num_vertices, 3)
430
+ or (num_vertices, 3) which will be expanded to batch size
431
+
432
+ Returns:
433
+ skinned_vertices: Skinned vertex positions, shape (batch_size, num_vertices, 3)
434
+
435
+ Note:
436
+ This method is provided for backward compatibility. New code should use
437
+ skin_with_trs() with the TRS tuple interface.
438
+ """
439
+ global_trs = (global_state_t, global_state_r, global_state_s)
440
+ return self.skin_with_trs(global_trs, rest_vertex_positions)
441
+
442
+ def unpose(
443
+ self, global_joint_state: torch.Tensor, verts: torch.Tensor
444
+ ) -> torch.Tensor:
445
+ return skel_state_backend.unpose_from_momentum_global_joint_state(
446
+ verts,
447
+ global_joint_state,
448
+ self.inverse_bind_pose,
449
+ self.skin_indices_flattened,
450
+ self.skin_weights_flattened,
451
+ self.vert_indices_flattened,
452
+ with_high_precision=True,
453
+ )
454
+
455
+
456
+ class Mesh(torch.nn.Module):
457
+ def __init__(
458
+ self,
459
+ character: pym_geometry.Character,
460
+ *,
461
+ dtype: torch.dtype = torch.float32,
462
+ ) -> None:
463
+ super().__init__()
464
+
465
+ self.register_buffer(
466
+ "rest_vertices",
467
+ torch.tensor(character.mesh.vertices, dtype=dtype).clone().detach(),
468
+ )
469
+
470
+ self.register_buffer(
471
+ "faces",
472
+ torch.tensor(character.mesh.faces, dtype=torch.int32).clone().detach(),
473
+ )
474
+
475
+ self.register_buffer(
476
+ "texcoords",
477
+ torch.tensor(character.mesh.texcoords, dtype=dtype).clone().detach(),
478
+ )
479
+
480
+ self.register_buffer(
481
+ "texcoord_faces",
482
+ torch.tensor(character.mesh.texcoord_faces, dtype=torch.int32)
483
+ .clone()
484
+ .detach(),
485
+ )
486
+
487
+
488
+ class ParameterTransform(torch.nn.Module):
489
+ def __init__(
490
+ self,
491
+ character: pym_geometry.Character,
492
+ *,
493
+ dtype: torch.dtype = torch.float32,
494
+ ) -> None:
495
+ super().__init__()
496
+
497
+ self.register_buffer(
498
+ "parameter_transform",
499
+ character.parameter_transform.transform.to(dtype=dtype)
500
+ .clone()
501
+ .detach()
502
+ .requires_grad_(False),
503
+ )
504
+
505
+ self.register_buffer(
506
+ "pose_parameters",
507
+ character.parameter_transform.pose_parameters.clone()
508
+ .detach()
509
+ .requires_grad_(False),
510
+ )
511
+
512
+ self.register_buffer(
513
+ "rigid_parameters",
514
+ character.parameter_transform.rigid_parameters.clone()
515
+ .detach()
516
+ .requires_grad_(False),
517
+ )
518
+
519
+ self.register_buffer(
520
+ "scaling_parameters",
521
+ character.parameter_transform.scaling_parameters.clone()
522
+ .detach()
523
+ .requires_grad_(False),
524
+ )
525
+
526
+ self.parameter_names: list[str] = character.parameter_transform.names
527
+
528
+ def forward(self, model_parameters: torch.Tensor) -> torch.Tensor:
529
+ if not hasattr(self, "parameter_transform"):
530
+ raise RuntimeError("Character has no parameter transform")
531
+ return torch.einsum(
532
+ "dn,...n->...d",
533
+ self.parameter_transform,
534
+ model_parameters,
535
+ )
536
+
537
+
538
+ class InverseParameterTransform(torch.nn.Module):
539
+ def __init__(
540
+ self, parameter_transform: ParameterTransform, rcond: float = 1e-5
541
+ ) -> None:
542
+ super().__init__()
543
+ self.rcond: float = rcond
544
+
545
+ # We tried using torch.linalg.lstsq, but the fully-pivoting and SVD-based
546
+ # versions don't run on the GPU while the non-pivoting version gives bad
547
+ # results for non-unique parameter transforms. Therefore let's precompute
548
+ # the full SVD, this is maybe overkill but we only have to do it once.
549
+
550
+ # Full SVD for general case
551
+ U, S_inv, V = self._compute_svd(parameter_transform.parameter_transform)
552
+ self.register_buffer("svd_U", U)
553
+ self.register_buffer("svd_S_inv", S_inv)
554
+ self.register_buffer("svd_V", V)
555
+
556
+ def _compute_svd(
557
+ self,
558
+ matrix: torch.Tensor,
559
+ ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
560
+ """
561
+ Compute the Singular Value Decomposition (SVD) of a matrix and return the components needed for pseudoinverse.
562
+
563
+ This function performs SVD on the input matrix and returns the components U, S_inv, and V,
564
+ where S_inv contains the reciprocals of singular values above the threshold defined by self.rcond,
565
+ and zeros for singular values below the threshold to avoid numerical instability.
566
+
567
+ Parameters
568
+ ----------
569
+ matrix : torch.Tensor
570
+ The input matrix to decompose using SVD.
571
+
572
+ Returns
573
+ -------
574
+ Tuple[torch.Tensor, torch.Tensor, torch.Tensor]
575
+ A tuple containing:
576
+ - U: Left singular vectors (detached from computation graph)
577
+ - S_inv: Reciprocal of singular values with thresholding (detached from computation graph)
578
+ - V: Right singular vectors (detached from computation graph)
579
+ """
580
+ U, S, V = torch.linalg.svd(matrix, full_matrices=False)
581
+ # Avoid divide-by-zero
582
+ S_inv = torch.where(S < self.rcond, 0.0, torch.reciprocal(S))
583
+ return U.detach(), S_inv.detach(), V.detach()
584
+
585
+ def _solve_via_svd(
586
+ self, U: torch.Tensor, S_inv: torch.Tensor, V: torch.Tensor, y: torch.Tensor
587
+ ) -> torch.Tensor:
588
+ # U * S * V^T * model_params = y
589
+ # model_params = V * S^-1 * U^T * y
590
+
591
+ # First multiply by U^T:
592
+ Ut_y = torch.einsum("jm,...j->...m", U, y)
593
+ while S_inv.ndim < Ut_y.ndim:
594
+ S_inv = S_inv.unsqueeze(0)
595
+ # Next divide by S (a diagonal matrix):
596
+ tmp = Ut_y * S_inv
597
+ # Finally multiply by V^T:
598
+ return torch.einsum("ij,...i->...j", V, tmp)
599
+
600
+ def joint_parameters_to_model_parameters(
601
+ self, joint_parameters: torch.Tensor
602
+ ) -> torch.Tensor:
603
+ return self._solve_via_svd(
604
+ self.svd_U, self.svd_S_inv, self.svd_V, joint_parameters
605
+ )
606
+
607
+
608
+ class AdvancedInverseParameterTransform(InverseParameterTransform):
609
+ """
610
+ This is a more advanced version of InverseParameterTransform that can handle
611
+ the case where pose and scale are mutually exclusive (i.e. no joint parameter
612
+ is affected by both pose and scale). In this case, we can compute a pose-only
613
+ SVD and use that to compute the inverse parameter transform.
614
+ """
615
+
616
+ def __init__(
617
+ self, parameter_transform: ParameterTransform, rcond: float = 1e-5
618
+ ) -> None:
619
+ super().__init__(parameter_transform, rcond)
620
+ self.parameter_transform: ParameterTransform = parameter_transform
621
+
622
+ # Pose-only SVD (for partial inverse when scales are known)
623
+ pose_scale_are_mutually_exclusive, affected_by_pose_mask = (
624
+ self.check_if_pose_scale_are_mutually_exclusive()
625
+ )
626
+ self.pose_scale_are_mutually_exclusive: bool = pose_scale_are_mutually_exclusive
627
+ self.register_buffer("affected_by_pose_mask", affected_by_pose_mask)
628
+ if pose_scale_are_mutually_exclusive:
629
+ # If pose and scale are mutually exclusive, we can compute a pose-only SVD
630
+ pose_matrix = parameter_transform.parameter_transform[
631
+ affected_by_pose_mask
632
+ ][:, parameter_transform.pose_parameters]
633
+ U_p, S_inv_p, V_p = self._compute_svd(pose_matrix)
634
+
635
+ self.register_buffer("svd_U_poses", U_p)
636
+ self.register_buffer("svd_S_poses_inv", S_inv_p)
637
+ self.register_buffer("svd_V_poses", V_p)
638
+ self.register_buffer("scale_only_parameter_transform", torch.tensor([]))
639
+
640
+ else:
641
+ pose_matrix = parameter_transform.parameter_transform[
642
+ ..., parameter_transform.pose_parameters
643
+ ]
644
+ scale_matrix = parameter_transform.parameter_transform[
645
+ ..., parameter_transform.scaling_parameters
646
+ ]
647
+ U_p, S_inv_p, V_p = self._compute_svd(pose_matrix)
648
+
649
+ self.register_buffer(
650
+ "scale_only_parameter_transform", scale_matrix.detach()
651
+ )
652
+ self.register_buffer("svd_U_poses", U_p)
653
+ self.register_buffer("svd_S_poses_inv", S_inv_p)
654
+ self.register_buffer("svd_V_poses", V_p)
655
+
656
+ def check_if_pose_scale_are_mutually_exclusive(self) -> Tuple[bool, torch.Tensor]:
657
+ # Check if pose and scale are mutually exclusive (i.e. no joint parameter is affected
658
+ # by both pose and scale)
659
+ pt = self.parameter_transform
660
+ transform = pt.parameter_transform
661
+ scale_mask = pt.scaling_parameters
662
+ pose_mask = pt.pose_parameters
663
+
664
+ # Compute which joint params are affected by scale vs pose
665
+ affected_by_scale_mask = (transform[:, scale_mask] != 0).any(dim=1)
666
+ affected_by_pose_mask = (transform[:, pose_mask] != 0).any(dim=1)
667
+
668
+ # Mutually exclusive if no joint is affected by both
669
+ return (
670
+ not torch.any(affected_by_scale_mask & affected_by_pose_mask)
671
+ ), affected_by_pose_mask
672
+
673
+ def joint_parameters_to_model_parameters_with_known_scales(
674
+ self, joint_parameters: torch.Tensor, scale_parameters: torch.Tensor
675
+ ) -> torch.Tensor:
676
+ if self.pose_scale_are_mutually_exclusive:
677
+ adjusted_joint_parameters = joint_parameters[
678
+ ..., self.affected_by_pose_mask
679
+ ]
680
+ else:
681
+ # y_adjusted = y - M_fixed @ x_fixed
682
+ adjusted_joint_parameters = joint_parameters - torch.einsum(
683
+ "dn,...n->...d", self.scale_only_parameter_transform, scale_parameters
684
+ )
685
+ poses = self._solve_via_svd(
686
+ self.svd_U_poses,
687
+ self.svd_S_poses_inv,
688
+ self.svd_V_poses,
689
+ adjusted_joint_parameters,
690
+ )
691
+
692
+ result = torch.zeros(
693
+ *poses.shape[:-1],
694
+ self.parameter_transform.parameter_transform.shape[-1],
695
+ device=poses.device,
696
+ dtype=poses.dtype,
697
+ )
698
+ result[..., self.parameter_transform.pose_parameters] = poses
699
+ result[..., self.parameter_transform.scaling_parameters] = scale_parameters
700
+ return result
701
+
702
+
703
+ class Character(torch.nn.Module):
704
+ def __init__(
705
+ self,
706
+ character: pym_geometry.Character,
707
+ *,
708
+ has_parameter_transform: bool = True,
709
+ has_skeleton: bool = True,
710
+ has_rest_mesh: bool = True,
711
+ has_skinning: bool = True,
712
+ has_limits: bool = True,
713
+ dtype: torch.dtype = torch.float32,
714
+ ) -> None:
715
+ super().__init__()
716
+
717
+ if has_skeleton:
718
+ self.skeleton: Skeleton = Skeleton(character, dtype=dtype)
719
+
720
+ if has_rest_mesh:
721
+ self.mesh: Mesh = Mesh(character, dtype=dtype)
722
+
723
+ if has_parameter_transform:
724
+ self.parameter_transform: ParameterTransform = ParameterTransform(
725
+ character, dtype=dtype
726
+ )
727
+
728
+ if has_skinning:
729
+ self.linear_blend_skinning: LinearBlendSkinning = LinearBlendSkinning(
730
+ character, dtype=dtype
731
+ )
732
+
733
+ if has_limits:
734
+ self.parameter_limits: ParameterLimits = ParameterLimits(
735
+ character.parameter_limits, dtype=dtype
736
+ )
737
+
738
+ def joint_parameters_to_local_skeleton_state(
739
+ self, joint_parameters: torch.Tensor
740
+ ) -> torch.Tensor:
741
+ if not hasattr(self, "skeleton"):
742
+ raise RuntimeError("Character has no skeleton, please provide one")
743
+ return self.skeleton.joint_parameters_to_local_skeleton_state(joint_parameters)
744
+
745
+ def model_parameters_to_local_skeleton_state(
746
+ self, model_parameters: torch.Tensor
747
+ ) -> torch.Tensor:
748
+ if not hasattr(self, "skeleton"):
749
+ raise RuntimeError("Character has no skeleton, please provide one")
750
+ return self.joint_parameters_to_local_skeleton_state(
751
+ self.model_parameters_to_joint_parameters(model_parameters)
752
+ )
753
+
754
+ def local_skeleton_state_to_skeleton_state(
755
+ self, local_skel_state: torch.Tensor
756
+ ) -> torch.Tensor:
757
+ if not hasattr(self, "skeleton"):
758
+ raise RuntimeError("Character has no skeleton, please provide one")
759
+ return self.skeleton.local_skeleton_state_to_skeleton_state(local_skel_state)
760
+
761
+ def model_parameters_to_joint_parameters(
762
+ self, model_parameters: torch.Tensor
763
+ ) -> torch.Tensor:
764
+ if not hasattr(self, "parameter_transform"):
765
+ raise RuntimeError(
766
+ "Character has no parameter transform, please provide one"
767
+ )
768
+ return self.parameter_transform.forward(model_parameters)
769
+
770
+ def joint_parameters_to_skeleton_state(
771
+ self, joint_parameters: torch.Tensor
772
+ ) -> torch.Tensor:
773
+ local_skel_state = self.joint_parameters_to_local_skeleton_state(
774
+ joint_parameters
775
+ )
776
+ return self.local_skeleton_state_to_skeleton_state(local_skel_state)
777
+
778
+ def model_parameters_to_skeleton_state(
779
+ self, model_parameters: torch.Tensor
780
+ ) -> torch.Tensor:
781
+ return self.joint_parameters_to_skeleton_state(
782
+ self.model_parameters_to_joint_parameters(model_parameters)
783
+ )
784
+
785
+ def skin_points(
786
+ self,
787
+ skel_state: torch.Tensor,
788
+ rest_vertex_positions: torch.Tensor | None = None,
789
+ ) -> torch.Tensor:
790
+ if rest_vertex_positions is None:
791
+ if not hasattr(self, "mesh"):
792
+ raise RuntimeError("Character has no rest mesh, please provide one")
793
+ rest_vertex_positions = self.mesh.rest_vertices
794
+
795
+ if not hasattr(self, "linear_blend_skinning"):
796
+ raise RuntimeError("Character has no skinning information")
797
+
798
+ return self.linear_blend_skinning.forward(
799
+ skel_state,
800
+ rest_vertex_positions,
801
+ )
802
+
803
+ def unpose(
804
+ self, skel_state: torch.Tensor, vertex_positions: torch.Tensor
805
+ ) -> torch.Tensor:
806
+ if not hasattr(self, "linear_blend_skinning"):
807
+ raise RuntimeError("Character has no skinning information")
808
+
809
+ return self.linear_blend_skinning.unpose(skel_state, vertex_positions)