pymomentum-cpu 0.1.78.post11__cp313-cp313-win_amd64.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 (512) 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/arrow_bundled_dependencies.lib +0 -0
  454. lib/arrow_static.lib +0 -0
  455. lib/axel.lib +0 -0
  456. lib/cmake/axel/axel-config.cmake +45 -0
  457. lib/cmake/axel/axelTargets-release.cmake +19 -0
  458. lib/cmake/axel/axelTargets.cmake +108 -0
  459. lib/cmake/momentum/Findre2.cmake +52 -0
  460. lib/cmake/momentum/momentum-config.cmake +67 -0
  461. lib/cmake/momentum/momentumTargets-release.cmake +259 -0
  462. lib/cmake/momentum/momentumTargets.cmake +377 -0
  463. lib/cmake/rerun_sdk/rerun_sdkConfig.cmake +70 -0
  464. lib/cmake/rerun_sdk/rerun_sdkConfigVersion.cmake +83 -0
  465. lib/cmake/rerun_sdk/rerun_sdkTargets-release.cmake +19 -0
  466. lib/cmake/rerun_sdk/rerun_sdkTargets.cmake +108 -0
  467. lib/momentum_app_utils.lib +0 -0
  468. lib/momentum_character.lib +0 -0
  469. lib/momentum_character_sequence_solver.lib +0 -0
  470. lib/momentum_character_solver.lib +0 -0
  471. lib/momentum_common.lib +0 -0
  472. lib/momentum_diff_ik.lib +0 -0
  473. lib/momentum_io.lib +0 -0
  474. lib/momentum_io_common.lib +0 -0
  475. lib/momentum_io_fbx.lib +0 -0
  476. lib/momentum_io_gltf.lib +0 -0
  477. lib/momentum_io_legacy_json.lib +0 -0
  478. lib/momentum_io_marker.lib +0 -0
  479. lib/momentum_io_motion.lib +0 -0
  480. lib/momentum_io_shape.lib +0 -0
  481. lib/momentum_io_skeleton.lib +0 -0
  482. lib/momentum_io_urdf.lib +0 -0
  483. lib/momentum_marker_tracker.lib +0 -0
  484. lib/momentum_math.lib +0 -0
  485. lib/momentum_online_qr.lib +0 -0
  486. lib/momentum_process_markers.lib +0 -0
  487. lib/momentum_rerun.lib +0 -0
  488. lib/momentum_simd_constraints.lib +0 -0
  489. lib/momentum_simd_generalized_loss.lib +0 -0
  490. lib/momentum_skeleton.lib +0 -0
  491. lib/momentum_solver.lib +0 -0
  492. lib/rerun_c__win_x64.lib +0 -0
  493. lib/rerun_sdk.lib +0 -0
  494. pymomentum/axel.cp313-win_amd64.pyd +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.cp313-win_amd64.pyd +0 -0
  500. pymomentum/marker_tracking.cp313-win_amd64.pyd +0 -0
  501. pymomentum/quaternion.py +740 -0
  502. pymomentum/skel_state.py +514 -0
  503. pymomentum/solver.cp313-win_amd64.pyd +0 -0
  504. pymomentum/solver2.cp313-win_amd64.pyd +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.78.post11.dist-info/METADATA +121 -0
  510. pymomentum_cpu-0.1.78.post11.dist-info/RECORD +512 -0
  511. pymomentum_cpu-0.1.78.post11.dist-info/WHEEL +5 -0
  512. pymomentum_cpu-0.1.78.post11.dist-info/licenses/LICENSE +21 -0
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
lib/momentum_math.lib ADDED
Binary file
Binary file
Binary file
lib/momentum_rerun.lib ADDED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
lib/rerun_sdk.lib ADDED
Binary file
Binary file
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env python3
2
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ #
4
+ # This source code is licensed under the MIT license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ """
8
+ PyMomentum Backend
9
+
10
+ High-performance implementations for forward kinematics and linear blend skinning operations.
11
+ """
12
+
13
+ # Make submodules available for import
14
+ from . import skel_state_backend, trs_backend, utils
15
+
16
+ __all__ = ["skel_state_backend", "trs_backend", "utils"]
@@ -0,0 +1,614 @@
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
+ Skeleton State Backend for PyMomentum
9
+
10
+ This module provides efficient forward kinematics and skinning operations using
11
+ the skeleton state representation (8 parameters per joint: translation, quaternion, scale).
12
+
13
+ The skeleton state representation is more compact than the TRS backend and uses
14
+ quaternions for rotation, making it suitable for applications requiring smooth
15
+ interpolation and fewer parameters.
16
+
17
+ Performance Notes:
18
+ This backend matches the behavior of the C++ Momentum code, ensuring consistency
19
+ with the reference implementation. However, the TRS backend may be 25-50% faster
20
+ in PyTorch due to not requiring quaternion normalization operations, though the
21
+ exact performance difference may vary depending on the specific use case.
22
+
23
+ Key Functions:
24
+ - global_skel_state_from_local_skel_state: Forward kinematics from local to global joint states
25
+ - skin_points_from_skel_state: Linear blend skinning using skeleton states
26
+ - local_skel_state_from_joint_params: Convert joint parameters to local states
27
+
28
+ Related Modules:
29
+ - trs_backend: Alternative backend using separate translation/rotation/scale tensors
30
+ - skel_state: Core skeleton state operations and utilities
31
+ - quaternion: Quaternion math operations used by this backend
32
+ """
33
+
34
+ from typing import List, Tuple
35
+
36
+ import torch as th
37
+
38
+ from pymomentum import quaternion, skel_state, trs
39
+ from pymomentum.backend.trs_backend import unpose_from_global_joint_state
40
+
41
+
42
+ @th.jit.script
43
+ def local_skel_state_from_joint_params(
44
+ joint_params: th.Tensor,
45
+ joint_offset: th.Tensor,
46
+ joint_quat_rotation: th.Tensor,
47
+ ) -> th.Tensor:
48
+ """
49
+ Convert joint parameters to local skeleton state representation.
50
+
51
+ This function transforms 7-parameter joint representation (translation, euler angles, log-scale)
52
+ into the 8-parameter skeleton state format (translation, quaternion, scale). The skeleton state
53
+ representation uses quaternions for rotation and linear scale factors.
54
+
55
+ Parameter Transformation:
56
+ - Translation: joint_params[:,:,:3] + joint_offset -> direct translation
57
+ - Rotation: euler_xyz angles -> quaternion, composed with joint pre-rotation
58
+ - Scale: log2(scale) -> linear scale via exp2() transformation
59
+
60
+ Args:
61
+ joint_params: Joint parameters, shape (batch_size, num_joints, 7).
62
+ Each joint has [tx, ty, tz, euler_x, euler_y, euler_z, log2_scale] parameters.
63
+ joint_offset: Per-joint translation offset, shape (num_joints, 3).
64
+ Static offset applied to each joint's local translation.
65
+ joint_quat_rotation: Per-joint rotation offset as quaternions, shape (num_joints, 4).
66
+ Static rotation [qx, qy, qz, qw] applied to each joint's local rotation.
67
+
68
+ Returns:
69
+ local_skel_state: Local skeleton state, shape (batch_size, num_joints, 8).
70
+ Each joint contains [tx, ty, tz, qx, qy, qz, qw, s] parameters.
71
+
72
+ Note:
73
+ The quaternion format follows [qx, qy, qz, qw] convention (vector-first).
74
+ Scale values are exponentiated from log2 space to linear space.
75
+ """
76
+ t = joint_offset[None, :] + joint_params[:, :, :3]
77
+ q = quaternion.multiply(
78
+ joint_quat_rotation[None],
79
+ quaternion.euler_xyz_to_quaternion(joint_params[:, :, 3:6]),
80
+ )
81
+ s = th.exp2(joint_params[:, :, 6:])
82
+
83
+ return th.cat([t, q, s], dim=-1)
84
+
85
+
86
+ @th.jit.script
87
+ def global_skel_state_from_local_skel_state_impl(
88
+ local_skel_state: th.Tensor,
89
+ prefix_mul_indices: List[th.Tensor],
90
+ save_intermediate_results: bool = True,
91
+ use_double_precision: bool = True,
92
+ ) -> Tuple[th.Tensor, List[th.Tensor]]:
93
+ """
94
+ Compute global skeleton state from local joint transformations using forward kinematics.
95
+
96
+ This function implements forward kinematics (FK) using prefix multiplication for efficient
97
+ parallel computation of joint transformations. Each joint's local transformation is composed
98
+ with its parent's global transformation to produce the joint's global transformation.
99
+
100
+ The skeleton state uses an 8-parameter representation per joint: [translation, quaternion, scale]
101
+ - translation (3D): local translation vector [tx, ty, tz]
102
+ - quaternion (4D): rotation quaternion [qx, qy, qz, qw] (normalized)
103
+ - scale (1D): uniform scale factor [s]
104
+
105
+ Forward Kinematics Algorithm:
106
+ For each joint j with parent p in the kinematic hierarchy:
107
+ global_state_j = global_state_p ⊙ local_state_j
108
+
109
+ Where ⊙ represents similarity transformation composition:
110
+ - t_global = t_parent + s_parent * rotate_by_quaternion(q_parent, t_local)
111
+ - q_global = quaternion_multiply(q_parent, q_local)
112
+ - s_global = s_parent * s_local
113
+
114
+ Args:
115
+ local_skel_state: Local joint transformations, shape (batch_size, num_joints, 8).
116
+ Each joint state contains [tx, ty, tz, qx, qy, qz, qw, s] parameters.
117
+ prefix_mul_indices: List of [child_index, parent_index] tensor pairs that define
118
+ the traversal order for the kinematic tree. This ordering enables efficient
119
+ parallel computation while respecting parent-child dependencies.
120
+ save_intermediate_results: If True, saves intermediate joint states during the
121
+ forward pass for use in backpropagation. Set to False for inference-only
122
+ computations to reduce memory usage.
123
+ use_double_precision: If True, performs computations in float64 for improved
124
+ numerical stability. Recommended for deep kinematic chains to minimize
125
+ accumulated floating-point errors.
126
+
127
+ Returns:
128
+ global_skel_state: Global joint transformations, shape (batch_size, num_joints, 8).
129
+ Each joint contains the composed transformation from root to that joint.
130
+ intermediate_results: List of intermediate joint states from the forward pass.
131
+ Required for efficient gradient computation during backpropagation.
132
+ Empty if save_intermediate_results=False.
133
+
134
+ Note:
135
+ This function is JIT-compiled for performance. The prefix multiplication approach
136
+ allows vectorized batch computation while maintaining kinematic chain dependencies.
137
+
138
+ See Also:
139
+ :func:`global_skel_state_from_local_skel_state`: User-facing wrapper function
140
+ :func:`local_skel_state_from_joint_params`: Convert joint parameters to local states
141
+ """
142
+ dtype = local_skel_state.dtype
143
+ intermediate_results: List[th.Tensor] = []
144
+ if use_double_precision:
145
+ global_skel_state = local_skel_state.clone().double()
146
+ else:
147
+ global_skel_state = local_skel_state.clone()
148
+ for prefix_mul_index in prefix_mul_indices:
149
+ source = prefix_mul_index[0]
150
+ target = prefix_mul_index[1]
151
+
152
+ state1 = global_skel_state.index_select(-2, target)
153
+ state2 = global_skel_state.index_select(-2, source)
154
+
155
+ if save_intermediate_results:
156
+ intermediate_results.append(state2.clone())
157
+
158
+ global_skel_state.index_copy_(-2, source, skel_state.multiply(state1, state2))
159
+
160
+ return (global_skel_state.to(dtype), intermediate_results)
161
+
162
+
163
+ def global_skel_state_from_local_skel_state_no_grad(
164
+ local_skel_state: th.Tensor,
165
+ prefix_mul_indices: List[th.Tensor],
166
+ save_intermediate_results: bool = True,
167
+ use_double_precision: bool = True,
168
+ ) -> Tuple[th.Tensor, List[th.Tensor]]:
169
+ """
170
+ Compute global skeleton state without gradient tracking.
171
+
172
+ This is a convenience wrapper around global_skel_state_from_local_skel_state_impl
173
+ that explicitly disables gradient computation using torch.no_grad(). Useful for
174
+ inference-only forward passes to reduce memory usage.
175
+
176
+ Args:
177
+ local_skel_state: Local joint transformations, shape (batch_size, num_joints, 8)
178
+ prefix_mul_indices: List of [child_index, parent_index] tensor pairs
179
+ save_intermediate_results: Whether to save intermediate states for backprop
180
+ use_double_precision: Whether to use float64 for numerical stability
181
+
182
+ Returns:
183
+ global_skel_state: Global joint transformations, shape (batch_size, num_joints, 8)
184
+ intermediate_results: List of intermediate joint states from forward pass
185
+
186
+ See Also:
187
+ :func:`global_skel_state_from_local_skel_state_impl`: Implementation function
188
+ """
189
+ with th.no_grad():
190
+ outputs = global_skel_state_from_local_skel_state_impl(
191
+ local_skel_state,
192
+ prefix_mul_indices,
193
+ save_intermediate_results=save_intermediate_results,
194
+ use_double_precision=use_double_precision,
195
+ )
196
+ return outputs
197
+
198
+
199
+ # @th.jit.script
200
+ def global_skel_state_from_local_skel_state_backprop(
201
+ global_skel_state: th.Tensor,
202
+ grad_global_skel_state: th.Tensor,
203
+ prefix_mul_indices: List[th.Tensor],
204
+ intermediate_results: List[th.Tensor],
205
+ use_double_precision: bool = True,
206
+ ) -> th.Tensor:
207
+ """
208
+ Compute gradients for local skeleton state through backpropagation.
209
+
210
+ This function implements the backward pass for forward kinematics, computing
211
+ gradients of the loss with respect to local joint states given gradients
212
+ with respect to global joint states.
213
+
214
+ The backpropagation uses the intermediate results saved during the forward
215
+ pass to efficiently compute gradients without recomputing the full forward
216
+ kinematics chain.
217
+
218
+ Gradient Flow:
219
+ For each joint j with parent p, the backward pass computes:
220
+ ∂L/∂local_j = ∂L/∂global_j * ∂global_j/∂local_j
221
+
222
+ Where the Jacobian ∂global_j/∂local_j depends on the parent's global state
223
+ and is computed using the chain rule through similarity transformation composition.
224
+
225
+ Args:
226
+ global_skel_state: Global joint states from forward pass, shape (batch_size, num_joints, 8).
227
+ These states are modified in-place during backpropagation.
228
+ grad_global_skel_state: Gradients w.r.t. global joint states, shape (batch_size, num_joints, 8).
229
+ Input gradients from downstream computations (e.g., skinning loss).
230
+ prefix_mul_indices: List of [child_index, parent_index] tensor pairs that defined
231
+ the forward pass traversal order. Backprop processes these in reverse.
232
+ intermediate_results: List of intermediate joint states saved during forward pass.
233
+ Required to compute accurate gradients without numerical drift.
234
+ use_double_precision: If True, performs computations in float64 for numerical stability.
235
+ Recommended for deep kinematic chains and precise gradient computation.
236
+
237
+ Returns:
238
+ grad_local_skel_state: Gradients w.r.t. local joint states, shape (batch_size, num_joints, 8).
239
+ These gradients can be used to update joint parameters via optimization.
240
+
241
+ Note:
242
+ This function processes the kinematic chain in reverse order of the forward pass,
243
+ accumulating gradients from children to parents while reconstructing intermediate states.
244
+
245
+ See Also:
246
+ :func:`global_skel_state_from_local_skel_state_impl`: Forward pass implementation
247
+ """
248
+ dtype = global_skel_state.dtype
249
+ if use_double_precision:
250
+ grad_local_skel_state = grad_global_skel_state.clone().double()
251
+ global_skel_state = global_skel_state.clone().double()
252
+ else:
253
+ grad_local_skel_state = grad_global_skel_state.clone()
254
+ global_skel_state = global_skel_state.clone()
255
+
256
+ for prefix_mul_index, state_source_original in list(
257
+ zip(prefix_mul_indices, intermediate_results)
258
+ )[::-1]:
259
+ source = prefix_mul_index[0]
260
+ target = prefix_mul_index[1]
261
+
262
+ state_target = global_skel_state.index_select(-2, target)
263
+
264
+ # forward
265
+ # This is for checking that the numerical error is in the safe
266
+ # range, but it's not completely abnormal to see large numerical
267
+ # error during backpropagation at the beginning of training.
268
+ # state_source = global_skel_state[:, source]
269
+ # state_source_expect = sim3_multiplication(
270
+ # state_target, state_source_original
271
+ # )
272
+ # assert th.allclose(
273
+ # state_source, state_source_expect, atol=1e-5, rtol=1e-5
274
+ # )
275
+
276
+ # backward
277
+ grad_target_accum, grad_source_original = skel_state.multiply_backprop(
278
+ state1=state_target,
279
+ state2=state_source_original,
280
+ grad_state=grad_local_skel_state.index_select(-2, source),
281
+ )
282
+
283
+ # setup the reduced gradients
284
+ grad_local_skel_state.index_copy_(-2, source, grad_source_original)
285
+ grad_local_skel_state.index_add_(-2, target, grad_target_accum)
286
+ # setup the reduced KC
287
+ global_skel_state.index_copy_(-2, source, state_source_original)
288
+
289
+ return grad_local_skel_state.to(dtype)
290
+
291
+
292
+ class GlobalSkelStateFromLocalSkelStateJIT(th.autograd.Function):
293
+ """
294
+ PyTorch autograd function for differentiable forward kinematics using skeleton states.
295
+
296
+ This class implements automatic differentiation for the forward kinematics operation,
297
+ allowing gradients to flow from global joint states back to local joint states.
298
+ The forward pass computes global states efficiently while saving intermediate results
299
+ for the backward pass.
300
+
301
+ Note:
302
+ This class is used internally by global_skel_state_from_local_skel_state when
303
+ not in JIT mode. It provides gradient computation capabilities that are not
304
+ available in pure JIT-compiled functions.
305
+ """
306
+
307
+ @staticmethod
308
+ # pyre-ignore[14]
309
+ def forward(
310
+ local_skel_state: th.Tensor,
311
+ prefix_mul_indices: List[th.Tensor],
312
+ ) -> Tuple[th.Tensor, List[th.Tensor]]:
313
+ return global_skel_state_from_local_skel_state_no_grad(
314
+ local_skel_state,
315
+ prefix_mul_indices,
316
+ )
317
+
318
+ @staticmethod
319
+ # pyre-ignore[14]
320
+ # pyre-ignore[2]
321
+ def setup_context(ctx, inputs, outputs) -> None:
322
+ (
323
+ _,
324
+ prefix_mul_indices,
325
+ ) = inputs
326
+ (
327
+ global_skel_state,
328
+ intermediate_results,
329
+ ) = outputs
330
+ # need to clone as it's modified in-place
331
+ ctx.save_for_backward(global_skel_state.clone())
332
+ ctx.intermediate_results = intermediate_results
333
+ ctx.prefix_mul_indices = prefix_mul_indices
334
+
335
+ @staticmethod
336
+ # pyre-ignore[14]
337
+ def backward(
338
+ # pyre-ignore[2]
339
+ ctx,
340
+ grad_global_skel_state: th.Tensor,
341
+ _0,
342
+ ) -> Tuple[th.Tensor, None]:
343
+ (global_skel_state,) = ctx.saved_tensors
344
+
345
+ intermediate_results = ctx.intermediate_results
346
+ prefix_mul_indices = ctx.prefix_mul_indices
347
+
348
+ grad_local_state = global_skel_state_from_local_skel_state_backprop(
349
+ global_skel_state,
350
+ grad_global_skel_state,
351
+ prefix_mul_indices,
352
+ intermediate_results,
353
+ )
354
+ return grad_local_state, None
355
+
356
+
357
+ def global_skel_state_from_local_skel_state(
358
+ local_skel_state: th.Tensor,
359
+ prefix_mul_indices: List[th.Tensor],
360
+ ) -> th.Tensor:
361
+ """
362
+ Compute global skeleton state from local joint transformations (user-facing wrapper).
363
+
364
+ This is the main entry point for forward kinematics using skeleton states. It automatically
365
+ selects between JIT-compiled and autograd-enabled implementations based on the execution context.
366
+
367
+ Args:
368
+ local_skel_state: Local joint transformations, shape (batch_size, num_joints, 8).
369
+ Each joint contains [tx, ty, tz, qx, qy, qz, qw, s] parameters.
370
+ prefix_mul_indices: List of [child_index, parent_index] tensor pairs defining
371
+ the kinematic hierarchy traversal order.
372
+
373
+ Returns:
374
+ global_skel_state: Global joint transformations, shape (batch_size, num_joints, 8).
375
+ Each joint contains the composed transformation from root to that joint.
376
+
377
+ Note:
378
+ When called within torch.jit.script or torch.jit.trace context, uses the JIT-compiled
379
+ implementation for maximum performance. Otherwise, uses the autograd-enabled version
380
+ for gradient computation.
381
+
382
+ See Also:
383
+ :func:`global_skel_state_from_local_skel_state_impl`: JIT implementation
384
+ :func:`local_skel_state_from_joint_params`: Convert joint parameters to local states
385
+ """
386
+
387
+ if th.jit.is_tracing() or th.jit.is_scripting():
388
+ global_skel_state, _ = global_skel_state_from_local_skel_state_impl(
389
+ local_skel_state, prefix_mul_indices
390
+ )
391
+ return global_skel_state
392
+ else:
393
+ global_skel_state, _ = GlobalSkelStateFromLocalSkelStateJIT.apply(
394
+ local_skel_state,
395
+ prefix_mul_indices,
396
+ )
397
+ return global_skel_state
398
+
399
+
400
+ @th.jit.script
401
+ def skin_points_from_skel_state(
402
+ template: th.Tensor,
403
+ global_skel_state: th.Tensor,
404
+ binded_skel_state_inv: th.Tensor,
405
+ skin_indices_flattened: th.Tensor,
406
+ skin_weights_flattened: th.Tensor,
407
+ vert_indices_flattened: th.Tensor,
408
+ ) -> th.Tensor:
409
+ """
410
+ Apply linear blend skinning (LBS) to points using skeleton state transformations.
411
+
412
+ This function deforms template points by blending joint transformations according
413
+ to skinning weights. Each point is influenced by multiple joints, with the final
414
+ position computed as a weighted average of joint-transformed positions.
415
+
416
+ Linear Blend Skinning Formula:
417
+ For each vertex v_i with position p_i in template:
418
+ skinned_p_i = Σ_j w_ij * T_j * (T_bind_j^(-1) * p_i)
419
+
420
+ Where:
421
+ - w_ij: skinning weight of joint j on vertex i (sum to 1 per vertex)
422
+ - T_j: global transformation of joint j
423
+ - T_bind_j^(-1): inverse bind pose transformation of joint j
424
+
425
+ The bind pose represents the joint configuration when skinning weights were defined.
426
+ The inverse bind pose transformation removes the original joint influence before
427
+ applying the current joint transformation.
428
+
429
+ Args:
430
+ template: Template vertex positions, shape (batch_size, num_vertices, 3).
431
+ These are the rest pose positions before deformation.
432
+ global_skel_state: Global joint transformations, shape (batch_size, num_joints, 8).
433
+ Each joint contains [tx, ty, tz, qx, qy, qz, qw, s] parameters.
434
+ binded_skel_state_inv: Inverse bind pose transformations, shape (num_joints, 8).
435
+ Static transformations that represent the joint configuration during binding.
436
+ skin_indices_flattened: Joint indices for skinning, shape (num_influences,).
437
+ Flattened list of joint indices that influence vertices.
438
+ skin_weights_flattened: Skinning weights, shape (num_influences,).
439
+ Corresponding weights for each joint influence (normalized per vertex).
440
+ vert_indices_flattened: Vertex indices for skinning, shape (num_influences,).
441
+ Flattened list of vertex indices corresponding to joint influences.
442
+
443
+ Returns:
444
+ skinned_points: Deformed vertex positions, shape (batch_size, num_vertices, 3).
445
+ Points transformed according to current joint poses and skinning weights.
446
+
447
+ Note:
448
+ This function is JIT-compiled for performance. The flattened indices allow
449
+ efficient vectorized computation of skinning influences across all vertices.
450
+
451
+ See Also:
452
+ :func:`skin_oriented_points_from_skel_state`: Skinning for oriented points (gaussians)
453
+ :func:`global_skel_state_from_local_skel_state`: Forward kinematics for joint states
454
+ """
455
+ assert template.shape[-1] == 3
456
+ while template.ndim < global_skel_state.ndim:
457
+ template = template.unsqueeze(0)
458
+
459
+ template = template.expand(
460
+ list(global_skel_state.shape[:-2]) + list(template.shape[-2:])
461
+ )
462
+
463
+ joint_state = skel_state.multiply(
464
+ global_skel_state,
465
+ binded_skel_state_inv,
466
+ )
467
+
468
+ skinned = th.zeros_like(template)
469
+ skinned = skinned.index_add(
470
+ -2,
471
+ vert_indices_flattened,
472
+ skel_state.transform_points(
473
+ th.index_select(joint_state, -2, skin_indices_flattened),
474
+ th.index_select(template, -2, vert_indices_flattened),
475
+ )
476
+ * skin_weights_flattened[None, :, None],
477
+ )
478
+ return skinned
479
+
480
+
481
+ @th.jit.script
482
+ def skin_oriented_points_from_skel_state(
483
+ means: th.Tensor,
484
+ quaternions: th.Tensor,
485
+ global_skel_state: th.Tensor,
486
+ binded_skel_state_inv: th.Tensor,
487
+ skin_indices_flattened: th.Tensor,
488
+ skin_weights_flattened: th.Tensor,
489
+ vert_indices_flattened: th.Tensor,
490
+ ) -> tuple[th.Tensor, th.Tensor]:
491
+ """
492
+ Apply linear blend skinning to oriented points (Gaussian splatting) using skeleton states.
493
+
494
+ This function extends standard LBS to handle oriented points, which have both position
495
+ and orientation. Each oriented point is influenced by multiple joints, with both its
496
+ position and orientation blended according to skinning weights.
497
+
498
+ For orientations, rotation matrices are linearly interpolated (LERP) and then converted
499
+ back to quaternions. This is different from spherical linear interpolation (SLERP) but
500
+ provides smoother blending for skinning applications.
501
+
502
+ Args:
503
+ means: Point positions, shape (batch_size, num_points, 3).
504
+ Center positions of the oriented points (e.g., Gaussian means).
505
+ quaternions: Point orientations, shape (batch_size, num_points, 4).
506
+ Orientations as quaternions in [qx, qy, qz, qw] format.
507
+ global_skel_state: Global joint transformations, shape (batch_size, num_joints, 8).
508
+ Each joint contains [tx, ty, tz, qx, qy, qz, qw, s] parameters.
509
+ binded_skel_state_inv: Inverse bind pose transformations, shape (num_joints, 8).
510
+ Static transformations representing the joint configuration during binding.
511
+ skin_indices_flattened: Joint indices for skinning, shape (num_influences,).
512
+ Flattened list of joint indices that influence points.
513
+ skin_weights_flattened: Skinning weights, shape (num_influences,).
514
+ Corresponding weights for each joint influence (normalized per point).
515
+ vert_indices_flattened: Point indices for skinning, shape (num_influences,).
516
+ Flattened list of point indices corresponding to joint influences.
517
+
518
+ Returns:
519
+ skinned_means: Deformed point positions, shape (batch_size, num_points, 3).
520
+ Transformed positions according to current joint poses and skinning weights.
521
+ skinned_quaternions: Blended point orientations, shape (batch_size, num_points, 4).
522
+ Orientations blended using rotation matrix interpolation and converted back to quaternions.
523
+
524
+ Note:
525
+ This function is commonly used for Gaussian splatting applications where each
526
+ Gaussian has both a mean position and orientation that need to be skinned.
527
+ The rotation blending uses linear interpolation in matrix space for stability.
528
+
529
+ See Also:
530
+ :func:`skin_points_from_skel_state`: Standard LBS for points without orientation
531
+ :func:`global_skel_state_from_local_skel_state`: Forward kinematics for joint states
532
+ """
533
+ assert means.shape[-1] == 3
534
+ assert quaternions.shape[-1] == 4
535
+ while means.ndim < global_skel_state.ndim:
536
+ means = means.unsqueeze(0)
537
+
538
+ means = means.expand(list(global_skel_state.shape[:-2]) + list(means.shape[-2:]))
539
+
540
+ joint_state = skel_state.multiply(
541
+ global_skel_state,
542
+ binded_skel_state_inv,
543
+ )
544
+
545
+ sim3_transforms = th.index_select(joint_state, -2, skin_indices_flattened)
546
+ t, q, s = skel_state.split(sim3_transforms)
547
+ r = quaternion.to_rotation_matrix(q)
548
+
549
+ means_flattened = th.index_select(means, -2, vert_indices_flattened)
550
+
551
+ skinned_means = th.zeros_like(means)
552
+ skinned_means = skinned_means.index_add(
553
+ -2,
554
+ vert_indices_flattened,
555
+ (s * quaternion.rotate_vector(q, means_flattened) + t)
556
+ * skin_weights_flattened[None, :, None],
557
+ )
558
+
559
+ lerp_rotations = th.zeros(
560
+ quaternions.shape[:-1] + (3, 3),
561
+ dtype=quaternions.dtype,
562
+ device=quaternions.device,
563
+ )
564
+ lerp_rotations = lerp_rotations.index_add(
565
+ -3,
566
+ vert_indices_flattened,
567
+ r * skin_weights_flattened[None, :, None, None],
568
+ )
569
+ lerp_quaternions = quaternion.from_rotation_matrix(lerp_rotations)
570
+ lerp_quaternions = quaternion.normalize(lerp_quaternions)
571
+ skinned_quaternions = quaternion.multiply_assume_normalized(
572
+ quaternions, lerp_quaternions
573
+ )
574
+ return skinned_means, skinned_quaternions
575
+
576
+
577
+ def unpose_from_momentum_global_joint_state(
578
+ verts: th.Tensor,
579
+ global_joint_state: th.Tensor,
580
+ binded_joint_state_inv: th.Tensor,
581
+ skin_indices_flattened: th.Tensor,
582
+ skin_weights_flattened: th.Tensor,
583
+ vert_indices_flattened: th.Tensor,
584
+ with_high_precision: bool = True,
585
+ ) -> th.Tensor:
586
+ """
587
+ The inverse function of skinning().
588
+ WARNING: the precision is low...
589
+
590
+ Args:
591
+ verts: [batch_size, num_verts, 3]
592
+ global_joint_state (th.Tensor): (B, J, 8)
593
+ binded_joint_state (th.Tensor): (J, 8)
594
+ skin_indices_flattened: (N, ) LBS skinning nbr joint indices
595
+ skin_weights_flattened: (N, ) LBS skinning nbr joint weights
596
+ vert_indices_flattened: (N, ) LBS skinning nbr corresponding vertex indices
597
+ with_high_precision: if True, use high precision solver (LDLT),
598
+ but requires a cuda device sync
599
+ """
600
+ t, r, s = trs.from_skeleton_state(global_joint_state)
601
+ t0, r0, _ = trs.from_skeleton_state(binded_joint_state_inv)
602
+
603
+ return unpose_from_global_joint_state(
604
+ verts,
605
+ t,
606
+ r,
607
+ s,
608
+ t0,
609
+ r0,
610
+ skin_indices_flattened,
611
+ skin_weights_flattened,
612
+ vert_indices_flattened,
613
+ with_high_precision,
614
+ )