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

Files changed (181) hide show
  1. warp/__init__.py +3 -1
  2. warp/__init__.pyi +3489 -1
  3. warp/autograd.py +45 -122
  4. warp/bin/warp-clang.dll +0 -0
  5. warp/bin/warp.dll +0 -0
  6. warp/build.py +241 -252
  7. warp/build_dll.py +125 -26
  8. warp/builtins.py +1907 -384
  9. warp/codegen.py +257 -101
  10. warp/config.py +12 -1
  11. warp/constants.py +1 -1
  12. warp/context.py +657 -223
  13. warp/dlpack.py +1 -1
  14. warp/examples/benchmarks/benchmark_cloth.py +2 -2
  15. warp/examples/benchmarks/benchmark_tile_sort.py +155 -0
  16. warp/examples/core/example_sample_mesh.py +1 -1
  17. warp/examples/core/example_spin_lock.py +93 -0
  18. warp/examples/core/example_work_queue.py +118 -0
  19. warp/examples/fem/example_adaptive_grid.py +5 -5
  20. warp/examples/fem/example_apic_fluid.py +1 -1
  21. warp/examples/fem/example_burgers.py +1 -1
  22. warp/examples/fem/example_convection_diffusion.py +9 -6
  23. warp/examples/fem/example_darcy_ls_optimization.py +489 -0
  24. warp/examples/fem/example_deformed_geometry.py +1 -1
  25. warp/examples/fem/example_diffusion.py +2 -2
  26. warp/examples/fem/example_diffusion_3d.py +1 -1
  27. warp/examples/fem/example_distortion_energy.py +1 -1
  28. warp/examples/fem/example_elastic_shape_optimization.py +387 -0
  29. warp/examples/fem/example_magnetostatics.py +5 -3
  30. warp/examples/fem/example_mixed_elasticity.py +5 -3
  31. warp/examples/fem/example_navier_stokes.py +11 -9
  32. warp/examples/fem/example_nonconforming_contact.py +5 -3
  33. warp/examples/fem/example_streamlines.py +8 -3
  34. warp/examples/fem/utils.py +9 -8
  35. warp/examples/interop/example_jax_ffi_callback.py +2 -2
  36. warp/examples/optim/example_drone.py +1 -1
  37. warp/examples/sim/example_cloth.py +1 -1
  38. warp/examples/sim/example_cloth_self_contact.py +48 -54
  39. warp/examples/tile/example_tile_block_cholesky.py +502 -0
  40. warp/examples/tile/example_tile_cholesky.py +2 -1
  41. warp/examples/tile/example_tile_convolution.py +1 -1
  42. warp/examples/tile/example_tile_filtering.py +1 -1
  43. warp/examples/tile/example_tile_matmul.py +1 -1
  44. warp/examples/tile/example_tile_mlp.py +2 -0
  45. warp/fabric.py +7 -7
  46. warp/fem/__init__.py +5 -0
  47. warp/fem/adaptivity.py +1 -1
  48. warp/fem/cache.py +152 -63
  49. warp/fem/dirichlet.py +2 -2
  50. warp/fem/domain.py +136 -6
  51. warp/fem/field/field.py +141 -99
  52. warp/fem/field/nodal_field.py +85 -39
  53. warp/fem/field/virtual.py +97 -52
  54. warp/fem/geometry/adaptive_nanogrid.py +91 -86
  55. warp/fem/geometry/closest_point.py +13 -0
  56. warp/fem/geometry/deformed_geometry.py +102 -40
  57. warp/fem/geometry/element.py +56 -2
  58. warp/fem/geometry/geometry.py +323 -22
  59. warp/fem/geometry/grid_2d.py +157 -62
  60. warp/fem/geometry/grid_3d.py +116 -20
  61. warp/fem/geometry/hexmesh.py +86 -20
  62. warp/fem/geometry/nanogrid.py +166 -86
  63. warp/fem/geometry/partition.py +59 -25
  64. warp/fem/geometry/quadmesh.py +86 -135
  65. warp/fem/geometry/tetmesh.py +47 -119
  66. warp/fem/geometry/trimesh.py +77 -270
  67. warp/fem/integrate.py +107 -52
  68. warp/fem/linalg.py +25 -58
  69. warp/fem/operator.py +124 -27
  70. warp/fem/quadrature/pic_quadrature.py +36 -14
  71. warp/fem/quadrature/quadrature.py +40 -16
  72. warp/fem/space/__init__.py +1 -1
  73. warp/fem/space/basis_function_space.py +66 -46
  74. warp/fem/space/basis_space.py +17 -4
  75. warp/fem/space/dof_mapper.py +1 -1
  76. warp/fem/space/function_space.py +2 -2
  77. warp/fem/space/grid_2d_function_space.py +4 -1
  78. warp/fem/space/hexmesh_function_space.py +4 -2
  79. warp/fem/space/nanogrid_function_space.py +3 -1
  80. warp/fem/space/partition.py +11 -2
  81. warp/fem/space/quadmesh_function_space.py +4 -1
  82. warp/fem/space/restriction.py +5 -2
  83. warp/fem/space/shape/__init__.py +10 -8
  84. warp/fem/space/tetmesh_function_space.py +4 -1
  85. warp/fem/space/topology.py +52 -21
  86. warp/fem/space/trimesh_function_space.py +4 -1
  87. warp/fem/utils.py +53 -8
  88. warp/jax.py +1 -2
  89. warp/jax_experimental/ffi.py +12 -17
  90. warp/jax_experimental/xla_ffi.py +37 -24
  91. warp/math.py +171 -1
  92. warp/native/array.h +99 -0
  93. warp/native/builtin.h +174 -31
  94. warp/native/coloring.cpp +1 -1
  95. warp/native/exports.h +118 -63
  96. warp/native/intersect.h +3 -3
  97. warp/native/mat.h +5 -10
  98. warp/native/mathdx.cpp +11 -5
  99. warp/native/matnn.h +1 -123
  100. warp/native/quat.h +28 -4
  101. warp/native/sparse.cpp +121 -258
  102. warp/native/sparse.cu +181 -274
  103. warp/native/spatial.h +305 -17
  104. warp/native/tile.h +583 -72
  105. warp/native/tile_radix_sort.h +1108 -0
  106. warp/native/tile_reduce.h +237 -2
  107. warp/native/tile_scan.h +240 -0
  108. warp/native/tuple.h +189 -0
  109. warp/native/vec.h +6 -16
  110. warp/native/warp.cpp +36 -4
  111. warp/native/warp.cu +574 -51
  112. warp/native/warp.h +47 -74
  113. warp/optim/linear.py +5 -1
  114. warp/paddle.py +7 -8
  115. warp/py.typed +0 -0
  116. warp/render/render_opengl.py +58 -29
  117. warp/render/render_usd.py +124 -61
  118. warp/sim/__init__.py +9 -0
  119. warp/sim/collide.py +252 -78
  120. warp/sim/graph_coloring.py +8 -1
  121. warp/sim/import_mjcf.py +4 -3
  122. warp/sim/import_usd.py +11 -7
  123. warp/sim/integrator.py +5 -2
  124. warp/sim/integrator_euler.py +1 -1
  125. warp/sim/integrator_featherstone.py +1 -1
  126. warp/sim/integrator_vbd.py +751 -320
  127. warp/sim/integrator_xpbd.py +1 -1
  128. warp/sim/model.py +265 -260
  129. warp/sim/utils.py +10 -7
  130. warp/sparse.py +303 -166
  131. warp/tape.py +52 -51
  132. warp/tests/cuda/test_conditional_captures.py +1046 -0
  133. warp/tests/cuda/test_streams.py +1 -1
  134. warp/tests/geometry/test_volume.py +2 -2
  135. warp/tests/interop/test_dlpack.py +9 -9
  136. warp/tests/interop/test_jax.py +0 -1
  137. warp/tests/run_coverage_serial.py +1 -1
  138. warp/tests/sim/disabled_kinematics.py +2 -2
  139. warp/tests/sim/{test_vbd.py → test_cloth.py} +296 -113
  140. warp/tests/sim/test_collision.py +159 -51
  141. warp/tests/sim/test_coloring.py +15 -1
  142. warp/tests/test_array.py +254 -2
  143. warp/tests/test_array_reduce.py +2 -2
  144. warp/tests/test_atomic_cas.py +299 -0
  145. warp/tests/test_codegen.py +142 -19
  146. warp/tests/test_conditional.py +47 -1
  147. warp/tests/test_ctypes.py +0 -20
  148. warp/tests/test_devices.py +8 -0
  149. warp/tests/test_fabricarray.py +4 -2
  150. warp/tests/test_fem.py +58 -25
  151. warp/tests/test_func.py +42 -1
  152. warp/tests/test_grad.py +1 -1
  153. warp/tests/test_lerp.py +1 -3
  154. warp/tests/test_map.py +481 -0
  155. warp/tests/test_mat.py +1 -24
  156. warp/tests/test_quat.py +6 -15
  157. warp/tests/test_rounding.py +10 -38
  158. warp/tests/test_runlength_encode.py +7 -7
  159. warp/tests/test_smoothstep.py +1 -1
  160. warp/tests/test_sparse.py +51 -2
  161. warp/tests/test_spatial.py +507 -1
  162. warp/tests/test_struct.py +2 -2
  163. warp/tests/test_tuple.py +265 -0
  164. warp/tests/test_types.py +2 -2
  165. warp/tests/test_utils.py +24 -18
  166. warp/tests/tile/test_tile.py +420 -1
  167. warp/tests/tile/test_tile_mathdx.py +518 -14
  168. warp/tests/tile/test_tile_reduce.py +213 -0
  169. warp/tests/tile/test_tile_shared_memory.py +130 -1
  170. warp/tests/tile/test_tile_sort.py +117 -0
  171. warp/tests/unittest_suites.py +4 -6
  172. warp/types.py +462 -308
  173. warp/utils.py +647 -86
  174. {warp_lang-1.7.2.dist-info → warp_lang-1.8.0.dist-info}/METADATA +20 -6
  175. {warp_lang-1.7.2.dist-info → warp_lang-1.8.0.dist-info}/RECORD +178 -166
  176. warp/stubs.py +0 -3381
  177. warp/tests/sim/test_xpbd.py +0 -399
  178. warp/tests/test_mlp.py +0 -282
  179. {warp_lang-1.7.2.dist-info → warp_lang-1.8.0.dist-info}/WHEEL +0 -0
  180. {warp_lang-1.7.2.dist-info → warp_lang-1.8.0.dist-info}/licenses/LICENSE.md +0 -0
  181. {warp_lang-1.7.2.dist-info → warp_lang-1.8.0.dist-info}/top_level.txt +0 -0
warp/native/warp.h CHANGED
@@ -19,6 +19,7 @@
19
19
 
20
20
  // defines all crt + builtin types
21
21
  #include "builtin.h"
22
+ #include <cstdint>
22
23
 
23
24
  #define WP_CURRENT_STREAM ((void*)0xffffffffffffffff)
24
25
 
@@ -177,95 +178,56 @@ extern "C"
177
178
  WP_API void runlength_encode_int_host(uint64_t values, uint64_t run_values, uint64_t run_lengths, uint64_t run_count, int n);
178
179
  WP_API void runlength_encode_int_device(uint64_t values, uint64_t run_values, uint64_t run_lengths, uint64_t run_count, int n);
179
180
 
180
- WP_API void bsr_matrix_from_triplets_float_host(
181
- int rows_per_block,
182
- int cols_per_block,
181
+ WP_API void bsr_matrix_from_triplets_host(
182
+ int block_size,
183
+ int scalar_size_in_bytes,
183
184
  int row_count,
184
- int tpl_nnz,
185
- int* tpl_rows,
186
- int* tpl_columns,
187
- void* tpl_values,
188
- bool prune_numerical_zeros,
189
- bool masked,
185
+ int col_count,
186
+ int tpl_nnz_upper_bound,
187
+ const int* tpl_nnz,
188
+ const int* tpl_rows,
189
+ const int* tpl_columns,
190
+ const void* tpl_values,
191
+ const uint64_t scalar_zero_mask,
192
+ bool masked_topology,
193
+ int* summed_block_offsets,
194
+ int* summed_block_indices,
190
195
  int* bsr_offsets,
191
196
  int* bsr_columns,
192
- void* bsr_values,
193
197
  int* bsr_nnz,
194
198
  void* bsr_nnz_event);
195
- WP_API void bsr_matrix_from_triplets_double_host(
196
- int rows_per_block,
197
- int cols_per_block,
199
+ WP_API void bsr_matrix_from_triplets_device(
200
+ int block_size,
201
+ int scalar_size_in_bytes,
198
202
  int row_count,
199
- int tpl_nnz,
200
- int* tpl_rows,
201
- int* tpl_columns,
202
- void* tpl_values,
203
- bool prune_numerical_zeros,
204
- bool masked,
203
+ int col_count,
204
+ int tpl_nnz_upper_bound,
205
+ const int* tpl_nnz,
206
+ const int* tpl_rows,
207
+ const int* tpl_columns,
208
+ const void* tpl_values,
209
+ const uint64_t scalar_zero_mask,
210
+ bool masked_topology,
211
+ int* summed_block_offsets,
212
+ int* summed_block_indices,
205
213
  int* bsr_offsets,
206
214
  int* bsr_columns,
207
- void* bsr_values,
208
- int* bsr_nnz,
209
- void* bsr_nnz_event);
210
- WP_API void bsr_matrix_from_triplets_float_device(
211
- int rows_per_block,
212
- int cols_per_block,
213
- int row_count,
214
- int tpl_nnz,
215
- int* tpl_rows,
216
- int* tpl_columns,
217
- void* tpl_values,
218
- bool prune_numerical_zeros,
219
- bool masked,
220
- int* bsr_offsets,
221
- int* bsr_columns,
222
- void* bsr_values,
223
- int* bsr_nnz,
224
- void* bsr_nnz_event);
225
- WP_API void bsr_matrix_from_triplets_double_device(
226
- int rows_per_block,
227
- int cols_per_block,
228
- int row_count,
229
- int tpl_nnz,
230
- int* tpl_rows,
231
- int* tpl_columns,
232
- void* tpl_values,
233
- bool prune_numerical_zeros,
234
- bool masked,
235
- int* bsr_offsets,
236
- int* bsr_columns,
237
- void* bsr_values,
238
215
  int* bsr_nnz,
239
216
  void* bsr_nnz_event);
240
217
 
241
- WP_API void bsr_transpose_float_host(int rows_per_block, int cols_per_block,
242
- int row_count, int col_count, int nnz,
243
- int* bsr_offsets, int* bsr_columns,
244
- void* bsr_values,
245
- int* transposed_bsr_offsets,
246
- int* transposed_bsr_columns,
247
- void* transposed_bsr_values);
248
- WP_API void bsr_transpose_double_host(int rows_per_block, int cols_per_block,
218
+ WP_API void bsr_transpose_host(
249
219
  int row_count, int col_count, int nnz,
250
- int* bsr_offsets, int* bsr_columns,
251
- void* bsr_values,
220
+ const int* bsr_offsets, const int* bsr_columns,
252
221
  int* transposed_bsr_offsets,
253
222
  int* transposed_bsr_columns,
254
- void* transposed_bsr_values);
255
- WP_API void bsr_transpose_float_device(int rows_per_block, int cols_per_block,
223
+ int* src_block_indices
224
+ );
225
+ WP_API void bsr_transpose_device(
256
226
  int row_count, int col_count, int nnz,
257
- int* bsr_offsets, int* bsr_columns,
258
- void* bsr_values,
227
+ const int* bsr_offsets, const int* bsr_columns,
259
228
  int* transposed_bsr_offsets,
260
229
  int* transposed_bsr_columns,
261
- void* transposed_bsr_values);
262
- WP_API void bsr_transpose_double_device(int rows_per_block, int cols_per_block,
263
- int row_count, int col_count, int nnz,
264
- int* bsr_offsets, int* bsr_columns,
265
- void* bsr_values,
266
- int* transposed_bsr_offsets,
267
- int* transposed_bsr_columns,
268
- void* transposed_bsr_values);
230
+ int* src_block_indices);
269
231
 
270
232
 
271
233
  WP_API int cuda_driver_version(); // CUDA driver version
@@ -279,6 +241,7 @@ extern "C"
279
241
  WP_API void* cuda_device_get_primary_context(int ordinal);
280
242
  WP_API const char* cuda_device_get_name(int ordinal);
281
243
  WP_API int cuda_device_get_arch(int ordinal);
244
+ WP_API int cuda_device_get_sm_count(int ordinal);
282
245
  WP_API void cuda_device_get_uuid(int ordinal, char uuid[16]);
283
246
  WP_API int cuda_device_get_pci_domain_id(int ordinal);
284
247
  WP_API int cuda_device_get_pci_bus_id(int ordinal);
@@ -345,13 +308,23 @@ extern "C"
345
308
 
346
309
  WP_API bool cuda_graph_begin_capture(void* context, void* stream, int external);
347
310
  WP_API bool cuda_graph_end_capture(void* context, void* stream, void** graph_ret);
311
+ WP_API bool cuda_graph_create_exec(void* context, void* graph, void** graph_exec_ret);
348
312
  WP_API bool cuda_graph_launch(void* graph, void* stream);
349
313
  WP_API bool cuda_graph_destroy(void* context, void* graph);
314
+ WP_API bool cuda_graph_exec_destroy(void* context, void* graph_exec);
315
+ WP_API bool capture_debug_dot_print(void* graph, const char *path, uint32_t flags);
316
+
317
+ WP_API bool cuda_graph_insert_if_else(void* context, void* stream, int* condition, void** if_graph_ret, void** else_graph_ret);
318
+ WP_API bool cuda_graph_insert_while(void* context, void* stream, int* condition, void** body_graph_ret, uint64_t* handle_ret);
319
+ WP_API bool cuda_graph_set_condition(void* context, void* stream, int* condition, uint64_t handle);
320
+ WP_API bool cuda_graph_pause_capture(void* context, void* stream, void** graph_ret);
321
+ WP_API bool cuda_graph_resume_capture(void* context, void* stream, void* graph);
322
+ WP_API bool cuda_graph_insert_child_graph(void* context, void* stream, void* child_graph);
350
323
 
351
- WP_API size_t cuda_compile_program(const char* cuda_src, const char* program_name, int arch, const char* include_dir, int num_cuda_include_dirs, const char** cuda_include_dirs, bool debug, bool verbose, bool verify_fp, bool fast_math, bool fuse_fp, bool lineinfo, const char* output_path, size_t num_ltoirs, char** ltoirs, size_t* ltoir_sizes, int* ltoir_input_types);
324
+ WP_API size_t cuda_compile_program(const char* cuda_src, const char* program_name, int arch, const char* include_dir, int num_cuda_include_dirs, const char** cuda_include_dirs, bool debug, bool verbose, bool verify_fp, bool fast_math, bool fuse_fp, bool lineinfo, bool compile_time_trace, const char* output_path, size_t num_ltoirs, char** ltoirs, size_t* ltoir_sizes, int* ltoir_input_types);
352
325
  WP_API bool cuda_compile_fft(const char* ltoir_output_path, const char* symbol_name, int num_include_dirs, const char** include_dirs, const char* mathdx_include_dir, int arch, int size, int elements_per_thread, int direction, int precision, int* shared_memory_size);
353
326
  WP_API bool cuda_compile_dot(const char* ltoir_output_path, const char* symbol_name, int num_include_dirs, const char** include_dirs, const char* mathdx_include_dir, int arch, int M, int N, int K, int precision_A, int precision_B, int precision_C, int type, int arrangement_A, int arrangement_B, int arrangement_C, int num_threads);
354
- WP_API bool cuda_compile_solver(const char* fatbin_output_path, const char* ltoir_output_path, const char* symbol_name, int num_include_dirs, const char** include_dirs, const char* mathdx_include_dir, int arch, int M, int N, int function, int precision, int fill_mode, int num_threads);
327
+ WP_API bool cuda_compile_solver(const char* fatbin_output_path, const char* ltoir_output_path, const char* symbol_name, int num_include_dirs, const char** include_dirs, const char* mathdx_include_dir, int arch, int M, int N, int NRHS, int function, int side, int diag, int precision, int arrangement_A, int arrangement_B, int fill_mode, int num_threads);
355
328
 
356
329
  WP_API void* cuda_load_module(void* context, const char* ptx);
357
330
  WP_API void cuda_unload_module(void* context, void* module);
warp/optim/linear.py CHANGED
@@ -39,7 +39,11 @@ class LinearOperator:
39
39
  .. code-block:: python
40
40
 
41
41
  def matvec(x: wp.array, y: wp.array, z: wp.array, alpha: Scalar, beta: Scalar):
42
- '''Performs the operation z = alpha * x + beta * y'''
42
+ '''Perform a generalized matrix-vector product.
43
+
44
+ This function computes the operation z = alpha * (A @ x) + beta * y, where 'A'
45
+ is the linear operator represented by this class.
46
+ '''
43
47
  ...
44
48
 
45
49
  For performance reasons, by default the iterative linear solvers in this module will try to capture the calls
warp/paddle.py CHANGED
@@ -16,7 +16,7 @@
16
16
  from __future__ import annotations
17
17
 
18
18
  import ctypes
19
- from typing import TYPE_CHECKING, Optional, Union
19
+ from typing import TYPE_CHECKING
20
20
 
21
21
  import numpy
22
22
 
@@ -29,7 +29,7 @@ if TYPE_CHECKING:
29
29
 
30
30
 
31
31
  # return the warp device corresponding to a paddle device
32
- def device_from_paddle(paddle_device: Union[Place, CPUPlace, CUDAPinnedPlace, CUDAPlace, str]) -> warp.context.Device:
32
+ def device_from_paddle(paddle_device: Place | CPUPlace | CUDAPinnedPlace | CUDAPlace | str) -> warp.context.Device:
33
33
  """Return the Warp device corresponding to a Paddle device.
34
34
 
35
35
  Args:
@@ -218,9 +218,9 @@ dtype_is_compatible.compatible_sets = None
218
218
  # wrap a paddle tensor to a wp array, data is not copied
219
219
  def from_paddle(
220
220
  t: paddle.Tensor,
221
- dtype: Optional[paddle.dtype] = None,
222
- requires_grad: Optional[bool] = None,
223
- grad: Optional[paddle.Tensor] = None,
221
+ dtype: paddle.dtype | None = None,
222
+ requires_grad: bool | None = None,
223
+ grad: paddle.Tensor | None = None,
224
224
  return_ctype: bool = False,
225
225
  ) -> warp.array:
226
226
  """Convert a Paddle tensor to a Warp array without copying the data.
@@ -339,9 +339,8 @@ def from_paddle(
339
339
  return a
340
340
 
341
341
 
342
- def to_paddle(a: warp.array, requires_grad: bool = None) -> paddle.Tensor:
343
- """
344
- Convert a Warp array to a Paddle tensor without copying the data.
342
+ def to_paddle(a: warp.array, requires_grad: bool | None = None) -> paddle.Tensor:
343
+ """Convert a Warp array to a Paddle tensor without copying the data.
345
344
 
346
345
  Args:
347
346
  a (warp.array): The Warp array to convert.
warp/py.typed ADDED
File without changes
@@ -691,7 +691,7 @@ class ShapeInstancer:
691
691
  cls.gl = gl
692
692
 
693
693
  def __new__(cls, *args, **kwargs):
694
- instance = super(ShapeInstancer, cls).__new__(cls)
694
+ instance = super().__new__(cls)
695
695
  instance.instance_transform_gl_buffer = None
696
696
  instance.vao = None
697
697
  return instance
@@ -1858,7 +1858,7 @@ class OpenGLRenderer:
1858
1858
  self._scaling = scaling
1859
1859
  self.update_model_matrix()
1860
1860
 
1861
- def begin_frame(self, t: float = None):
1861
+ def begin_frame(self, t: float | None = None):
1862
1862
  self._last_begin_frame_time = time.time()
1863
1863
  self.time = t or self.clock_time
1864
1864
 
@@ -2295,9 +2295,9 @@ Instances: {len(self._instances)}"""
2295
2295
  name: str,
2296
2296
  shape: int,
2297
2297
  body,
2298
- pos,
2299
- rot,
2300
- scale=(1.0, 1.0, 1.0),
2298
+ pos: tuple,
2299
+ rot: tuple,
2300
+ scale: tuple = (1.0, 1.0, 1.0),
2301
2301
  color1=None,
2302
2302
  color2=None,
2303
2303
  custom_index: int = -1,
@@ -2720,10 +2720,11 @@ Instances: {len(self._instances)}"""
2720
2720
  length: float,
2721
2721
  color: tuple = (1.0, 1.0, 1.0),
2722
2722
  color2=None,
2723
- parent_body: str = None,
2723
+ parent_body: str | None = None,
2724
2724
  is_template: bool = False,
2725
2725
  u_scaling=1.0,
2726
2726
  v_scaling=1.0,
2727
+ visible: bool = True,
2727
2728
  ):
2728
2729
  """Add a plane for visualization
2729
2730
 
@@ -2811,9 +2812,10 @@ Instances: {len(self._instances)}"""
2811
2812
  pos: tuple,
2812
2813
  rot: tuple,
2813
2814
  radius: float,
2814
- parent_body: str = None,
2815
+ parent_body: str | None = None,
2815
2816
  is_template: bool = False,
2816
- color=None,
2817
+ color: tuple[float, float, float] | None = None,
2818
+ visible: bool = True,
2817
2819
  ):
2818
2820
  """Add a sphere for visualization
2819
2821
 
@@ -2843,10 +2845,11 @@ Instances: {len(self._instances)}"""
2843
2845
  rot: tuple,
2844
2846
  radius: float,
2845
2847
  half_height: float,
2846
- parent_body: str = None,
2848
+ parent_body: str | None = None,
2847
2849
  is_template: bool = False,
2848
2850
  up_axis: int = 1,
2849
- color: tuple = None,
2851
+ color: tuple[float, float, float] | None = None,
2852
+ visible: bool = True,
2850
2853
  ):
2851
2854
  """Add a capsule for visualization
2852
2855
 
@@ -2878,10 +2881,11 @@ Instances: {len(self._instances)}"""
2878
2881
  rot: tuple,
2879
2882
  radius: float,
2880
2883
  half_height: float,
2881
- parent_body: str = None,
2884
+ parent_body: str | None = None,
2882
2885
  is_template: bool = False,
2883
2886
  up_axis: int = 1,
2884
- color: tuple = None,
2887
+ color: tuple[float, float, float] | None = None,
2888
+ visible: bool = True,
2885
2889
  ):
2886
2890
  """Add a cylinder for visualization
2887
2891
 
@@ -2913,10 +2917,11 @@ Instances: {len(self._instances)}"""
2913
2917
  rot: tuple,
2914
2918
  radius: float,
2915
2919
  half_height: float,
2916
- parent_body: str = None,
2920
+ parent_body: str | None = None,
2917
2921
  is_template: bool = False,
2918
2922
  up_axis: int = 1,
2919
- color: tuple = None,
2923
+ color: tuple[float, float, float] | None = None,
2924
+ visible: bool = True,
2920
2925
  ):
2921
2926
  """Add a cone for visualization
2922
2927
 
@@ -2947,9 +2952,10 @@ Instances: {len(self._instances)}"""
2947
2952
  pos: tuple,
2948
2953
  rot: tuple,
2949
2954
  extents: tuple,
2950
- parent_body: str = None,
2955
+ parent_body: str | None = None,
2951
2956
  is_template: bool = False,
2952
- color: tuple = None,
2957
+ color: tuple[float, float, float] | None = None,
2958
+ visible: bool = True,
2953
2959
  ):
2954
2960
  """Add a box for visualization
2955
2961
 
@@ -2982,9 +2988,10 @@ Instances: {len(self._instances)}"""
2982
2988
  rot=(0.0, 0.0, 0.0, 1.0),
2983
2989
  scale=(1.0, 1.0, 1.0),
2984
2990
  update_topology=False,
2985
- parent_body: str = None,
2991
+ parent_body: str | None = None,
2986
2992
  is_template: bool = False,
2987
2993
  smooth_shading: bool = True,
2994
+ visible: bool = True,
2988
2995
  ):
2989
2996
  """Add a mesh for visualization
2990
2997
 
@@ -3094,12 +3101,13 @@ Instances: {len(self._instances)}"""
3094
3101
  rot: tuple,
3095
3102
  base_radius: float,
3096
3103
  base_height: float,
3097
- cap_radius: float = None,
3098
- cap_height: float = None,
3099
- parent_body: str = None,
3104
+ cap_radius: float | None = None,
3105
+ cap_height: float | None = None,
3106
+ parent_body: str | None = None,
3100
3107
  is_template: bool = False,
3101
3108
  up_axis: int = 1,
3102
- color: tuple[float, float, float] = None,
3109
+ color: tuple[float, float, float] | None = None,
3110
+ visible: bool = True,
3103
3111
  ):
3104
3112
  """Add a arrow for visualization
3105
3113
 
@@ -3127,10 +3135,16 @@ Instances: {len(self._instances)}"""
3127
3135
  self.add_shape_instance(name, shape, body, pos, rot, color1=color, color2=color)
3128
3136
  return shape
3129
3137
 
3130
- def render_ref(self, name: str, path: str, pos: tuple, rot: tuple, scale: tuple, color: tuple = None):
3131
- """
3132
- Create a reference (instance) with the given name to the given path.
3133
- """
3138
+ def render_ref(
3139
+ self,
3140
+ name: str,
3141
+ path: str,
3142
+ pos: tuple,
3143
+ rot: tuple,
3144
+ scale: tuple,
3145
+ color: tuple[float, float, float] | None = None,
3146
+ ):
3147
+ """Create a reference (instance) with the given name to the given path."""
3134
3148
 
3135
3149
  if path in self._instances:
3136
3150
  _, body, shape, _, original_scale, color1, color2 = self._instances[path]
@@ -3141,7 +3155,7 @@ Instances: {len(self._instances)}"""
3141
3155
 
3142
3156
  raise Exception("Cannot create reference to path: " + path)
3143
3157
 
3144
- def render_points(self, name: str, points, radius, colors=None):
3158
+ def render_points(self, name: str, points, radius, colors=None, as_spheres: bool = True, visible: bool = True):
3145
3159
  """Add a set of points
3146
3160
 
3147
3161
  Args:
@@ -3199,7 +3213,7 @@ Instances: {len(self._instances)}"""
3199
3213
  if name not in self._shape_instancers:
3200
3214
  instancer = ShapeInstancer(self._shape_shader, self._device)
3201
3215
  vertices, indices = self._create_capsule_mesh(radius, 0.5)
3202
- if color is None or isinstance(color, list) and len(color) > 0 and isinstance(color[0], list):
3216
+ if color is None or (isinstance(color, list) and len(color) > 0 and isinstance(color[0], list)):
3203
3217
  color = tab10_color_map(len(self._shape_geo_hash))
3204
3218
  instancer.register_shape(vertices, indices, color, color)
3205
3219
  instancer.allocate_instances(np.zeros((len(lines), 3)))
@@ -3220,7 +3234,15 @@ Instances: {len(self._instances)}"""
3220
3234
  device=self._device,
3221
3235
  )
3222
3236
 
3223
- def render_line_list(self, name: str, vertices, indices, color: tuple = None, radius: float = 0.01):
3237
+ def render_line_list(
3238
+ self,
3239
+ name: str,
3240
+ vertices,
3241
+ indices,
3242
+ color: tuple[float, float, float] | None = None,
3243
+ radius: float = 0.01,
3244
+ visible: bool = True,
3245
+ ):
3224
3246
  """Add a line list as a set of capsules
3225
3247
 
3226
3248
  Args:
@@ -3235,7 +3257,14 @@ Instances: {len(self._instances)}"""
3235
3257
  lines = np.array(lines)
3236
3258
  self._render_lines(name, lines, color, radius)
3237
3259
 
3238
- def render_line_strip(self, name: str, vertices, color: tuple = None, radius: float = 0.01):
3260
+ def render_line_strip(
3261
+ self,
3262
+ name: str,
3263
+ vertices,
3264
+ color: tuple[float, float, float] | None = None,
3265
+ radius: float = 0.01,
3266
+ visible: bool = True,
3267
+ ):
3239
3268
  """Add a line strip as a set of capsules
3240
3269
 
3241
3270
  Args: