warp-lang 1.7.2rc1__py3-none-macosx_10_13_universal2.whl → 1.8.0__py3-none-macosx_10_13_universal2.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 warp-lang might be problematic. Click here for more details.

Files changed (180) hide show
  1. warp/__init__.py +3 -1
  2. warp/__init__.pyi +3489 -1
  3. warp/autograd.py +45 -122
  4. warp/bin/libwarp.dylib +0 -0
  5. warp/build.py +241 -252
  6. warp/build_dll.py +125 -26
  7. warp/builtins.py +1907 -384
  8. warp/codegen.py +257 -101
  9. warp/config.py +12 -1
  10. warp/constants.py +1 -1
  11. warp/context.py +657 -223
  12. warp/dlpack.py +1 -1
  13. warp/examples/benchmarks/benchmark_cloth.py +2 -2
  14. warp/examples/benchmarks/benchmark_tile_sort.py +155 -0
  15. warp/examples/core/example_sample_mesh.py +1 -1
  16. warp/examples/core/example_spin_lock.py +93 -0
  17. warp/examples/core/example_work_queue.py +118 -0
  18. warp/examples/fem/example_adaptive_grid.py +5 -5
  19. warp/examples/fem/example_apic_fluid.py +1 -1
  20. warp/examples/fem/example_burgers.py +1 -1
  21. warp/examples/fem/example_convection_diffusion.py +9 -6
  22. warp/examples/fem/example_darcy_ls_optimization.py +489 -0
  23. warp/examples/fem/example_deformed_geometry.py +1 -1
  24. warp/examples/fem/example_diffusion.py +2 -2
  25. warp/examples/fem/example_diffusion_3d.py +1 -1
  26. warp/examples/fem/example_distortion_energy.py +1 -1
  27. warp/examples/fem/example_elastic_shape_optimization.py +387 -0
  28. warp/examples/fem/example_magnetostatics.py +5 -3
  29. warp/examples/fem/example_mixed_elasticity.py +5 -3
  30. warp/examples/fem/example_navier_stokes.py +11 -9
  31. warp/examples/fem/example_nonconforming_contact.py +5 -3
  32. warp/examples/fem/example_streamlines.py +8 -3
  33. warp/examples/fem/utils.py +9 -8
  34. warp/examples/interop/example_jax_ffi_callback.py +2 -2
  35. warp/examples/optim/example_drone.py +1 -1
  36. warp/examples/sim/example_cloth.py +1 -1
  37. warp/examples/sim/example_cloth_self_contact.py +48 -54
  38. warp/examples/tile/example_tile_block_cholesky.py +502 -0
  39. warp/examples/tile/example_tile_cholesky.py +2 -1
  40. warp/examples/tile/example_tile_convolution.py +1 -1
  41. warp/examples/tile/example_tile_filtering.py +1 -1
  42. warp/examples/tile/example_tile_matmul.py +1 -1
  43. warp/examples/tile/example_tile_mlp.py +2 -0
  44. warp/fabric.py +7 -7
  45. warp/fem/__init__.py +5 -0
  46. warp/fem/adaptivity.py +1 -1
  47. warp/fem/cache.py +152 -63
  48. warp/fem/dirichlet.py +2 -2
  49. warp/fem/domain.py +136 -6
  50. warp/fem/field/field.py +141 -99
  51. warp/fem/field/nodal_field.py +85 -39
  52. warp/fem/field/virtual.py +97 -52
  53. warp/fem/geometry/adaptive_nanogrid.py +91 -86
  54. warp/fem/geometry/closest_point.py +13 -0
  55. warp/fem/geometry/deformed_geometry.py +102 -40
  56. warp/fem/geometry/element.py +56 -2
  57. warp/fem/geometry/geometry.py +323 -22
  58. warp/fem/geometry/grid_2d.py +157 -62
  59. warp/fem/geometry/grid_3d.py +116 -20
  60. warp/fem/geometry/hexmesh.py +86 -20
  61. warp/fem/geometry/nanogrid.py +166 -86
  62. warp/fem/geometry/partition.py +59 -25
  63. warp/fem/geometry/quadmesh.py +86 -135
  64. warp/fem/geometry/tetmesh.py +47 -119
  65. warp/fem/geometry/trimesh.py +77 -270
  66. warp/fem/integrate.py +107 -52
  67. warp/fem/linalg.py +25 -58
  68. warp/fem/operator.py +124 -27
  69. warp/fem/quadrature/pic_quadrature.py +36 -14
  70. warp/fem/quadrature/quadrature.py +40 -16
  71. warp/fem/space/__init__.py +1 -1
  72. warp/fem/space/basis_function_space.py +66 -46
  73. warp/fem/space/basis_space.py +17 -4
  74. warp/fem/space/dof_mapper.py +1 -1
  75. warp/fem/space/function_space.py +2 -2
  76. warp/fem/space/grid_2d_function_space.py +4 -1
  77. warp/fem/space/hexmesh_function_space.py +4 -2
  78. warp/fem/space/nanogrid_function_space.py +3 -1
  79. warp/fem/space/partition.py +11 -2
  80. warp/fem/space/quadmesh_function_space.py +4 -1
  81. warp/fem/space/restriction.py +5 -2
  82. warp/fem/space/shape/__init__.py +10 -8
  83. warp/fem/space/tetmesh_function_space.py +4 -1
  84. warp/fem/space/topology.py +52 -21
  85. warp/fem/space/trimesh_function_space.py +4 -1
  86. warp/fem/utils.py +53 -8
  87. warp/jax.py +1 -2
  88. warp/jax_experimental/ffi.py +12 -17
  89. warp/jax_experimental/xla_ffi.py +37 -24
  90. warp/math.py +171 -1
  91. warp/native/array.h +99 -0
  92. warp/native/builtin.h +174 -31
  93. warp/native/coloring.cpp +1 -1
  94. warp/native/exports.h +118 -63
  95. warp/native/intersect.h +3 -3
  96. warp/native/mat.h +5 -10
  97. warp/native/mathdx.cpp +11 -5
  98. warp/native/matnn.h +1 -123
  99. warp/native/quat.h +28 -4
  100. warp/native/sparse.cpp +121 -258
  101. warp/native/sparse.cu +181 -274
  102. warp/native/spatial.h +305 -17
  103. warp/native/tile.h +583 -72
  104. warp/native/tile_radix_sort.h +1108 -0
  105. warp/native/tile_reduce.h +237 -2
  106. warp/native/tile_scan.h +240 -0
  107. warp/native/tuple.h +189 -0
  108. warp/native/vec.h +6 -16
  109. warp/native/warp.cpp +36 -4
  110. warp/native/warp.cu +574 -51
  111. warp/native/warp.h +47 -74
  112. warp/optim/linear.py +5 -1
  113. warp/paddle.py +7 -8
  114. warp/py.typed +0 -0
  115. warp/render/render_opengl.py +58 -29
  116. warp/render/render_usd.py +124 -61
  117. warp/sim/__init__.py +9 -0
  118. warp/sim/collide.py +252 -78
  119. warp/sim/graph_coloring.py +8 -1
  120. warp/sim/import_mjcf.py +4 -3
  121. warp/sim/import_usd.py +11 -7
  122. warp/sim/integrator.py +5 -2
  123. warp/sim/integrator_euler.py +1 -1
  124. warp/sim/integrator_featherstone.py +1 -1
  125. warp/sim/integrator_vbd.py +751 -320
  126. warp/sim/integrator_xpbd.py +1 -1
  127. warp/sim/model.py +265 -260
  128. warp/sim/utils.py +10 -7
  129. warp/sparse.py +303 -166
  130. warp/tape.py +52 -51
  131. warp/tests/cuda/test_conditional_captures.py +1046 -0
  132. warp/tests/cuda/test_streams.py +1 -1
  133. warp/tests/geometry/test_volume.py +2 -2
  134. warp/tests/interop/test_dlpack.py +9 -9
  135. warp/tests/interop/test_jax.py +0 -1
  136. warp/tests/run_coverage_serial.py +1 -1
  137. warp/tests/sim/disabled_kinematics.py +2 -2
  138. warp/tests/sim/{test_vbd.py → test_cloth.py} +296 -113
  139. warp/tests/sim/test_collision.py +159 -51
  140. warp/tests/sim/test_coloring.py +15 -1
  141. warp/tests/test_array.py +254 -2
  142. warp/tests/test_array_reduce.py +2 -2
  143. warp/tests/test_atomic_cas.py +299 -0
  144. warp/tests/test_codegen.py +142 -19
  145. warp/tests/test_conditional.py +47 -1
  146. warp/tests/test_ctypes.py +0 -20
  147. warp/tests/test_devices.py +8 -0
  148. warp/tests/test_fabricarray.py +4 -2
  149. warp/tests/test_fem.py +58 -25
  150. warp/tests/test_func.py +42 -1
  151. warp/tests/test_grad.py +1 -1
  152. warp/tests/test_lerp.py +1 -3
  153. warp/tests/test_map.py +481 -0
  154. warp/tests/test_mat.py +1 -24
  155. warp/tests/test_quat.py +6 -15
  156. warp/tests/test_rounding.py +10 -38
  157. warp/tests/test_runlength_encode.py +7 -7
  158. warp/tests/test_smoothstep.py +1 -1
  159. warp/tests/test_sparse.py +51 -2
  160. warp/tests/test_spatial.py +507 -1
  161. warp/tests/test_struct.py +2 -2
  162. warp/tests/test_tuple.py +265 -0
  163. warp/tests/test_types.py +2 -2
  164. warp/tests/test_utils.py +24 -18
  165. warp/tests/tile/test_tile.py +420 -1
  166. warp/tests/tile/test_tile_mathdx.py +518 -14
  167. warp/tests/tile/test_tile_reduce.py +213 -0
  168. warp/tests/tile/test_tile_shared_memory.py +130 -1
  169. warp/tests/tile/test_tile_sort.py +117 -0
  170. warp/tests/unittest_suites.py +4 -6
  171. warp/types.py +462 -308
  172. warp/utils.py +647 -86
  173. {warp_lang-1.7.2rc1.dist-info → warp_lang-1.8.0.dist-info}/METADATA +20 -6
  174. {warp_lang-1.7.2rc1.dist-info → warp_lang-1.8.0.dist-info}/RECORD +177 -165
  175. warp/stubs.py +0 -3381
  176. warp/tests/sim/test_xpbd.py +0 -399
  177. warp/tests/test_mlp.py +0 -282
  178. {warp_lang-1.7.2rc1.dist-info → warp_lang-1.8.0.dist-info}/WHEEL +0 -0
  179. {warp_lang-1.7.2rc1.dist-info → warp_lang-1.8.0.dist-info}/licenses/LICENSE.md +0 -0
  180. {warp_lang-1.7.2rc1.dist-info → warp_lang-1.8.0.dist-info}/top_level.txt +0 -0
warp/render/render_usd.py CHANGED
@@ -80,7 +80,7 @@ class UsdRenderer:
80
80
  """A USD renderer"""
81
81
 
82
82
  def __init__(self, stage, up_axis="Y", fps=60, scaling=1.0):
83
- """Construct a UsdRenderer object
83
+ """Construct a UsdRenderer object.
84
84
 
85
85
  Args:
86
86
  model: A simulation model
@@ -173,12 +173,13 @@ class UsdRenderer:
173
173
  def add_shape_instance(
174
174
  self,
175
175
  name: str,
176
- shape,
176
+ shape: int,
177
177
  body,
178
178
  pos: tuple,
179
179
  rot: tuple,
180
180
  scale: tuple = (1.0, 1.0, 1.0),
181
- color: tuple = (1.0, 1.0, 1.0),
181
+ color1=None,
182
+ color2=None,
182
183
  custom_index: int = -1,
183
184
  visible: bool = True,
184
185
  ):
@@ -201,12 +202,15 @@ class UsdRenderer:
201
202
  rot: tuple,
202
203
  width: float,
203
204
  length: float,
204
- color: tuple = None,
205
- parent_body: str = None,
205
+ color: tuple[float, float, float] = (1.0, 1.0, 1.0),
206
+ color2=None,
207
+ parent_body: str | None = None,
206
208
  is_template: bool = False,
209
+ u_scaling: float = 1.0,
210
+ v_scaling: float = 1.0,
211
+ visible: bool = True,
207
212
  ):
208
- """
209
- Render a plane with the given dimensions.
213
+ """Render a plane with the given dimensions.
210
214
 
211
215
  Args:
212
216
  name: Name of the plane
@@ -254,6 +258,7 @@ class UsdRenderer:
254
258
  if not is_template:
255
259
  _usd_set_xform(plane, pos, rot, (1.0, 1.0, 1.0), 0.0)
256
260
 
261
+ plane.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
257
262
  return prim_path
258
263
 
259
264
  def render_ground(self, size: float = 100.0, plane=None):
@@ -302,9 +307,10 @@ class UsdRenderer:
302
307
  pos: tuple,
303
308
  rot: tuple,
304
309
  radius: float,
305
- parent_body: str = None,
310
+ parent_body: str | None = None,
306
311
  is_template: bool = False,
307
- color: tuple = None,
312
+ color: tuple[float, float, float] | None = None,
313
+ visible: bool = True,
308
314
  ):
309
315
  """Debug helper to add a sphere for visualization
310
316
 
@@ -343,6 +349,7 @@ class UsdRenderer:
343
349
  if not is_template:
344
350
  _usd_set_xform(sphere, pos, rot, (1.0, 1.0, 1.0), self.time)
345
351
 
352
+ sphere.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
346
353
  return prim_path
347
354
 
348
355
  def render_capsule(
@@ -352,12 +359,13 @@ class UsdRenderer:
352
359
  rot: tuple,
353
360
  radius: float,
354
361
  half_height: float,
355
- parent_body: str = None,
362
+ parent_body: str | None = None,
356
363
  is_template: bool = False,
357
- color: tuple = None,
364
+ up_axis: int = 1,
365
+ color: tuple[float, float, float] | None = None,
366
+ visible: bool = True,
358
367
  ):
359
- """
360
- Debug helper to add a capsule for visualization
368
+ """Debug helper to add a capsule for visualization
361
369
 
362
370
  Args:
363
371
  pos: The position of the capsule
@@ -387,7 +395,7 @@ class UsdRenderer:
387
395
 
388
396
  capsule.GetRadiusAttr().Set(float(radius))
389
397
  capsule.GetHeightAttr().Set(float(half_height * 2.0))
390
- capsule.GetAxisAttr().Set("Y")
398
+ capsule.GetAxisAttr().Set(UP_AXIS_TOKEN[up_axis])
391
399
 
392
400
  if color is not None:
393
401
  capsule.GetDisplayColorAttr().Set([Gf.Vec3f(color)], self.time)
@@ -397,6 +405,7 @@ class UsdRenderer:
397
405
  if not is_template:
398
406
  _usd_set_xform(capsule, pos, rot, (1.0, 1.0, 1.0), self.time)
399
407
 
408
+ capsule.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
400
409
  return prim_path
401
410
 
402
411
  def render_cylinder(
@@ -406,12 +415,13 @@ class UsdRenderer:
406
415
  rot: tuple,
407
416
  radius: float,
408
417
  half_height: float,
409
- parent_body: str = None,
418
+ parent_body: str | None = None,
410
419
  is_template: bool = False,
411
- color: tuple = None,
420
+ up_axis: int = 1,
421
+ color: tuple[float, float, float] | None = None,
422
+ visible: bool = True,
412
423
  ):
413
- """
414
- Debug helper to add a cylinder for visualization
424
+ """Debug helper to add a cylinder for visualization
415
425
 
416
426
  Args:
417
427
  pos: The position of the cylinder
@@ -441,7 +451,7 @@ class UsdRenderer:
441
451
 
442
452
  cylinder.GetRadiusAttr().Set(float(radius))
443
453
  cylinder.GetHeightAttr().Set(float(half_height * 2.0))
444
- cylinder.GetAxisAttr().Set("Y")
454
+ cylinder.GetAxisAttr().Set(UP_AXIS_TOKEN[up_axis])
445
455
 
446
456
  if color is not None:
447
457
  cylinder.GetDisplayColorAttr().Set([Gf.Vec3f(color)], self.time)
@@ -451,6 +461,7 @@ class UsdRenderer:
451
461
  if not is_template:
452
462
  _usd_set_xform(cylinder, pos, rot, (1.0, 1.0, 1.0), self.time)
453
463
 
464
+ cylinder.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
454
465
  return prim_path
455
466
 
456
467
  def render_cone(
@@ -460,12 +471,13 @@ class UsdRenderer:
460
471
  rot: tuple,
461
472
  radius: float,
462
473
  half_height: float,
463
- parent_body: str = None,
474
+ parent_body: str | None = None,
464
475
  is_template: bool = False,
465
- color: tuple = None,
476
+ up_axis: int = 1,
477
+ color: tuple[float, float, float] | None = None,
478
+ visible: bool = True,
466
479
  ):
467
- """
468
- Debug helper to add a cone for visualization
480
+ """Debug helper to add a cone for visualization
469
481
 
470
482
  Args:
471
483
  pos: The position of the cone
@@ -495,7 +507,7 @@ class UsdRenderer:
495
507
 
496
508
  cone.GetRadiusAttr().Set(float(radius))
497
509
  cone.GetHeightAttr().Set(float(half_height * 2.0))
498
- cone.GetAxisAttr().Set("Y")
510
+ cone.GetAxisAttr().Set(UP_AXIS_TOKEN[up_axis])
499
511
 
500
512
  if color is not None:
501
513
  cone.GetDisplayColorAttr().Set([Gf.Vec3f(color)], self.time)
@@ -505,6 +517,7 @@ class UsdRenderer:
505
517
  if not is_template:
506
518
  _usd_set_xform(cone, pos, rot, (1.0, 1.0, 1.0), self.time)
507
519
 
520
+ cone.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
508
521
  return prim_path
509
522
 
510
523
  def render_box(
@@ -513,9 +526,10 @@ class UsdRenderer:
513
526
  pos: tuple,
514
527
  rot: tuple,
515
528
  extents: tuple,
516
- parent_body: str = None,
529
+ parent_body: str | None = None,
517
530
  is_template: bool = False,
518
- color: tuple = None,
531
+ color: tuple[float, float, float] | None = None,
532
+ visible: bool = True,
519
533
  ):
520
534
  """Debug helper to add a box for visualization
521
535
 
@@ -553,9 +567,10 @@ class UsdRenderer:
553
567
  if not is_template:
554
568
  _usd_set_xform(cube, pos, rot, extents, self.time)
555
569
 
570
+ cube.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
556
571
  return prim_path
557
572
 
558
- def render_ref(self, name: str, path: str, pos: tuple, rot: tuple, scale: tuple, color: tuple = None):
573
+ def render_ref(self, name: str, path: str, pos: tuple, rot: tuple, scale: tuple, color: tuple | None = None):
559
574
  from pxr import Gf, Usd, UsdGeom
560
575
 
561
576
  ref_path = "/root/" + name
@@ -586,8 +601,10 @@ class UsdRenderer:
586
601
  rot=(0.0, 0.0, 0.0, 1.0),
587
602
  scale=(1.0, 1.0, 1.0),
588
603
  update_topology=False,
589
- parent_body: str = None,
604
+ parent_body: str | None = None,
590
605
  is_template: bool = False,
606
+ smooth_shading: bool = True,
607
+ visible: bool = True,
591
608
  ):
592
609
  from pxr import Sdf, UsdGeom
593
610
 
@@ -635,6 +652,7 @@ class UsdRenderer:
635
652
  if not is_template:
636
653
  _usd_set_xform(mesh, pos, rot, scale, self.time)
637
654
 
655
+ mesh.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
638
656
  return prim_path
639
657
 
640
658
  def render_arrow(
@@ -644,12 +662,12 @@ class UsdRenderer:
644
662
  rot: tuple,
645
663
  base_radius: float,
646
664
  base_height: float,
647
- cap_radius: float = None,
648
- cap_height: float = None,
649
- parent_body: str = None,
665
+ cap_radius: float | None = None,
666
+ cap_height: float | None = None,
667
+ parent_body: str | None = None,
650
668
  is_template: bool = False,
651
669
  up_axis: int = 1,
652
- color: tuple[float, float, float] = None,
670
+ color: tuple[float, float, float] | None = None,
653
671
  visible: bool = True,
654
672
  ):
655
673
  from pxr import Gf, Sdf, UsdGeom
@@ -709,7 +727,7 @@ class UsdRenderer:
709
727
  name: str,
710
728
  vertices,
711
729
  indices,
712
- color: tuple = None,
730
+ color: tuple[float, float, float] | None = None,
713
731
  radius: float = 0.01,
714
732
  visible: bool = True,
715
733
  ):
@@ -762,9 +780,18 @@ class UsdRenderer:
762
780
  instancer.GetScalesAttr().Set(line_scales, self.time)
763
781
  instancer.GetProtoIndicesAttr().Set([0] * num_lines, self.time)
764
782
 
765
- # instancer.GetPrimvar("displayColor").Set(line_colors, time)
783
+ # instancer.GetPrimvar("displayColor").Set(line_colors, time)
784
+
785
+ instancer.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
766
786
 
767
- def render_line_strip(self, name: str, vertices, color: tuple, radius: float = 0.01):
787
+ def render_line_strip(
788
+ self,
789
+ name: str,
790
+ vertices,
791
+ color: tuple[float, float, float] | None = None,
792
+ radius: float = 0.01,
793
+ visible: bool = True,
794
+ ):
768
795
  from pxr import Gf, UsdGeom
769
796
 
770
797
  num_lines = int(len(vertices) - 1)
@@ -807,44 +834,80 @@ class UsdRenderer:
807
834
  instancer_capsule = UsdGeom.Capsule.Get(self.stage, instancer.GetPath().AppendChild("capsule"))
808
835
  instancer_capsule.GetDisplayColorAttr().Set([Gf.Vec3f(color)], self.time)
809
836
 
837
+ instancer.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
838
+
810
839
  def render_points(self, name: str, points, radius, colors=None, as_spheres: bool = True, visible: bool = True):
811
- from pxr import Gf, UsdGeom, Vt
840
+ from pxr import Sdf, UsdGeom, Vt
812
841
 
813
- instancer_path = self.root.GetPath().AppendChild(name)
814
- instancer = UsdGeom.PointInstancer.Get(self.stage, instancer_path)
815
- radius_is_scalar = np.isscalar(radius)
816
- if not instancer:
817
- if colors is None or len(colors) == 3:
842
+ instancer_path = self._resolve_path(name)
843
+
844
+ if np.isscalar(radius):
845
+ radius_interp = "constant"
846
+ else:
847
+ radius_interp = "vertex"
848
+
849
+ if colors is None:
850
+ color_interp = "constant"
851
+ elif len(colors) == 3 and all(np.isscalar(x) for x in colors):
852
+ color_interp = "constant"
853
+ is_single_color = True
854
+ else:
855
+ color_interp = "vertex"
856
+ is_single_color = False
857
+
858
+ if as_spheres:
859
+ instancer = UsdGeom.PointInstancer.Get(self.stage, instancer_path)
860
+ if not instancer:
818
861
  instancer = UsdGeom.PointInstancer.Define(self.stage, instancer_path)
819
- instancer_sphere = UsdGeom.Sphere.Define(self.stage, instancer.GetPath().AppendChild("sphere"))
820
- if radius_is_scalar:
821
- instancer_sphere.GetRadiusAttr().Set(radius)
822
- else:
823
- instancer_sphere.GetRadiusAttr().Set(1.0)
824
- instancer.GetScalesAttr().Set(np.tile(radius, (3, 1)).T)
862
+ sphere = UsdGeom.Sphere.Define(self.stage, instancer.GetPath().AppendChild("sphere"))
863
+ primvar_api = UsdGeom.PrimvarsAPI(instancer)
864
+
865
+ instancer.CreatePrototypesRel().SetTargets((sphere.GetPath(),))
866
+ instancer.CreateProtoIndicesAttr().Set(Vt.IntArray((0,) * len(points)))
825
867
 
826
868
  if colors is not None:
827
- instancer_sphere.GetDisplayColorAttr().Set([Gf.Vec3f(colors)], self.time)
869
+ primvar_api.CreatePrimvar("displayColor", Sdf.ValueTypeNames.Color3fArray, color_interp, 1)
828
870
 
829
- instancer.CreatePrototypesRel().SetTargets([instancer_sphere.GetPath()])
830
- instancer.CreateProtoIndicesAttr().Set(Vt.IntArray((0,) * len(points)))
871
+ instancer.GetPositionsAttr().Set(points, self.time)
831
872
 
832
- # set identity rotations
833
- quats = [Gf.Quath(1.0, 0.0, 0.0, 0.0)] * len(points)
834
- instancer.GetOrientationsAttr().Set(quats, self.time)
873
+ if radius_interp == "constant":
874
+ radius = np.tile(radius, (3, len(points))).T
835
875
  else:
836
- instancer = UsdGeom.Points.Define(self.stage, instancer_path)
876
+ radius = np.tile(radius, (3, 1)).T
837
877
 
838
- if radius_is_scalar:
839
- instancer.GetWidthsAttr().Set([radius * 2.0] * len(points))
840
- else:
841
- instancer.GetWidthsAttr().Set(radius * 2.0)
878
+ instancer.GetScalesAttr().Set(radius, self.time)
842
879
 
843
- if colors is None or len(colors) == 3:
844
- instancer.GetPositionsAttr().Set(points, self.time)
880
+ if colors is not None:
881
+ if is_single_color:
882
+ colors = (colors,)
883
+
884
+ primvar_api = UsdGeom.PrimvarsAPI(instancer)
885
+ primvar_api.GetPrimvar("displayColor").Set(colors, self.time)
845
886
  else:
887
+ instancer = UsdGeom.Points.Get(self.stage, instancer_path)
888
+ if not instancer:
889
+ instancer = UsdGeom.Points.Define(self.stage, instancer_path)
890
+
891
+ UsdGeom.Primvar(instancer.GetWidthsAttr()).SetInterpolation(radius_interp)
892
+ UsdGeom.Primvar(instancer.GetDisplayColorAttr()).SetInterpolation(color_interp)
893
+
846
894
  instancer.GetPointsAttr().Set(points, self.time)
847
- instancer.GetDisplayColorAttr().Set(colors, self.time)
895
+
896
+ if np.isscalar(radius):
897
+ widths = (radius * 2.0,)
898
+ else:
899
+ widths = np.array(radius) * 2.0
900
+
901
+ instancer.GetWidthsAttr().Set(widths, self.time)
902
+
903
+ if colors is not None:
904
+ if len(colors) == 3:
905
+ colors = (colors,)
906
+
907
+ instancer.GetDisplayColorAttr().Set(colors, self.time)
908
+
909
+ instancer.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
910
+ return instancer.GetPath()
848
911
 
849
912
  def update_body_transforms(self, body_q):
850
913
  from pxr import Sdf, UsdGeom
warp/sim/__init__.py CHANGED
@@ -13,6 +13,8 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
 
16
+ from warp.utils import warn
17
+
16
18
  from .articulation import eval_fk, eval_ik
17
19
  from .collide import collide
18
20
  from .import_mjcf import parse_mjcf
@@ -63,3 +65,10 @@ from .utils import (
63
65
  quat_to_euler,
64
66
  velocity_at_point,
65
67
  )
68
+
69
+ warn(
70
+ "The `warp.sim` module is deprecated and will be removed in v1.10. "
71
+ "Please transition to using the forthcoming Newton library instead.",
72
+ DeprecationWarning,
73
+ stacklevel=2,
74
+ )