warp-lang 1.0.2__py3-none-manylinux2014_x86_64.whl → 1.2.0__py3-none-manylinux2014_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of warp-lang might be problematic. Click here for more details.

Files changed (356) hide show
  1. warp/__init__.py +108 -97
  2. warp/__init__.pyi +1 -1
  3. warp/bin/warp-clang.so +0 -0
  4. warp/bin/warp.so +0 -0
  5. warp/build.py +88 -113
  6. warp/build_dll.py +383 -375
  7. warp/builtins.py +3693 -3354
  8. warp/codegen.py +2925 -2792
  9. warp/config.py +40 -36
  10. warp/constants.py +49 -45
  11. warp/context.py +5409 -5102
  12. warp/dlpack.py +442 -442
  13. warp/examples/__init__.py +16 -16
  14. warp/examples/assets/bear.usd +0 -0
  15. warp/examples/assets/bunny.usd +0 -0
  16. warp/examples/assets/cartpole.urdf +110 -110
  17. warp/examples/assets/crazyflie.usd +0 -0
  18. warp/examples/assets/cube.usd +0 -0
  19. warp/examples/assets/nv_ant.xml +92 -92
  20. warp/examples/assets/nv_humanoid.xml +183 -183
  21. warp/examples/assets/quadruped.urdf +267 -267
  22. warp/examples/assets/rocks.nvdb +0 -0
  23. warp/examples/assets/rocks.usd +0 -0
  24. warp/examples/assets/sphere.usd +0 -0
  25. warp/examples/benchmarks/benchmark_api.py +381 -383
  26. warp/examples/benchmarks/benchmark_cloth.py +278 -277
  27. warp/examples/benchmarks/benchmark_cloth_cupy.py +88 -88
  28. warp/examples/benchmarks/benchmark_cloth_jax.py +97 -100
  29. warp/examples/benchmarks/benchmark_cloth_numba.py +146 -142
  30. warp/examples/benchmarks/benchmark_cloth_numpy.py +77 -77
  31. warp/examples/benchmarks/benchmark_cloth_pytorch.py +86 -86
  32. warp/examples/benchmarks/benchmark_cloth_taichi.py +112 -112
  33. warp/examples/benchmarks/benchmark_cloth_warp.py +145 -146
  34. warp/examples/benchmarks/benchmark_launches.py +293 -295
  35. warp/examples/browse.py +29 -29
  36. warp/examples/core/example_dem.py +232 -219
  37. warp/examples/core/example_fluid.py +291 -267
  38. warp/examples/core/example_graph_capture.py +142 -126
  39. warp/examples/core/example_marching_cubes.py +186 -174
  40. warp/examples/core/example_mesh.py +172 -155
  41. warp/examples/core/example_mesh_intersect.py +203 -193
  42. warp/examples/core/example_nvdb.py +174 -170
  43. warp/examples/core/example_raycast.py +103 -90
  44. warp/examples/core/example_raymarch.py +197 -178
  45. warp/examples/core/example_render_opengl.py +183 -141
  46. warp/examples/core/example_sph.py +403 -387
  47. warp/examples/core/example_torch.py +219 -181
  48. warp/examples/core/example_wave.py +261 -248
  49. warp/examples/fem/bsr_utils.py +378 -380
  50. warp/examples/fem/example_apic_fluid.py +432 -389
  51. warp/examples/fem/example_burgers.py +262 -0
  52. warp/examples/fem/example_convection_diffusion.py +180 -168
  53. warp/examples/fem/example_convection_diffusion_dg.py +217 -209
  54. warp/examples/fem/example_deformed_geometry.py +175 -159
  55. warp/examples/fem/example_diffusion.py +199 -173
  56. warp/examples/fem/example_diffusion_3d.py +178 -152
  57. warp/examples/fem/example_diffusion_mgpu.py +219 -214
  58. warp/examples/fem/example_mixed_elasticity.py +242 -222
  59. warp/examples/fem/example_navier_stokes.py +257 -243
  60. warp/examples/fem/example_stokes.py +218 -192
  61. warp/examples/fem/example_stokes_transfer.py +263 -249
  62. warp/examples/fem/mesh_utils.py +133 -109
  63. warp/examples/fem/plot_utils.py +292 -287
  64. warp/examples/optim/example_bounce.py +258 -246
  65. warp/examples/optim/example_cloth_throw.py +220 -209
  66. warp/examples/optim/example_diffray.py +564 -536
  67. warp/examples/optim/example_drone.py +862 -835
  68. warp/examples/optim/example_inverse_kinematics.py +174 -168
  69. warp/examples/optim/example_inverse_kinematics_torch.py +183 -169
  70. warp/examples/optim/example_spring_cage.py +237 -231
  71. warp/examples/optim/example_trajectory.py +221 -199
  72. warp/examples/optim/example_walker.py +304 -293
  73. warp/examples/sim/example_cartpole.py +137 -129
  74. warp/examples/sim/example_cloth.py +194 -186
  75. warp/examples/sim/example_granular.py +122 -111
  76. warp/examples/sim/example_granular_collision_sdf.py +195 -186
  77. warp/examples/sim/example_jacobian_ik.py +234 -214
  78. warp/examples/sim/example_particle_chain.py +116 -105
  79. warp/examples/sim/example_quadruped.py +191 -180
  80. warp/examples/sim/example_rigid_chain.py +195 -187
  81. warp/examples/sim/example_rigid_contact.py +187 -177
  82. warp/examples/sim/example_rigid_force.py +125 -125
  83. warp/examples/sim/example_rigid_gyroscopic.py +107 -95
  84. warp/examples/sim/example_rigid_soft_contact.py +132 -122
  85. warp/examples/sim/example_soft_body.py +188 -177
  86. warp/fabric.py +337 -335
  87. warp/fem/__init__.py +61 -27
  88. warp/fem/cache.py +403 -388
  89. warp/fem/dirichlet.py +178 -179
  90. warp/fem/domain.py +262 -263
  91. warp/fem/field/__init__.py +100 -101
  92. warp/fem/field/field.py +148 -149
  93. warp/fem/field/nodal_field.py +298 -299
  94. warp/fem/field/restriction.py +22 -21
  95. warp/fem/field/test.py +180 -181
  96. warp/fem/field/trial.py +183 -183
  97. warp/fem/geometry/__init__.py +16 -19
  98. warp/fem/geometry/closest_point.py +69 -70
  99. warp/fem/geometry/deformed_geometry.py +270 -271
  100. warp/fem/geometry/element.py +748 -744
  101. warp/fem/geometry/geometry.py +184 -186
  102. warp/fem/geometry/grid_2d.py +380 -373
  103. warp/fem/geometry/grid_3d.py +437 -435
  104. warp/fem/geometry/hexmesh.py +953 -953
  105. warp/fem/geometry/nanogrid.py +455 -0
  106. warp/fem/geometry/partition.py +374 -376
  107. warp/fem/geometry/quadmesh_2d.py +532 -532
  108. warp/fem/geometry/tetmesh.py +840 -840
  109. warp/fem/geometry/trimesh_2d.py +577 -577
  110. warp/fem/integrate.py +1684 -1615
  111. warp/fem/operator.py +190 -191
  112. warp/fem/polynomial.py +214 -213
  113. warp/fem/quadrature/__init__.py +2 -2
  114. warp/fem/quadrature/pic_quadrature.py +243 -245
  115. warp/fem/quadrature/quadrature.py +295 -294
  116. warp/fem/space/__init__.py +179 -292
  117. warp/fem/space/basis_space.py +522 -489
  118. warp/fem/space/collocated_function_space.py +100 -105
  119. warp/fem/space/dof_mapper.py +236 -236
  120. warp/fem/space/function_space.py +148 -145
  121. warp/fem/space/grid_2d_function_space.py +148 -267
  122. warp/fem/space/grid_3d_function_space.py +167 -306
  123. warp/fem/space/hexmesh_function_space.py +253 -352
  124. warp/fem/space/nanogrid_function_space.py +202 -0
  125. warp/fem/space/partition.py +350 -350
  126. warp/fem/space/quadmesh_2d_function_space.py +261 -369
  127. warp/fem/space/restriction.py +161 -160
  128. warp/fem/space/shape/__init__.py +90 -15
  129. warp/fem/space/shape/cube_shape_function.py +728 -738
  130. warp/fem/space/shape/shape_function.py +102 -103
  131. warp/fem/space/shape/square_shape_function.py +611 -611
  132. warp/fem/space/shape/tet_shape_function.py +565 -567
  133. warp/fem/space/shape/triangle_shape_function.py +429 -429
  134. warp/fem/space/tetmesh_function_space.py +224 -292
  135. warp/fem/space/topology.py +297 -295
  136. warp/fem/space/trimesh_2d_function_space.py +153 -221
  137. warp/fem/types.py +77 -77
  138. warp/fem/utils.py +495 -495
  139. warp/jax.py +166 -141
  140. warp/jax_experimental.py +341 -339
  141. warp/native/array.h +1081 -1025
  142. warp/native/builtin.h +1603 -1560
  143. warp/native/bvh.cpp +402 -398
  144. warp/native/bvh.cu +533 -525
  145. warp/native/bvh.h +430 -429
  146. warp/native/clang/clang.cpp +496 -464
  147. warp/native/crt.cpp +42 -32
  148. warp/native/crt.h +352 -335
  149. warp/native/cuda_crt.h +1049 -1049
  150. warp/native/cuda_util.cpp +549 -540
  151. warp/native/cuda_util.h +288 -203
  152. warp/native/cutlass_gemm.cpp +34 -34
  153. warp/native/cutlass_gemm.cu +372 -372
  154. warp/native/error.cpp +66 -66
  155. warp/native/error.h +27 -27
  156. warp/native/exports.h +187 -0
  157. warp/native/fabric.h +228 -228
  158. warp/native/hashgrid.cpp +301 -278
  159. warp/native/hashgrid.cu +78 -77
  160. warp/native/hashgrid.h +227 -227
  161. warp/native/initializer_array.h +32 -32
  162. warp/native/intersect.h +1204 -1204
  163. warp/native/intersect_adj.h +365 -365
  164. warp/native/intersect_tri.h +322 -322
  165. warp/native/marching.cpp +2 -2
  166. warp/native/marching.cu +497 -497
  167. warp/native/marching.h +2 -2
  168. warp/native/mat.h +1545 -1498
  169. warp/native/matnn.h +333 -333
  170. warp/native/mesh.cpp +203 -203
  171. warp/native/mesh.cu +292 -293
  172. warp/native/mesh.h +1887 -1887
  173. warp/native/nanovdb/GridHandle.h +366 -0
  174. warp/native/nanovdb/HostBuffer.h +590 -0
  175. warp/native/nanovdb/NanoVDB.h +6624 -4782
  176. warp/native/nanovdb/PNanoVDB.h +3390 -2553
  177. warp/native/noise.h +850 -850
  178. warp/native/quat.h +1112 -1085
  179. warp/native/rand.h +303 -299
  180. warp/native/range.h +108 -108
  181. warp/native/reduce.cpp +156 -156
  182. warp/native/reduce.cu +348 -348
  183. warp/native/runlength_encode.cpp +61 -61
  184. warp/native/runlength_encode.cu +46 -46
  185. warp/native/scan.cpp +30 -30
  186. warp/native/scan.cu +36 -36
  187. warp/native/scan.h +7 -7
  188. warp/native/solid_angle.h +442 -442
  189. warp/native/sort.cpp +94 -94
  190. warp/native/sort.cu +97 -97
  191. warp/native/sort.h +14 -14
  192. warp/native/sparse.cpp +337 -337
  193. warp/native/sparse.cu +544 -544
  194. warp/native/spatial.h +630 -630
  195. warp/native/svd.h +562 -562
  196. warp/native/temp_buffer.h +30 -30
  197. warp/native/vec.h +1177 -1133
  198. warp/native/volume.cpp +529 -297
  199. warp/native/volume.cu +58 -32
  200. warp/native/volume.h +960 -538
  201. warp/native/volume_builder.cu +446 -425
  202. warp/native/volume_builder.h +34 -19
  203. warp/native/volume_impl.h +61 -0
  204. warp/native/warp.cpp +1057 -1052
  205. warp/native/warp.cu +2949 -2828
  206. warp/native/warp.h +321 -305
  207. warp/optim/__init__.py +9 -9
  208. warp/optim/adam.py +120 -120
  209. warp/optim/linear.py +1104 -939
  210. warp/optim/sgd.py +104 -92
  211. warp/render/__init__.py +10 -10
  212. warp/render/render_opengl.py +3356 -3204
  213. warp/render/render_usd.py +768 -749
  214. warp/render/utils.py +152 -150
  215. warp/sim/__init__.py +52 -59
  216. warp/sim/articulation.py +685 -685
  217. warp/sim/collide.py +1594 -1590
  218. warp/sim/import_mjcf.py +489 -481
  219. warp/sim/import_snu.py +220 -221
  220. warp/sim/import_urdf.py +536 -516
  221. warp/sim/import_usd.py +887 -881
  222. warp/sim/inertia.py +316 -317
  223. warp/sim/integrator.py +234 -233
  224. warp/sim/integrator_euler.py +1956 -1956
  225. warp/sim/integrator_featherstone.py +1917 -1991
  226. warp/sim/integrator_xpbd.py +3288 -3312
  227. warp/sim/model.py +4473 -4314
  228. warp/sim/particles.py +113 -112
  229. warp/sim/render.py +417 -403
  230. warp/sim/utils.py +413 -410
  231. warp/sparse.py +1289 -1227
  232. warp/stubs.py +2192 -2469
  233. warp/tape.py +1162 -225
  234. warp/tests/__init__.py +1 -1
  235. warp/tests/__main__.py +4 -4
  236. warp/tests/assets/test_index_grid.nvdb +0 -0
  237. warp/tests/assets/torus.usda +105 -105
  238. warp/tests/aux_test_class_kernel.py +26 -26
  239. warp/tests/aux_test_compile_consts_dummy.py +10 -10
  240. warp/tests/aux_test_conditional_unequal_types_kernels.py +21 -21
  241. warp/tests/aux_test_dependent.py +20 -22
  242. warp/tests/aux_test_grad_customs.py +21 -23
  243. warp/tests/aux_test_reference.py +9 -11
  244. warp/tests/aux_test_reference_reference.py +8 -10
  245. warp/tests/aux_test_square.py +15 -17
  246. warp/tests/aux_test_unresolved_func.py +14 -14
  247. warp/tests/aux_test_unresolved_symbol.py +14 -14
  248. warp/tests/disabled_kinematics.py +237 -239
  249. warp/tests/run_coverage_serial.py +31 -31
  250. warp/tests/test_adam.py +155 -157
  251. warp/tests/test_arithmetic.py +1088 -1124
  252. warp/tests/test_array.py +2415 -2326
  253. warp/tests/test_array_reduce.py +148 -150
  254. warp/tests/test_async.py +666 -656
  255. warp/tests/test_atomic.py +139 -141
  256. warp/tests/test_bool.py +212 -149
  257. warp/tests/test_builtins_resolution.py +1290 -1292
  258. warp/tests/test_bvh.py +162 -171
  259. warp/tests/test_closest_point_edge_edge.py +227 -228
  260. warp/tests/test_codegen.py +562 -553
  261. warp/tests/test_compile_consts.py +217 -101
  262. warp/tests/test_conditional.py +244 -246
  263. warp/tests/test_copy.py +230 -215
  264. warp/tests/test_ctypes.py +630 -632
  265. warp/tests/test_dense.py +65 -67
  266. warp/tests/test_devices.py +89 -98
  267. warp/tests/test_dlpack.py +528 -529
  268. warp/tests/test_examples.py +403 -378
  269. warp/tests/test_fabricarray.py +952 -955
  270. warp/tests/test_fast_math.py +60 -54
  271. warp/tests/test_fem.py +1298 -1278
  272. warp/tests/test_fp16.py +128 -130
  273. warp/tests/test_func.py +336 -337
  274. warp/tests/test_generics.py +596 -571
  275. warp/tests/test_grad.py +885 -640
  276. warp/tests/test_grad_customs.py +331 -336
  277. warp/tests/test_hash_grid.py +208 -164
  278. warp/tests/test_import.py +37 -39
  279. warp/tests/test_indexedarray.py +1132 -1134
  280. warp/tests/test_intersect.py +65 -67
  281. warp/tests/test_jax.py +305 -307
  282. warp/tests/test_large.py +169 -164
  283. warp/tests/test_launch.py +352 -354
  284. warp/tests/test_lerp.py +217 -261
  285. warp/tests/test_linear_solvers.py +189 -171
  286. warp/tests/test_lvalue.py +419 -493
  287. warp/tests/test_marching_cubes.py +63 -65
  288. warp/tests/test_mat.py +1799 -1827
  289. warp/tests/test_mat_lite.py +113 -115
  290. warp/tests/test_mat_scalar_ops.py +2905 -2889
  291. warp/tests/test_math.py +124 -193
  292. warp/tests/test_matmul.py +498 -499
  293. warp/tests/test_matmul_lite.py +408 -410
  294. warp/tests/test_mempool.py +186 -190
  295. warp/tests/test_mesh.py +281 -324
  296. warp/tests/test_mesh_query_aabb.py +226 -241
  297. warp/tests/test_mesh_query_point.py +690 -702
  298. warp/tests/test_mesh_query_ray.py +290 -303
  299. warp/tests/test_mlp.py +274 -276
  300. warp/tests/test_model.py +108 -110
  301. warp/tests/test_module_hashing.py +111 -0
  302. warp/tests/test_modules_lite.py +36 -39
  303. warp/tests/test_multigpu.py +161 -163
  304. warp/tests/test_noise.py +244 -248
  305. warp/tests/test_operators.py +248 -250
  306. warp/tests/test_options.py +121 -125
  307. warp/tests/test_peer.py +131 -137
  308. warp/tests/test_pinned.py +76 -78
  309. warp/tests/test_print.py +52 -54
  310. warp/tests/test_quat.py +2084 -2086
  311. warp/tests/test_rand.py +324 -288
  312. warp/tests/test_reload.py +207 -217
  313. warp/tests/test_rounding.py +177 -179
  314. warp/tests/test_runlength_encode.py +188 -190
  315. warp/tests/test_sim_grad.py +241 -0
  316. warp/tests/test_sim_kinematics.py +89 -97
  317. warp/tests/test_smoothstep.py +166 -168
  318. warp/tests/test_snippet.py +303 -266
  319. warp/tests/test_sparse.py +466 -460
  320. warp/tests/test_spatial.py +2146 -2148
  321. warp/tests/test_special_values.py +362 -0
  322. warp/tests/test_streams.py +484 -473
  323. warp/tests/test_struct.py +708 -675
  324. warp/tests/test_tape.py +171 -148
  325. warp/tests/test_torch.py +741 -743
  326. warp/tests/test_transient_module.py +85 -87
  327. warp/tests/test_types.py +554 -659
  328. warp/tests/test_utils.py +488 -499
  329. warp/tests/test_vec.py +1262 -1268
  330. warp/tests/test_vec_lite.py +71 -73
  331. warp/tests/test_vec_scalar_ops.py +2097 -2099
  332. warp/tests/test_verify_fp.py +92 -94
  333. warp/tests/test_volume.py +961 -736
  334. warp/tests/test_volume_write.py +338 -265
  335. warp/tests/unittest_serial.py +38 -37
  336. warp/tests/unittest_suites.py +367 -359
  337. warp/tests/unittest_utils.py +434 -578
  338. warp/tests/unused_test_misc.py +69 -71
  339. warp/tests/walkthrough_debug.py +85 -85
  340. warp/thirdparty/appdirs.py +598 -598
  341. warp/thirdparty/dlpack.py +143 -143
  342. warp/thirdparty/unittest_parallel.py +563 -561
  343. warp/torch.py +321 -295
  344. warp/types.py +4941 -4450
  345. warp/utils.py +1008 -821
  346. {warp_lang-1.0.2.dist-info → warp_lang-1.2.0.dist-info}/LICENSE.md +126 -126
  347. {warp_lang-1.0.2.dist-info → warp_lang-1.2.0.dist-info}/METADATA +365 -400
  348. warp_lang-1.2.0.dist-info/RECORD +359 -0
  349. warp/examples/assets/cube.usda +0 -42
  350. warp/examples/assets/sphere.usda +0 -56
  351. warp/examples/assets/torus.usda +0 -105
  352. warp/examples/fem/example_convection_diffusion_dg0.py +0 -194
  353. warp/native/nanovdb/PNanoVDBWrite.h +0 -295
  354. warp_lang-1.0.2.dist-info/RECORD +0 -352
  355. {warp_lang-1.0.2.dist-info → warp_lang-1.2.0.dist-info}/WHEEL +0 -0
  356. {warp_lang-1.0.2.dist-info → warp_lang-1.2.0.dist-info}/top_level.txt +0 -0
warp/stubs.py CHANGED
@@ -1,2469 +1,2192 @@
1
- # Autogenerated file, do not edit, this file provides stubs for builtins autocomplete in VSCode, PyCharm, etc
2
-
3
- from typing import Any
4
- from typing import Tuple
5
- from typing import Callable
6
- from typing import TypeVar
7
- from typing import Generic
8
- from typing import overload as over
9
-
10
- Length = TypeVar("Length", bound=int)
11
- Rows = TypeVar("Rows", bound=int)
12
- Cols = TypeVar("Cols", bound=int)
13
- DType = TypeVar("DType")
14
- Int = TypeVar("Int")
15
- Float = TypeVar("Float")
16
- Scalar = TypeVar("Scalar")
17
- Vector = Generic[Length, Scalar]
18
- Matrix = Generic[Rows, Cols, Scalar]
19
- Quaternion = Generic[Float]
20
- Transformation = Generic[Float]
21
- Array = Generic[DType]
22
- FabricArray = Generic[DType]
23
- IndexedFabricArray = Generic[DType]
24
-
25
-
26
- from warp.types import array, array1d, array2d, array3d, array4d, constant
27
- from warp.types import indexedarray, indexedarray1d, indexedarray2d, indexedarray3d, indexedarray4d
28
- from warp.fabric import fabricarray, fabricarrayarray, indexedfabricarray, indexedfabricarrayarray
29
-
30
- from warp.types import bool, int8, uint8, int16, uint16, int32, uint32, int64, uint64, float16, float32, float64
31
- from warp.types import vec2, vec2b, vec2ub, vec2s, vec2us, vec2i, vec2ui, vec2l, vec2ul, vec2h, vec2f, vec2d
32
- from warp.types import vec3, vec3b, vec3ub, vec3s, vec3us, vec3i, vec3ui, vec3l, vec3ul, vec3h, vec3f, vec3d
33
- from warp.types import vec4, vec4b, vec4ub, vec4s, vec4us, vec4i, vec4ui, vec4l, vec4ul, vec4h, vec4f, vec4d
34
- from warp.types import mat22, mat22h, mat22f, mat22d
35
- from warp.types import mat33, mat33h, mat33f, mat33d
36
- from warp.types import mat44, mat44h, mat44f, mat44d
37
- from warp.types import quat, quath, quatf, quatd
38
- from warp.types import transform, transformh, transformf, transformd
39
- from warp.types import spatial_vector, spatial_vectorh, spatial_vectorf, spatial_vectord
40
- from warp.types import spatial_matrix, spatial_matrixh, spatial_matrixf, spatial_matrixd
41
-
42
- from warp.types import Bvh, Mesh, HashGrid, Volume, MarchingCubes
43
- from warp.types import bvh_query_t, hash_grid_query_t, mesh_query_aabb_t, mesh_query_point_t, mesh_query_ray_t
44
-
45
- from warp.types import matmul, adj_matmul, batched_matmul, adj_batched_matmul, from_ptr
46
-
47
- from warp.types import vector as vec
48
- from warp.types import matrix as mat
49
-
50
- from warp.types import dtype_from_numpy, dtype_to_numpy
51
-
52
- from warp.context import init, func, func_grad, func_replay, func_native, kernel, struct, overload
53
- from warp.context import is_cpu_available, is_cuda_available, is_device_available
54
- from warp.context import get_devices, get_preferred_device
55
- from warp.context import get_cuda_devices, get_cuda_device_count, get_cuda_device, map_cuda_device, unmap_cuda_device
56
- from warp.context import get_device, set_device, synchronize_device
57
- from warp.context import (
58
- zeros,
59
- zeros_like,
60
- ones,
61
- ones_like,
62
- full,
63
- full_like,
64
- clone,
65
- empty,
66
- empty_like,
67
- copy,
68
- from_numpy,
69
- launch,
70
- synchronize,
71
- force_load,
72
- load_module,
73
- )
74
- from warp.context import set_module_options, get_module_options, get_module
75
- from warp.context import capture_begin, capture_end, capture_launch
76
- from warp.context import Kernel, Function, Launch
77
- from warp.context import Stream, get_stream, set_stream, wait_stream, synchronize_stream
78
- from warp.context import Event, record_event, wait_event, synchronize_event
79
- from warp.context import RegisteredGLBuffer
80
- from warp.context import is_mempool_supported, is_mempool_enabled, set_mempool_enabled
81
- from warp.context import set_mempool_release_threshold, get_mempool_release_threshold
82
- from warp.context import is_mempool_access_supported, is_mempool_access_enabled, set_mempool_access_enabled
83
- from warp.context import is_peer_access_supported, is_peer_access_enabled, set_peer_access_enabled
84
-
85
- from warp.tape import Tape
86
- from warp.utils import ScopedTimer, ScopedDevice, ScopedStream
87
- from warp.utils import ScopedMempool, ScopedMempoolAccess, ScopedPeerAccess
88
- from warp.utils import ScopedCapture
89
- from warp.utils import transform_expand, quat_between_vectors
90
-
91
- from warp.torch import from_torch, to_torch
92
- from warp.torch import dtype_from_torch, dtype_to_torch
93
- from warp.torch import device_from_torch, device_to_torch
94
- from warp.torch import stream_from_torch, stream_to_torch
95
-
96
- from warp.jax import from_jax, to_jax
97
- from warp.jax import dtype_from_jax, dtype_to_jax
98
- from warp.jax import device_from_jax, device_to_jax
99
-
100
- from warp.dlpack import from_dlpack, to_dlpack
101
-
102
- from warp.constants import *
103
-
104
- from . import builtins
105
-
106
- import warp.config
107
-
108
- __version__ = warp.config.version
109
-
110
-
111
- @over
112
- def min(x: Scalar, y: Scalar) -> Scalar:
113
- """
114
- Return the minimum of two scalars.
115
- """
116
- ...
117
-
118
-
119
- @over
120
- def min(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
121
- """
122
- Return the element-wise minimum of two vectors.
123
- """
124
- ...
125
-
126
-
127
- @over
128
- def min(v: Vector[Any, Scalar]) -> Scalar:
129
- """
130
- Return the minimum element of a vector ``v``.
131
- """
132
- ...
133
-
134
-
135
- @over
136
- def max(x: Scalar, y: Scalar) -> Scalar:
137
- """
138
- Return the maximum of two scalars.
139
- """
140
- ...
141
-
142
-
143
- @over
144
- def max(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
145
- """
146
- Return the element-wise maximum of two vectors.
147
- """
148
- ...
149
-
150
-
151
- @over
152
- def max(v: Vector[Any, Scalar]) -> Scalar:
153
- """
154
- Return the maximum element of a vector ``v``.
155
- """
156
- ...
157
-
158
-
159
- @over
160
- def clamp(x: Scalar, a: Scalar, b: Scalar) -> Scalar:
161
- """
162
- Clamp the value of ``x`` to the range [a, b].
163
- """
164
- ...
165
-
166
-
167
- @over
168
- def abs(x: Scalar) -> Scalar:
169
- """
170
- Return the absolute value of ``x``.
171
- """
172
- ...
173
-
174
-
175
- @over
176
- def sign(x: Scalar) -> Scalar:
177
- """
178
- Return -1 if ``x`` < 0, return 1 otherwise.
179
- """
180
- ...
181
-
182
-
183
- @over
184
- def step(x: Scalar) -> Scalar:
185
- """
186
- Return 1.0 if ``x`` < 0.0, return 0.0 otherwise.
187
- """
188
- ...
189
-
190
-
191
- @over
192
- def nonzero(x: Scalar) -> Scalar:
193
- """
194
- Return 1.0 if ``x`` is not equal to zero, return 0.0 otherwise.
195
- """
196
- ...
197
-
198
-
199
- @over
200
- def sin(x: Float) -> Float:
201
- """
202
- Return the sine of ``x`` in radians.
203
- """
204
- ...
205
-
206
-
207
- @over
208
- def cos(x: Float) -> Float:
209
- """
210
- Return the cosine of ``x`` in radians.
211
- """
212
- ...
213
-
214
-
215
- @over
216
- def acos(x: Float) -> Float:
217
- """
218
- Return arccos of ``x`` in radians. Inputs are automatically clamped to [-1.0, 1.0].
219
- """
220
- ...
221
-
222
-
223
- @over
224
- def asin(x: Float) -> Float:
225
- """
226
- Return arcsin of ``x`` in radians. Inputs are automatically clamped to [-1.0, 1.0].
227
- """
228
- ...
229
-
230
-
231
- @over
232
- def sqrt(x: Float) -> Float:
233
- """
234
- Return the square root of ``x``, where ``x`` is positive.
235
- """
236
- ...
237
-
238
-
239
- @over
240
- def cbrt(x: Float) -> Float:
241
- """
242
- Return the cube root of ``x``.
243
- """
244
- ...
245
-
246
-
247
- @over
248
- def tan(x: Float) -> Float:
249
- """
250
- Return the tangent of ``x`` in radians.
251
- """
252
- ...
253
-
254
-
255
- @over
256
- def atan(x: Float) -> Float:
257
- """
258
- Return the arctangent of ``x`` in radians.
259
- """
260
- ...
261
-
262
-
263
- @over
264
- def atan2(y: Float, x: Float) -> Float:
265
- """
266
- Return the 2-argument arctangent, atan2, of the point ``(x, y)`` in radians.
267
- """
268
- ...
269
-
270
-
271
- @over
272
- def sinh(x: Float) -> Float:
273
- """
274
- Return the sinh of ``x``.
275
- """
276
- ...
277
-
278
-
279
- @over
280
- def cosh(x: Float) -> Float:
281
- """
282
- Return the cosh of ``x``.
283
- """
284
- ...
285
-
286
-
287
- @over
288
- def tanh(x: Float) -> Float:
289
- """
290
- Return the tanh of ``x``.
291
- """
292
- ...
293
-
294
-
295
- @over
296
- def degrees(x: Float) -> Float:
297
- """
298
- Convert ``x`` from radians into degrees.
299
- """
300
- ...
301
-
302
-
303
- @over
304
- def radians(x: Float) -> Float:
305
- """
306
- Convert ``x`` from degrees into radians.
307
- """
308
- ...
309
-
310
-
311
- @over
312
- def log(x: Float) -> Float:
313
- """
314
- Return the natural logarithm (base-e) of ``x``, where ``x`` is positive.
315
- """
316
- ...
317
-
318
-
319
- @over
320
- def log2(x: Float) -> Float:
321
- """
322
- Return the binary logarithm (base-2) of ``x``, where ``x`` is positive.
323
- """
324
- ...
325
-
326
-
327
- @over
328
- def log10(x: Float) -> Float:
329
- """
330
- Return the common logarithm (base-10) of ``x``, where ``x`` is positive.
331
- """
332
- ...
333
-
334
-
335
- @over
336
- def exp(x: Float) -> Float:
337
- """
338
- Return the value of the exponential function :math:`e^x`.
339
- """
340
- ...
341
-
342
-
343
- @over
344
- def pow(x: Float, y: Float) -> Float:
345
- """
346
- Return the result of ``x`` raised to power of ``y``.
347
- """
348
- ...
349
-
350
-
351
- @over
352
- def round(x: Float) -> Float:
353
- """
354
- Return the nearest integer value to ``x``, rounding halfway cases away from zero.
355
- This is the most intuitive form of rounding in the colloquial sense, but can be slower than other options like :func:`warp.rint()`.
356
- Differs from :func:`numpy.round()`, which behaves the same way as :func:`numpy.rint()`.
357
- """
358
- ...
359
-
360
-
361
- @over
362
- def rint(x: Float) -> Float:
363
- """
364
- Return the nearest integer value to ``x``, rounding halfway cases to nearest even integer.
365
- It is generally faster than :func:`warp.round()`. Equivalent to :func:`numpy.rint()`.
366
- """
367
- ...
368
-
369
-
370
- @over
371
- def trunc(x: Float) -> Float:
372
- """
373
- Return the nearest integer that is closer to zero than ``x``.
374
- In other words, it discards the fractional part of ``x``.
375
- It is similar to casting ``float(int(x))``, but preserves the negative sign when x is in the range [-0.0, -1.0).
376
- Equivalent to :func:`numpy.trunc()` and :func:`numpy.fix()`.
377
- """
378
- ...
379
-
380
-
381
- @over
382
- def floor(x: Float) -> Float:
383
- """
384
- Return the largest integer that is less than or equal to ``x``.
385
- """
386
- ...
387
-
388
-
389
- @over
390
- def ceil(x: Float) -> Float:
391
- """
392
- Return the smallest integer that is greater than or equal to ``x``.
393
- """
394
- ...
395
-
396
-
397
- @over
398
- def frac(x: Float) -> Float:
399
- """
400
- Retrieve the fractional part of x.
401
- In other words, it discards the integer part of x and is equivalent to ``x - trunc(x)``.
402
- """
403
- ...
404
-
405
-
406
- @over
407
- def dot(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Scalar:
408
- """
409
- Compute the dot product between two vectors.
410
- """
411
- ...
412
-
413
-
414
- @over
415
- def dot(x: Quaternion[Float], y: Quaternion[Float]) -> Scalar:
416
- """
417
- Compute the dot product between two quaternions.
418
- """
419
- ...
420
-
421
-
422
- @over
423
- def ddot(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Scalar:
424
- """
425
- Compute the double dot product between two matrices.
426
- """
427
- ...
428
-
429
-
430
- @over
431
- def argmin(v: Vector[Any, Scalar]) -> uint32:
432
- """
433
- Return the index of the minimum element of a vector ``v``.
434
- """
435
- ...
436
-
437
-
438
- @over
439
- def argmax(v: Vector[Any, Scalar]) -> uint32:
440
- """
441
- Return the index of the maximum element of a vector ``v``.
442
- """
443
- ...
444
-
445
-
446
- @over
447
- def outer(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Matrix[Any, Any, Scalar]:
448
- """
449
- Compute the outer product ``x*y^T`` for two vectors.
450
- """
451
- ...
452
-
453
-
454
- @over
455
- def cross(x: Vector[3, Scalar], y: Vector[3, Scalar]) -> Vector[3, Scalar]:
456
- """
457
- Compute the cross product of two 3D vectors.
458
- """
459
- ...
460
-
461
-
462
- @over
463
- def skew(x: Vector[3, Scalar]):
464
- """
465
- Compute the skew-symmetric 3x3 matrix for a 3D vector ``x``.
466
- """
467
- ...
468
-
469
-
470
- @over
471
- def length(x: Vector[Any, Float]) -> Scalar:
472
- """
473
- Compute the length of a vector ``x``.
474
- """
475
- ...
476
-
477
-
478
- @over
479
- def length(x: Quaternion[Float]) -> Scalar:
480
- """
481
- Compute the length of a quaternion ``x``.
482
- """
483
- ...
484
-
485
-
486
- @over
487
- def length_sq(x: Vector[Any, Scalar]) -> Scalar:
488
- """
489
- Compute the squared length of a 2D vector ``x``.
490
- """
491
- ...
492
-
493
-
494
- @over
495
- def length_sq(x: Quaternion[Scalar]) -> Scalar:
496
- """
497
- Compute the squared length of a quaternion ``x``.
498
- """
499
- ...
500
-
501
-
502
- @over
503
- def normalize(x: Vector[Any, Float]) -> Vector[Any, Scalar]:
504
- """
505
- Compute the normalized value of ``x``. If ``length(x)`` is 0 then the zero vector is returned.
506
- """
507
- ...
508
-
509
-
510
- @over
511
- def normalize(x: Quaternion[Float]) -> Quaternion[Scalar]:
512
- """
513
- Compute the normalized value of ``x``. If ``length(x)`` is 0, then the zero quaternion is returned.
514
- """
515
- ...
516
-
517
-
518
- @over
519
- def transpose(m: Matrix[Any, Any, Scalar]):
520
- """
521
- Return the transpose of the matrix ``m``.
522
- """
523
- ...
524
-
525
-
526
- @over
527
- def inverse(m: Matrix[2, 2, Float]) -> Matrix[Any, Any, Float]:
528
- """
529
- Return the inverse of a 2x2 matrix ``m``.
530
- """
531
- ...
532
-
533
-
534
- @over
535
- def inverse(m: Matrix[3, 3, Float]) -> Matrix[Any, Any, Float]:
536
- """
537
- Return the inverse of a 3x3 matrix ``m``.
538
- """
539
- ...
540
-
541
-
542
- @over
543
- def inverse(m: Matrix[4, 4, Float]) -> Matrix[Any, Any, Float]:
544
- """
545
- Return the inverse of a 4x4 matrix ``m``.
546
- """
547
- ...
548
-
549
-
550
- @over
551
- def determinant(m: Matrix[2, 2, Float]) -> Scalar:
552
- """
553
- Return the determinant of a 2x2 matrix ``m``.
554
- """
555
- ...
556
-
557
-
558
- @over
559
- def determinant(m: Matrix[3, 3, Float]) -> Scalar:
560
- """
561
- Return the determinant of a 3x3 matrix ``m``.
562
- """
563
- ...
564
-
565
-
566
- @over
567
- def determinant(m: Matrix[4, 4, Float]) -> Scalar:
568
- """
569
- Return the determinant of a 4x4 matrix ``m``.
570
- """
571
- ...
572
-
573
-
574
- @over
575
- def trace(m: Matrix[Any, Any, Scalar]) -> Scalar:
576
- """
577
- Return the trace of the matrix ``m``.
578
- """
579
- ...
580
-
581
-
582
- @over
583
- def diag(d: Vector[Any, Scalar]) -> Matrix[Any, Any, Scalar]:
584
- """
585
- Returns a matrix with the components of the vector ``d`` on the diagonal.
586
- """
587
- ...
588
-
589
-
590
- @over
591
- def get_diag(m: Matrix[Any, Any, Scalar]) -> Vector[Any, Scalar]:
592
- """
593
- Returns a vector containing the diagonal elements of the square matrix ``m``.
594
- """
595
- ...
596
-
597
-
598
- @over
599
- def cw_mul(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
600
- """
601
- Component-wise multiplication of two 2D vectors.
602
- """
603
- ...
604
-
605
-
606
- @over
607
- def cw_mul(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
608
- """
609
- Component-wise multiplication of two 2D vectors.
610
- """
611
- ...
612
-
613
-
614
- @over
615
- def cw_div(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
616
- """
617
- Component-wise division of two 2D vectors.
618
- """
619
- ...
620
-
621
-
622
- @over
623
- def cw_div(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
624
- """
625
- Component-wise division of two 2D vectors.
626
- """
627
- ...
628
-
629
-
630
- @over
631
- def quat_identity() -> quatf:
632
- """
633
- Construct an identity quaternion with zero imaginary part and real part of 1.0
634
- """
635
- ...
636
-
637
-
638
- @over
639
- def quat_from_axis_angle(axis: Vector[3, Float], angle: Float) -> Quaternion[Scalar]:
640
- """
641
- Construct a quaternion representing a rotation of angle radians around the given axis.
642
- """
643
- ...
644
-
645
-
646
- @over
647
- def quat_to_axis_angle(q: Quaternion[Float], axis: Vector[3, Float], angle: Float):
648
- """
649
- Extract the rotation axis and angle radians a quaternion represents.
650
- """
651
- ...
652
-
653
-
654
- @over
655
- def quat_from_matrix(m: Matrix[3, 3, Float]) -> Quaternion[Scalar]:
656
- """
657
- Construct a quaternion from a 3x3 matrix.
658
- """
659
- ...
660
-
661
-
662
- @over
663
- def quat_rpy(roll: Float, pitch: Float, yaw: Float) -> Quaternion[Scalar]:
664
- """
665
- Construct a quaternion representing a combined roll (z), pitch (x), yaw rotations (y) in radians.
666
- """
667
- ...
668
-
669
-
670
- @over
671
- def quat_inverse(q: Quaternion[Float]) -> Quaternion[Scalar]:
672
- """
673
- Compute quaternion conjugate.
674
- """
675
- ...
676
-
677
-
678
- @over
679
- def quat_rotate(q: Quaternion[Float], p: Vector[3, Float]) -> Vector[3, Scalar]:
680
- """
681
- Rotate a vector by a quaternion.
682
- """
683
- ...
684
-
685
-
686
- @over
687
- def quat_rotate_inv(q: Quaternion[Float], p: Vector[3, Float]) -> Vector[3, Scalar]:
688
- """
689
- Rotate a vector by the inverse of a quaternion.
690
- """
691
- ...
692
-
693
-
694
- @over
695
- def quat_slerp(q0: Quaternion[Float], q1: Quaternion[Float], t: Float) -> Quaternion[Scalar]:
696
- """
697
- Linearly interpolate between two quaternions.
698
- """
699
- ...
700
-
701
-
702
- @over
703
- def quat_to_matrix(q: Quaternion[Float]) -> Matrix[3, 3, Scalar]:
704
- """
705
- Convert a quaternion to a 3x3 rotation matrix.
706
- """
707
- ...
708
-
709
-
710
- @over
711
- def transform_identity() -> transformf:
712
- """
713
- Construct an identity transform with zero translation and identity rotation.
714
- """
715
- ...
716
-
717
-
718
- @over
719
- def transform_get_translation(t: Transformation[Float]) -> Vector[3, Scalar]:
720
- """
721
- Return the translational part of a transform ``t``.
722
- """
723
- ...
724
-
725
-
726
- @over
727
- def transform_get_rotation(t: Transformation[Float]) -> Quaternion[Scalar]:
728
- """
729
- Return the rotational part of a transform ``t``.
730
- """
731
- ...
732
-
733
-
734
- @over
735
- def transform_multiply(a: Transformation[Float], b: Transformation[Float]) -> Transformation[Scalar]:
736
- """
737
- Multiply two rigid body transformations together.
738
- """
739
- ...
740
-
741
-
742
- @over
743
- def transform_point(t: Transformation[Scalar], p: Vector[3, Scalar]) -> Vector[3, Scalar]:
744
- """
745
- Apply the transform to a point ``p`` treating the homogeneous coordinate as w=1 (translation and rotation).
746
- """
747
- ...
748
-
749
-
750
- @over
751
- def transform_point(m: Matrix[4, 4, Scalar], p: Vector[3, Scalar]) -> Vector[3, Scalar]:
752
- """
753
- Apply the transform to a point ``p`` treating the homogeneous coordinate as w=1.
754
- The transformation is applied treating ``p`` as a column vector, e.g.: ``y = M*p``.
755
- Note this is in contrast to some libraries, notably USD, which applies transforms to row vectors, ``y^T = p^T*M^T``.
756
- If the transform is coming from a library that uses row-vectors, then users should transpose the transformation
757
- matrix before calling this method.
758
- """
759
- ...
760
-
761
-
762
- @over
763
- def transform_vector(t: Transformation[Scalar], v: Vector[3, Scalar]) -> Vector[3, Scalar]:
764
- """
765
- Apply the transform to a vector ``v`` treating the homogeneous coordinate as w=0 (rotation only).
766
- """
767
- ...
768
-
769
-
770
- @over
771
- def transform_vector(m: Matrix[4, 4, Scalar], v: Vector[3, Scalar]) -> Vector[3, Scalar]:
772
- """
773
- Apply the transform to a vector ``v`` treating the homogeneous coordinate as w=0.
774
- The transformation is applied treating ``v`` as a column vector, e.g.: ``y = M*v``
775
- note this is in contrast to some libraries, notably USD, which applies transforms to row vectors, ``y^T = v^T*M^T``.
776
- If the transform is coming from a library that uses row-vectors, then users should transpose the transformation
777
- matrix before calling this method.
778
- """
779
- ...
780
-
781
-
782
- @over
783
- def transform_inverse(t: Transformation[Float]) -> Transformation[Float]:
784
- """
785
- Compute the inverse of the transformation ``t``.
786
- """
787
- ...
788
-
789
-
790
- @over
791
- def spatial_dot(a: Vector[6, Float], b: Vector[6, Float]) -> Scalar:
792
- """
793
- Compute the dot product of two 6D screw vectors.
794
- """
795
- ...
796
-
797
-
798
- @over
799
- def spatial_cross(a: Vector[6, Float], b: Vector[6, Float]) -> Vector[6, Float]:
800
- """
801
- Compute the cross product of two 6D screw vectors.
802
- """
803
- ...
804
-
805
-
806
- @over
807
- def spatial_cross_dual(a: Vector[6, Float], b: Vector[6, Float]) -> Vector[6, Float]:
808
- """
809
- Compute the dual cross product of two 6D screw vectors.
810
- """
811
- ...
812
-
813
-
814
- @over
815
- def spatial_top(a: Vector[6, Float]):
816
- """
817
- Return the top (first) part of a 6D screw vector.
818
- """
819
- ...
820
-
821
-
822
- @over
823
- def spatial_bottom(a: Vector[6, Float]):
824
- """
825
- Return the bottom (second) part of a 6D screw vector.
826
- """
827
- ...
828
-
829
-
830
- @over
831
- def spatial_jacobian(
832
- S: Array[Vector[6, Float]],
833
- joint_parents: Array[int32],
834
- joint_qd_start: Array[int32],
835
- joint_start: int32,
836
- joint_count: int32,
837
- J_start: int32,
838
- J_out: Array[Float],
839
- ):
840
- """ """
841
- ...
842
-
843
-
844
- @over
845
- def spatial_mass(
846
- I_s: Array[Matrix[6, 6, Float]], joint_start: int32, joint_count: int32, M_start: int32, M: Array[Float]
847
- ):
848
- """ """
849
- ...
850
-
851
-
852
- @over
853
- def mlp(
854
- weights: Array[float32],
855
- bias: Array[float32],
856
- activation: Callable,
857
- index: int32,
858
- x: Array[float32],
859
- out: Array[float32],
860
- ):
861
- """
862
- Evaluate a multi-layer perceptron (MLP) layer in the form: ``out = act(weights*x + bias)``.
863
-
864
- :param weights: A layer's network weights with dimensions ``(m, n)``.
865
- :param bias: An array with dimensions ``(n)``.
866
- :param activation: A ``wp.func`` function that takes a single scalar float as input and returns a scalar float as output
867
- :param index: The batch item to process, typically each thread will process one item in the batch, in which case
868
- index should be ``wp.tid()``
869
- :param x: The feature matrix with dimensions ``(n, b)``
870
- :param out: The network output with dimensions ``(m, b)``
871
-
872
- :note: Feature and output matrices are transposed compared to some other frameworks such as PyTorch.
873
- All matrices are assumed to be stored in flattened row-major memory layout (NumPy default).
874
- """
875
- ...
876
-
877
-
878
- @over
879
- def bvh_query_aabb(id: uint64, lower: vec3f, upper: vec3f) -> bvh_query_t:
880
- """
881
- Construct an axis-aligned bounding box query against a BVH object. This query can be used to iterate over all bounds
882
- inside a BVH.
883
-
884
- :param id: The BVH identifier
885
- :param lower: The lower bound of the bounding box in BVH space
886
- :param upper: The upper bound of the bounding box in BVH space
887
- """
888
- ...
889
-
890
-
891
- @over
892
- def bvh_query_ray(id: uint64, start: vec3f, dir: vec3f) -> bvh_query_t:
893
- """
894
- Construct a ray query against a BVH object. This query can be used to iterate over all bounds
895
- that intersect the ray.
896
-
897
- :param id: The BVH identifier
898
- :param start: The start of the ray in BVH space
899
- :param dir: The direction of the ray in BVH space
900
- """
901
- ...
902
-
903
-
904
- @over
905
- def bvh_query_next(query: bvh_query_t, index: int32) -> bool:
906
- """
907
- Move to the next bound returned by the query.
908
- The index of the current bound is stored in ``index``, returns ``False`` if there are no more overlapping bound.
909
- """
910
- ...
911
-
912
-
913
- @over
914
- def mesh_query_point(id: uint64, point: vec3f, max_dist: float32) -> mesh_query_point_t:
915
- """
916
- Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
917
-
918
- Identifies the sign of the distance using additional ray-casts to determine if the point is inside or outside.
919
- This method is relatively robust, but does increase computational cost.
920
- See below for additional sign determination methods.
921
-
922
- :param id: The mesh identifier
923
- :param point: The point in space to query
924
- :param max_dist: Mesh faces above this distance will not be considered by the query
925
- """
926
- ...
927
-
928
-
929
- @over
930
- def mesh_query_point_no_sign(id: uint64, point: vec3f, max_dist: float32) -> mesh_query_point_t:
931
- """
932
- Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
933
-
934
- This method does not compute the sign of the point (inside/outside) which makes it faster than other point query methods.
935
-
936
- :param id: The mesh identifier
937
- :param point: The point in space to query
938
- :param max_dist: Mesh faces above this distance will not be considered by the query
939
- """
940
- ...
941
-
942
-
943
- @over
944
- def mesh_query_furthest_point_no_sign(id: uint64, point: vec3f, min_dist: float32) -> mesh_query_point_t:
945
- """
946
- Computes the furthest point on the mesh with identifier `id` to the given point in space.
947
-
948
- This method does not compute the sign of the point (inside/outside).
949
-
950
- :param id: The mesh identifier
951
- :param point: The point in space to query
952
- :param min_dist: Mesh faces below this distance will not be considered by the query
953
- """
954
- ...
955
-
956
-
957
- @over
958
- def mesh_query_point_sign_normal(id: uint64, point: vec3f, max_dist: float32, epsilon: float32) -> mesh_query_point_t:
959
- """
960
- Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
961
-
962
- Identifies the sign of the distance (inside/outside) using the angle-weighted pseudo normal.
963
- This approach to sign determination is robust for well conditioned meshes that are watertight and non-self intersecting.
964
- It is also comparatively fast to compute.
965
-
966
- :param id: The mesh identifier
967
- :param point: The point in space to query
968
- :param max_dist: Mesh faces above this distance will not be considered by the query
969
- :param epsilon: Epsilon treating distance values as equal, when locating the minimum distance vertex/face/edge, as a
970
- fraction of the average edge length, also for treating closest point as being on edge/vertex default 1e-3
971
- """
972
- ...
973
-
974
-
975
- @over
976
- def mesh_query_point_sign_winding_number(
977
- id: uint64, point: vec3f, max_dist: float32, accuracy: float32, threshold: float32
978
- ) -> mesh_query_point_t:
979
- """
980
- Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given point in space.
981
-
982
- Identifies the sign using the winding number of the mesh relative to the query point. This method of sign determination is robust for poorly conditioned meshes
983
- and provides a smooth approximation to sign even when the mesh is not watertight. This method is the most robust and accurate of the sign determination meshes
984
- but also the most expensive.
985
-
986
- .. note:: The :class:`Mesh` object must be constructed with ``support_winding_number=True`` for this method to return correct results.
987
-
988
- :param id: The mesh identifier
989
- :param point: The point in space to query
990
- :param max_dist: Mesh faces above this distance will not be considered by the query
991
- :param accuracy: Accuracy for computing the winding number with fast winding number method utilizing second-order dipole approximation, default 2.0
992
- :param threshold: The threshold of the winding number to be considered inside, default 0.5
993
- """
994
- ...
995
-
996
-
997
- @over
998
- def mesh_query_ray(id: uint64, start: vec3f, dir: vec3f, max_t: float32) -> mesh_query_ray_t:
999
- """
1000
- Computes the closest ray hit on the :class:`Mesh` with identifier ``id``.
1001
-
1002
- :param id: The mesh identifier
1003
- :param start: The start point of the ray
1004
- :param dir: The ray direction (should be normalized)
1005
- :param max_t: The maximum distance along the ray to check for intersections
1006
- """
1007
- ...
1008
-
1009
-
1010
- @over
1011
- def mesh_query_aabb(id: uint64, lower: vec3f, upper: vec3f) -> mesh_query_aabb_t:
1012
- """
1013
- Construct an axis-aligned bounding box query against a :class:`Mesh`.
1014
- This query can be used to iterate over all triangles inside a volume.
1015
-
1016
- :param id: The mesh identifier
1017
- :param lower: The lower bound of the bounding box in mesh space
1018
- :param upper: The upper bound of the bounding box in mesh space
1019
- """
1020
- ...
1021
-
1022
-
1023
- @over
1024
- def mesh_query_aabb_next(query: mesh_query_aabb_t, index: int32) -> bool:
1025
- """
1026
- Move to the next triangle overlapping the query bounding box.
1027
- The index of the current face is stored in ``index``, returns ``False`` if there are no more overlapping triangles.
1028
- """
1029
- ...
1030
-
1031
-
1032
- @over
1033
- def mesh_eval_position(id: uint64, face: int32, bary_u: float32, bary_v: float32) -> vec3f:
1034
- """
1035
- Evaluates the position on the :class:`Mesh` given a face index and barycentric coordinates.
1036
- """
1037
- ...
1038
-
1039
-
1040
- @over
1041
- def mesh_eval_velocity(id: uint64, face: int32, bary_u: float32, bary_v: float32) -> vec3f:
1042
- """
1043
- Evaluates the velocity on the :class:`Mesh` given a face index and barycentric coordinates.
1044
- """
1045
- ...
1046
-
1047
-
1048
- @over
1049
- def hash_grid_query(id: uint64, point: vec3f, max_dist: float32) -> hash_grid_query_t:
1050
- """
1051
- Construct a point query against a :class:`HashGrid`. This query can be used to iterate over all neighboring points within a fixed radius from the query point.
1052
- """
1053
- ...
1054
-
1055
-
1056
- @over
1057
- def hash_grid_query_next(query: hash_grid_query_t, index: int32) -> bool:
1058
- """
1059
- Move to the next point in the hash grid query. The index of the current neighbor is stored in ``index``, returns ``False``
1060
- if there are no more neighbors.
1061
- """
1062
- ...
1063
-
1064
-
1065
- @over
1066
- def hash_grid_point_id(id: uint64, index: int32) -> int:
1067
- """
1068
- Return the index of a point in the :class:`HashGrid`. This can be used to reorder threads such that grid
1069
- traversal occurs in a spatially coherent order.
1070
-
1071
- Returns -1 if the :class:`HashGrid` has not been reserved.
1072
- """
1073
- ...
1074
-
1075
-
1076
- @over
1077
- def intersect_tri_tri(v0: vec3f, v1: vec3f, v2: vec3f, u0: vec3f, u1: vec3f, u2: vec3f) -> int:
1078
- """
1079
- Tests for intersection between two triangles (v0, v1, v2) and (u0, u1, u2) using Moller's method. Returns > 0 if triangles intersect.
1080
- """
1081
- ...
1082
-
1083
-
1084
- @over
1085
- def mesh_get(id: uint64) -> Mesh:
1086
- """
1087
- Retrieves the mesh given its index.
1088
- """
1089
- ...
1090
-
1091
-
1092
- @over
1093
- def mesh_eval_face_normal(id: uint64, face: int32) -> vec3f:
1094
- """
1095
- Evaluates the face normal the mesh given a face index.
1096
- """
1097
- ...
1098
-
1099
-
1100
- @over
1101
- def mesh_get_point(id: uint64, index: int32) -> vec3f:
1102
- """
1103
- Returns the point of the mesh given a index.
1104
- """
1105
- ...
1106
-
1107
-
1108
- @over
1109
- def mesh_get_velocity(id: uint64, index: int32) -> vec3f:
1110
- """
1111
- Returns the velocity of the mesh given a index.
1112
- """
1113
- ...
1114
-
1115
-
1116
- @over
1117
- def mesh_get_index(id: uint64, index: int32) -> int:
1118
- """
1119
- Returns the point-index of the mesh given a face-vertex index.
1120
- """
1121
- ...
1122
-
1123
-
1124
- @over
1125
- def closest_point_edge_edge(p1: vec3f, q1: vec3f, p2: vec3f, q2: vec3f, epsilon: float32) -> vec3f:
1126
- """
1127
- Finds the closest points between two edges. Returns barycentric weights to the points on each edge, as well as the closest distance between the edges.
1128
-
1129
- :param p1: First point of first edge
1130
- :param q1: Second point of first edge
1131
- :param p2: First point of second edge
1132
- :param q2: Second point of second edge
1133
- :param epsilon: Zero tolerance for determining if points in an edge are degenerate.
1134
- :param out: vec3 output containing (s,t,d), where `s` in [0,1] is the barycentric weight for the first edge, `t` is the barycentric weight for the second edge, and `d` is the distance between the two edges at these two closest points.
1135
- """
1136
- ...
1137
-
1138
-
1139
- @over
1140
- def volume_sample_f(id: uint64, uvw: vec3f, sampling_mode: int32) -> float:
1141
- """
1142
- Sample the volume given by ``id`` at the volume local-space point ``uvw``.
1143
- Interpolation should be :attr:`warp.Volume.CLOSEST` or :attr:`wp.Volume.LINEAR.`
1144
- """
1145
- ...
1146
-
1147
-
1148
- @over
1149
- def volume_sample_grad_f(id: uint64, uvw: vec3f, sampling_mode: int32, grad: vec3f) -> float:
1150
- """
1151
- Sample the volume and its gradient given by ``id`` at the volume local-space point ``uvw``.
1152
- Interpolation should be :attr:`warp.Volume.CLOSEST` or :attr:`wp.Volume.LINEAR.`
1153
- """
1154
- ...
1155
-
1156
-
1157
- @over
1158
- def volume_lookup_f(id: uint64, i: int32, j: int32, k: int32) -> float:
1159
- """
1160
- Returns the value of voxel with coordinates ``i``, ``j``, ``k``.
1161
- If the voxel at this index does not exist, this function returns the background value
1162
- """
1163
- ...
1164
-
1165
-
1166
- @over
1167
- def volume_store_f(id: uint64, i: int32, j: int32, k: int32, value: float32):
1168
- """
1169
- Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``.
1170
- """
1171
- ...
1172
-
1173
-
1174
- @over
1175
- def volume_sample_v(id: uint64, uvw: vec3f, sampling_mode: int32) -> vec3f:
1176
- """
1177
- Sample the vector volume given by ``id`` at the volume local-space point ``uvw``.
1178
- Interpolation should be :attr:`warp.Volume.CLOSEST` or :attr:`wp.Volume.LINEAR.`
1179
- """
1180
- ...
1181
-
1182
-
1183
- @over
1184
- def volume_lookup_v(id: uint64, i: int32, j: int32, k: int32) -> vec3f:
1185
- """
1186
- Returns the vector value of voxel with coordinates ``i``, ``j``, ``k``.
1187
- If the voxel at this index does not exist, this function returns the background value.
1188
- """
1189
- ...
1190
-
1191
-
1192
- @over
1193
- def volume_store_v(id: uint64, i: int32, j: int32, k: int32, value: vec3f):
1194
- """
1195
- Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``.
1196
- """
1197
- ...
1198
-
1199
-
1200
- @over
1201
- def volume_sample_i(id: uint64, uvw: vec3f) -> int:
1202
- """
1203
- Sample the :class:`int32` volume given by ``id`` at the volume local-space point ``uvw``.
1204
- """
1205
- ...
1206
-
1207
-
1208
- @over
1209
- def volume_lookup_i(id: uint64, i: int32, j: int32, k: int32) -> int:
1210
- """
1211
- Returns the :class:`int32` value of voxel with coordinates ``i``, ``j``, ``k``.
1212
- If the voxel at this index does not exist, this function returns the background value.
1213
- """
1214
- ...
1215
-
1216
-
1217
- @over
1218
- def volume_store_i(id: uint64, i: int32, j: int32, k: int32, value: int32):
1219
- """
1220
- Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``.
1221
- """
1222
- ...
1223
-
1224
-
1225
- @over
1226
- def volume_index_to_world(id: uint64, uvw: vec3f) -> vec3f:
1227
- """
1228
- Transform a point ``uvw`` defined in volume index space to world space given the volume's intrinsic affine transformation.
1229
- """
1230
- ...
1231
-
1232
-
1233
- @over
1234
- def volume_world_to_index(id: uint64, xyz: vec3f) -> vec3f:
1235
- """
1236
- Transform a point ``xyz`` defined in volume world space to the volume's index space given the volume's intrinsic affine transformation.
1237
- """
1238
- ...
1239
-
1240
-
1241
- @over
1242
- def volume_index_to_world_dir(id: uint64, uvw: vec3f) -> vec3f:
1243
- """
1244
- Transform a direction ``uvw`` defined in volume index space to world space given the volume's intrinsic affine transformation.
1245
- """
1246
- ...
1247
-
1248
-
1249
- @over
1250
- def volume_world_to_index_dir(id: uint64, xyz: vec3f) -> vec3f:
1251
- """
1252
- Transform a direction ``xyz`` defined in volume world space to the volume's index space given the volume's intrinsic affine transformation.
1253
- """
1254
- ...
1255
-
1256
-
1257
- @over
1258
- def rand_init(seed: int32) -> uint32:
1259
- """
1260
- Initialize a new random number generator given a user-defined seed. Returns a 32-bit integer representing the RNG state.
1261
- """
1262
- ...
1263
-
1264
-
1265
- @over
1266
- def rand_init(seed: int32, offset: int32) -> uint32:
1267
- """
1268
- Initialize a new random number generator given a user-defined seed and an offset.
1269
- This alternative constructor can be useful in parallel programs, where a kernel as a whole should share a seed,
1270
- but each thread should generate uncorrelated values. In this case usage should be ``r = rand_init(seed, tid)``
1271
- """
1272
- ...
1273
-
1274
-
1275
- @over
1276
- def randi(state: uint32) -> int:
1277
- """
1278
- Return a random integer in the range [0, 2^32).
1279
- """
1280
- ...
1281
-
1282
-
1283
- @over
1284
- def randi(state: uint32, min: int32, max: int32) -> int:
1285
- """
1286
- Return a random integer between [min, max).
1287
- """
1288
- ...
1289
-
1290
-
1291
- @over
1292
- def randf(state: uint32) -> float:
1293
- """
1294
- Return a random float between [0.0, 1.0).
1295
- """
1296
- ...
1297
-
1298
-
1299
- @over
1300
- def randf(state: uint32, min: float32, max: float32) -> float:
1301
- """
1302
- Return a random float between [min, max).
1303
- """
1304
- ...
1305
-
1306
-
1307
- @over
1308
- def randn(state: uint32) -> float:
1309
- """
1310
- Sample a normal distribution.
1311
- """
1312
- ...
1313
-
1314
-
1315
- @over
1316
- def sample_cdf(state: uint32, cdf: Array[float32]) -> int:
1317
- """
1318
- Inverse-transform sample a cumulative distribution function.
1319
- """
1320
- ...
1321
-
1322
-
1323
- @over
1324
- def sample_triangle(state: uint32) -> vec2f:
1325
- """
1326
- Uniformly sample a triangle. Returns sample barycentric coordinates.
1327
- """
1328
- ...
1329
-
1330
-
1331
- @over
1332
- def sample_unit_ring(state: uint32) -> vec2f:
1333
- """
1334
- Uniformly sample a ring in the xy plane.
1335
- """
1336
- ...
1337
-
1338
-
1339
- @over
1340
- def sample_unit_disk(state: uint32) -> vec2f:
1341
- """
1342
- Uniformly sample a disk in the xy plane.
1343
- """
1344
- ...
1345
-
1346
-
1347
- @over
1348
- def sample_unit_sphere_surface(state: uint32) -> vec3f:
1349
- """
1350
- Uniformly sample a unit sphere surface.
1351
- """
1352
- ...
1353
-
1354
-
1355
- @over
1356
- def sample_unit_sphere(state: uint32) -> vec3f:
1357
- """
1358
- Uniformly sample a unit sphere.
1359
- """
1360
- ...
1361
-
1362
-
1363
- @over
1364
- def sample_unit_hemisphere_surface(state: uint32) -> vec3f:
1365
- """
1366
- Uniformly sample a unit hemisphere surface.
1367
- """
1368
- ...
1369
-
1370
-
1371
- @over
1372
- def sample_unit_hemisphere(state: uint32) -> vec3f:
1373
- """
1374
- Uniformly sample a unit hemisphere.
1375
- """
1376
- ...
1377
-
1378
-
1379
- @over
1380
- def sample_unit_square(state: uint32) -> vec2f:
1381
- """
1382
- Uniformly sample a unit square.
1383
- """
1384
- ...
1385
-
1386
-
1387
- @over
1388
- def sample_unit_cube(state: uint32) -> vec3f:
1389
- """
1390
- Uniformly sample a unit cube.
1391
- """
1392
- ...
1393
-
1394
-
1395
- @over
1396
- def poisson(state: uint32, lam: float32) -> uint32:
1397
- """
1398
- Generate a random sample from a Poisson distribution.
1399
-
1400
- :param state: RNG state
1401
- :param lam: The expected value of the distribution
1402
- """
1403
- ...
1404
-
1405
-
1406
- @over
1407
- def noise(state: uint32, x: float32) -> float:
1408
- """
1409
- Non-periodic Perlin-style noise in 1D.
1410
- """
1411
- ...
1412
-
1413
-
1414
- @over
1415
- def noise(state: uint32, xy: vec2f) -> float:
1416
- """
1417
- Non-periodic Perlin-style noise in 2D.
1418
- """
1419
- ...
1420
-
1421
-
1422
- @over
1423
- def noise(state: uint32, xyz: vec3f) -> float:
1424
- """
1425
- Non-periodic Perlin-style noise in 3D.
1426
- """
1427
- ...
1428
-
1429
-
1430
- @over
1431
- def noise(state: uint32, xyzt: vec4f) -> float:
1432
- """
1433
- Non-periodic Perlin-style noise in 4D.
1434
- """
1435
- ...
1436
-
1437
-
1438
- @over
1439
- def pnoise(state: uint32, x: float32, px: int32) -> float:
1440
- """
1441
- Periodic Perlin-style noise in 1D.
1442
- """
1443
- ...
1444
-
1445
-
1446
- @over
1447
- def pnoise(state: uint32, xy: vec2f, px: int32, py: int32) -> float:
1448
- """
1449
- Periodic Perlin-style noise in 2D.
1450
- """
1451
- ...
1452
-
1453
-
1454
- @over
1455
- def pnoise(state: uint32, xyz: vec3f, px: int32, py: int32, pz: int32) -> float:
1456
- """
1457
- Periodic Perlin-style noise in 3D.
1458
- """
1459
- ...
1460
-
1461
-
1462
- @over
1463
- def pnoise(state: uint32, xyzt: vec4f, px: int32, py: int32, pz: int32, pt: int32) -> float:
1464
- """
1465
- Periodic Perlin-style noise in 4D.
1466
- """
1467
- ...
1468
-
1469
-
1470
- @over
1471
- def curlnoise(state: uint32, xy: vec2f, octaves: uint32, lacunarity: float32, gain: float32) -> vec2f:
1472
- """
1473
- Divergence-free vector field based on the gradient of a Perlin noise function.
1474
- """
1475
- ...
1476
-
1477
-
1478
- @over
1479
- def curlnoise(state: uint32, xyz: vec3f, octaves: uint32, lacunarity: float32, gain: float32) -> vec3f:
1480
- """
1481
- Divergence-free vector field based on the curl of three Perlin noise functions.
1482
- """
1483
- ...
1484
-
1485
-
1486
- @over
1487
- def curlnoise(state: uint32, xyzt: vec4f, octaves: uint32, lacunarity: float32, gain: float32) -> vec3f:
1488
- """
1489
- Divergence-free vector field based on the curl of three Perlin noise functions.
1490
- """
1491
- ...
1492
-
1493
-
1494
- @over
1495
- def printf():
1496
- """
1497
- Allows printing formatted strings using C-style format specifiers.
1498
- """
1499
- ...
1500
-
1501
-
1502
- @over
1503
- def tid() -> Tuple[int, int]:
1504
- """
1505
- Return the current thread indices for a 2D kernel launch. Use ``i,j = wp.tid()`` syntax to retrieve the
1506
- coordinates inside the kernel thread grid. This function may not be called from user-defined Warp functions.
1507
- """
1508
- ...
1509
-
1510
-
1511
- @over
1512
- def tid() -> Tuple[int, int, int]:
1513
- """
1514
- Return the current thread indices for a 3D kernel launch. Use ``i,j,k = wp.tid()`` syntax to retrieve the
1515
- coordinates inside the kernel thread grid. This function may not be called from user-defined Warp functions.
1516
- """
1517
- ...
1518
-
1519
-
1520
- @over
1521
- def tid() -> Tuple[int, int, int, int]:
1522
- """
1523
- Return the current thread indices for a 4D kernel launch. Use ``i,j,k,l = wp.tid()`` syntax to retrieve the
1524
- coordinates inside the kernel thread grid. This function may not be called from user-defined Warp functions.
1525
- """
1526
- ...
1527
-
1528
-
1529
- @over
1530
- def select(cond: bool, arg1: Any, arg2: Any):
1531
- """
1532
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1533
- """
1534
- ...
1535
-
1536
-
1537
- @over
1538
- def select(cond: bool, arg1: Any, arg2: Any):
1539
- """
1540
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1541
- """
1542
- ...
1543
-
1544
-
1545
- @over
1546
- def select(cond: int8, arg1: Any, arg2: Any):
1547
- """
1548
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1549
- """
1550
- ...
1551
-
1552
-
1553
- @over
1554
- def select(cond: uint8, arg1: Any, arg2: Any):
1555
- """
1556
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1557
- """
1558
- ...
1559
-
1560
-
1561
- @over
1562
- def select(cond: int16, arg1: Any, arg2: Any):
1563
- """
1564
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1565
- """
1566
- ...
1567
-
1568
-
1569
- @over
1570
- def select(cond: uint16, arg1: Any, arg2: Any):
1571
- """
1572
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1573
- """
1574
- ...
1575
-
1576
-
1577
- @over
1578
- def select(cond: int32, arg1: Any, arg2: Any):
1579
- """
1580
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1581
- """
1582
- ...
1583
-
1584
-
1585
- @over
1586
- def select(cond: uint32, arg1: Any, arg2: Any):
1587
- """
1588
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1589
- """
1590
- ...
1591
-
1592
-
1593
- @over
1594
- def select(cond: int64, arg1: Any, arg2: Any):
1595
- """
1596
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1597
- """
1598
- ...
1599
-
1600
-
1601
- @over
1602
- def select(cond: uint64, arg1: Any, arg2: Any):
1603
- """
1604
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1605
- """
1606
- ...
1607
-
1608
-
1609
- @over
1610
- def select(arr: Array[Any], arg1: Any, arg2: Any):
1611
- """
1612
- Select between two arguments, if ``arr`` is null then return ``arg1``, otherwise return ``arg2``
1613
- """
1614
- ...
1615
-
1616
-
1617
- @over
1618
- def atomic_add(a: Array[Any], i: int32, value: Any):
1619
- """
1620
- Atomically add ``value`` onto ``a[i]``.
1621
- """
1622
- ...
1623
-
1624
-
1625
- @over
1626
- def atomic_add(a: Array[Any], i: int32, j: int32, value: Any):
1627
- """
1628
- Atomically add ``value`` onto ``a[i,j]``.
1629
- """
1630
- ...
1631
-
1632
-
1633
- @over
1634
- def atomic_add(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
1635
- """
1636
- Atomically add ``value`` onto ``a[i,j,k]``.
1637
- """
1638
- ...
1639
-
1640
-
1641
- @over
1642
- def atomic_add(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1643
- """
1644
- Atomically add ``value`` onto ``a[i,j,k,l]``.
1645
- """
1646
- ...
1647
-
1648
-
1649
- @over
1650
- def atomic_add(a: FabricArray[Any], i: int32, value: Any):
1651
- """
1652
- Atomically add ``value`` onto ``a[i]``.
1653
- """
1654
- ...
1655
-
1656
-
1657
- @over
1658
- def atomic_add(a: FabricArray[Any], i: int32, j: int32, value: Any):
1659
- """
1660
- Atomically add ``value`` onto ``a[i,j]``.
1661
- """
1662
- ...
1663
-
1664
-
1665
- @over
1666
- def atomic_add(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1667
- """
1668
- Atomically add ``value`` onto ``a[i,j,k]``.
1669
- """
1670
- ...
1671
-
1672
-
1673
- @over
1674
- def atomic_add(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1675
- """
1676
- Atomically add ``value`` onto ``a[i,j,k,l]``.
1677
- """
1678
- ...
1679
-
1680
-
1681
- @over
1682
- def atomic_add(a: IndexedFabricArray[Any], i: int32, value: Any):
1683
- """
1684
- Atomically add ``value`` onto ``a[i]``.
1685
- """
1686
- ...
1687
-
1688
-
1689
- @over
1690
- def atomic_add(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
1691
- """
1692
- Atomically add ``value`` onto ``a[i,j]``.
1693
- """
1694
- ...
1695
-
1696
-
1697
- @over
1698
- def atomic_add(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1699
- """
1700
- Atomically add ``value`` onto ``a[i,j,k]``.
1701
- """
1702
- ...
1703
-
1704
-
1705
- @over
1706
- def atomic_add(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1707
- """
1708
- Atomically add ``value`` onto ``a[i,j,k,l]``.
1709
- """
1710
- ...
1711
-
1712
-
1713
- @over
1714
- def atomic_sub(a: Array[Any], i: int32, value: Any):
1715
- """
1716
- Atomically subtract ``value`` onto ``a[i]``.
1717
- """
1718
- ...
1719
-
1720
-
1721
- @over
1722
- def atomic_sub(a: Array[Any], i: int32, j: int32, value: Any):
1723
- """
1724
- Atomically subtract ``value`` onto ``a[i,j]``.
1725
- """
1726
- ...
1727
-
1728
-
1729
- @over
1730
- def atomic_sub(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
1731
- """
1732
- Atomically subtract ``value`` onto ``a[i,j,k]``.
1733
- """
1734
- ...
1735
-
1736
-
1737
- @over
1738
- def atomic_sub(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1739
- """
1740
- Atomically subtract ``value`` onto ``a[i,j,k,l]``.
1741
- """
1742
- ...
1743
-
1744
-
1745
- @over
1746
- def atomic_sub(a: FabricArray[Any], i: int32, value: Any):
1747
- """
1748
- Atomically subtract ``value`` onto ``a[i]``.
1749
- """
1750
- ...
1751
-
1752
-
1753
- @over
1754
- def atomic_sub(a: FabricArray[Any], i: int32, j: int32, value: Any):
1755
- """
1756
- Atomically subtract ``value`` onto ``a[i,j]``.
1757
- """
1758
- ...
1759
-
1760
-
1761
- @over
1762
- def atomic_sub(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1763
- """
1764
- Atomically subtract ``value`` onto ``a[i,j,k]``.
1765
- """
1766
- ...
1767
-
1768
-
1769
- @over
1770
- def atomic_sub(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1771
- """
1772
- Atomically subtract ``value`` onto ``a[i,j,k,l]``.
1773
- """
1774
- ...
1775
-
1776
-
1777
- @over
1778
- def atomic_sub(a: IndexedFabricArray[Any], i: int32, value: Any):
1779
- """
1780
- Atomically subtract ``value`` onto ``a[i]``.
1781
- """
1782
- ...
1783
-
1784
-
1785
- @over
1786
- def atomic_sub(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
1787
- """
1788
- Atomically subtract ``value`` onto ``a[i,j]``.
1789
- """
1790
- ...
1791
-
1792
-
1793
- @over
1794
- def atomic_sub(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1795
- """
1796
- Atomically subtract ``value`` onto ``a[i,j,k]``.
1797
- """
1798
- ...
1799
-
1800
-
1801
- @over
1802
- def atomic_sub(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1803
- """
1804
- Atomically subtract ``value`` onto ``a[i,j,k,l]``.
1805
- """
1806
- ...
1807
-
1808
-
1809
- @over
1810
- def atomic_min(a: Array[Any], i: int32, value: Any):
1811
- """
1812
- Compute the minimum of ``value`` and ``a[i]`` and atomically update the array.
1813
-
1814
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1815
- """
1816
- ...
1817
-
1818
-
1819
- @over
1820
- def atomic_min(a: Array[Any], i: int32, j: int32, value: Any):
1821
- """
1822
- Compute the minimum of ``value`` and ``a[i,j]`` and atomically update the array.
1823
-
1824
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1825
- """
1826
- ...
1827
-
1828
-
1829
- @over
1830
- def atomic_min(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
1831
- """
1832
- Compute the minimum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1833
-
1834
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1835
- """
1836
- ...
1837
-
1838
-
1839
- @over
1840
- def atomic_min(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1841
- """
1842
- Compute the minimum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1843
-
1844
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1845
- """
1846
- ...
1847
-
1848
-
1849
- @over
1850
- def atomic_min(a: FabricArray[Any], i: int32, value: Any):
1851
- """
1852
- Compute the minimum of ``value`` and ``a[i]`` and atomically update the array.
1853
-
1854
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1855
- """
1856
- ...
1857
-
1858
-
1859
- @over
1860
- def atomic_min(a: FabricArray[Any], i: int32, j: int32, value: Any):
1861
- """
1862
- Compute the minimum of ``value`` and ``a[i,j]`` and atomically update the array.
1863
-
1864
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1865
- """
1866
- ...
1867
-
1868
-
1869
- @over
1870
- def atomic_min(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1871
- """
1872
- Compute the minimum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1873
-
1874
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1875
- """
1876
- ...
1877
-
1878
-
1879
- @over
1880
- def atomic_min(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1881
- """
1882
- Compute the minimum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1883
-
1884
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1885
- """
1886
- ...
1887
-
1888
-
1889
- @over
1890
- def atomic_min(a: IndexedFabricArray[Any], i: int32, value: Any):
1891
- """
1892
- Compute the minimum of ``value`` and ``a[i]`` and atomically update the array.
1893
-
1894
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1895
- """
1896
- ...
1897
-
1898
-
1899
- @over
1900
- def atomic_min(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
1901
- """
1902
- Compute the minimum of ``value`` and ``a[i,j]`` and atomically update the array.
1903
-
1904
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1905
- """
1906
- ...
1907
-
1908
-
1909
- @over
1910
- def atomic_min(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1911
- """
1912
- Compute the minimum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1913
-
1914
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1915
- """
1916
- ...
1917
-
1918
-
1919
- @over
1920
- def atomic_min(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1921
- """
1922
- Compute the minimum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1923
-
1924
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1925
- """
1926
- ...
1927
-
1928
-
1929
- @over
1930
- def atomic_max(a: Array[Any], i: int32, value: Any):
1931
- """
1932
- Compute the maximum of ``value`` and ``a[i]`` and atomically update the array.
1933
-
1934
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1935
- """
1936
- ...
1937
-
1938
-
1939
- @over
1940
- def atomic_max(a: Array[Any], i: int32, j: int32, value: Any):
1941
- """
1942
- Compute the maximum of ``value`` and ``a[i,j]`` and atomically update the array.
1943
-
1944
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1945
- """
1946
- ...
1947
-
1948
-
1949
- @over
1950
- def atomic_max(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
1951
- """
1952
- Compute the maximum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1953
-
1954
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1955
- """
1956
- ...
1957
-
1958
-
1959
- @over
1960
- def atomic_max(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1961
- """
1962
- Compute the maximum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1963
-
1964
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1965
- """
1966
- ...
1967
-
1968
-
1969
- @over
1970
- def atomic_max(a: FabricArray[Any], i: int32, value: Any):
1971
- """
1972
- Compute the maximum of ``value`` and ``a[i]`` and atomically update the array.
1973
-
1974
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1975
- """
1976
- ...
1977
-
1978
-
1979
- @over
1980
- def atomic_max(a: FabricArray[Any], i: int32, j: int32, value: Any):
1981
- """
1982
- Compute the maximum of ``value`` and ``a[i,j]`` and atomically update the array.
1983
-
1984
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1985
- """
1986
- ...
1987
-
1988
-
1989
- @over
1990
- def atomic_max(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1991
- """
1992
- Compute the maximum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1993
-
1994
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1995
- """
1996
- ...
1997
-
1998
-
1999
- @over
2000
- def atomic_max(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
2001
- """
2002
- Compute the maximum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
2003
-
2004
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
2005
- """
2006
- ...
2007
-
2008
-
2009
- @over
2010
- def atomic_max(a: IndexedFabricArray[Any], i: int32, value: Any):
2011
- """
2012
- Compute the maximum of ``value`` and ``a[i]`` and atomically update the array.
2013
-
2014
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
2015
- """
2016
- ...
2017
-
2018
-
2019
- @over
2020
- def atomic_max(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
2021
- """
2022
- Compute the maximum of ``value`` and ``a[i,j]`` and atomically update the array.
2023
-
2024
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
2025
- """
2026
- ...
2027
-
2028
-
2029
- @over
2030
- def atomic_max(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
2031
- """
2032
- Compute the maximum of ``value`` and ``a[i,j,k]`` and atomically update the array.
2033
-
2034
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
2035
- """
2036
- ...
2037
-
2038
-
2039
- @over
2040
- def atomic_max(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
2041
- """
2042
- Compute the maximum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
2043
-
2044
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
2045
- """
2046
- ...
2047
-
2048
-
2049
- @over
2050
- def lerp(a: Float, b: Float, t: Float) -> Float:
2051
- """
2052
- Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``
2053
- """
2054
- ...
2055
-
2056
-
2057
- @over
2058
- def lerp(a: Vector[Any, Float], b: Vector[Any, Float], t: Float) -> Vector[Any, Float]:
2059
- """
2060
- Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``
2061
- """
2062
- ...
2063
-
2064
-
2065
- @over
2066
- def lerp(a: Matrix[Any, Any, Float], b: Matrix[Any, Any, Float], t: Float) -> Matrix[Any, Any, Float]:
2067
- """
2068
- Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``
2069
- """
2070
- ...
2071
-
2072
-
2073
- @over
2074
- def lerp(a: Quaternion[Float], b: Quaternion[Float], t: Float) -> Quaternion[Float]:
2075
- """
2076
- Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``
2077
- """
2078
- ...
2079
-
2080
-
2081
- @over
2082
- def lerp(a: Transformation[Float], b: Transformation[Float], t: Float) -> Transformation[Float]:
2083
- """
2084
- Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``
2085
- """
2086
- ...
2087
-
2088
-
2089
- @over
2090
- def smoothstep(edge0: Float, edge1: Float, x: Float) -> Float:
2091
- """
2092
- Smoothly interpolate between two values ``edge0`` and ``edge1`` using a factor ``x``,
2093
- and return a result between 0 and 1 using a cubic Hermite interpolation after clamping.
2094
- """
2095
- ...
2096
-
2097
-
2098
- @over
2099
- def expect_near(arg1: Float, arg2: Float, tolerance: Float):
2100
- """
2101
- Prints an error to stdout if ``arg1`` and ``arg2`` are not closer than tolerance in magnitude
2102
- """
2103
- ...
2104
-
2105
-
2106
- @over
2107
- def expect_near(arg1: vec3f, arg2: vec3f, tolerance: float32):
2108
- """
2109
- Prints an error to stdout if any element of ``arg1`` and ``arg2`` are not closer than tolerance in magnitude
2110
- """
2111
- ...
2112
-
2113
-
2114
- @over
2115
- def lower_bound(arr: Array[Scalar], value: Scalar) -> int:
2116
- """
2117
- Search a sorted array ``arr`` for the closest element greater than or equal to ``value``.
2118
- """
2119
- ...
2120
-
2121
-
2122
- @over
2123
- def lower_bound(arr: Array[Scalar], arr_begin: int32, arr_end: int32, value: Scalar) -> int:
2124
- """
2125
- Search a sorted array ``arr`` in the range [arr_begin, arr_end) for the closest element greater than or equal to ``value``.
2126
- """
2127
- ...
2128
-
2129
-
2130
- @over
2131
- def add(x: Scalar, y: Scalar) -> Scalar:
2132
- """ """
2133
- ...
2134
-
2135
-
2136
- @over
2137
- def add(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2138
- """ """
2139
- ...
2140
-
2141
-
2142
- @over
2143
- def add(x: Quaternion[Scalar], y: Quaternion[Scalar]) -> Quaternion[Scalar]:
2144
- """ """
2145
- ...
2146
-
2147
-
2148
- @over
2149
- def add(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2150
- """ """
2151
- ...
2152
-
2153
-
2154
- @over
2155
- def add(x: Transformation[Scalar], y: Transformation[Scalar]) -> Transformation[Scalar]:
2156
- """ """
2157
- ...
2158
-
2159
-
2160
- @over
2161
- def sub(x: Scalar, y: Scalar) -> Scalar:
2162
- """ """
2163
- ...
2164
-
2165
-
2166
- @over
2167
- def sub(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2168
- """ """
2169
- ...
2170
-
2171
-
2172
- @over
2173
- def sub(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2174
- """ """
2175
- ...
2176
-
2177
-
2178
- @over
2179
- def sub(x: Quaternion[Scalar], y: Quaternion[Scalar]) -> Quaternion[Scalar]:
2180
- """ """
2181
- ...
2182
-
2183
-
2184
- @over
2185
- def sub(x: Transformation[Scalar], y: Transformation[Scalar]) -> Transformation[Scalar]:
2186
- """ """
2187
- ...
2188
-
2189
-
2190
- @over
2191
- def bit_and(x: Int, y: Int) -> Int:
2192
- """ """
2193
- ...
2194
-
2195
-
2196
- @over
2197
- def bit_or(x: Int, y: Int) -> Int:
2198
- """ """
2199
- ...
2200
-
2201
-
2202
- @over
2203
- def bit_xor(x: Int, y: Int) -> Int:
2204
- """ """
2205
- ...
2206
-
2207
-
2208
- @over
2209
- def lshift(x: Int, y: Int) -> Int:
2210
- """ """
2211
- ...
2212
-
2213
-
2214
- @over
2215
- def rshift(x: Int, y: Int) -> Int:
2216
- """ """
2217
- ...
2218
-
2219
-
2220
- @over
2221
- def invert(x: Int) -> Int:
2222
- """ """
2223
- ...
2224
-
2225
-
2226
- @over
2227
- def mul(x: Scalar, y: Scalar) -> Scalar:
2228
- """ """
2229
- ...
2230
-
2231
-
2232
- @over
2233
- def mul(x: Vector[Any, Scalar], y: Scalar) -> Vector[Any, Scalar]:
2234
- """ """
2235
- ...
2236
-
2237
-
2238
- @over
2239
- def mul(x: Scalar, y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2240
- """ """
2241
- ...
2242
-
2243
-
2244
- @over
2245
- def mul(x: Quaternion[Scalar], y: Scalar) -> Quaternion[Scalar]:
2246
- """ """
2247
- ...
2248
-
2249
-
2250
- @over
2251
- def mul(x: Scalar, y: Quaternion[Scalar]) -> Quaternion[Scalar]:
2252
- """ """
2253
- ...
2254
-
2255
-
2256
- @over
2257
- def mul(x: Quaternion[Scalar], y: Quaternion[Scalar]) -> Quaternion[Scalar]:
2258
- """ """
2259
- ...
2260
-
2261
-
2262
- @over
2263
- def mul(x: Scalar, y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2264
- """ """
2265
- ...
2266
-
2267
-
2268
- @over
2269
- def mul(x: Matrix[Any, Any, Scalar], y: Scalar) -> Matrix[Any, Any, Scalar]:
2270
- """ """
2271
- ...
2272
-
2273
-
2274
- @over
2275
- def mul(x: Matrix[Any, Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2276
- """ """
2277
- ...
2278
-
2279
-
2280
- @over
2281
- def mul(x: Vector[Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Vector[Any, Scalar]:
2282
- """ """
2283
- ...
2284
-
2285
-
2286
- @over
2287
- def mul(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]):
2288
- """ """
2289
- ...
2290
-
2291
-
2292
- @over
2293
- def mul(x: Transformation[Scalar], y: Transformation[Scalar]) -> Transformation[Scalar]:
2294
- """ """
2295
- ...
2296
-
2297
-
2298
- @over
2299
- def mul(x: Scalar, y: Transformation[Scalar]) -> Transformation[Scalar]:
2300
- """ """
2301
- ...
2302
-
2303
-
2304
- @over
2305
- def mul(x: Transformation[Scalar], y: Scalar) -> Transformation[Scalar]:
2306
- """ """
2307
- ...
2308
-
2309
-
2310
- @over
2311
- def mod(x: Scalar, y: Scalar) -> Scalar:
2312
- """ """
2313
- ...
2314
-
2315
-
2316
- @over
2317
- def div(x: Scalar, y: Scalar) -> Scalar:
2318
- """ """
2319
- ...
2320
-
2321
-
2322
- @over
2323
- def div(x: Vector[Any, Scalar], y: Scalar) -> Vector[Any, Scalar]:
2324
- """ """
2325
- ...
2326
-
2327
-
2328
- @over
2329
- def div(x: Scalar, y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2330
- """ """
2331
- ...
2332
-
2333
-
2334
- @over
2335
- def div(x: Matrix[Any, Any, Scalar], y: Scalar) -> Matrix[Any, Any, Scalar]:
2336
- """ """
2337
- ...
2338
-
2339
-
2340
- @over
2341
- def div(x: Scalar, y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2342
- """ """
2343
- ...
2344
-
2345
-
2346
- @over
2347
- def div(x: Quaternion[Scalar], y: Scalar) -> Quaternion[Scalar]:
2348
- """ """
2349
- ...
2350
-
2351
-
2352
- @over
2353
- def div(x: Scalar, y: Quaternion[Scalar]) -> Quaternion[Scalar]:
2354
- """ """
2355
- ...
2356
-
2357
-
2358
- @over
2359
- def floordiv(x: Scalar, y: Scalar) -> Scalar:
2360
- """ """
2361
- ...
2362
-
2363
-
2364
- @over
2365
- def pos(x: Scalar) -> Scalar:
2366
- """ """
2367
- ...
2368
-
2369
-
2370
- @over
2371
- def pos(x: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2372
- """ """
2373
- ...
2374
-
2375
-
2376
- @over
2377
- def pos(x: Quaternion[Scalar]) -> Quaternion[Scalar]:
2378
- """ """
2379
- ...
2380
-
2381
-
2382
- @over
2383
- def pos(x: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2384
- """ """
2385
- ...
2386
-
2387
-
2388
- @over
2389
- def neg(x: Scalar) -> Scalar:
2390
- """ """
2391
- ...
2392
-
2393
-
2394
- @over
2395
- def neg(x: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2396
- """ """
2397
- ...
2398
-
2399
-
2400
- @over
2401
- def neg(x: Quaternion[Scalar]) -> Quaternion[Scalar]:
2402
- """ """
2403
- ...
2404
-
2405
-
2406
- @over
2407
- def neg(x: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2408
- """ """
2409
- ...
2410
-
2411
-
2412
- @over
2413
- def unot(b: bool) -> bool:
2414
- """ """
2415
- ...
2416
-
2417
-
2418
- @over
2419
- def unot(b: int8) -> bool:
2420
- """ """
2421
- ...
2422
-
2423
-
2424
- @over
2425
- def unot(b: uint8) -> bool:
2426
- """ """
2427
- ...
2428
-
2429
-
2430
- @over
2431
- def unot(b: int16) -> bool:
2432
- """ """
2433
- ...
2434
-
2435
-
2436
- @over
2437
- def unot(b: uint16) -> bool:
2438
- """ """
2439
- ...
2440
-
2441
-
2442
- @over
2443
- def unot(b: int32) -> bool:
2444
- """ """
2445
- ...
2446
-
2447
-
2448
- @over
2449
- def unot(b: uint32) -> bool:
2450
- """ """
2451
- ...
2452
-
2453
-
2454
- @over
2455
- def unot(b: int64) -> bool:
2456
- """ """
2457
- ...
2458
-
2459
-
2460
- @over
2461
- def unot(b: uint64) -> bool:
2462
- """ """
2463
- ...
2464
-
2465
-
2466
- @over
2467
- def unot(a: Array[Any]) -> bool:
2468
- """ """
2469
- ...
1
+ # Autogenerated file, do not edit, this file provides stubs for builtins autocomplete in VSCode, PyCharm, etc
2
+
3
+ from typing import Any
4
+ from typing import Tuple
5
+ from typing import Callable
6
+ from typing import TypeVar
7
+ from typing import Generic
8
+ from typing import overload as over
9
+
10
+ Length = TypeVar("Length", bound=int)
11
+ Rows = TypeVar("Rows", bound=int)
12
+ Cols = TypeVar("Cols", bound=int)
13
+ DType = TypeVar("DType")
14
+ Int = TypeVar("Int")
15
+ Float = TypeVar("Float")
16
+ Scalar = TypeVar("Scalar")
17
+ Vector = Generic[Length, Scalar]
18
+ Matrix = Generic[Rows, Cols, Scalar]
19
+ Quaternion = Generic[Float]
20
+ Transformation = Generic[Float]
21
+ Array = Generic[DType]
22
+ FabricArray = Generic[DType]
23
+ IndexedFabricArray = Generic[DType]
24
+
25
+
26
+ from warp.types import array, array1d, array2d, array3d, array4d, constant
27
+ from warp.types import indexedarray, indexedarray1d, indexedarray2d, indexedarray3d, indexedarray4d
28
+ from warp.fabric import fabricarray, fabricarrayarray, indexedfabricarray, indexedfabricarrayarray
29
+
30
+ from warp.types import bool, int8, uint8, int16, uint16, int32, uint32, int64, uint64, float16, float32, float64
31
+ from warp.types import vec2, vec2b, vec2ub, vec2s, vec2us, vec2i, vec2ui, vec2l, vec2ul, vec2h, vec2f, vec2d
32
+ from warp.types import vec3, vec3b, vec3ub, vec3s, vec3us, vec3i, vec3ui, vec3l, vec3ul, vec3h, vec3f, vec3d
33
+ from warp.types import vec4, vec4b, vec4ub, vec4s, vec4us, vec4i, vec4ui, vec4l, vec4ul, vec4h, vec4f, vec4d
34
+ from warp.types import mat22, mat22h, mat22f, mat22d
35
+ from warp.types import mat33, mat33h, mat33f, mat33d
36
+ from warp.types import mat44, mat44h, mat44f, mat44d
37
+ from warp.types import quat, quath, quatf, quatd
38
+ from warp.types import transform, transformh, transformf, transformd
39
+ from warp.types import spatial_vector, spatial_vectorh, spatial_vectorf, spatial_vectord
40
+ from warp.types import spatial_matrix, spatial_matrixh, spatial_matrixf, spatial_matrixd
41
+
42
+ from warp.types import Bvh, Mesh, HashGrid, Volume, MarchingCubes
43
+ from warp.types import bvh_query_t, hash_grid_query_t, mesh_query_aabb_t, mesh_query_point_t, mesh_query_ray_t
44
+
45
+ from warp.types import matmul, adj_matmul, batched_matmul, adj_batched_matmul, from_ptr
46
+
47
+ from warp.types import vector as vec
48
+ from warp.types import matrix as mat
49
+
50
+ from warp.types import dtype_from_numpy, dtype_to_numpy
51
+
52
+ from warp.context import init, func, func_grad, func_replay, func_native, kernel, struct, overload
53
+ from warp.context import is_cpu_available, is_cuda_available, is_device_available
54
+ from warp.context import get_devices, get_preferred_device
55
+ from warp.context import get_cuda_devices, get_cuda_device_count, get_cuda_device, map_cuda_device, unmap_cuda_device
56
+ from warp.context import get_device, set_device, synchronize_device
57
+ from warp.context import (
58
+ zeros,
59
+ zeros_like,
60
+ ones,
61
+ ones_like,
62
+ full,
63
+ full_like,
64
+ clone,
65
+ empty,
66
+ empty_like,
67
+ copy,
68
+ from_numpy,
69
+ launch,
70
+ synchronize,
71
+ force_load,
72
+ load_module,
73
+ )
74
+ from warp.context import set_module_options, get_module_options, get_module
75
+ from warp.context import capture_begin, capture_end, capture_launch
76
+ from warp.context import Kernel, Function, Launch
77
+ from warp.context import Stream, get_stream, set_stream, wait_stream, synchronize_stream
78
+ from warp.context import Event, record_event, wait_event, synchronize_event, get_event_elapsed_time
79
+ from warp.context import RegisteredGLBuffer
80
+ from warp.context import is_mempool_supported, is_mempool_enabled, set_mempool_enabled
81
+ from warp.context import set_mempool_release_threshold, get_mempool_release_threshold
82
+ from warp.context import is_mempool_access_supported, is_mempool_access_enabled, set_mempool_access_enabled
83
+ from warp.context import is_peer_access_supported, is_peer_access_enabled, set_peer_access_enabled
84
+
85
+ from warp.tape import Tape
86
+ from warp.utils import ScopedTimer, ScopedDevice, ScopedStream
87
+ from warp.utils import ScopedMempool, ScopedMempoolAccess, ScopedPeerAccess
88
+ from warp.utils import ScopedCapture
89
+ from warp.utils import transform_expand, quat_between_vectors
90
+ from warp.utils import TimingResult, timing_begin, timing_end, timing_print
91
+ from warp.utils import (
92
+ TIMING_KERNEL,
93
+ TIMING_KERNEL_BUILTIN,
94
+ TIMING_MEMCPY,
95
+ TIMING_MEMSET,
96
+ TIMING_GRAPH,
97
+ TIMING_ALL,
98
+ )
99
+
100
+ from warp.torch import from_torch, to_torch
101
+ from warp.torch import dtype_from_torch, dtype_to_torch
102
+ from warp.torch import device_from_torch, device_to_torch
103
+ from warp.torch import stream_from_torch, stream_to_torch
104
+
105
+ from warp.jax import from_jax, to_jax
106
+ from warp.jax import dtype_from_jax, dtype_to_jax
107
+ from warp.jax import device_from_jax, device_to_jax
108
+
109
+ from warp.dlpack import from_dlpack, to_dlpack
110
+
111
+ from warp.constants import *
112
+
113
+ from . import builtins
114
+
115
+ import warp.config
116
+
117
+ __version__ = warp.config.version
118
+
119
+
120
+ @over
121
+ def min(x: Scalar, y: Scalar) -> Scalar:
122
+ """Return the minimum of two scalars."""
123
+ ...
124
+
125
+
126
+ @over
127
+ def min(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
128
+ """Return the element-wise minimum of two vectors."""
129
+ ...
130
+
131
+
132
+ @over
133
+ def min(v: Vector[Any, Scalar]) -> Scalar:
134
+ """Return the minimum element of a vector ``v``."""
135
+ ...
136
+
137
+
138
+ @over
139
+ def max(x: Scalar, y: Scalar) -> Scalar:
140
+ """Return the maximum of two scalars."""
141
+ ...
142
+
143
+
144
+ @over
145
+ def max(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
146
+ """Return the element-wise maximum of two vectors."""
147
+ ...
148
+
149
+
150
+ @over
151
+ def max(v: Vector[Any, Scalar]) -> Scalar:
152
+ """Return the maximum element of a vector ``v``."""
153
+ ...
154
+
155
+
156
+ @over
157
+ def clamp(x: Scalar, a: Scalar, b: Scalar) -> Scalar:
158
+ """Clamp the value of ``x`` to the range [a, b]."""
159
+ ...
160
+
161
+
162
+ @over
163
+ def abs(x: Scalar) -> Scalar:
164
+ """Return the absolute value of ``x``."""
165
+ ...
166
+
167
+
168
+ @over
169
+ def sign(x: Scalar) -> Scalar:
170
+ """Return -1 if ``x`` < 0, return 1 otherwise."""
171
+ ...
172
+
173
+
174
+ @over
175
+ def step(x: Scalar) -> Scalar:
176
+ """Return 1.0 if ``x`` < 0.0, return 0.0 otherwise."""
177
+ ...
178
+
179
+
180
+ @over
181
+ def nonzero(x: Scalar) -> Scalar:
182
+ """Return 1.0 if ``x`` is not equal to zero, return 0.0 otherwise."""
183
+ ...
184
+
185
+
186
+ @over
187
+ def sin(x: Float) -> Float:
188
+ """Return the sine of ``x`` in radians."""
189
+ ...
190
+
191
+
192
+ @over
193
+ def cos(x: Float) -> Float:
194
+ """Return the cosine of ``x`` in radians."""
195
+ ...
196
+
197
+
198
+ @over
199
+ def acos(x: Float) -> Float:
200
+ """Return arccos of ``x`` in radians. Inputs are automatically clamped to [-1.0, 1.0]."""
201
+ ...
202
+
203
+
204
+ @over
205
+ def asin(x: Float) -> Float:
206
+ """Return arcsin of ``x`` in radians. Inputs are automatically clamped to [-1.0, 1.0]."""
207
+ ...
208
+
209
+
210
+ @over
211
+ def sqrt(x: Float) -> Float:
212
+ """Return the square root of ``x``, where ``x`` is positive."""
213
+ ...
214
+
215
+
216
+ @over
217
+ def cbrt(x: Float) -> Float:
218
+ """Return the cube root of ``x``."""
219
+ ...
220
+
221
+
222
+ @over
223
+ def tan(x: Float) -> Float:
224
+ """Return the tangent of ``x`` in radians."""
225
+ ...
226
+
227
+
228
+ @over
229
+ def atan(x: Float) -> Float:
230
+ """Return the arctangent of ``x`` in radians."""
231
+ ...
232
+
233
+
234
+ @over
235
+ def atan2(y: Float, x: Float) -> Float:
236
+ """Return the 2-argument arctangent, atan2, of the point ``(x, y)`` in radians."""
237
+ ...
238
+
239
+
240
+ @over
241
+ def sinh(x: Float) -> Float:
242
+ """Return the sinh of ``x``."""
243
+ ...
244
+
245
+
246
+ @over
247
+ def cosh(x: Float) -> Float:
248
+ """Return the cosh of ``x``."""
249
+ ...
250
+
251
+
252
+ @over
253
+ def tanh(x: Float) -> Float:
254
+ """Return the tanh of ``x``."""
255
+ ...
256
+
257
+
258
+ @over
259
+ def degrees(x: Float) -> Float:
260
+ """Convert ``x`` from radians into degrees."""
261
+ ...
262
+
263
+
264
+ @over
265
+ def radians(x: Float) -> Float:
266
+ """Convert ``x`` from degrees into radians."""
267
+ ...
268
+
269
+
270
+ @over
271
+ def log(x: Float) -> Float:
272
+ """Return the natural logarithm (base-e) of ``x``, where ``x`` is positive."""
273
+ ...
274
+
275
+
276
+ @over
277
+ def log2(x: Float) -> Float:
278
+ """Return the binary logarithm (base-2) of ``x``, where ``x`` is positive."""
279
+ ...
280
+
281
+
282
+ @over
283
+ def log10(x: Float) -> Float:
284
+ """Return the common logarithm (base-10) of ``x``, where ``x`` is positive."""
285
+ ...
286
+
287
+
288
+ @over
289
+ def exp(x: Float) -> Float:
290
+ """Return the value of the exponential function :math:`e^x`."""
291
+ ...
292
+
293
+
294
+ @over
295
+ def pow(x: Float, y: Float) -> Float:
296
+ """Return the result of ``x`` raised to power of ``y``."""
297
+ ...
298
+
299
+
300
+ @over
301
+ def round(x: Float) -> Float:
302
+ """Return the nearest integer value to ``x``, rounding halfway cases away from zero.
303
+
304
+ This is the most intuitive form of rounding in the colloquial sense, but can be slower than other options like :func:`warp.rint()`.
305
+ Differs from :func:`numpy.round()`, which behaves the same way as :func:`numpy.rint()`.
306
+ """
307
+ ...
308
+
309
+
310
+ @over
311
+ def rint(x: Float) -> Float:
312
+ """Return the nearest integer value to ``x``, rounding halfway cases to nearest even integer.
313
+
314
+ It is generally faster than :func:`warp.round()`. Equivalent to :func:`numpy.rint()`.
315
+ """
316
+ ...
317
+
318
+
319
+ @over
320
+ def trunc(x: Float) -> Float:
321
+ """Return the nearest integer that is closer to zero than ``x``.
322
+
323
+ In other words, it discards the fractional part of ``x``.
324
+ It is similar to casting ``float(int(x))``, but preserves the negative sign when x is in the range [-0.0, -1.0).
325
+ Equivalent to :func:`numpy.trunc()` and :func:`numpy.fix()`.
326
+ """
327
+ ...
328
+
329
+
330
+ @over
331
+ def floor(x: Float) -> Float:
332
+ """Return the largest integer that is less than or equal to ``x``."""
333
+ ...
334
+
335
+
336
+ @over
337
+ def ceil(x: Float) -> Float:
338
+ """Return the smallest integer that is greater than or equal to ``x``."""
339
+ ...
340
+
341
+
342
+ @over
343
+ def frac(x: Float) -> Float:
344
+ """Retrieve the fractional part of x.
345
+
346
+ In other words, it discards the integer part of x and is equivalent to ``x - trunc(x)``.
347
+ """
348
+ ...
349
+
350
+
351
+ @over
352
+ def isfinite(x: Scalar) -> bool:
353
+ """Return ``True`` if x is a finite number, otherwise return ``False``."""
354
+ ...
355
+
356
+
357
+ @over
358
+ def isfinite(x: Vector[Any, Scalar]) -> bool:
359
+ """Return ``True`` if all elements of the vector ``x`` are finite, otherwise return ``False``."""
360
+ ...
361
+
362
+
363
+ @over
364
+ def isfinite(x: Quaternion[Scalar]) -> bool:
365
+ """Return ``True`` if all elements of the quaternion ``x`` are finite, otherwise return ``False``."""
366
+ ...
367
+
368
+
369
+ @over
370
+ def isfinite(m: Matrix[Any, Any, Scalar]) -> bool:
371
+ """Return ``True`` if all elements of the matrix ``m`` are finite, otherwise return ``False``."""
372
+ ...
373
+
374
+
375
+ @over
376
+ def isnan(x: Scalar) -> bool:
377
+ """Return ``True`` if ``x`` is NaN, otherwise return ``False``."""
378
+ ...
379
+
380
+
381
+ @over
382
+ def isnan(x: Vector[Any, Scalar]) -> bool:
383
+ """Return ``True`` if any element of the vector ``x`` is NaN, otherwise return ``False``."""
384
+ ...
385
+
386
+
387
+ @over
388
+ def isnan(x: Quaternion[Scalar]) -> bool:
389
+ """Return ``True`` if any element of the quaternion ``x`` is NaN, otherwise return ``False``."""
390
+ ...
391
+
392
+
393
+ @over
394
+ def isnan(m: Matrix[Any, Any, Scalar]) -> bool:
395
+ """Return ``True`` if any element of the matrix ``m`` is NaN, otherwise return ``False``."""
396
+ ...
397
+
398
+
399
+ @over
400
+ def isinf(x: Scalar) -> bool:
401
+ """Return ``True`` if x is positive or negative infinity, otherwise return ``False``."""
402
+ ...
403
+
404
+
405
+ @over
406
+ def isinf(x: Vector[Any, Scalar]) -> bool:
407
+ """Return ``True`` if any element of the vector ``x`` is positive or negative infinity, otherwise return ``False``."""
408
+ ...
409
+
410
+
411
+ @over
412
+ def isinf(x: Quaternion[Scalar]) -> bool:
413
+ """Return ``True`` if any element of the quaternion ``x`` is positive or negative infinity, otherwise return ``False``."""
414
+ ...
415
+
416
+
417
+ @over
418
+ def isinf(m: Matrix[Any, Any, Scalar]) -> bool:
419
+ """Return ``True`` if any element of the matrix ``m`` is positive or negative infinity, otherwise return ``False``."""
420
+ ...
421
+
422
+
423
+ @over
424
+ def dot(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Scalar:
425
+ """Compute the dot product between two vectors."""
426
+ ...
427
+
428
+
429
+ @over
430
+ def dot(x: Quaternion[Float], y: Quaternion[Float]) -> Scalar:
431
+ """Compute the dot product between two quaternions."""
432
+ ...
433
+
434
+
435
+ @over
436
+ def ddot(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Scalar:
437
+ """Compute the double dot product between two matrices."""
438
+ ...
439
+
440
+
441
+ @over
442
+ def argmin(v: Vector[Any, Scalar]) -> uint32:
443
+ """Return the index of the minimum element of a vector ``v``."""
444
+ ...
445
+
446
+
447
+ @over
448
+ def argmax(v: Vector[Any, Scalar]) -> uint32:
449
+ """Return the index of the maximum element of a vector ``v``."""
450
+ ...
451
+
452
+
453
+ @over
454
+ def outer(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Matrix[Any, Any, Scalar]:
455
+ """Compute the outer product ``x*y^T`` for two vectors."""
456
+ ...
457
+
458
+
459
+ @over
460
+ def cross(x: Vector[3, Scalar], y: Vector[3, Scalar]) -> Vector[3, Scalar]:
461
+ """Compute the cross product of two 3D vectors."""
462
+ ...
463
+
464
+
465
+ @over
466
+ def skew(x: Vector[3, Scalar]):
467
+ """Compute the skew-symmetric 3x3 matrix for a 3D vector ``x``."""
468
+ ...
469
+
470
+
471
+ @over
472
+ def length(x: Vector[Any, Float]) -> Scalar:
473
+ """Compute the length of a floating-point vector ``x``."""
474
+ ...
475
+
476
+
477
+ @over
478
+ def length(x: Quaternion[Float]) -> Scalar:
479
+ """Compute the length of a quaternion ``x``."""
480
+ ...
481
+
482
+
483
+ @over
484
+ def length_sq(x: Vector[Any, Scalar]) -> Scalar:
485
+ """Compute the squared length of a vector ``x``."""
486
+ ...
487
+
488
+
489
+ @over
490
+ def length_sq(x: Quaternion[Scalar]) -> Scalar:
491
+ """Compute the squared length of a quaternion ``x``."""
492
+ ...
493
+
494
+
495
+ @over
496
+ def normalize(x: Vector[Any, Float]) -> Vector[Any, Scalar]:
497
+ """Compute the normalized value of ``x``. If ``length(x)`` is 0 then the zero vector is returned."""
498
+ ...
499
+
500
+
501
+ @over
502
+ def normalize(x: Quaternion[Float]) -> Quaternion[Scalar]:
503
+ """Compute the normalized value of ``x``. If ``length(x)`` is 0, then the zero quaternion is returned."""
504
+ ...
505
+
506
+
507
+ @over
508
+ def transpose(m: Matrix[Any, Any, Scalar]):
509
+ """Return the transpose of the matrix ``m``."""
510
+ ...
511
+
512
+
513
+ @over
514
+ def inverse(m: Matrix[2, 2, Float]) -> Matrix[Any, Any, Float]:
515
+ """Return the inverse of a 2x2 matrix ``m``."""
516
+ ...
517
+
518
+
519
+ @over
520
+ def inverse(m: Matrix[3, 3, Float]) -> Matrix[Any, Any, Float]:
521
+ """Return the inverse of a 3x3 matrix ``m``."""
522
+ ...
523
+
524
+
525
+ @over
526
+ def inverse(m: Matrix[4, 4, Float]) -> Matrix[Any, Any, Float]:
527
+ """Return the inverse of a 4x4 matrix ``m``."""
528
+ ...
529
+
530
+
531
+ @over
532
+ def determinant(m: Matrix[2, 2, Float]) -> Scalar:
533
+ """Return the determinant of a 2x2 matrix ``m``."""
534
+ ...
535
+
536
+
537
+ @over
538
+ def determinant(m: Matrix[3, 3, Float]) -> Scalar:
539
+ """Return the determinant of a 3x3 matrix ``m``."""
540
+ ...
541
+
542
+
543
+ @over
544
+ def determinant(m: Matrix[4, 4, Float]) -> Scalar:
545
+ """Return the determinant of a 4x4 matrix ``m``."""
546
+ ...
547
+
548
+
549
+ @over
550
+ def trace(m: Matrix[Any, Any, Scalar]) -> Scalar:
551
+ """Return the trace of the matrix ``m``."""
552
+ ...
553
+
554
+
555
+ @over
556
+ def diag(d: Vector[Any, Scalar]) -> Matrix[Any, Any, Scalar]:
557
+ """Returns a matrix with the components of the vector ``d`` on the diagonal."""
558
+ ...
559
+
560
+
561
+ @over
562
+ def get_diag(m: Matrix[Any, Any, Scalar]) -> Vector[Any, Scalar]:
563
+ """Returns a vector containing the diagonal elements of the square matrix ``m``."""
564
+ ...
565
+
566
+
567
+ @over
568
+ def cw_mul(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
569
+ """Component-wise multiplication of two vectors."""
570
+ ...
571
+
572
+
573
+ @over
574
+ def cw_mul(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
575
+ """Component-wise multiplication of two matrices."""
576
+ ...
577
+
578
+
579
+ @over
580
+ def cw_div(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
581
+ """Component-wise division of two vectors."""
582
+ ...
583
+
584
+
585
+ @over
586
+ def cw_div(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
587
+ """Component-wise division of two matrices."""
588
+ ...
589
+
590
+
591
+ @over
592
+ def quat_identity() -> quatf:
593
+ """Construct an identity quaternion with zero imaginary part and real part of 1.0"""
594
+ ...
595
+
596
+
597
+ @over
598
+ def quat_from_axis_angle(axis: Vector[3, Float], angle: Float) -> Quaternion[Scalar]:
599
+ """Construct a quaternion representing a rotation of angle radians around the given axis."""
600
+ ...
601
+
602
+
603
+ @over
604
+ def quat_to_axis_angle(q: Quaternion[Float], axis: Vector[3, Float], angle: Float):
605
+ """Extract the rotation axis and angle radians a quaternion represents."""
606
+ ...
607
+
608
+
609
+ @over
610
+ def quat_from_matrix(m: Matrix[3, 3, Float]) -> Quaternion[Scalar]:
611
+ """Construct a quaternion from a 3x3 matrix."""
612
+ ...
613
+
614
+
615
+ @over
616
+ def quat_rpy(roll: Float, pitch: Float, yaw: Float) -> Quaternion[Scalar]:
617
+ """Construct a quaternion representing a combined roll (z), pitch (x), yaw rotations (y) in radians."""
618
+ ...
619
+
620
+
621
+ @over
622
+ def quat_inverse(q: Quaternion[Float]) -> Quaternion[Scalar]:
623
+ """Compute quaternion conjugate."""
624
+ ...
625
+
626
+
627
+ @over
628
+ def quat_rotate(q: Quaternion[Float], p: Vector[3, Float]) -> Vector[3, Scalar]:
629
+ """Rotate a vector by a quaternion."""
630
+ ...
631
+
632
+
633
+ @over
634
+ def quat_rotate_inv(q: Quaternion[Float], p: Vector[3, Float]) -> Vector[3, Scalar]:
635
+ """Rotate a vector by the inverse of a quaternion."""
636
+ ...
637
+
638
+
639
+ @over
640
+ def quat_slerp(q0: Quaternion[Float], q1: Quaternion[Float], t: Float) -> Quaternion[Scalar]:
641
+ """Linearly interpolate between two quaternions."""
642
+ ...
643
+
644
+
645
+ @over
646
+ def quat_to_matrix(q: Quaternion[Float]) -> Matrix[3, 3, Scalar]:
647
+ """Convert a quaternion to a 3x3 rotation matrix."""
648
+ ...
649
+
650
+
651
+ @over
652
+ def transform_identity() -> transformf:
653
+ """Construct an identity transform with zero translation and identity rotation."""
654
+ ...
655
+
656
+
657
+ @over
658
+ def transform_get_translation(t: Transformation[Float]) -> Vector[3, Scalar]:
659
+ """Return the translational part of a transform ``t``."""
660
+ ...
661
+
662
+
663
+ @over
664
+ def transform_get_rotation(t: Transformation[Float]) -> Quaternion[Scalar]:
665
+ """Return the rotational part of a transform ``t``."""
666
+ ...
667
+
668
+
669
+ @over
670
+ def transform_multiply(a: Transformation[Float], b: Transformation[Float]) -> Transformation[Scalar]:
671
+ """Multiply two rigid body transformations together."""
672
+ ...
673
+
674
+
675
+ @over
676
+ def transform_point(t: Transformation[Scalar], p: Vector[3, Scalar]) -> Vector[3, Scalar]:
677
+ """Apply the transform to a point ``p`` treating the homogeneous coordinate as w=1 (translation and rotation)."""
678
+ ...
679
+
680
+
681
+ @over
682
+ def transform_point(m: Matrix[4, 4, Scalar], p: Vector[3, Scalar]) -> Vector[3, Scalar]:
683
+ """Apply the transform to a point ``p`` treating the homogeneous coordinate as w=1.
684
+
685
+ The transformation is applied treating ``p`` as a column vector, e.g.: ``y = M*p``.
686
+ Note this is in contrast to some libraries, notably USD, which applies transforms to row vectors, ``y^T = p^T*M^T``.
687
+ If the transform is coming from a library that uses row-vectors, then users should transpose the transformation
688
+ matrix before calling this method.
689
+ """
690
+ ...
691
+
692
+
693
+ @over
694
+ def transform_vector(t: Transformation[Scalar], v: Vector[3, Scalar]) -> Vector[3, Scalar]:
695
+ """Apply the transform to a vector ``v`` treating the homogeneous coordinate as w=0 (rotation only)."""
696
+ ...
697
+
698
+
699
+ @over
700
+ def transform_vector(m: Matrix[4, 4, Scalar], v: Vector[3, Scalar]) -> Vector[3, Scalar]:
701
+ """Apply the transform to a vector ``v`` treating the homogeneous coordinate as w=0.
702
+
703
+ The transformation is applied treating ``v`` as a column vector, e.g.: ``y = M*v``
704
+ note this is in contrast to some libraries, notably USD, which applies transforms to row vectors, ``y^T = v^T*M^T``.
705
+ If the transform is coming from a library that uses row-vectors, then users should transpose the transformation
706
+ matrix before calling this method.
707
+ """
708
+ ...
709
+
710
+
711
+ @over
712
+ def transform_inverse(t: Transformation[Float]) -> Transformation[Float]:
713
+ """Compute the inverse of the transformation ``t``."""
714
+ ...
715
+
716
+
717
+ @over
718
+ def spatial_dot(a: Vector[6, Float], b: Vector[6, Float]) -> Scalar:
719
+ """Compute the dot product of two 6D screw vectors."""
720
+ ...
721
+
722
+
723
+ @over
724
+ def spatial_cross(a: Vector[6, Float], b: Vector[6, Float]) -> Vector[6, Float]:
725
+ """Compute the cross product of two 6D screw vectors."""
726
+ ...
727
+
728
+
729
+ @over
730
+ def spatial_cross_dual(a: Vector[6, Float], b: Vector[6, Float]) -> Vector[6, Float]:
731
+ """Compute the dual cross product of two 6D screw vectors."""
732
+ ...
733
+
734
+
735
+ @over
736
+ def spatial_top(a: Vector[6, Float]):
737
+ """Return the top (first) part of a 6D screw vector."""
738
+ ...
739
+
740
+
741
+ @over
742
+ def spatial_bottom(a: Vector[6, Float]):
743
+ """Return the bottom (second) part of a 6D screw vector."""
744
+ ...
745
+
746
+
747
+ @over
748
+ def spatial_jacobian(
749
+ S: Array[Vector[6, Float]],
750
+ joint_parents: Array[int32],
751
+ joint_qd_start: Array[int32],
752
+ joint_start: int32,
753
+ joint_count: int32,
754
+ J_start: int32,
755
+ J_out: Array[Float],
756
+ ):
757
+ """ """
758
+ ...
759
+
760
+
761
+ @over
762
+ def spatial_mass(
763
+ I_s: Array[Matrix[6, 6, Float]], joint_start: int32, joint_count: int32, M_start: int32, M: Array[Float]
764
+ ):
765
+ """ """
766
+ ...
767
+
768
+
769
+ @over
770
+ def mlp(
771
+ weights: Array[float32],
772
+ bias: Array[float32],
773
+ activation: Callable,
774
+ index: int32,
775
+ x: Array[float32],
776
+ out: Array[float32],
777
+ ):
778
+ """Evaluate a multi-layer perceptron (MLP) layer in the form: ``out = act(weights*x + bias)``.
779
+
780
+ :param weights: A layer's network weights with dimensions ``(m, n)``.
781
+ :param bias: An array with dimensions ``(n)``.
782
+ :param activation: A ``wp.func`` function that takes a single scalar float as input and returns a scalar float as output
783
+ :param index: The batch item to process, typically each thread will process one item in the batch, in which case
784
+ index should be ``wp.tid()``
785
+ :param x: The feature matrix with dimensions ``(n, b)``
786
+ :param out: The network output with dimensions ``(m, b)``
787
+
788
+ :note: Feature and output matrices are transposed compared to some other frameworks such as PyTorch.
789
+ All matrices are assumed to be stored in flattened row-major memory layout (NumPy default).
790
+ """
791
+ ...
792
+
793
+
794
+ @over
795
+ def bvh_query_aabb(id: uint64, lower: vec3f, upper: vec3f) -> bvh_query_t:
796
+ """Construct an axis-aligned bounding box query against a BVH object.
797
+
798
+ This query can be used to iterate over all bounds inside a BVH.
799
+
800
+ :param id: The BVH identifier
801
+ :param lower: The lower bound of the bounding box in BVH space
802
+ :param upper: The upper bound of the bounding box in BVH space
803
+ """
804
+ ...
805
+
806
+
807
+ @over
808
+ def bvh_query_ray(id: uint64, start: vec3f, dir: vec3f) -> bvh_query_t:
809
+ """Construct a ray query against a BVH object.
810
+
811
+ This query can be used to iterate over all bounds that intersect the ray.
812
+
813
+ :param id: The BVH identifier
814
+ :param start: The start of the ray in BVH space
815
+ :param dir: The direction of the ray in BVH space
816
+ """
817
+ ...
818
+
819
+
820
+ @over
821
+ def bvh_query_next(query: bvh_query_t, index: int32) -> bool:
822
+ """Move to the next bound returned by the query.
823
+ The index of the current bound is stored in ``index``, returns ``False`` if there are no more overlapping bound.
824
+ """
825
+ ...
826
+
827
+
828
+ @over
829
+ def mesh_query_point(id: uint64, point: vec3f, max_dist: float32) -> mesh_query_point_t:
830
+ """Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
831
+
832
+ Identifies the sign of the distance using additional ray-casts to determine if the point is inside or outside.
833
+ This method is relatively robust, but does increase computational cost.
834
+ See below for additional sign determination methods.
835
+
836
+ :param id: The mesh identifier
837
+ :param point: The point in space to query
838
+ :param max_dist: Mesh faces above this distance will not be considered by the query
839
+ """
840
+ ...
841
+
842
+
843
+ @over
844
+ def mesh_query_point_no_sign(id: uint64, point: vec3f, max_dist: float32) -> mesh_query_point_t:
845
+ """Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
846
+
847
+ This method does not compute the sign of the point (inside/outside) which makes it faster than other point query methods.
848
+
849
+ :param id: The mesh identifier
850
+ :param point: The point in space to query
851
+ :param max_dist: Mesh faces above this distance will not be considered by the query
852
+ """
853
+ ...
854
+
855
+
856
+ @over
857
+ def mesh_query_furthest_point_no_sign(id: uint64, point: vec3f, min_dist: float32) -> mesh_query_point_t:
858
+ """Computes the furthest point on the mesh with identifier `id` to the given point in space.
859
+
860
+ This method does not compute the sign of the point (inside/outside).
861
+
862
+ :param id: The mesh identifier
863
+ :param point: The point in space to query
864
+ :param min_dist: Mesh faces below this distance will not be considered by the query
865
+ """
866
+ ...
867
+
868
+
869
+ @over
870
+ def mesh_query_point_sign_normal(id: uint64, point: vec3f, max_dist: float32, epsilon: float32) -> mesh_query_point_t:
871
+ """Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
872
+
873
+ Identifies the sign of the distance (inside/outside) using the angle-weighted pseudo normal.
874
+ This approach to sign determination is robust for well conditioned meshes that are watertight and non-self intersecting.
875
+ It is also comparatively fast to compute.
876
+
877
+ :param id: The mesh identifier
878
+ :param point: The point in space to query
879
+ :param max_dist: Mesh faces above this distance will not be considered by the query
880
+ :param epsilon: Epsilon treating distance values as equal, when locating the minimum distance vertex/face/edge, as a
881
+ fraction of the average edge length, also for treating closest point as being on edge/vertex default 1e-3
882
+ """
883
+ ...
884
+
885
+
886
+ @over
887
+ def mesh_query_point_sign_winding_number(
888
+ id: uint64, point: vec3f, max_dist: float32, accuracy: float32, threshold: float32
889
+ ) -> mesh_query_point_t:
890
+ """Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given point in space.
891
+
892
+ Identifies the sign using the winding number of the mesh relative to the query point. This method of sign determination is robust for poorly conditioned meshes
893
+ and provides a smooth approximation to sign even when the mesh is not watertight. This method is the most robust and accurate of the sign determination meshes
894
+ but also the most expensive.
895
+
896
+ .. note:: The :class:`Mesh` object must be constructed with ``support_winding_number=True`` for this method to return correct results.
897
+
898
+ :param id: The mesh identifier
899
+ :param point: The point in space to query
900
+ :param max_dist: Mesh faces above this distance will not be considered by the query
901
+ :param accuracy: Accuracy for computing the winding number with fast winding number method utilizing second-order dipole approximation, default 2.0
902
+ :param threshold: The threshold of the winding number to be considered inside, default 0.5
903
+ """
904
+ ...
905
+
906
+
907
+ @over
908
+ def mesh_query_ray(id: uint64, start: vec3f, dir: vec3f, max_t: float32) -> mesh_query_ray_t:
909
+ """Computes the closest ray hit on the :class:`Mesh` with identifier ``id``.
910
+
911
+ :param id: The mesh identifier
912
+ :param start: The start point of the ray
913
+ :param dir: The ray direction (should be normalized)
914
+ :param max_t: The maximum distance along the ray to check for intersections
915
+ """
916
+ ...
917
+
918
+
919
+ @over
920
+ def mesh_query_aabb(id: uint64, lower: vec3f, upper: vec3f) -> mesh_query_aabb_t:
921
+ """Construct an axis-aligned bounding box query against a :class:`Mesh`.
922
+
923
+ This query can be used to iterate over all triangles inside a volume.
924
+
925
+ :param id: The mesh identifier
926
+ :param lower: The lower bound of the bounding box in mesh space
927
+ :param upper: The upper bound of the bounding box in mesh space
928
+ """
929
+ ...
930
+
931
+
932
+ @over
933
+ def mesh_query_aabb_next(query: mesh_query_aabb_t, index: int32) -> bool:
934
+ """Move to the next triangle overlapping the query bounding box.
935
+
936
+ The index of the current face is stored in ``index``, returns ``False`` if there are no more overlapping triangles.
937
+ """
938
+ ...
939
+
940
+
941
+ @over
942
+ def mesh_eval_position(id: uint64, face: int32, bary_u: float32, bary_v: float32) -> vec3f:
943
+ """Evaluates the position on the :class:`Mesh` given a face index and barycentric coordinates."""
944
+ ...
945
+
946
+
947
+ @over
948
+ def mesh_eval_velocity(id: uint64, face: int32, bary_u: float32, bary_v: float32) -> vec3f:
949
+ """Evaluates the velocity on the :class:`Mesh` given a face index and barycentric coordinates."""
950
+ ...
951
+
952
+
953
+ @over
954
+ def hash_grid_query(id: uint64, point: vec3f, max_dist: float32) -> hash_grid_query_t:
955
+ """Construct a point query against a :class:`HashGrid`.
956
+
957
+ This query can be used to iterate over all neighboring point within a fixed radius from the query point.
958
+ """
959
+ ...
960
+
961
+
962
+ @over
963
+ def hash_grid_query_next(query: hash_grid_query_t, index: int32) -> bool:
964
+ """Move to the next point in the hash grid query.
965
+
966
+ The index of the current neighbor is stored in ``index``, returns ``False`` if there are no more neighbors.
967
+ """
968
+ ...
969
+
970
+
971
+ @over
972
+ def hash_grid_point_id(id: uint64, index: int32) -> int:
973
+ """Return the index of a point in the :class:`HashGrid`.
974
+
975
+ This can be used to reorder threads such that grid traversal occurs in a spatially coherent order.
976
+
977
+ Returns -1 if the :class:`HashGrid` has not been reserved.
978
+ """
979
+ ...
980
+
981
+
982
+ @over
983
+ def intersect_tri_tri(v0: vec3f, v1: vec3f, v2: vec3f, u0: vec3f, u1: vec3f, u2: vec3f) -> int:
984
+ """Tests for intersection between two triangles (v0, v1, v2) and (u0, u1, u2) using Moller's method.
985
+
986
+ Returns > 0 if triangles intersect.
987
+ """
988
+ ...
989
+
990
+
991
+ @over
992
+ def mesh_get(id: uint64) -> Mesh:
993
+ """Retrieves the mesh given its index."""
994
+ ...
995
+
996
+
997
+ @over
998
+ def mesh_eval_face_normal(id: uint64, face: int32) -> vec3f:
999
+ """Evaluates the face normal the mesh given a face index."""
1000
+ ...
1001
+
1002
+
1003
+ @over
1004
+ def mesh_get_point(id: uint64, index: int32) -> vec3f:
1005
+ """Returns the point of the mesh given a index."""
1006
+ ...
1007
+
1008
+
1009
+ @over
1010
+ def mesh_get_velocity(id: uint64, index: int32) -> vec3f:
1011
+ """Returns the velocity of the mesh given a index."""
1012
+ ...
1013
+
1014
+
1015
+ @over
1016
+ def mesh_get_index(id: uint64, index: int32) -> int:
1017
+ """Returns the point-index of the mesh given a face-vertex index."""
1018
+ ...
1019
+
1020
+
1021
+ @over
1022
+ def closest_point_edge_edge(p1: vec3f, q1: vec3f, p2: vec3f, q2: vec3f, epsilon: float32) -> vec3f:
1023
+ """Finds the closest points between two edges.
1024
+
1025
+ Returns barycentric weights to the points on each edge, as well as the closest distance between the edges.
1026
+
1027
+ :param p1: First point of first edge
1028
+ :param q1: Second point of first edge
1029
+ :param p2: First point of second edge
1030
+ :param q2: Second point of second edge
1031
+ :param epsilon: Zero tolerance for determining if points in an edge are degenerate.
1032
+ :param out: vec3 output containing (s,t,d), where `s` in [0,1] is the barycentric weight for the first edge, `t` is the barycentric weight for the second edge, and `d` is the distance between the two edges at these two closest points.
1033
+ """
1034
+ ...
1035
+
1036
+
1037
+ @over
1038
+ def volume_sample_f(id: uint64, uvw: vec3f, sampling_mode: int32) -> float:
1039
+ """Sample the volume given by ``id`` at the volume local-space point ``uvw``.
1040
+
1041
+ Interpolation should be :attr:`warp.Volume.CLOSEST` or :attr:`wp.Volume.LINEAR.`
1042
+ """
1043
+ ...
1044
+
1045
+
1046
+ @over
1047
+ def volume_sample_grad_f(id: uint64, uvw: vec3f, sampling_mode: int32, grad: vec3f) -> float:
1048
+ """Sample the volume and its gradient given by ``id`` at the volume local-space point ``uvw``.
1049
+
1050
+ Interpolation should be :attr:`warp.Volume.CLOSEST` or :attr:`wp.Volume.LINEAR.`
1051
+ """
1052
+ ...
1053
+
1054
+
1055
+ @over
1056
+ def volume_lookup_f(id: uint64, i: int32, j: int32, k: int32) -> float:
1057
+ """Returns the value of voxel with coordinates ``i``, ``j``, ``k``.
1058
+
1059
+ If the voxel at this index does not exist, this function returns the background value
1060
+ """
1061
+ ...
1062
+
1063
+
1064
+ @over
1065
+ def volume_store_f(id: uint64, i: int32, j: int32, k: int32, value: float32):
1066
+ """Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``."""
1067
+ ...
1068
+
1069
+
1070
+ @over
1071
+ def volume_sample_v(id: uint64, uvw: vec3f, sampling_mode: int32) -> vec3f:
1072
+ """Sample the vector volume given by ``id`` at the volume local-space point ``uvw``.
1073
+
1074
+ Interpolation should be :attr:`warp.Volume.CLOSEST` or :attr:`wp.Volume.LINEAR.`
1075
+ """
1076
+ ...
1077
+
1078
+
1079
+ @over
1080
+ def volume_lookup_v(id: uint64, i: int32, j: int32, k: int32) -> vec3f:
1081
+ """Returns the vector value of voxel with coordinates ``i``, ``j``, ``k``.
1082
+
1083
+ If the voxel at this index does not exist, this function returns the background value.
1084
+ """
1085
+ ...
1086
+
1087
+
1088
+ @over
1089
+ def volume_store_v(id: uint64, i: int32, j: int32, k: int32, value: vec3f):
1090
+ """Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``."""
1091
+ ...
1092
+
1093
+
1094
+ @over
1095
+ def volume_sample_i(id: uint64, uvw: vec3f) -> int:
1096
+ """Sample the :class:`int32` volume given by ``id`` at the volume local-space point ``uvw``."""
1097
+ ...
1098
+
1099
+
1100
+ @over
1101
+ def volume_lookup_i(id: uint64, i: int32, j: int32, k: int32) -> int:
1102
+ """Returns the :class:`int32` value of voxel with coordinates ``i``, ``j``, ``k``.
1103
+
1104
+ If the voxel at this index does not exist, this function returns the background value.
1105
+ """
1106
+ ...
1107
+
1108
+
1109
+ @over
1110
+ def volume_store_i(id: uint64, i: int32, j: int32, k: int32, value: int32):
1111
+ """Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``."""
1112
+ ...
1113
+
1114
+
1115
+ @over
1116
+ def volume_lookup_index(id: uint64, i: int32, j: int32, k: int32) -> int32:
1117
+ """Returns the index associated to the voxel with coordinates ``i``, ``j``, ``k``.
1118
+
1119
+ If the voxel at this index does not exist, this function returns -1.
1120
+ This function is available for both index grids and classical volumes.
1121
+
1122
+ """
1123
+ ...
1124
+
1125
+
1126
+ @over
1127
+ def volume_index_to_world(id: uint64, uvw: vec3f) -> vec3f:
1128
+ """Transform a point ``uvw`` defined in volume index space to world space given the volume's intrinsic affine transformation."""
1129
+ ...
1130
+
1131
+
1132
+ @over
1133
+ def volume_world_to_index(id: uint64, xyz: vec3f) -> vec3f:
1134
+ """Transform a point ``xyz`` defined in volume world space to the volume's index space given the volume's intrinsic affine transformation."""
1135
+ ...
1136
+
1137
+
1138
+ @over
1139
+ def volume_index_to_world_dir(id: uint64, uvw: vec3f) -> vec3f:
1140
+ """Transform a direction ``uvw`` defined in volume index space to world space given the volume's intrinsic affine transformation."""
1141
+ ...
1142
+
1143
+
1144
+ @over
1145
+ def volume_world_to_index_dir(id: uint64, xyz: vec3f) -> vec3f:
1146
+ """Transform a direction ``xyz`` defined in volume world space to the volume's index space given the volume's intrinsic affine transformation."""
1147
+ ...
1148
+
1149
+
1150
+ @over
1151
+ def rand_init(seed: int32) -> uint32:
1152
+ """Initialize a new random number generator given a user-defined seed. Returns a 32-bit integer representing the RNG state."""
1153
+ ...
1154
+
1155
+
1156
+ @over
1157
+ def rand_init(seed: int32, offset: int32) -> uint32:
1158
+ """Initialize a new random number generator given a user-defined seed and an offset.
1159
+
1160
+ This alternative constructor can be useful in parallel programs, where a kernel as a whole should share a seed,
1161
+ but each thread should generate uncorrelated values. In this case usage should be ``r = rand_init(seed, tid)``
1162
+ """
1163
+ ...
1164
+
1165
+
1166
+ @over
1167
+ def randi(state: uint32) -> int:
1168
+ """Return a random integer in the range [0, 2^32)."""
1169
+ ...
1170
+
1171
+
1172
+ @over
1173
+ def randi(state: uint32, min: int32, max: int32) -> int:
1174
+ """Return a random integer between [min, max)."""
1175
+ ...
1176
+
1177
+
1178
+ @over
1179
+ def randf(state: uint32) -> float:
1180
+ """Return a random float between [0.0, 1.0)."""
1181
+ ...
1182
+
1183
+
1184
+ @over
1185
+ def randf(state: uint32, min: float32, max: float32) -> float:
1186
+ """Return a random float between [min, max)."""
1187
+ ...
1188
+
1189
+
1190
+ @over
1191
+ def randn(state: uint32) -> float:
1192
+ """Sample a normal distribution."""
1193
+ ...
1194
+
1195
+
1196
+ @over
1197
+ def sample_cdf(state: uint32, cdf: Array[float32]) -> int:
1198
+ """Inverse-transform sample a cumulative distribution function."""
1199
+ ...
1200
+
1201
+
1202
+ @over
1203
+ def sample_triangle(state: uint32) -> vec2f:
1204
+ """Uniformly sample a triangle. Returns sample barycentric coordinates."""
1205
+ ...
1206
+
1207
+
1208
+ @over
1209
+ def sample_unit_ring(state: uint32) -> vec2f:
1210
+ """Uniformly sample a ring in the xy plane."""
1211
+ ...
1212
+
1213
+
1214
+ @over
1215
+ def sample_unit_disk(state: uint32) -> vec2f:
1216
+ """Uniformly sample a disk in the xy plane."""
1217
+ ...
1218
+
1219
+
1220
+ @over
1221
+ def sample_unit_sphere_surface(state: uint32) -> vec3f:
1222
+ """Uniformly sample a unit sphere surface."""
1223
+ ...
1224
+
1225
+
1226
+ @over
1227
+ def sample_unit_sphere(state: uint32) -> vec3f:
1228
+ """Uniformly sample a unit sphere."""
1229
+ ...
1230
+
1231
+
1232
+ @over
1233
+ def sample_unit_hemisphere_surface(state: uint32) -> vec3f:
1234
+ """Uniformly sample a unit hemisphere surface."""
1235
+ ...
1236
+
1237
+
1238
+ @over
1239
+ def sample_unit_hemisphere(state: uint32) -> vec3f:
1240
+ """Uniformly sample a unit hemisphere."""
1241
+ ...
1242
+
1243
+
1244
+ @over
1245
+ def sample_unit_square(state: uint32) -> vec2f:
1246
+ """Uniformly sample a unit square."""
1247
+ ...
1248
+
1249
+
1250
+ @over
1251
+ def sample_unit_cube(state: uint32) -> vec3f:
1252
+ """Uniformly sample a unit cube."""
1253
+ ...
1254
+
1255
+
1256
+ @over
1257
+ def poisson(state: uint32, lam: float32) -> uint32:
1258
+ """Generate a random sample from a Poisson distribution.
1259
+
1260
+ :param state: RNG state
1261
+ :param lam: The expected value of the distribution
1262
+ """
1263
+ ...
1264
+
1265
+
1266
+ @over
1267
+ def noise(state: uint32, x: float32) -> float:
1268
+ """Non-periodic Perlin-style noise in 1D."""
1269
+ ...
1270
+
1271
+
1272
+ @over
1273
+ def noise(state: uint32, xy: vec2f) -> float:
1274
+ """Non-periodic Perlin-style noise in 2D."""
1275
+ ...
1276
+
1277
+
1278
+ @over
1279
+ def noise(state: uint32, xyz: vec3f) -> float:
1280
+ """Non-periodic Perlin-style noise in 3D."""
1281
+ ...
1282
+
1283
+
1284
+ @over
1285
+ def noise(state: uint32, xyzt: vec4f) -> float:
1286
+ """Non-periodic Perlin-style noise in 4D."""
1287
+ ...
1288
+
1289
+
1290
+ @over
1291
+ def pnoise(state: uint32, x: float32, px: int32) -> float:
1292
+ """Periodic Perlin-style noise in 1D."""
1293
+ ...
1294
+
1295
+
1296
+ @over
1297
+ def pnoise(state: uint32, xy: vec2f, px: int32, py: int32) -> float:
1298
+ """Periodic Perlin-style noise in 2D."""
1299
+ ...
1300
+
1301
+
1302
+ @over
1303
+ def pnoise(state: uint32, xyz: vec3f, px: int32, py: int32, pz: int32) -> float:
1304
+ """Periodic Perlin-style noise in 3D."""
1305
+ ...
1306
+
1307
+
1308
+ @over
1309
+ def pnoise(state: uint32, xyzt: vec4f, px: int32, py: int32, pz: int32, pt: int32) -> float:
1310
+ """Periodic Perlin-style noise in 4D."""
1311
+ ...
1312
+
1313
+
1314
+ @over
1315
+ def curlnoise(state: uint32, xy: vec2f, octaves: uint32, lacunarity: float32, gain: float32) -> vec2f:
1316
+ """Divergence-free vector field based on the gradient of a Perlin noise function."""
1317
+ ...
1318
+
1319
+
1320
+ @over
1321
+ def curlnoise(state: uint32, xyz: vec3f, octaves: uint32, lacunarity: float32, gain: float32) -> vec3f:
1322
+ """Divergence-free vector field based on the curl of three Perlin noise functions."""
1323
+ ...
1324
+
1325
+
1326
+ @over
1327
+ def curlnoise(state: uint32, xyzt: vec4f, octaves: uint32, lacunarity: float32, gain: float32) -> vec3f:
1328
+ """Divergence-free vector field based on the curl of three Perlin noise functions."""
1329
+ ...
1330
+
1331
+
1332
+ @over
1333
+ def printf():
1334
+ """Allows printing formatted strings using C-style format specifiers."""
1335
+ ...
1336
+
1337
+
1338
+ @over
1339
+ def tid() -> Tuple[int, int]:
1340
+ """Return the current thread indices for a 2D kernel launch.
1341
+
1342
+ Use ``i,j = wp.tid()`` syntax to retrieve the coordinates inside the kernel thread grid.
1343
+
1344
+ This function may not be called from user-defined Warp functions.
1345
+ """
1346
+ ...
1347
+
1348
+
1349
+ @over
1350
+ def tid() -> Tuple[int, int, int]:
1351
+ """Return the current thread indices for a 3D kernel launch.
1352
+
1353
+ Use ``i,j,k = wp.tid()`` syntax to retrieve the coordinates inside the kernel thread grid.
1354
+
1355
+ This function may not be called from user-defined Warp functions.
1356
+ """
1357
+ ...
1358
+
1359
+
1360
+ @over
1361
+ def tid() -> Tuple[int, int, int, int]:
1362
+ """Return the current thread indices for a 4D kernel launch.
1363
+
1364
+ Use ``i,j,k,l = wp.tid()`` syntax to retrieve the coordinates inside the kernel thread grid.
1365
+
1366
+ This function may not be called from user-defined Warp functions.
1367
+ """
1368
+ ...
1369
+
1370
+
1371
+ @over
1372
+ def select(cond: bool, arg1: Any, arg2: Any):
1373
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1374
+ ...
1375
+
1376
+
1377
+ @over
1378
+ def select(cond: int8, arg1: Any, arg2: Any):
1379
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1380
+ ...
1381
+
1382
+
1383
+ @over
1384
+ def select(cond: uint8, arg1: Any, arg2: Any):
1385
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1386
+ ...
1387
+
1388
+
1389
+ @over
1390
+ def select(cond: int16, arg1: Any, arg2: Any):
1391
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1392
+ ...
1393
+
1394
+
1395
+ @over
1396
+ def select(cond: uint16, arg1: Any, arg2: Any):
1397
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1398
+ ...
1399
+
1400
+
1401
+ @over
1402
+ def select(cond: int32, arg1: Any, arg2: Any):
1403
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1404
+ ...
1405
+
1406
+
1407
+ @over
1408
+ def select(cond: uint32, arg1: Any, arg2: Any):
1409
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1410
+ ...
1411
+
1412
+
1413
+ @over
1414
+ def select(cond: int64, arg1: Any, arg2: Any):
1415
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1416
+ ...
1417
+
1418
+
1419
+ @over
1420
+ def select(cond: uint64, arg1: Any, arg2: Any):
1421
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1422
+ ...
1423
+
1424
+
1425
+ @over
1426
+ def select(arr: Array[Any], arg1: Any, arg2: Any):
1427
+ """Select between two arguments, if ``arr`` is null then return ``arg1``, otherwise return ``arg2``"""
1428
+ ...
1429
+
1430
+
1431
+ @over
1432
+ def atomic_add(a: Array[Any], i: int32, value: Any):
1433
+ """Atomically add ``value`` onto ``a[i]``."""
1434
+ ...
1435
+
1436
+
1437
+ @over
1438
+ def atomic_add(a: Array[Any], i: int32, j: int32, value: Any):
1439
+ """Atomically add ``value`` onto ``a[i,j]``."""
1440
+ ...
1441
+
1442
+
1443
+ @over
1444
+ def atomic_add(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
1445
+ """Atomically add ``value`` onto ``a[i,j,k]``."""
1446
+ ...
1447
+
1448
+
1449
+ @over
1450
+ def atomic_add(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1451
+ """Atomically add ``value`` onto ``a[i,j,k,l]``."""
1452
+ ...
1453
+
1454
+
1455
+ @over
1456
+ def atomic_add(a: FabricArray[Any], i: int32, value: Any):
1457
+ """Atomically add ``value`` onto ``a[i]``."""
1458
+ ...
1459
+
1460
+
1461
+ @over
1462
+ def atomic_add(a: FabricArray[Any], i: int32, j: int32, value: Any):
1463
+ """Atomically add ``value`` onto ``a[i,j]``."""
1464
+ ...
1465
+
1466
+
1467
+ @over
1468
+ def atomic_add(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1469
+ """Atomically add ``value`` onto ``a[i,j,k]``."""
1470
+ ...
1471
+
1472
+
1473
+ @over
1474
+ def atomic_add(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1475
+ """Atomically add ``value`` onto ``a[i,j,k,l]``."""
1476
+ ...
1477
+
1478
+
1479
+ @over
1480
+ def atomic_add(a: IndexedFabricArray[Any], i: int32, value: Any):
1481
+ """Atomically add ``value`` onto ``a[i]``."""
1482
+ ...
1483
+
1484
+
1485
+ @over
1486
+ def atomic_add(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
1487
+ """Atomically add ``value`` onto ``a[i,j]``."""
1488
+ ...
1489
+
1490
+
1491
+ @over
1492
+ def atomic_add(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1493
+ """Atomically add ``value`` onto ``a[i,j,k]``."""
1494
+ ...
1495
+
1496
+
1497
+ @over
1498
+ def atomic_add(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1499
+ """Atomically add ``value`` onto ``a[i,j,k,l]``."""
1500
+ ...
1501
+
1502
+
1503
+ @over
1504
+ def atomic_sub(a: Array[Any], i: int32, value: Any):
1505
+ """Atomically subtract ``value`` onto ``a[i]``."""
1506
+ ...
1507
+
1508
+
1509
+ @over
1510
+ def atomic_sub(a: Array[Any], i: int32, j: int32, value: Any):
1511
+ """Atomically subtract ``value`` onto ``a[i,j]``."""
1512
+ ...
1513
+
1514
+
1515
+ @over
1516
+ def atomic_sub(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
1517
+ """Atomically subtract ``value`` onto ``a[i,j,k]``."""
1518
+ ...
1519
+
1520
+
1521
+ @over
1522
+ def atomic_sub(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1523
+ """Atomically subtract ``value`` onto ``a[i,j,k,l]``."""
1524
+ ...
1525
+
1526
+
1527
+ @over
1528
+ def atomic_sub(a: FabricArray[Any], i: int32, value: Any):
1529
+ """Atomically subtract ``value`` onto ``a[i]``."""
1530
+ ...
1531
+
1532
+
1533
+ @over
1534
+ def atomic_sub(a: FabricArray[Any], i: int32, j: int32, value: Any):
1535
+ """Atomically subtract ``value`` onto ``a[i,j]``."""
1536
+ ...
1537
+
1538
+
1539
+ @over
1540
+ def atomic_sub(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1541
+ """Atomically subtract ``value`` onto ``a[i,j,k]``."""
1542
+ ...
1543
+
1544
+
1545
+ @over
1546
+ def atomic_sub(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1547
+ """Atomically subtract ``value`` onto ``a[i,j,k,l]``."""
1548
+ ...
1549
+
1550
+
1551
+ @over
1552
+ def atomic_sub(a: IndexedFabricArray[Any], i: int32, value: Any):
1553
+ """Atomically subtract ``value`` onto ``a[i]``."""
1554
+ ...
1555
+
1556
+
1557
+ @over
1558
+ def atomic_sub(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
1559
+ """Atomically subtract ``value`` onto ``a[i,j]``."""
1560
+ ...
1561
+
1562
+
1563
+ @over
1564
+ def atomic_sub(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1565
+ """Atomically subtract ``value`` onto ``a[i,j,k]``."""
1566
+ ...
1567
+
1568
+
1569
+ @over
1570
+ def atomic_sub(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1571
+ """Atomically subtract ``value`` onto ``a[i,j,k,l]``."""
1572
+ ...
1573
+
1574
+
1575
+ @over
1576
+ def atomic_min(a: Array[Any], i: int32, value: Any):
1577
+ """Compute the minimum of ``value`` and ``a[i]`` and atomically update the array.
1578
+
1579
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1580
+ """
1581
+ ...
1582
+
1583
+
1584
+ @over
1585
+ def atomic_min(a: Array[Any], i: int32, j: int32, value: Any):
1586
+ """Compute the minimum of ``value`` and ``a[i,j]`` and atomically update the array.
1587
+
1588
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1589
+ """
1590
+ ...
1591
+
1592
+
1593
+ @over
1594
+ def atomic_min(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
1595
+ """Compute the minimum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1596
+
1597
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1598
+ """
1599
+ ...
1600
+
1601
+
1602
+ @over
1603
+ def atomic_min(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1604
+ """Compute the minimum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1605
+
1606
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1607
+ """
1608
+ ...
1609
+
1610
+
1611
+ @over
1612
+ def atomic_min(a: FabricArray[Any], i: int32, value: Any):
1613
+ """Compute the minimum of ``value`` and ``a[i]`` and atomically update the array.
1614
+
1615
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1616
+ """
1617
+ ...
1618
+
1619
+
1620
+ @over
1621
+ def atomic_min(a: FabricArray[Any], i: int32, j: int32, value: Any):
1622
+ """Compute the minimum of ``value`` and ``a[i,j]`` and atomically update the array.
1623
+
1624
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1625
+ """
1626
+ ...
1627
+
1628
+
1629
+ @over
1630
+ def atomic_min(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1631
+ """Compute the minimum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1632
+
1633
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1634
+ """
1635
+ ...
1636
+
1637
+
1638
+ @over
1639
+ def atomic_min(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1640
+ """Compute the minimum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1641
+
1642
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1643
+ """
1644
+ ...
1645
+
1646
+
1647
+ @over
1648
+ def atomic_min(a: IndexedFabricArray[Any], i: int32, value: Any):
1649
+ """Compute the minimum of ``value`` and ``a[i]`` and atomically update the array.
1650
+
1651
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1652
+ """
1653
+ ...
1654
+
1655
+
1656
+ @over
1657
+ def atomic_min(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
1658
+ """Compute the minimum of ``value`` and ``a[i,j]`` and atomically update the array.
1659
+
1660
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1661
+ """
1662
+ ...
1663
+
1664
+
1665
+ @over
1666
+ def atomic_min(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1667
+ """Compute the minimum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1668
+
1669
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1670
+ """
1671
+ ...
1672
+
1673
+
1674
+ @over
1675
+ def atomic_min(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1676
+ """Compute the minimum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1677
+
1678
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1679
+ """
1680
+ ...
1681
+
1682
+
1683
+ @over
1684
+ def atomic_max(a: Array[Any], i: int32, value: Any):
1685
+ """Compute the maximum of ``value`` and ``a[i]`` and atomically update the array.
1686
+
1687
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1688
+ """
1689
+ ...
1690
+
1691
+
1692
+ @over
1693
+ def atomic_max(a: Array[Any], i: int32, j: int32, value: Any):
1694
+ """Compute the maximum of ``value`` and ``a[i,j]`` and atomically update the array.
1695
+
1696
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1697
+ """
1698
+ ...
1699
+
1700
+
1701
+ @over
1702
+ def atomic_max(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
1703
+ """Compute the maximum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1704
+
1705
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1706
+ """
1707
+ ...
1708
+
1709
+
1710
+ @over
1711
+ def atomic_max(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1712
+ """Compute the maximum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1713
+
1714
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1715
+ """
1716
+ ...
1717
+
1718
+
1719
+ @over
1720
+ def atomic_max(a: FabricArray[Any], i: int32, value: Any):
1721
+ """Compute the maximum of ``value`` and ``a[i]`` and atomically update the array.
1722
+
1723
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1724
+ """
1725
+ ...
1726
+
1727
+
1728
+ @over
1729
+ def atomic_max(a: FabricArray[Any], i: int32, j: int32, value: Any):
1730
+ """Compute the maximum of ``value`` and ``a[i,j]`` and atomically update the array.
1731
+
1732
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1733
+ """
1734
+ ...
1735
+
1736
+
1737
+ @over
1738
+ def atomic_max(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1739
+ """Compute the maximum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1740
+
1741
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1742
+ """
1743
+ ...
1744
+
1745
+
1746
+ @over
1747
+ def atomic_max(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1748
+ """Compute the maximum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1749
+
1750
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1751
+ """
1752
+ ...
1753
+
1754
+
1755
+ @over
1756
+ def atomic_max(a: IndexedFabricArray[Any], i: int32, value: Any):
1757
+ """Compute the maximum of ``value`` and ``a[i]`` and atomically update the array.
1758
+
1759
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1760
+ """
1761
+ ...
1762
+
1763
+
1764
+ @over
1765
+ def atomic_max(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
1766
+ """Compute the maximum of ``value`` and ``a[i,j]`` and atomically update the array.
1767
+
1768
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1769
+ """
1770
+ ...
1771
+
1772
+
1773
+ @over
1774
+ def atomic_max(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1775
+ """Compute the maximum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1776
+
1777
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1778
+ """
1779
+ ...
1780
+
1781
+
1782
+ @over
1783
+ def atomic_max(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1784
+ """Compute the maximum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1785
+
1786
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1787
+ """
1788
+ ...
1789
+
1790
+
1791
+ @over
1792
+ def lerp(a: Float, b: Float, t: Float) -> Float:
1793
+ """Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``"""
1794
+ ...
1795
+
1796
+
1797
+ @over
1798
+ def lerp(a: Vector[Any, Float], b: Vector[Any, Float], t: Float) -> Vector[Any, Float]:
1799
+ """Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``"""
1800
+ ...
1801
+
1802
+
1803
+ @over
1804
+ def lerp(a: Matrix[Any, Any, Float], b: Matrix[Any, Any, Float], t: Float) -> Matrix[Any, Any, Float]:
1805
+ """Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``"""
1806
+ ...
1807
+
1808
+
1809
+ @over
1810
+ def lerp(a: Quaternion[Float], b: Quaternion[Float], t: Float) -> Quaternion[Float]:
1811
+ """Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``"""
1812
+ ...
1813
+
1814
+
1815
+ @over
1816
+ def lerp(a: Transformation[Float], b: Transformation[Float], t: Float) -> Transformation[Float]:
1817
+ """Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``"""
1818
+ ...
1819
+
1820
+
1821
+ @over
1822
+ def smoothstep(edge0: Float, edge1: Float, x: Float) -> Float:
1823
+ """Smoothly interpolate between two values ``edge0`` and ``edge1`` using a factor ``x``,
1824
+ and return a result between 0 and 1 using a cubic Hermite interpolation after clamping.
1825
+ """
1826
+ ...
1827
+
1828
+
1829
+ @over
1830
+ def expect_near(arg1: Float, arg2: Float, tolerance: Float):
1831
+ """Prints an error to stdout if ``arg1`` and ``arg2`` are not closer than tolerance in magnitude"""
1832
+ ...
1833
+
1834
+
1835
+ @over
1836
+ def expect_near(arg1: vec3f, arg2: vec3f, tolerance: float32):
1837
+ """Prints an error to stdout if any element of ``arg1`` and ``arg2`` are not closer than tolerance in magnitude"""
1838
+ ...
1839
+
1840
+
1841
+ @over
1842
+ def lower_bound(arr: Array[Scalar], value: Scalar) -> int:
1843
+ """Search a sorted array ``arr`` for the closest element greater than or equal to ``value``."""
1844
+ ...
1845
+
1846
+
1847
+ @over
1848
+ def lower_bound(arr: Array[Scalar], arr_begin: int32, arr_end: int32, value: Scalar) -> int:
1849
+ """Search a sorted array ``arr`` in the range [arr_begin, arr_end) for the closest element greater than or equal to ``value``."""
1850
+ ...
1851
+
1852
+
1853
+ @over
1854
+ def add(x: Scalar, y: Scalar) -> Scalar:
1855
+ """ """
1856
+ ...
1857
+
1858
+
1859
+ @over
1860
+ def add(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
1861
+ """ """
1862
+ ...
1863
+
1864
+
1865
+ @over
1866
+ def add(x: Quaternion[Scalar], y: Quaternion[Scalar]) -> Quaternion[Scalar]:
1867
+ """ """
1868
+ ...
1869
+
1870
+
1871
+ @over
1872
+ def add(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
1873
+ """ """
1874
+ ...
1875
+
1876
+
1877
+ @over
1878
+ def add(x: Transformation[Scalar], y: Transformation[Scalar]) -> Transformation[Scalar]:
1879
+ """ """
1880
+ ...
1881
+
1882
+
1883
+ @over
1884
+ def sub(x: Scalar, y: Scalar) -> Scalar:
1885
+ """ """
1886
+ ...
1887
+
1888
+
1889
+ @over
1890
+ def sub(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
1891
+ """ """
1892
+ ...
1893
+
1894
+
1895
+ @over
1896
+ def sub(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
1897
+ """ """
1898
+ ...
1899
+
1900
+
1901
+ @over
1902
+ def sub(x: Quaternion[Scalar], y: Quaternion[Scalar]) -> Quaternion[Scalar]:
1903
+ """ """
1904
+ ...
1905
+
1906
+
1907
+ @over
1908
+ def sub(x: Transformation[Scalar], y: Transformation[Scalar]) -> Transformation[Scalar]:
1909
+ """ """
1910
+ ...
1911
+
1912
+
1913
+ @over
1914
+ def bit_and(x: Int, y: Int) -> Int:
1915
+ """ """
1916
+ ...
1917
+
1918
+
1919
+ @over
1920
+ def bit_or(x: Int, y: Int) -> Int:
1921
+ """ """
1922
+ ...
1923
+
1924
+
1925
+ @over
1926
+ def bit_xor(x: Int, y: Int) -> Int:
1927
+ """ """
1928
+ ...
1929
+
1930
+
1931
+ @over
1932
+ def lshift(x: Int, y: Int) -> Int:
1933
+ """ """
1934
+ ...
1935
+
1936
+
1937
+ @over
1938
+ def rshift(x: Int, y: Int) -> Int:
1939
+ """ """
1940
+ ...
1941
+
1942
+
1943
+ @over
1944
+ def invert(x: Int) -> Int:
1945
+ """ """
1946
+ ...
1947
+
1948
+
1949
+ @over
1950
+ def mul(x: Scalar, y: Scalar) -> Scalar:
1951
+ """ """
1952
+ ...
1953
+
1954
+
1955
+ @over
1956
+ def mul(x: Vector[Any, Scalar], y: Scalar) -> Vector[Any, Scalar]:
1957
+ """ """
1958
+ ...
1959
+
1960
+
1961
+ @over
1962
+ def mul(x: Scalar, y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
1963
+ """ """
1964
+ ...
1965
+
1966
+
1967
+ @over
1968
+ def mul(x: Quaternion[Scalar], y: Scalar) -> Quaternion[Scalar]:
1969
+ """ """
1970
+ ...
1971
+
1972
+
1973
+ @over
1974
+ def mul(x: Scalar, y: Quaternion[Scalar]) -> Quaternion[Scalar]:
1975
+ """ """
1976
+ ...
1977
+
1978
+
1979
+ @over
1980
+ def mul(x: Quaternion[Scalar], y: Quaternion[Scalar]) -> Quaternion[Scalar]:
1981
+ """ """
1982
+ ...
1983
+
1984
+
1985
+ @over
1986
+ def mul(x: Scalar, y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
1987
+ """ """
1988
+ ...
1989
+
1990
+
1991
+ @over
1992
+ def mul(x: Matrix[Any, Any, Scalar], y: Scalar) -> Matrix[Any, Any, Scalar]:
1993
+ """ """
1994
+ ...
1995
+
1996
+
1997
+ @over
1998
+ def mul(x: Matrix[Any, Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
1999
+ """ """
2000
+ ...
2001
+
2002
+
2003
+ @over
2004
+ def mul(x: Vector[Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Vector[Any, Scalar]:
2005
+ """ """
2006
+ ...
2007
+
2008
+
2009
+ @over
2010
+ def mul(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]):
2011
+ """ """
2012
+ ...
2013
+
2014
+
2015
+ @over
2016
+ def mul(x: Transformation[Scalar], y: Transformation[Scalar]) -> Transformation[Scalar]:
2017
+ """ """
2018
+ ...
2019
+
2020
+
2021
+ @over
2022
+ def mul(x: Scalar, y: Transformation[Scalar]) -> Transformation[Scalar]:
2023
+ """ """
2024
+ ...
2025
+
2026
+
2027
+ @over
2028
+ def mul(x: Transformation[Scalar], y: Scalar) -> Transformation[Scalar]:
2029
+ """ """
2030
+ ...
2031
+
2032
+
2033
+ @over
2034
+ def mod(x: Scalar, y: Scalar) -> Scalar:
2035
+ """ """
2036
+ ...
2037
+
2038
+
2039
+ @over
2040
+ def div(x: Scalar, y: Scalar) -> Scalar:
2041
+ """ """
2042
+ ...
2043
+
2044
+
2045
+ @over
2046
+ def div(x: Vector[Any, Scalar], y: Scalar) -> Vector[Any, Scalar]:
2047
+ """ """
2048
+ ...
2049
+
2050
+
2051
+ @over
2052
+ def div(x: Scalar, y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2053
+ """ """
2054
+ ...
2055
+
2056
+
2057
+ @over
2058
+ def div(x: Matrix[Any, Any, Scalar], y: Scalar) -> Matrix[Any, Any, Scalar]:
2059
+ """ """
2060
+ ...
2061
+
2062
+
2063
+ @over
2064
+ def div(x: Scalar, y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2065
+ """ """
2066
+ ...
2067
+
2068
+
2069
+ @over
2070
+ def div(x: Quaternion[Scalar], y: Scalar) -> Quaternion[Scalar]:
2071
+ """ """
2072
+ ...
2073
+
2074
+
2075
+ @over
2076
+ def div(x: Scalar, y: Quaternion[Scalar]) -> Quaternion[Scalar]:
2077
+ """ """
2078
+ ...
2079
+
2080
+
2081
+ @over
2082
+ def floordiv(x: Scalar, y: Scalar) -> Scalar:
2083
+ """ """
2084
+ ...
2085
+
2086
+
2087
+ @over
2088
+ def pos(x: Scalar) -> Scalar:
2089
+ """ """
2090
+ ...
2091
+
2092
+
2093
+ @over
2094
+ def pos(x: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2095
+ """ """
2096
+ ...
2097
+
2098
+
2099
+ @over
2100
+ def pos(x: Quaternion[Scalar]) -> Quaternion[Scalar]:
2101
+ """ """
2102
+ ...
2103
+
2104
+
2105
+ @over
2106
+ def pos(x: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2107
+ """ """
2108
+ ...
2109
+
2110
+
2111
+ @over
2112
+ def neg(x: Scalar) -> Scalar:
2113
+ """ """
2114
+ ...
2115
+
2116
+
2117
+ @over
2118
+ def neg(x: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2119
+ """ """
2120
+ ...
2121
+
2122
+
2123
+ @over
2124
+ def neg(x: Quaternion[Scalar]) -> Quaternion[Scalar]:
2125
+ """ """
2126
+ ...
2127
+
2128
+
2129
+ @over
2130
+ def neg(x: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2131
+ """ """
2132
+ ...
2133
+
2134
+
2135
+ @over
2136
+ def unot(b: bool) -> bool:
2137
+ """ """
2138
+ ...
2139
+
2140
+
2141
+ @over
2142
+ def unot(b: int8) -> bool:
2143
+ """ """
2144
+ ...
2145
+
2146
+
2147
+ @over
2148
+ def unot(b: uint8) -> bool:
2149
+ """ """
2150
+ ...
2151
+
2152
+
2153
+ @over
2154
+ def unot(b: int16) -> bool:
2155
+ """ """
2156
+ ...
2157
+
2158
+
2159
+ @over
2160
+ def unot(b: uint16) -> bool:
2161
+ """ """
2162
+ ...
2163
+
2164
+
2165
+ @over
2166
+ def unot(b: int32) -> bool:
2167
+ """ """
2168
+ ...
2169
+
2170
+
2171
+ @over
2172
+ def unot(b: uint32) -> bool:
2173
+ """ """
2174
+ ...
2175
+
2176
+
2177
+ @over
2178
+ def unot(b: int64) -> bool:
2179
+ """ """
2180
+ ...
2181
+
2182
+
2183
+ @over
2184
+ def unot(b: uint64) -> bool:
2185
+ """ """
2186
+ ...
2187
+
2188
+
2189
+ @over
2190
+ def unot(a: Array[Any]) -> bool:
2191
+ """ """
2192
+ ...