warp-lang 0.9.0__py3-none-win_amd64.whl → 0.11.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of warp-lang might be problematic. Click here for more details.
- warp/__init__.py +15 -7
- warp/__init__.pyi +1 -0
- warp/bin/warp-clang.dll +0 -0
- warp/bin/warp.dll +0 -0
- warp/build.py +22 -443
- warp/build_dll.py +384 -0
- warp/builtins.py +998 -488
- warp/codegen.py +1307 -739
- warp/config.py +5 -3
- warp/constants.py +6 -0
- warp/context.py +1291 -548
- warp/dlpack.py +31 -31
- warp/fabric.py +326 -0
- warp/fem/__init__.py +27 -0
- warp/fem/cache.py +389 -0
- warp/fem/dirichlet.py +181 -0
- warp/fem/domain.py +263 -0
- warp/fem/field/__init__.py +101 -0
- warp/fem/field/field.py +149 -0
- warp/fem/field/nodal_field.py +299 -0
- warp/fem/field/restriction.py +21 -0
- warp/fem/field/test.py +181 -0
- warp/fem/field/trial.py +183 -0
- warp/fem/geometry/__init__.py +19 -0
- warp/fem/geometry/closest_point.py +70 -0
- warp/fem/geometry/deformed_geometry.py +271 -0
- warp/fem/geometry/element.py +744 -0
- warp/fem/geometry/geometry.py +186 -0
- warp/fem/geometry/grid_2d.py +373 -0
- warp/fem/geometry/grid_3d.py +435 -0
- warp/fem/geometry/hexmesh.py +953 -0
- warp/fem/geometry/partition.py +376 -0
- warp/fem/geometry/quadmesh_2d.py +532 -0
- warp/fem/geometry/tetmesh.py +840 -0
- warp/fem/geometry/trimesh_2d.py +577 -0
- warp/fem/integrate.py +1616 -0
- warp/fem/operator.py +191 -0
- warp/fem/polynomial.py +213 -0
- warp/fem/quadrature/__init__.py +2 -0
- warp/fem/quadrature/pic_quadrature.py +245 -0
- warp/fem/quadrature/quadrature.py +294 -0
- warp/fem/space/__init__.py +292 -0
- warp/fem/space/basis_space.py +489 -0
- warp/fem/space/collocated_function_space.py +105 -0
- warp/fem/space/dof_mapper.py +236 -0
- warp/fem/space/function_space.py +145 -0
- warp/fem/space/grid_2d_function_space.py +267 -0
- warp/fem/space/grid_3d_function_space.py +306 -0
- warp/fem/space/hexmesh_function_space.py +352 -0
- warp/fem/space/partition.py +350 -0
- warp/fem/space/quadmesh_2d_function_space.py +369 -0
- warp/fem/space/restriction.py +160 -0
- warp/fem/space/shape/__init__.py +15 -0
- warp/fem/space/shape/cube_shape_function.py +738 -0
- warp/fem/space/shape/shape_function.py +103 -0
- warp/fem/space/shape/square_shape_function.py +611 -0
- warp/fem/space/shape/tet_shape_function.py +567 -0
- warp/fem/space/shape/triangle_shape_function.py +429 -0
- warp/fem/space/tetmesh_function_space.py +292 -0
- warp/fem/space/topology.py +295 -0
- warp/fem/space/trimesh_2d_function_space.py +221 -0
- warp/fem/types.py +77 -0
- warp/fem/utils.py +495 -0
- warp/native/array.h +164 -55
- warp/native/builtin.h +150 -174
- warp/native/bvh.cpp +75 -328
- warp/native/bvh.cu +406 -23
- warp/native/bvh.h +37 -45
- warp/native/clang/clang.cpp +136 -24
- warp/native/crt.cpp +1 -76
- warp/native/crt.h +111 -104
- warp/native/cuda_crt.h +1049 -0
- warp/native/cuda_util.cpp +15 -3
- warp/native/cuda_util.h +3 -1
- warp/native/cutlass/tools/library/scripts/conv2d_operation.py +463 -0
- warp/native/cutlass/tools/library/scripts/conv3d_operation.py +321 -0
- warp/native/cutlass/tools/library/scripts/gemm_operation.py +988 -0
- warp/native/cutlass/tools/library/scripts/generator.py +4625 -0
- warp/native/cutlass/tools/library/scripts/library.py +799 -0
- warp/native/cutlass/tools/library/scripts/manifest.py +402 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/docs/source/conf.py +96 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/profile/conv/conv2d_f16_sm80.py +106 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/profile/gemm/gemm_f32_sm80.py +91 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/setup.py +80 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/__init__.py +48 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/arguments.py +118 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/c_types.py +241 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/compiler.py +432 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/conv2d_operation.py +631 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/epilogue.py +1026 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/frontend.py +104 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/gemm_operation.py +1276 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/library.py +744 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/memory_manager.py +74 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/operation.py +110 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/parser.py +619 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/reduction_operation.py +398 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/tensor_ref.py +70 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/__init__.py +4 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/conv2d_testbed.py +646 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/gemm_grouped_testbed.py +235 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/gemm_testbed.py +557 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/profiler.py +70 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/type_hint.py +39 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/utils/__init__.py +1 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/utils/device.py +76 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/utils/reference_model.py +255 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/__init__.py +0 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_dgrad_implicit_gemm_f16nhwc_f16nhwc_f16nhwc_tensor_op_f16_sm80.py +201 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_dgrad_implicit_gemm_f16nhwc_f16nhwc_f32nhwc_tensor_op_f32_sm80.py +177 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_dgrad_implicit_gemm_f32nhwc_f32nhwc_f32nhwc_simt_f32_sm80.py +98 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_dgrad_implicit_gemm_tf32nhwc_tf32nhwc_f32nhwc_tensor_op_f32_sm80.py +95 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_few_channels_f16nhwc_f16nhwc_f16nhwc_tensor_op_f32_sm80.py +163 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_fixed_channels_f16nhwc_f16nhwc_f16nhwc_tensor_op_f32_sm80.py +187 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_implicit_gemm_f16nhwc_f16nhwc_f16nhwc_tensor_op_f16_sm80.py +309 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_implicit_gemm_f16nhwc_f16nhwc_f32nhwc_tensor_op_f32_sm80.py +54 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_implicit_gemm_f32nhwc_f32nhwc_f32nhwc_simt_f32_sm80.py +96 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_implicit_gemm_tf32nhwc_tf32nhwc_f32nhwc_tensor_op_f32_sm80.py +107 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_strided_dgrad_implicit_gemm_f16nhwc_f16nhwc_f32nhwc_tensor_op_f32_sm80.py +253 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_wgrad_implicit_gemm_f16nhwc_f16nhwc_f16nhwc_tensor_op_f16_sm80.py +97 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_wgrad_implicit_gemm_f16nhwc_f16nhwc_f32nhwc_tensor_op_f32_sm80.py +242 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_wgrad_implicit_gemm_f32nhwc_f32nhwc_f32nhwc_simt_f32_sm80.py +96 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_wgrad_implicit_gemm_tf32nhwc_tf32nhwc_f32nhwc_tensor_op_f32_sm80.py +107 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/run_all_tests.py +10 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/frontend/test_frontend.py +146 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/__init__.py +0 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_bf16_sm80.py +96 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_f16_sm80.py +447 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_f32_sm80.py +146 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_f64_sm80.py +102 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_grouped_sm80.py +203 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_s8_sm80.py +229 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/run_all_tests.py +9 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/unit/test_sm80.py +453 -0
- warp/native/cutlass/tools/library/scripts/rank_2k_operation.py +398 -0
- warp/native/cutlass/tools/library/scripts/rank_k_operation.py +387 -0
- warp/native/cutlass/tools/library/scripts/rt.py +796 -0
- warp/native/cutlass/tools/library/scripts/symm_operation.py +400 -0
- warp/native/cutlass/tools/library/scripts/trmm_operation.py +407 -0
- warp/native/cutlass_gemm.cu +5 -3
- warp/native/exports.h +1240 -949
- warp/native/fabric.h +228 -0
- warp/native/hashgrid.cpp +4 -4
- warp/native/hashgrid.h +22 -2
- warp/native/initializer_array.h +2 -2
- warp/native/intersect.h +22 -7
- warp/native/intersect_adj.h +8 -8
- warp/native/intersect_tri.h +13 -16
- warp/native/marching.cu +157 -161
- warp/native/mat.h +119 -19
- warp/native/matnn.h +2 -2
- warp/native/mesh.cpp +108 -83
- warp/native/mesh.cu +243 -6
- warp/native/mesh.h +1547 -458
- warp/native/nanovdb/NanoVDB.h +1 -1
- warp/native/noise.h +272 -329
- warp/native/quat.h +51 -8
- warp/native/rand.h +45 -35
- warp/native/range.h +6 -2
- warp/native/reduce.cpp +157 -0
- warp/native/reduce.cu +348 -0
- warp/native/runlength_encode.cpp +62 -0
- warp/native/runlength_encode.cu +46 -0
- warp/native/scan.cu +11 -13
- warp/native/scan.h +1 -0
- warp/native/solid_angle.h +442 -0
- warp/native/sort.cpp +13 -0
- warp/native/sort.cu +9 -1
- warp/native/sparse.cpp +338 -0
- warp/native/sparse.cu +545 -0
- warp/native/spatial.h +2 -2
- warp/native/temp_buffer.h +30 -0
- warp/native/vec.h +126 -24
- warp/native/volume.h +120 -0
- warp/native/warp.cpp +658 -53
- warp/native/warp.cu +660 -68
- warp/native/warp.h +112 -12
- warp/optim/__init__.py +1 -0
- warp/optim/linear.py +922 -0
- warp/optim/sgd.py +92 -0
- warp/render/render_opengl.py +392 -152
- warp/render/render_usd.py +11 -11
- warp/sim/__init__.py +2 -2
- warp/sim/articulation.py +385 -185
- warp/sim/collide.py +21 -8
- warp/sim/import_mjcf.py +297 -106
- warp/sim/import_urdf.py +389 -210
- warp/sim/import_usd.py +198 -97
- warp/sim/inertia.py +17 -18
- warp/sim/integrator_euler.py +14 -8
- warp/sim/integrator_xpbd.py +161 -19
- warp/sim/model.py +795 -291
- warp/sim/optimizer.py +2 -6
- warp/sim/render.py +65 -3
- warp/sim/utils.py +3 -0
- warp/sparse.py +1227 -0
- warp/stubs.py +665 -223
- warp/tape.py +66 -15
- warp/tests/__main__.py +3 -6
- warp/tests/assets/curlnoise_golden.npy +0 -0
- warp/tests/assets/pnoise_golden.npy +0 -0
- warp/tests/assets/torus.usda +105 -105
- warp/tests/{test_class_kernel.py → aux_test_class_kernel.py} +9 -1
- warp/tests/aux_test_conditional_unequal_types_kernels.py +21 -0
- warp/tests/{test_dependent.py → aux_test_dependent.py} +2 -2
- warp/tests/{test_reference.py → aux_test_reference.py} +1 -1
- warp/tests/aux_test_unresolved_func.py +14 -0
- warp/tests/aux_test_unresolved_symbol.py +14 -0
- warp/tests/disabled_kinematics.py +239 -0
- warp/tests/run_coverage_serial.py +31 -0
- warp/tests/test_adam.py +103 -106
- warp/tests/test_arithmetic.py +128 -74
- warp/tests/test_array.py +1497 -211
- warp/tests/test_array_reduce.py +150 -0
- warp/tests/test_atomic.py +64 -28
- warp/tests/test_bool.py +99 -0
- warp/tests/test_builtins_resolution.py +1292 -0
- warp/tests/test_bvh.py +75 -43
- warp/tests/test_closest_point_edge_edge.py +54 -57
- warp/tests/test_codegen.py +233 -128
- warp/tests/test_compile_consts.py +28 -20
- warp/tests/test_conditional.py +108 -24
- warp/tests/test_copy.py +10 -12
- warp/tests/test_ctypes.py +112 -88
- warp/tests/test_dense.py +21 -14
- warp/tests/test_devices.py +98 -0
- warp/tests/test_dlpack.py +136 -108
- warp/tests/test_examples.py +277 -0
- warp/tests/test_fabricarray.py +955 -0
- warp/tests/test_fast_math.py +15 -11
- warp/tests/test_fem.py +1271 -0
- warp/tests/test_fp16.py +53 -19
- warp/tests/test_func.py +187 -74
- warp/tests/test_generics.py +194 -49
- warp/tests/test_grad.py +180 -116
- warp/tests/test_grad_customs.py +176 -0
- warp/tests/test_hash_grid.py +52 -37
- warp/tests/test_import.py +10 -23
- warp/tests/test_indexedarray.py +577 -24
- warp/tests/test_intersect.py +18 -9
- warp/tests/test_large.py +141 -0
- warp/tests/test_launch.py +251 -15
- warp/tests/test_lerp.py +64 -65
- warp/tests/test_linear_solvers.py +154 -0
- warp/tests/test_lvalue.py +493 -0
- warp/tests/test_marching_cubes.py +12 -13
- warp/tests/test_mat.py +508 -2778
- warp/tests/test_mat_lite.py +115 -0
- warp/tests/test_mat_scalar_ops.py +2889 -0
- warp/tests/test_math.py +103 -9
- warp/tests/test_matmul.py +305 -69
- warp/tests/test_matmul_lite.py +410 -0
- warp/tests/test_mesh.py +71 -14
- warp/tests/test_mesh_query_aabb.py +41 -25
- warp/tests/test_mesh_query_point.py +325 -34
- warp/tests/test_mesh_query_ray.py +39 -22
- warp/tests/test_mlp.py +30 -22
- warp/tests/test_model.py +92 -89
- warp/tests/test_modules_lite.py +39 -0
- warp/tests/test_multigpu.py +88 -114
- warp/tests/test_noise.py +12 -11
- warp/tests/test_operators.py +16 -20
- warp/tests/test_options.py +11 -11
- warp/tests/test_pinned.py +17 -18
- warp/tests/test_print.py +32 -11
- warp/tests/test_quat.py +275 -129
- warp/tests/test_rand.py +18 -16
- warp/tests/test_reload.py +38 -34
- warp/tests/test_rounding.py +50 -43
- warp/tests/test_runlength_encode.py +190 -0
- warp/tests/test_smoothstep.py +9 -11
- warp/tests/test_snippet.py +143 -0
- warp/tests/test_sparse.py +460 -0
- warp/tests/test_spatial.py +276 -243
- warp/tests/test_streams.py +110 -85
- warp/tests/test_struct.py +331 -85
- warp/tests/test_tape.py +39 -21
- warp/tests/test_torch.py +118 -89
- warp/tests/test_transient_module.py +12 -13
- warp/tests/test_types.py +614 -0
- warp/tests/test_utils.py +494 -0
- warp/tests/test_vec.py +354 -1987
- warp/tests/test_vec_lite.py +73 -0
- warp/tests/test_vec_scalar_ops.py +2099 -0
- warp/tests/test_volume.py +457 -293
- warp/tests/test_volume_write.py +124 -134
- warp/tests/unittest_serial.py +35 -0
- warp/tests/unittest_suites.py +341 -0
- warp/tests/unittest_utils.py +568 -0
- warp/tests/unused_test_misc.py +71 -0
- warp/tests/{test_debug.py → walkthough_debug.py} +3 -17
- warp/thirdparty/appdirs.py +36 -45
- warp/thirdparty/unittest_parallel.py +549 -0
- warp/torch.py +72 -30
- warp/types.py +1744 -713
- warp/utils.py +360 -350
- warp_lang-0.11.0.dist-info/LICENSE.md +36 -0
- warp_lang-0.11.0.dist-info/METADATA +238 -0
- warp_lang-0.11.0.dist-info/RECORD +332 -0
- {warp_lang-0.9.0.dist-info → warp_lang-0.11.0.dist-info}/WHEEL +1 -1
- warp/bin/warp-clang.exp +0 -0
- warp/bin/warp-clang.lib +0 -0
- warp/bin/warp.exp +0 -0
- warp/bin/warp.lib +0 -0
- warp/tests/test_all.py +0 -215
- warp/tests/test_array_scan.py +0 -60
- warp/tests/test_base.py +0 -208
- warp/tests/test_unresolved_func.py +0 -7
- warp/tests/test_unresolved_symbol.py +0 -7
- warp_lang-0.9.0.dist-info/METADATA +0 -20
- warp_lang-0.9.0.dist-info/RECORD +0 -177
- /warp/tests/{test_compile_consts_dummy.py → aux_test_compile_consts_dummy.py} +0 -0
- /warp/tests/{test_reference_reference.py → aux_test_reference_reference.py} +0 -0
- /warp/tests/{test_square.py → aux_test_square.py} +0 -0
- {warp_lang-0.9.0.dist-info → warp_lang-0.11.0.dist-info}/top_level.txt +0 -0
warp/stubs.py
CHANGED
|
@@ -19,12 +19,15 @@ Matrix = Generic[Rows, Cols, Scalar]
|
|
|
19
19
|
Quaternion = Generic[Float]
|
|
20
20
|
Transformation = Generic[Float]
|
|
21
21
|
Array = Generic[DType]
|
|
22
|
+
FabricArray = Generic[DType]
|
|
23
|
+
IndexedFabricArray = Generic[DType]
|
|
22
24
|
|
|
23
25
|
|
|
24
26
|
from warp.types import array, array1d, array2d, array3d, array4d, constant
|
|
25
27
|
from warp.types import indexedarray, indexedarray1d, indexedarray2d, indexedarray3d, indexedarray4d
|
|
28
|
+
from warp.fabric import fabricarray, fabricarrayarray, indexedfabricarray, indexedfabricarrayarray
|
|
26
29
|
|
|
27
|
-
from warp.types import int8, uint8, int16, uint16, int32, uint32, int64, uint64, float16, float32, float64
|
|
30
|
+
from warp.types import bool, int8, uint8, int16, uint16, int32, uint32, int64, uint64, float16, float32, float64
|
|
28
31
|
from warp.types import vec2, vec2b, vec2ub, vec2s, vec2us, vec2i, vec2ui, vec2l, vec2ul, vec2h, vec2f, vec2d
|
|
29
32
|
from warp.types import vec3, vec3b, vec3ub, vec3s, vec3us, vec3i, vec3ui, vec3l, vec3ul, vec3h, vec3f, vec3d
|
|
30
33
|
from warp.types import vec4, vec4b, vec4ub, vec4s, vec4us, vec4i, vec4ui, vec4l, vec4ul, vec4h, vec4f, vec4d
|
|
@@ -37,14 +40,15 @@ from warp.types import spatial_vector, spatial_vectorh, spatial_vectorf, spatial
|
|
|
37
40
|
from warp.types import spatial_matrix, spatial_matrixh, spatial_matrixf, spatial_matrixd
|
|
38
41
|
|
|
39
42
|
from warp.types import Bvh, Mesh, HashGrid, Volume, MarchingCubes
|
|
40
|
-
from warp.types import bvh_query_t, mesh_query_aabb_t,
|
|
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
|
+
|
|
41
45
|
|
|
42
46
|
from warp.types import matmul, adj_matmul, batched_matmul, adj_batched_matmul, from_ptr
|
|
43
47
|
|
|
44
48
|
from warp.types import vector as vec
|
|
45
49
|
from warp.types import matrix as mat
|
|
46
50
|
|
|
47
|
-
from warp.context import init, func, kernel, struct, overload
|
|
51
|
+
from warp.context import init, func, func_grad, func_replay, func_native, kernel, struct, overload
|
|
48
52
|
from warp.context import is_cpu_available, is_cuda_available, is_device_available
|
|
49
53
|
from warp.context import get_devices, get_preferred_device
|
|
50
54
|
from warp.context import get_cuda_devices, get_cuda_device_count, get_cuda_device, map_cuda_device, unmap_cuda_device
|
|
@@ -52,6 +56,8 @@ from warp.context import get_device, set_device, synchronize_device
|
|
|
52
56
|
from warp.context import (
|
|
53
57
|
zeros,
|
|
54
58
|
zeros_like,
|
|
59
|
+
full,
|
|
60
|
+
full_like,
|
|
55
61
|
clone,
|
|
56
62
|
empty,
|
|
57
63
|
empty_like,
|
|
@@ -64,15 +70,14 @@ from warp.context import (
|
|
|
64
70
|
)
|
|
65
71
|
from warp.context import set_module_options, get_module_options, get_module
|
|
66
72
|
from warp.context import capture_begin, capture_end, capture_launch
|
|
67
|
-
from warp.context import
|
|
68
|
-
from warp.context import Kernel, Function
|
|
73
|
+
from warp.context import Kernel, Function, Launch
|
|
69
74
|
from warp.context import Stream, get_stream, set_stream, synchronize_stream
|
|
70
75
|
from warp.context import Event, record_event, wait_event, wait_stream
|
|
71
76
|
from warp.context import RegisteredGLBuffer
|
|
72
77
|
|
|
73
78
|
from warp.tape import Tape
|
|
74
|
-
from warp.utils import ScopedTimer,
|
|
75
|
-
from warp.utils import transform_expand
|
|
79
|
+
from warp.utils import ScopedTimer, ScopedDevice, ScopedStream
|
|
80
|
+
from warp.utils import transform_expand, quat_between_vectors
|
|
76
81
|
|
|
77
82
|
from warp.torch import from_torch, to_torch
|
|
78
83
|
from warp.torch import device_from_torch, device_to_torch
|
|
@@ -87,6 +92,10 @@ from warp.constants import *
|
|
|
87
92
|
|
|
88
93
|
from . import builtins
|
|
89
94
|
|
|
95
|
+
import warp.config
|
|
96
|
+
|
|
97
|
+
__version__ = warp.config.version
|
|
98
|
+
|
|
90
99
|
|
|
91
100
|
@over
|
|
92
101
|
def min(x: Scalar, y: Scalar) -> Scalar:
|
|
@@ -99,7 +108,7 @@ def min(x: Scalar, y: Scalar) -> Scalar:
|
|
|
99
108
|
@over
|
|
100
109
|
def min(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
|
|
101
110
|
"""
|
|
102
|
-
Return the element
|
|
111
|
+
Return the element-wise minimum of two vectors.
|
|
103
112
|
"""
|
|
104
113
|
...
|
|
105
114
|
|
|
@@ -107,7 +116,7 @@ def min(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
|
|
|
107
116
|
@over
|
|
108
117
|
def min(v: Vector[Any, Scalar]) -> Scalar:
|
|
109
118
|
"""
|
|
110
|
-
Return the minimum element of a vector
|
|
119
|
+
Return the minimum element of a vector ``v``.
|
|
111
120
|
"""
|
|
112
121
|
...
|
|
113
122
|
|
|
@@ -123,7 +132,7 @@ def max(x: Scalar, y: Scalar) -> Scalar:
|
|
|
123
132
|
@over
|
|
124
133
|
def max(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
|
|
125
134
|
"""
|
|
126
|
-
Return the element
|
|
135
|
+
Return the element-wise maximum of two vectors.
|
|
127
136
|
"""
|
|
128
137
|
...
|
|
129
138
|
|
|
@@ -131,7 +140,7 @@ def max(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
|
|
|
131
140
|
@over
|
|
132
141
|
def max(v: Vector[Any, Scalar]) -> Scalar:
|
|
133
142
|
"""
|
|
134
|
-
Return the maximum element of a vector
|
|
143
|
+
Return the maximum element of a vector ``v``.
|
|
135
144
|
"""
|
|
136
145
|
...
|
|
137
146
|
|
|
@@ -139,7 +148,7 @@ def max(v: Vector[Any, Scalar]) -> Scalar:
|
|
|
139
148
|
@over
|
|
140
149
|
def clamp(x: Scalar, a: Scalar, b: Scalar) -> Scalar:
|
|
141
150
|
"""
|
|
142
|
-
Clamp the value of x to the range [a, b].
|
|
151
|
+
Clamp the value of ``x`` to the range [a, b].
|
|
143
152
|
"""
|
|
144
153
|
...
|
|
145
154
|
|
|
@@ -147,7 +156,7 @@ def clamp(x: Scalar, a: Scalar, b: Scalar) -> Scalar:
|
|
|
147
156
|
@over
|
|
148
157
|
def abs(x: Scalar) -> Scalar:
|
|
149
158
|
"""
|
|
150
|
-
Return the absolute value of x
|
|
159
|
+
Return the absolute value of ``x``.
|
|
151
160
|
"""
|
|
152
161
|
...
|
|
153
162
|
|
|
@@ -155,7 +164,7 @@ def abs(x: Scalar) -> Scalar:
|
|
|
155
164
|
@over
|
|
156
165
|
def sign(x: Scalar) -> Scalar:
|
|
157
166
|
"""
|
|
158
|
-
Return -1 if x < 0, return 1 otherwise.
|
|
167
|
+
Return -1 if ``x`` < 0, return 1 otherwise.
|
|
159
168
|
"""
|
|
160
169
|
...
|
|
161
170
|
|
|
@@ -163,7 +172,7 @@ def sign(x: Scalar) -> Scalar:
|
|
|
163
172
|
@over
|
|
164
173
|
def step(x: Scalar) -> Scalar:
|
|
165
174
|
"""
|
|
166
|
-
Return 1.0 if x < 0.0, return 0.0 otherwise.
|
|
175
|
+
Return 1.0 if ``x`` < 0.0, return 0.0 otherwise.
|
|
167
176
|
"""
|
|
168
177
|
...
|
|
169
178
|
|
|
@@ -171,7 +180,7 @@ def step(x: Scalar) -> Scalar:
|
|
|
171
180
|
@over
|
|
172
181
|
def nonzero(x: Scalar) -> Scalar:
|
|
173
182
|
"""
|
|
174
|
-
Return 1.0 if x is not equal to zero, return 0.0 otherwise.
|
|
183
|
+
Return 1.0 if ``x`` is not equal to zero, return 0.0 otherwise.
|
|
175
184
|
"""
|
|
176
185
|
...
|
|
177
186
|
|
|
@@ -179,7 +188,7 @@ def nonzero(x: Scalar) -> Scalar:
|
|
|
179
188
|
@over
|
|
180
189
|
def sin(x: Float) -> Float:
|
|
181
190
|
"""
|
|
182
|
-
Return the sine of x in radians.
|
|
191
|
+
Return the sine of ``x`` in radians.
|
|
183
192
|
"""
|
|
184
193
|
...
|
|
185
194
|
|
|
@@ -187,7 +196,7 @@ def sin(x: Float) -> Float:
|
|
|
187
196
|
@over
|
|
188
197
|
def cos(x: Float) -> Float:
|
|
189
198
|
"""
|
|
190
|
-
Return the cosine of x in radians.
|
|
199
|
+
Return the cosine of ``x`` in radians.
|
|
191
200
|
"""
|
|
192
201
|
...
|
|
193
202
|
|
|
@@ -195,7 +204,7 @@ def cos(x: Float) -> Float:
|
|
|
195
204
|
@over
|
|
196
205
|
def acos(x: Float) -> Float:
|
|
197
206
|
"""
|
|
198
|
-
Return arccos of x in radians. Inputs are automatically clamped to [-1.0, 1.0].
|
|
207
|
+
Return arccos of ``x`` in radians. Inputs are automatically clamped to [-1.0, 1.0].
|
|
199
208
|
"""
|
|
200
209
|
...
|
|
201
210
|
|
|
@@ -203,7 +212,7 @@ def acos(x: Float) -> Float:
|
|
|
203
212
|
@over
|
|
204
213
|
def asin(x: Float) -> Float:
|
|
205
214
|
"""
|
|
206
|
-
Return arcsin of x in radians. Inputs are automatically clamped to [-1.0, 1.0].
|
|
215
|
+
Return arcsin of ``x`` in radians. Inputs are automatically clamped to [-1.0, 1.0].
|
|
207
216
|
"""
|
|
208
217
|
...
|
|
209
218
|
|
|
@@ -211,7 +220,15 @@ def asin(x: Float) -> Float:
|
|
|
211
220
|
@over
|
|
212
221
|
def sqrt(x: Float) -> Float:
|
|
213
222
|
"""
|
|
214
|
-
Return the
|
|
223
|
+
Return the square root of ``x``, where ``x`` is positive.
|
|
224
|
+
"""
|
|
225
|
+
...
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
@over
|
|
229
|
+
def cbrt(x: Float) -> Float:
|
|
230
|
+
"""
|
|
231
|
+
Return the cube root of ``x``.
|
|
215
232
|
"""
|
|
216
233
|
...
|
|
217
234
|
|
|
@@ -219,7 +236,7 @@ def sqrt(x: Float) -> Float:
|
|
|
219
236
|
@over
|
|
220
237
|
def tan(x: Float) -> Float:
|
|
221
238
|
"""
|
|
222
|
-
Return tangent of x in radians.
|
|
239
|
+
Return the tangent of ``x`` in radians.
|
|
223
240
|
"""
|
|
224
241
|
...
|
|
225
242
|
|
|
@@ -227,7 +244,7 @@ def tan(x: Float) -> Float:
|
|
|
227
244
|
@over
|
|
228
245
|
def atan(x: Float) -> Float:
|
|
229
246
|
"""
|
|
230
|
-
Return
|
|
247
|
+
Return the arctangent of ``x`` in radians.
|
|
231
248
|
"""
|
|
232
249
|
...
|
|
233
250
|
|
|
@@ -235,7 +252,7 @@ def atan(x: Float) -> Float:
|
|
|
235
252
|
@over
|
|
236
253
|
def atan2(y: Float, x: Float) -> Float:
|
|
237
254
|
"""
|
|
238
|
-
Return atan2 of x.
|
|
255
|
+
Return the 2-argument arctangent, atan2, of the point ``(x, y)`` in radians.
|
|
239
256
|
"""
|
|
240
257
|
...
|
|
241
258
|
|
|
@@ -243,7 +260,7 @@ def atan2(y: Float, x: Float) -> Float:
|
|
|
243
260
|
@over
|
|
244
261
|
def sinh(x: Float) -> Float:
|
|
245
262
|
"""
|
|
246
|
-
Return the sinh of x
|
|
263
|
+
Return the sinh of ``x``.
|
|
247
264
|
"""
|
|
248
265
|
...
|
|
249
266
|
|
|
@@ -251,7 +268,7 @@ def sinh(x: Float) -> Float:
|
|
|
251
268
|
@over
|
|
252
269
|
def cosh(x: Float) -> Float:
|
|
253
270
|
"""
|
|
254
|
-
Return the cosh of x
|
|
271
|
+
Return the cosh of ``x``.
|
|
255
272
|
"""
|
|
256
273
|
...
|
|
257
274
|
|
|
@@ -259,7 +276,7 @@ def cosh(x: Float) -> Float:
|
|
|
259
276
|
@over
|
|
260
277
|
def tanh(x: Float) -> Float:
|
|
261
278
|
"""
|
|
262
|
-
Return the tanh of x
|
|
279
|
+
Return the tanh of ``x``.
|
|
263
280
|
"""
|
|
264
281
|
...
|
|
265
282
|
|
|
@@ -267,7 +284,7 @@ def tanh(x: Float) -> Float:
|
|
|
267
284
|
@over
|
|
268
285
|
def degrees(x: Float) -> Float:
|
|
269
286
|
"""
|
|
270
|
-
Convert radians into degrees.
|
|
287
|
+
Convert ``x`` from radians into degrees.
|
|
271
288
|
"""
|
|
272
289
|
...
|
|
273
290
|
|
|
@@ -275,7 +292,7 @@ def degrees(x: Float) -> Float:
|
|
|
275
292
|
@over
|
|
276
293
|
def radians(x: Float) -> Float:
|
|
277
294
|
"""
|
|
278
|
-
Convert degrees into radians.
|
|
295
|
+
Convert ``x`` from degrees into radians.
|
|
279
296
|
"""
|
|
280
297
|
...
|
|
281
298
|
|
|
@@ -283,7 +300,7 @@ def radians(x: Float) -> Float:
|
|
|
283
300
|
@over
|
|
284
301
|
def log(x: Float) -> Float:
|
|
285
302
|
"""
|
|
286
|
-
Return the natural
|
|
303
|
+
Return the natural logarithm (base-e) of ``x``, where ``x`` is positive.
|
|
287
304
|
"""
|
|
288
305
|
...
|
|
289
306
|
|
|
@@ -291,7 +308,7 @@ def log(x: Float) -> Float:
|
|
|
291
308
|
@over
|
|
292
309
|
def log2(x: Float) -> Float:
|
|
293
310
|
"""
|
|
294
|
-
Return the
|
|
311
|
+
Return the binary logarithm (base-2) of ``x``, where ``x`` is positive.
|
|
295
312
|
"""
|
|
296
313
|
...
|
|
297
314
|
|
|
@@ -299,7 +316,7 @@ def log2(x: Float) -> Float:
|
|
|
299
316
|
@over
|
|
300
317
|
def log10(x: Float) -> Float:
|
|
301
318
|
"""
|
|
302
|
-
Return the
|
|
319
|
+
Return the common logarithm (base-10) of ``x``, where ``x`` is positive.
|
|
303
320
|
"""
|
|
304
321
|
...
|
|
305
322
|
|
|
@@ -307,7 +324,7 @@ def log10(x: Float) -> Float:
|
|
|
307
324
|
@over
|
|
308
325
|
def exp(x: Float) -> Float:
|
|
309
326
|
"""
|
|
310
|
-
Return
|
|
327
|
+
Return the value of the exponential function :math:`e^x`.
|
|
311
328
|
"""
|
|
312
329
|
...
|
|
313
330
|
|
|
@@ -315,7 +332,7 @@ def exp(x: Float) -> Float:
|
|
|
315
332
|
@over
|
|
316
333
|
def pow(x: Float, y: Float) -> Float:
|
|
317
334
|
"""
|
|
318
|
-
Return the result of x raised to power of y
|
|
335
|
+
Return the result of ``x`` raised to power of ``y``.
|
|
319
336
|
"""
|
|
320
337
|
...
|
|
321
338
|
|
|
@@ -323,9 +340,9 @@ def pow(x: Float, y: Float) -> Float:
|
|
|
323
340
|
@over
|
|
324
341
|
def round(x: Float) -> Float:
|
|
325
342
|
"""
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
343
|
+
Return the nearest integer value to ``x``, rounding halfway cases away from zero.
|
|
344
|
+
This is the most intuitive form of rounding in the colloquial sense, but can be slower than other options like :func:`warp.rint()`.
|
|
345
|
+
Differs from :func:`numpy.round()`, which behaves the same way as :func:`numpy.rint()`.
|
|
329
346
|
"""
|
|
330
347
|
...
|
|
331
348
|
|
|
@@ -333,9 +350,8 @@ def round(x: Float) -> Float:
|
|
|
333
350
|
@over
|
|
334
351
|
def rint(x: Float) -> Float:
|
|
335
352
|
"""
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
Equivalent to ``numpy.rint()``.
|
|
353
|
+
Return the nearest integer value to ``x``, rounding halfway cases to nearest even integer.
|
|
354
|
+
It is generally faster than :func:`warp.round()`. Equivalent to :func:`numpy.rint()`.
|
|
339
355
|
"""
|
|
340
356
|
...
|
|
341
357
|
|
|
@@ -343,10 +359,10 @@ def rint(x: Float) -> Float:
|
|
|
343
359
|
@over
|
|
344
360
|
def trunc(x: Float) -> Float:
|
|
345
361
|
"""
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
362
|
+
Return the nearest integer that is closer to zero than ``x``.
|
|
363
|
+
In other words, it discards the fractional part of ``x``.
|
|
364
|
+
It is similar to casting ``float(int(x))``, but preserves the negative sign when x is in the range [-0.0, -1.0).
|
|
365
|
+
Equivalent to :func:`numpy.trunc()` and :func:`numpy.fix()`.
|
|
350
366
|
"""
|
|
351
367
|
...
|
|
352
368
|
|
|
@@ -354,7 +370,7 @@ def trunc(x: Float) -> Float:
|
|
|
354
370
|
@over
|
|
355
371
|
def floor(x: Float) -> Float:
|
|
356
372
|
"""
|
|
357
|
-
|
|
373
|
+
Return the largest integer that is less than or equal to ``x``.
|
|
358
374
|
"""
|
|
359
375
|
...
|
|
360
376
|
|
|
@@ -362,7 +378,16 @@ def floor(x: Float) -> Float:
|
|
|
362
378
|
@over
|
|
363
379
|
def ceil(x: Float) -> Float:
|
|
364
380
|
"""
|
|
365
|
-
|
|
381
|
+
Return the smallest integer that is greater than or equal to ``x``.
|
|
382
|
+
"""
|
|
383
|
+
...
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
@over
|
|
387
|
+
def frac(x: Float) -> Float:
|
|
388
|
+
"""
|
|
389
|
+
Retrieve the fractional part of x.
|
|
390
|
+
In other words, it discards the integer part of x and is equivalent to ``x - trunc(x)``.
|
|
366
391
|
"""
|
|
367
392
|
...
|
|
368
393
|
|
|
@@ -394,7 +419,7 @@ def ddot(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Scalar:
|
|
|
394
419
|
@over
|
|
395
420
|
def argmin(v: Vector[Any, Scalar]) -> uint32:
|
|
396
421
|
"""
|
|
397
|
-
Return the index of the minimum element of a vector
|
|
422
|
+
Return the index of the minimum element of a vector ``v``.
|
|
398
423
|
"""
|
|
399
424
|
...
|
|
400
425
|
|
|
@@ -402,7 +427,7 @@ def argmin(v: Vector[Any, Scalar]) -> uint32:
|
|
|
402
427
|
@over
|
|
403
428
|
def argmax(v: Vector[Any, Scalar]) -> uint32:
|
|
404
429
|
"""
|
|
405
|
-
Return the index of the maximum element of a vector
|
|
430
|
+
Return the index of the maximum element of a vector ``v``.
|
|
406
431
|
"""
|
|
407
432
|
...
|
|
408
433
|
|
|
@@ -410,7 +435,7 @@ def argmax(v: Vector[Any, Scalar]) -> uint32:
|
|
|
410
435
|
@over
|
|
411
436
|
def outer(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Matrix[Any, Any, Scalar]:
|
|
412
437
|
"""
|
|
413
|
-
Compute the outer product x*y^T for two
|
|
438
|
+
Compute the outer product ``x*y^T`` for two vectors.
|
|
414
439
|
"""
|
|
415
440
|
...
|
|
416
441
|
|
|
@@ -418,7 +443,7 @@ def outer(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Matrix[Any, Any, Sc
|
|
|
418
443
|
@over
|
|
419
444
|
def cross(x: Vector[3, Scalar], y: Vector[3, Scalar]) -> Vector[3, Scalar]:
|
|
420
445
|
"""
|
|
421
|
-
Compute the cross product of two
|
|
446
|
+
Compute the cross product of two 3D vectors.
|
|
422
447
|
"""
|
|
423
448
|
...
|
|
424
449
|
|
|
@@ -426,7 +451,7 @@ def cross(x: Vector[3, Scalar], y: Vector[3, Scalar]) -> Vector[3, Scalar]:
|
|
|
426
451
|
@over
|
|
427
452
|
def skew(x: Vector[3, Scalar]):
|
|
428
453
|
"""
|
|
429
|
-
Compute the skew
|
|
454
|
+
Compute the skew-symmetric 3x3 matrix for a 3D vector ``x``.
|
|
430
455
|
"""
|
|
431
456
|
...
|
|
432
457
|
|
|
@@ -434,7 +459,7 @@ def skew(x: Vector[3, Scalar]):
|
|
|
434
459
|
@over
|
|
435
460
|
def length(x: Vector[Any, Float]) -> Scalar:
|
|
436
461
|
"""
|
|
437
|
-
Compute the length of a vector
|
|
462
|
+
Compute the length of a vector ``x``.
|
|
438
463
|
"""
|
|
439
464
|
...
|
|
440
465
|
|
|
@@ -442,7 +467,7 @@ def length(x: Vector[Any, Float]) -> Scalar:
|
|
|
442
467
|
@over
|
|
443
468
|
def length(x: Quaternion[Float]) -> Scalar:
|
|
444
469
|
"""
|
|
445
|
-
Compute the length of a quaternion
|
|
470
|
+
Compute the length of a quaternion ``x``.
|
|
446
471
|
"""
|
|
447
472
|
...
|
|
448
473
|
|
|
@@ -450,7 +475,7 @@ def length(x: Quaternion[Float]) -> Scalar:
|
|
|
450
475
|
@over
|
|
451
476
|
def length_sq(x: Vector[Any, Scalar]) -> Scalar:
|
|
452
477
|
"""
|
|
453
|
-
Compute the squared length of a
|
|
478
|
+
Compute the squared length of a 2D vector ``x``.
|
|
454
479
|
"""
|
|
455
480
|
...
|
|
456
481
|
|
|
@@ -458,7 +483,7 @@ def length_sq(x: Vector[Any, Scalar]) -> Scalar:
|
|
|
458
483
|
@over
|
|
459
484
|
def length_sq(x: Quaternion[Scalar]) -> Scalar:
|
|
460
485
|
"""
|
|
461
|
-
Compute the squared length of a quaternion
|
|
486
|
+
Compute the squared length of a quaternion ``x``.
|
|
462
487
|
"""
|
|
463
488
|
...
|
|
464
489
|
|
|
@@ -466,7 +491,7 @@ def length_sq(x: Quaternion[Scalar]) -> Scalar:
|
|
|
466
491
|
@over
|
|
467
492
|
def normalize(x: Vector[Any, Float]) -> Vector[Any, Scalar]:
|
|
468
493
|
"""
|
|
469
|
-
Compute the normalized value of x
|
|
494
|
+
Compute the normalized value of ``x``. If ``length(x)`` is 0 then the zero vector is returned.
|
|
470
495
|
"""
|
|
471
496
|
...
|
|
472
497
|
|
|
@@ -474,7 +499,7 @@ def normalize(x: Vector[Any, Float]) -> Vector[Any, Scalar]:
|
|
|
474
499
|
@over
|
|
475
500
|
def normalize(x: Quaternion[Float]) -> Quaternion[Scalar]:
|
|
476
501
|
"""
|
|
477
|
-
Compute the normalized value of x
|
|
502
|
+
Compute the normalized value of ``x``. If ``length(x)`` is 0, then the zero quaternion is returned.
|
|
478
503
|
"""
|
|
479
504
|
...
|
|
480
505
|
|
|
@@ -482,7 +507,7 @@ def normalize(x: Quaternion[Float]) -> Quaternion[Scalar]:
|
|
|
482
507
|
@over
|
|
483
508
|
def transpose(m: Matrix[Any, Any, Scalar]):
|
|
484
509
|
"""
|
|
485
|
-
Return the transpose of the matrix m
|
|
510
|
+
Return the transpose of the matrix ``m``.
|
|
486
511
|
"""
|
|
487
512
|
...
|
|
488
513
|
|
|
@@ -490,7 +515,7 @@ def transpose(m: Matrix[Any, Any, Scalar]):
|
|
|
490
515
|
@over
|
|
491
516
|
def inverse(m: Matrix[2, 2, Float]) -> Matrix[Any, Any, Float]:
|
|
492
517
|
"""
|
|
493
|
-
Return the inverse of a 2x2 matrix m
|
|
518
|
+
Return the inverse of a 2x2 matrix ``m``.
|
|
494
519
|
"""
|
|
495
520
|
...
|
|
496
521
|
|
|
@@ -498,7 +523,7 @@ def inverse(m: Matrix[2, 2, Float]) -> Matrix[Any, Any, Float]:
|
|
|
498
523
|
@over
|
|
499
524
|
def inverse(m: Matrix[3, 3, Float]) -> Matrix[Any, Any, Float]:
|
|
500
525
|
"""
|
|
501
|
-
Return the inverse of a 3x3 matrix m
|
|
526
|
+
Return the inverse of a 3x3 matrix ``m``.
|
|
502
527
|
"""
|
|
503
528
|
...
|
|
504
529
|
|
|
@@ -506,7 +531,7 @@ def inverse(m: Matrix[3, 3, Float]) -> Matrix[Any, Any, Float]:
|
|
|
506
531
|
@over
|
|
507
532
|
def inverse(m: Matrix[4, 4, Float]) -> Matrix[Any, Any, Float]:
|
|
508
533
|
"""
|
|
509
|
-
Return the inverse of a 4x4 matrix m
|
|
534
|
+
Return the inverse of a 4x4 matrix ``m``.
|
|
510
535
|
"""
|
|
511
536
|
...
|
|
512
537
|
|
|
@@ -514,7 +539,7 @@ def inverse(m: Matrix[4, 4, Float]) -> Matrix[Any, Any, Float]:
|
|
|
514
539
|
@over
|
|
515
540
|
def determinant(m: Matrix[2, 2, Float]) -> Scalar:
|
|
516
541
|
"""
|
|
517
|
-
Return the determinant of a 2x2 matrix m
|
|
542
|
+
Return the determinant of a 2x2 matrix ``m``.
|
|
518
543
|
"""
|
|
519
544
|
...
|
|
520
545
|
|
|
@@ -522,7 +547,7 @@ def determinant(m: Matrix[2, 2, Float]) -> Scalar:
|
|
|
522
547
|
@over
|
|
523
548
|
def determinant(m: Matrix[3, 3, Float]) -> Scalar:
|
|
524
549
|
"""
|
|
525
|
-
Return the determinant of a 3x3 matrix m
|
|
550
|
+
Return the determinant of a 3x3 matrix ``m``.
|
|
526
551
|
"""
|
|
527
552
|
...
|
|
528
553
|
|
|
@@ -530,7 +555,7 @@ def determinant(m: Matrix[3, 3, Float]) -> Scalar:
|
|
|
530
555
|
@over
|
|
531
556
|
def determinant(m: Matrix[4, 4, Float]) -> Scalar:
|
|
532
557
|
"""
|
|
533
|
-
Return the determinant of a 4x4 matrix m
|
|
558
|
+
Return the determinant of a 4x4 matrix ``m``.
|
|
534
559
|
"""
|
|
535
560
|
...
|
|
536
561
|
|
|
@@ -538,7 +563,7 @@ def determinant(m: Matrix[4, 4, Float]) -> Scalar:
|
|
|
538
563
|
@over
|
|
539
564
|
def trace(m: Matrix[Any, Any, Scalar]) -> Scalar:
|
|
540
565
|
"""
|
|
541
|
-
Return the trace of the matrix m
|
|
566
|
+
Return the trace of the matrix ``m``.
|
|
542
567
|
"""
|
|
543
568
|
...
|
|
544
569
|
|
|
@@ -546,7 +571,15 @@ def trace(m: Matrix[Any, Any, Scalar]) -> Scalar:
|
|
|
546
571
|
@over
|
|
547
572
|
def diag(d: Vector[Any, Scalar]) -> Matrix[Any, Any, Scalar]:
|
|
548
573
|
"""
|
|
549
|
-
Returns a matrix with the components of the vector d on the diagonal
|
|
574
|
+
Returns a matrix with the components of the vector ``d`` on the diagonal.
|
|
575
|
+
"""
|
|
576
|
+
...
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
@over
|
|
580
|
+
def get_diag(m: Matrix[Any, Any, Scalar]) -> Vector[Any, Scalar]:
|
|
581
|
+
"""
|
|
582
|
+
Returns a vector containing the diagonal elements of the square matrix ``m``.
|
|
550
583
|
"""
|
|
551
584
|
...
|
|
552
585
|
|
|
@@ -554,7 +587,7 @@ def diag(d: Vector[Any, Scalar]) -> Matrix[Any, Any, Scalar]:
|
|
|
554
587
|
@over
|
|
555
588
|
def cw_mul(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
|
|
556
589
|
"""
|
|
557
|
-
Component
|
|
590
|
+
Component-wise multiplication of two 2D vectors.
|
|
558
591
|
"""
|
|
559
592
|
...
|
|
560
593
|
|
|
@@ -562,7 +595,7 @@ def cw_mul(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar
|
|
|
562
595
|
@over
|
|
563
596
|
def cw_mul(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
|
|
564
597
|
"""
|
|
565
|
-
Component
|
|
598
|
+
Component-wise multiplication of two 2D vectors.
|
|
566
599
|
"""
|
|
567
600
|
...
|
|
568
601
|
|
|
@@ -570,7 +603,7 @@ def cw_mul(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[A
|
|
|
570
603
|
@over
|
|
571
604
|
def cw_div(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
|
|
572
605
|
"""
|
|
573
|
-
Component
|
|
606
|
+
Component-wise division of two 2D vectors.
|
|
574
607
|
"""
|
|
575
608
|
...
|
|
576
609
|
|
|
@@ -578,7 +611,7 @@ def cw_div(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar
|
|
|
578
611
|
@over
|
|
579
612
|
def cw_div(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
|
|
580
613
|
"""
|
|
581
|
-
Component
|
|
614
|
+
Component-wise division of two 2D vectors.
|
|
582
615
|
"""
|
|
583
616
|
...
|
|
584
617
|
|
|
@@ -642,7 +675,7 @@ def quat_rotate(q: Quaternion[Float], p: Vector[3, Float]) -> Vector[3, Scalar]:
|
|
|
642
675
|
@over
|
|
643
676
|
def quat_rotate_inv(q: Quaternion[Float], p: Vector[3, Float]) -> Vector[3, Scalar]:
|
|
644
677
|
"""
|
|
645
|
-
Rotate a vector the inverse of a quaternion.
|
|
678
|
+
Rotate a vector by the inverse of a quaternion.
|
|
646
679
|
"""
|
|
647
680
|
...
|
|
648
681
|
|
|
@@ -674,7 +707,7 @@ def transform_identity() -> transformf:
|
|
|
674
707
|
@over
|
|
675
708
|
def transform_get_translation(t: Transformation[Float]) -> Vector[3, Scalar]:
|
|
676
709
|
"""
|
|
677
|
-
Return the translational part of a transform
|
|
710
|
+
Return the translational part of a transform ``t``.
|
|
678
711
|
"""
|
|
679
712
|
...
|
|
680
713
|
|
|
@@ -682,7 +715,7 @@ def transform_get_translation(t: Transformation[Float]) -> Vector[3, Scalar]:
|
|
|
682
715
|
@over
|
|
683
716
|
def transform_get_rotation(t: Transformation[Float]) -> Quaternion[Scalar]:
|
|
684
717
|
"""
|
|
685
|
-
Return the rotational part of a transform
|
|
718
|
+
Return the rotational part of a transform ``t``.
|
|
686
719
|
"""
|
|
687
720
|
...
|
|
688
721
|
|
|
@@ -698,7 +731,7 @@ def transform_multiply(a: Transformation[Float], b: Transformation[Float]) -> Tr
|
|
|
698
731
|
@over
|
|
699
732
|
def transform_point(t: Transformation[Scalar], p: Vector[3, Scalar]) -> Vector[3, Scalar]:
|
|
700
733
|
"""
|
|
701
|
-
Apply the transform to a point p treating the
|
|
734
|
+
Apply the transform to a point ``p`` treating the homogeneous coordinate as w=1 (translation and rotation).
|
|
702
735
|
"""
|
|
703
736
|
...
|
|
704
737
|
|
|
@@ -706,9 +739,11 @@ def transform_point(t: Transformation[Scalar], p: Vector[3, Scalar]) -> Vector[3
|
|
|
706
739
|
@over
|
|
707
740
|
def transform_point(m: Matrix[4, 4, Scalar], p: Vector[3, Scalar]) -> Vector[3, Scalar]:
|
|
708
741
|
"""
|
|
709
|
-
Apply the transform to a point ``p`` treating the
|
|
710
|
-
|
|
711
|
-
|
|
742
|
+
Apply the transform to a point ``p`` treating the homogeneous coordinate as w=1.
|
|
743
|
+
The transformation is applied treating ``p`` as a column vector, e.g.: ``y = M*p``.
|
|
744
|
+
Note this is in contrast to some libraries, notably USD, which applies transforms to row vectors, ``y^T = p^T*M^T``.
|
|
745
|
+
If the transform is coming from a library that uses row-vectors, then users should transpose the transformation
|
|
746
|
+
matrix before calling this method.
|
|
712
747
|
"""
|
|
713
748
|
...
|
|
714
749
|
|
|
@@ -716,7 +751,7 @@ def transform_point(m: Matrix[4, 4, Scalar], p: Vector[3, Scalar]) -> Vector[3,
|
|
|
716
751
|
@over
|
|
717
752
|
def transform_vector(t: Transformation[Scalar], v: Vector[3, Scalar]) -> Vector[3, Scalar]:
|
|
718
753
|
"""
|
|
719
|
-
Apply the transform to a vector v treating the
|
|
754
|
+
Apply the transform to a vector ``v`` treating the homogeneous coordinate as w=0 (rotation only).
|
|
720
755
|
"""
|
|
721
756
|
...
|
|
722
757
|
|
|
@@ -724,9 +759,11 @@ def transform_vector(t: Transformation[Scalar], v: Vector[3, Scalar]) -> Vector[
|
|
|
724
759
|
@over
|
|
725
760
|
def transform_vector(m: Matrix[4, 4, Scalar], v: Vector[3, Scalar]) -> Vector[3, Scalar]:
|
|
726
761
|
"""
|
|
727
|
-
Apply the transform to a vector ``v`` treating the
|
|
728
|
-
|
|
729
|
-
|
|
762
|
+
Apply the transform to a vector ``v`` treating the homogeneous coordinate as w=0.
|
|
763
|
+
The transformation is applied treating ``v`` as a column vector, e.g.: ``y = M*v``
|
|
764
|
+
note this is in contrast to some libraries, notably USD, which applies transforms to row vectors, ``y^T = v^T*M^T``.
|
|
765
|
+
If the transform is coming from a library that uses row-vectors, then users should transpose the transformation
|
|
766
|
+
matrix before calling this method.
|
|
730
767
|
"""
|
|
731
768
|
...
|
|
732
769
|
|
|
@@ -734,7 +771,7 @@ def transform_vector(m: Matrix[4, 4, Scalar], v: Vector[3, Scalar]) -> Vector[3,
|
|
|
734
771
|
@over
|
|
735
772
|
def transform_inverse(t: Transformation[Float]) -> Transformation[Float]:
|
|
736
773
|
"""
|
|
737
|
-
Compute the inverse of the
|
|
774
|
+
Compute the inverse of the transformation ``t``.
|
|
738
775
|
"""
|
|
739
776
|
...
|
|
740
777
|
|
|
@@ -742,7 +779,7 @@ def transform_inverse(t: Transformation[Float]) -> Transformation[Float]:
|
|
|
742
779
|
@over
|
|
743
780
|
def spatial_dot(a: Vector[6, Float], b: Vector[6, Float]) -> Scalar:
|
|
744
781
|
"""
|
|
745
|
-
Compute the dot product of two
|
|
782
|
+
Compute the dot product of two 6D screw vectors.
|
|
746
783
|
"""
|
|
747
784
|
...
|
|
748
785
|
|
|
@@ -750,7 +787,7 @@ def spatial_dot(a: Vector[6, Float], b: Vector[6, Float]) -> Scalar:
|
|
|
750
787
|
@over
|
|
751
788
|
def spatial_cross(a: Vector[6, Float], b: Vector[6, Float]) -> Vector[6, Float]:
|
|
752
789
|
"""
|
|
753
|
-
Compute the cross
|
|
790
|
+
Compute the cross product of two 6D screw vectors.
|
|
754
791
|
"""
|
|
755
792
|
...
|
|
756
793
|
|
|
@@ -758,7 +795,7 @@ def spatial_cross(a: Vector[6, Float], b: Vector[6, Float]) -> Vector[6, Float]:
|
|
|
758
795
|
@over
|
|
759
796
|
def spatial_cross_dual(a: Vector[6, Float], b: Vector[6, Float]) -> Vector[6, Float]:
|
|
760
797
|
"""
|
|
761
|
-
Compute the dual cross
|
|
798
|
+
Compute the dual cross product of two 6D screw vectors.
|
|
762
799
|
"""
|
|
763
800
|
...
|
|
764
801
|
|
|
@@ -766,7 +803,7 @@ def spatial_cross_dual(a: Vector[6, Float], b: Vector[6, Float]) -> Vector[6, Fl
|
|
|
766
803
|
@over
|
|
767
804
|
def spatial_top(a: Vector[6, Float]):
|
|
768
805
|
"""
|
|
769
|
-
Return the top (first) part of a
|
|
806
|
+
Return the top (first) part of a 6D screw vector.
|
|
770
807
|
"""
|
|
771
808
|
...
|
|
772
809
|
|
|
@@ -774,7 +811,7 @@ def spatial_top(a: Vector[6, Float]):
|
|
|
774
811
|
@over
|
|
775
812
|
def spatial_bottom(a: Vector[6, Float]):
|
|
776
813
|
"""
|
|
777
|
-
Return the bottom (second) part of a
|
|
814
|
+
Return the bottom (second) part of a 6D screw vector.
|
|
778
815
|
"""
|
|
779
816
|
...
|
|
780
817
|
|
|
@@ -816,11 +853,13 @@ def mlp(
|
|
|
816
853
|
:param weights: A layer's network weights with dimensions ``(m, n)``.
|
|
817
854
|
:param bias: An array with dimensions ``(n)``.
|
|
818
855
|
:param activation: A ``wp.func`` function that takes a single scalar float as input and returns a scalar float as output
|
|
819
|
-
:param index: The batch item to process, typically each thread will process
|
|
856
|
+
:param index: The batch item to process, typically each thread will process one item in the batch, in which case
|
|
857
|
+
index should be ``wp.tid()``
|
|
820
858
|
:param x: The feature matrix with dimensions ``(n, b)``
|
|
821
859
|
:param out: The network output with dimensions ``(m, b)``
|
|
822
860
|
|
|
823
|
-
:note: Feature and output matrices are transposed compared to some other frameworks such as PyTorch.
|
|
861
|
+
:note: Feature and output matrices are transposed compared to some other frameworks such as PyTorch.
|
|
862
|
+
All matrices are assumed to be stored in flattened row-major memory layout (NumPy default).
|
|
824
863
|
"""
|
|
825
864
|
...
|
|
826
865
|
|
|
@@ -828,12 +867,12 @@ def mlp(
|
|
|
828
867
|
@over
|
|
829
868
|
def bvh_query_aabb(id: uint64, lower: vec3f, upper: vec3f) -> bvh_query_t:
|
|
830
869
|
"""
|
|
831
|
-
Construct an axis-aligned bounding box query against a
|
|
832
|
-
inside a
|
|
870
|
+
Construct an axis-aligned bounding box query against a BVH object. This query can be used to iterate over all bounds
|
|
871
|
+
inside a BVH.
|
|
833
872
|
|
|
834
|
-
:param id: The
|
|
835
|
-
:param lower: The lower bound of the bounding box in
|
|
836
|
-
:param upper: The upper bound of the bounding box in
|
|
873
|
+
:param id: The BVH identifier
|
|
874
|
+
:param lower: The lower bound of the bounding box in BVH space
|
|
875
|
+
:param upper: The upper bound of the bounding box in BVH space
|
|
837
876
|
"""
|
|
838
877
|
...
|
|
839
878
|
|
|
@@ -841,12 +880,12 @@ def bvh_query_aabb(id: uint64, lower: vec3f, upper: vec3f) -> bvh_query_t:
|
|
|
841
880
|
@over
|
|
842
881
|
def bvh_query_ray(id: uint64, start: vec3f, dir: vec3f) -> bvh_query_t:
|
|
843
882
|
"""
|
|
844
|
-
Construct a ray query against a
|
|
845
|
-
that intersect the ray.
|
|
883
|
+
Construct a ray query against a BVH object. This query can be used to iterate over all bounds
|
|
884
|
+
that intersect the ray.
|
|
846
885
|
|
|
847
|
-
:param id: The
|
|
848
|
-
:param start: The start of the ray in
|
|
849
|
-
:param dir: The direction of the ray in
|
|
886
|
+
:param id: The BVH identifier
|
|
887
|
+
:param start: The start of the ray in BVH space
|
|
888
|
+
:param dir: The direction of the ray in BVH space
|
|
850
889
|
"""
|
|
851
890
|
...
|
|
852
891
|
|
|
@@ -854,56 +893,105 @@ def bvh_query_ray(id: uint64, start: vec3f, dir: vec3f) -> bvh_query_t:
|
|
|
854
893
|
@over
|
|
855
894
|
def bvh_query_next(query: bvh_query_t, index: int32) -> bool:
|
|
856
895
|
"""
|
|
857
|
-
Move to the next bound returned by the query.
|
|
858
|
-
if there are no more overlapping bound.
|
|
896
|
+
Move to the next bound returned by the query.
|
|
897
|
+
The index of the current bound is stored in ``index``, returns ``False`` if there are no more overlapping bound.
|
|
859
898
|
"""
|
|
860
899
|
...
|
|
861
900
|
|
|
862
901
|
|
|
863
902
|
@over
|
|
864
|
-
def mesh_query_point(
|
|
865
|
-
id: uint64, point: vec3f, max_dist: float32, inside: float32, face: int32, bary_u: float32, bary_v: float32
|
|
866
|
-
) -> bool:
|
|
903
|
+
def mesh_query_point(id: uint64, point: vec3f, max_dist: float32) -> mesh_query_point_t:
|
|
867
904
|
"""
|
|
868
|
-
Computes the closest point on the
|
|
905
|
+
Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
|
|
906
|
+
|
|
907
|
+
Identifies the sign of the distance using additional ray-casts to determine if the point is inside or outside.
|
|
908
|
+
This method is relatively robust, but does increase computational cost.
|
|
909
|
+
See below for additional sign determination methods.
|
|
910
|
+
|
|
911
|
+
:param id: The mesh identifier
|
|
912
|
+
:param point: The point in space to query
|
|
913
|
+
:param max_dist: Mesh faces above this distance will not be considered by the query
|
|
914
|
+
"""
|
|
915
|
+
...
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
@over
|
|
919
|
+
def mesh_query_point_no_sign(id: uint64, point: vec3f, max_dist: float32) -> mesh_query_point_t:
|
|
920
|
+
"""
|
|
921
|
+
Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
|
|
922
|
+
|
|
923
|
+
This method does not compute the sign of the point (inside/outside) which makes it faster than other point query methods.
|
|
869
924
|
|
|
870
925
|
:param id: The mesh identifier
|
|
871
926
|
:param point: The point in space to query
|
|
872
927
|
:param max_dist: Mesh faces above this distance will not be considered by the query
|
|
873
|
-
:param inside: Returns a value < 0 if query point is inside the mesh, >=0 otherwise. Note that mesh must be watertight for this to be robust
|
|
874
|
-
:param face: Returns the index of the closest face
|
|
875
|
-
:param bary_u: Returns the barycentric u coordinate of the closest point
|
|
876
|
-
:param bary_v: Returns the barycentric v coordinate of the closest point
|
|
877
928
|
"""
|
|
878
929
|
...
|
|
879
930
|
|
|
880
931
|
|
|
881
932
|
@over
|
|
882
|
-
def
|
|
883
|
-
id: uint64,
|
|
884
|
-
start: vec3f,
|
|
885
|
-
dir: vec3f,
|
|
886
|
-
max_t: float32,
|
|
887
|
-
t: float32,
|
|
888
|
-
bary_u: float32,
|
|
889
|
-
bary_v: float32,
|
|
890
|
-
sign: float32,
|
|
891
|
-
normal: vec3f,
|
|
892
|
-
face: int32,
|
|
893
|
-
) -> bool:
|
|
933
|
+
def mesh_query_furthest_point_no_sign(id: uint64, point: vec3f, min_dist: float32) -> mesh_query_point_t:
|
|
894
934
|
"""
|
|
895
|
-
Computes the
|
|
935
|
+
Computes the furthest point on the mesh with identifier `id` to the given point in space.
|
|
936
|
+
|
|
937
|
+
This method does not compute the sign of the point (inside/outside).
|
|
938
|
+
|
|
939
|
+
:param id: The mesh identifier
|
|
940
|
+
:param point: The point in space to query
|
|
941
|
+
:param min_dist: Mesh faces below this distance will not be considered by the query
|
|
942
|
+
"""
|
|
943
|
+
...
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
@over
|
|
947
|
+
def mesh_query_point_sign_normal(id: uint64, point: vec3f, max_dist: float32, epsilon: float32) -> mesh_query_point_t:
|
|
948
|
+
"""
|
|
949
|
+
Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
|
|
950
|
+
|
|
951
|
+
Identifies the sign of the distance (inside/outside) using the angle-weighted pseudo normal.
|
|
952
|
+
This approach to sign determination is robust for well conditioned meshes that are watertight and non-self intersecting.
|
|
953
|
+
It is also comparatively fast to compute.
|
|
954
|
+
|
|
955
|
+
:param id: The mesh identifier
|
|
956
|
+
:param point: The point in space to query
|
|
957
|
+
:param max_dist: Mesh faces above this distance will not be considered by the query
|
|
958
|
+
:param epsilon: Epsilon treating distance values as equal, when locating the minimum distance vertex/face/edge, as a
|
|
959
|
+
fraction of the average edge length, also for treating closest point as being on edge/vertex default 1e-3
|
|
960
|
+
"""
|
|
961
|
+
...
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
@over
|
|
965
|
+
def mesh_query_point_sign_winding_number(
|
|
966
|
+
id: uint64, point: vec3f, max_dist: float32, accuracy: float32, threshold: float32
|
|
967
|
+
) -> mesh_query_point_t:
|
|
968
|
+
"""
|
|
969
|
+
Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given point in space.
|
|
970
|
+
|
|
971
|
+
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
|
|
972
|
+
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
|
|
973
|
+
but also the most expensive.
|
|
974
|
+
|
|
975
|
+
.. note:: The :class:`Mesh` object must be constructed with ``support_winding_number=True`` for this method to return correct results.
|
|
976
|
+
|
|
977
|
+
:param id: The mesh identifier
|
|
978
|
+
:param point: The point in space to query
|
|
979
|
+
:param max_dist: Mesh faces above this distance will not be considered by the query
|
|
980
|
+
:param accuracy: Accuracy for computing the winding number with fast winding number method utilizing second-order dipole approximation, default 2.0
|
|
981
|
+
:param threshold: The threshold of the winding number to be considered inside, default 0.5
|
|
982
|
+
"""
|
|
983
|
+
...
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
@over
|
|
987
|
+
def mesh_query_ray(id: uint64, start: vec3f, dir: vec3f, max_t: float32) -> mesh_query_ray_t:
|
|
988
|
+
"""
|
|
989
|
+
Computes the closest ray hit on the :class:`Mesh` with identifier ``id``.
|
|
896
990
|
|
|
897
991
|
:param id: The mesh identifier
|
|
898
992
|
:param start: The start point of the ray
|
|
899
993
|
:param dir: The ray direction (should be normalized)
|
|
900
994
|
:param max_t: The maximum distance along the ray to check for intersections
|
|
901
|
-
:param t: Returns the distance of the closest hit along the ray
|
|
902
|
-
:param bary_u: Returns the barycentric u coordinate of the closest hit
|
|
903
|
-
:param bary_v: Returns the barycentric v coordinate of the closest hit
|
|
904
|
-
:param sign: Returns a value > 0 if the hit ray hit front of the face, returns < 0 otherwise
|
|
905
|
-
:param normal: Returns the face normal
|
|
906
|
-
:param face: Returns the index of the hit face
|
|
907
995
|
"""
|
|
908
996
|
...
|
|
909
997
|
|
|
@@ -911,8 +999,8 @@ def mesh_query_ray(
|
|
|
911
999
|
@over
|
|
912
1000
|
def mesh_query_aabb(id: uint64, lower: vec3f, upper: vec3f) -> mesh_query_aabb_t:
|
|
913
1001
|
"""
|
|
914
|
-
Construct an axis-aligned bounding box query against a
|
|
915
|
-
|
|
1002
|
+
Construct an axis-aligned bounding box query against a :class:`Mesh`.
|
|
1003
|
+
This query can be used to iterate over all triangles inside a volume.
|
|
916
1004
|
|
|
917
1005
|
:param id: The mesh identifier
|
|
918
1006
|
:param lower: The lower bound of the bounding box in mesh space
|
|
@@ -924,8 +1012,8 @@ def mesh_query_aabb(id: uint64, lower: vec3f, upper: vec3f) -> mesh_query_aabb_t
|
|
|
924
1012
|
@over
|
|
925
1013
|
def mesh_query_aabb_next(query: mesh_query_aabb_t, index: int32) -> bool:
|
|
926
1014
|
"""
|
|
927
|
-
Move to the next triangle overlapping the query bounding box.
|
|
928
|
-
if there are no more overlapping triangles.
|
|
1015
|
+
Move to the next triangle overlapping the query bounding box.
|
|
1016
|
+
The index of the current face is stored in ``index``, returns ``False`` if there are no more overlapping triangles.
|
|
929
1017
|
"""
|
|
930
1018
|
...
|
|
931
1019
|
|
|
@@ -933,7 +1021,7 @@ def mesh_query_aabb_next(query: mesh_query_aabb_t, index: int32) -> bool:
|
|
|
933
1021
|
@over
|
|
934
1022
|
def mesh_eval_position(id: uint64, face: int32, bary_u: float32, bary_v: float32) -> vec3f:
|
|
935
1023
|
"""
|
|
936
|
-
Evaluates the position on the
|
|
1024
|
+
Evaluates the position on the :class:`Mesh` given a face index and barycentric coordinates.
|
|
937
1025
|
"""
|
|
938
1026
|
...
|
|
939
1027
|
|
|
@@ -941,7 +1029,7 @@ def mesh_eval_position(id: uint64, face: int32, bary_u: float32, bary_v: float32
|
|
|
941
1029
|
@over
|
|
942
1030
|
def mesh_eval_velocity(id: uint64, face: int32, bary_u: float32, bary_v: float32) -> vec3f:
|
|
943
1031
|
"""
|
|
944
|
-
Evaluates the velocity on the
|
|
1032
|
+
Evaluates the velocity on the :class:`Mesh` given a face index and barycentric coordinates.
|
|
945
1033
|
"""
|
|
946
1034
|
...
|
|
947
1035
|
|
|
@@ -949,8 +1037,7 @@ def mesh_eval_velocity(id: uint64, face: int32, bary_u: float32, bary_v: float32
|
|
|
949
1037
|
@over
|
|
950
1038
|
def hash_grid_query(id: uint64, point: vec3f, max_dist: float32) -> hash_grid_query_t:
|
|
951
1039
|
"""
|
|
952
|
-
Construct a point query against a
|
|
953
|
-
fixed radius from the query point. Returns an object that is used to track state during neighbor traversal.
|
|
1040
|
+
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.
|
|
954
1041
|
"""
|
|
955
1042
|
...
|
|
956
1043
|
|
|
@@ -967,8 +1054,10 @@ def hash_grid_query_next(query: hash_grid_query_t, index: int32) -> bool:
|
|
|
967
1054
|
@over
|
|
968
1055
|
def hash_grid_point_id(id: uint64, index: int32) -> int:
|
|
969
1056
|
"""
|
|
970
|
-
Return the index of a point in the
|
|
1057
|
+
Return the index of a point in the :class:`HashGrid`. This can be used to reorder threads such that grid
|
|
971
1058
|
traversal occurs in a spatially coherent order.
|
|
1059
|
+
|
|
1060
|
+
Returns -1 if the :class:`HashGrid` has not been reserved.
|
|
972
1061
|
"""
|
|
973
1062
|
...
|
|
974
1063
|
|
|
@@ -1039,7 +1128,17 @@ def closest_point_edge_edge(p1: vec3f, q1: vec3f, p2: vec3f, q2: vec3f, epsilon:
|
|
|
1039
1128
|
@over
|
|
1040
1129
|
def volume_sample_f(id: uint64, uvw: vec3f, sampling_mode: int32) -> float:
|
|
1041
1130
|
"""
|
|
1042
|
-
Sample the volume given by ``id`` at the volume local-space point ``uvw``.
|
|
1131
|
+
Sample the volume given by ``id`` at the volume local-space point ``uvw``.
|
|
1132
|
+
Interpolation should be :attr:`warp.Volume.CLOSEST` or :attr:`wp.Volume.LINEAR.`
|
|
1133
|
+
"""
|
|
1134
|
+
...
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
@over
|
|
1138
|
+
def volume_sample_grad_f(id: uint64, uvw: vec3f, sampling_mode: int32, grad: vec3f) -> float:
|
|
1139
|
+
"""
|
|
1140
|
+
Sample the volume and its gradient given by ``id`` at the volume local-space point ``uvw``.
|
|
1141
|
+
Interpolation should be :attr:`warp.Volume.CLOSEST` or :attr:`wp.Volume.LINEAR.`
|
|
1043
1142
|
"""
|
|
1044
1143
|
...
|
|
1045
1144
|
|
|
@@ -1047,7 +1146,8 @@ def volume_sample_f(id: uint64, uvw: vec3f, sampling_mode: int32) -> float:
|
|
|
1047
1146
|
@over
|
|
1048
1147
|
def volume_lookup_f(id: uint64, i: int32, j: int32, k: int32) -> float:
|
|
1049
1148
|
"""
|
|
1050
|
-
Returns the value of voxel with coordinates ``i``, ``j``, ``k
|
|
1149
|
+
Returns the value of voxel with coordinates ``i``, ``j``, ``k``.
|
|
1150
|
+
If the voxel at this index does not exist, this function returns the background value
|
|
1051
1151
|
"""
|
|
1052
1152
|
...
|
|
1053
1153
|
|
|
@@ -1055,7 +1155,7 @@ def volume_lookup_f(id: uint64, i: int32, j: int32, k: int32) -> float:
|
|
|
1055
1155
|
@over
|
|
1056
1156
|
def volume_store_f(id: uint64, i: int32, j: int32, k: int32, value: float32):
|
|
1057
1157
|
"""
|
|
1058
|
-
Store
|
|
1158
|
+
Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``.
|
|
1059
1159
|
"""
|
|
1060
1160
|
...
|
|
1061
1161
|
|
|
@@ -1063,7 +1163,8 @@ def volume_store_f(id: uint64, i: int32, j: int32, k: int32, value: float32):
|
|
|
1063
1163
|
@over
|
|
1064
1164
|
def volume_sample_v(id: uint64, uvw: vec3f, sampling_mode: int32) -> vec3f:
|
|
1065
1165
|
"""
|
|
1066
|
-
Sample the vector volume given by ``id`` at the volume local-space point ``uvw``.
|
|
1166
|
+
Sample the vector volume given by ``id`` at the volume local-space point ``uvw``.
|
|
1167
|
+
Interpolation should be :attr:`warp.Volume.CLOSEST` or :attr:`wp.Volume.LINEAR.`
|
|
1067
1168
|
"""
|
|
1068
1169
|
...
|
|
1069
1170
|
|
|
@@ -1071,7 +1172,8 @@ def volume_sample_v(id: uint64, uvw: vec3f, sampling_mode: int32) -> vec3f:
|
|
|
1071
1172
|
@over
|
|
1072
1173
|
def volume_lookup_v(id: uint64, i: int32, j: int32, k: int32) -> vec3f:
|
|
1073
1174
|
"""
|
|
1074
|
-
Returns the vector value of voxel with coordinates ``i``, ``j``, ``k
|
|
1175
|
+
Returns the vector value of voxel with coordinates ``i``, ``j``, ``k``.
|
|
1176
|
+
If the voxel at this index does not exist, this function returns the background value.
|
|
1075
1177
|
"""
|
|
1076
1178
|
...
|
|
1077
1179
|
|
|
@@ -1079,7 +1181,7 @@ def volume_lookup_v(id: uint64, i: int32, j: int32, k: int32) -> vec3f:
|
|
|
1079
1181
|
@over
|
|
1080
1182
|
def volume_store_v(id: uint64, i: int32, j: int32, k: int32, value: vec3f):
|
|
1081
1183
|
"""
|
|
1082
|
-
Store
|
|
1184
|
+
Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``.
|
|
1083
1185
|
"""
|
|
1084
1186
|
...
|
|
1085
1187
|
|
|
@@ -1087,7 +1189,7 @@ def volume_store_v(id: uint64, i: int32, j: int32, k: int32, value: vec3f):
|
|
|
1087
1189
|
@over
|
|
1088
1190
|
def volume_sample_i(id: uint64, uvw: vec3f) -> int:
|
|
1089
1191
|
"""
|
|
1090
|
-
Sample the int32 volume given by ``id`` at the volume local-space point ``uvw``.
|
|
1192
|
+
Sample the :class:`int32` volume given by ``id`` at the volume local-space point ``uvw``.
|
|
1091
1193
|
"""
|
|
1092
1194
|
...
|
|
1093
1195
|
|
|
@@ -1095,7 +1197,8 @@ def volume_sample_i(id: uint64, uvw: vec3f) -> int:
|
|
|
1095
1197
|
@over
|
|
1096
1198
|
def volume_lookup_i(id: uint64, i: int32, j: int32, k: int32) -> int:
|
|
1097
1199
|
"""
|
|
1098
|
-
Returns the int32 value of voxel with coordinates ``i``, ``j``, ``k
|
|
1200
|
+
Returns the :class:`int32` value of voxel with coordinates ``i``, ``j``, ``k``.
|
|
1201
|
+
If the voxel at this index does not exist, this function returns the background value.
|
|
1099
1202
|
"""
|
|
1100
1203
|
...
|
|
1101
1204
|
|
|
@@ -1103,7 +1206,7 @@ def volume_lookup_i(id: uint64, i: int32, j: int32, k: int32) -> int:
|
|
|
1103
1206
|
@over
|
|
1104
1207
|
def volume_store_i(id: uint64, i: int32, j: int32, k: int32, value: int32):
|
|
1105
1208
|
"""
|
|
1106
|
-
Store
|
|
1209
|
+
Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``.
|
|
1107
1210
|
"""
|
|
1108
1211
|
...
|
|
1109
1212
|
|
|
@@ -1111,7 +1214,7 @@ def volume_store_i(id: uint64, i: int32, j: int32, k: int32, value: int32):
|
|
|
1111
1214
|
@over
|
|
1112
1215
|
def volume_index_to_world(id: uint64, uvw: vec3f) -> vec3f:
|
|
1113
1216
|
"""
|
|
1114
|
-
Transform a point defined in volume index space to world space given the volume's intrinsic affine transformation.
|
|
1217
|
+
Transform a point ``uvw`` defined in volume index space to world space given the volume's intrinsic affine transformation.
|
|
1115
1218
|
"""
|
|
1116
1219
|
...
|
|
1117
1220
|
|
|
@@ -1119,7 +1222,7 @@ def volume_index_to_world(id: uint64, uvw: vec3f) -> vec3f:
|
|
|
1119
1222
|
@over
|
|
1120
1223
|
def volume_world_to_index(id: uint64, xyz: vec3f) -> vec3f:
|
|
1121
1224
|
"""
|
|
1122
|
-
Transform a point defined in volume world space to the volume's index space
|
|
1225
|
+
Transform a point ``xyz`` defined in volume world space to the volume's index space given the volume's intrinsic affine transformation.
|
|
1123
1226
|
"""
|
|
1124
1227
|
...
|
|
1125
1228
|
|
|
@@ -1127,7 +1230,7 @@ def volume_world_to_index(id: uint64, xyz: vec3f) -> vec3f:
|
|
|
1127
1230
|
@over
|
|
1128
1231
|
def volume_index_to_world_dir(id: uint64, uvw: vec3f) -> vec3f:
|
|
1129
1232
|
"""
|
|
1130
|
-
Transform a direction defined in volume index space to world space given the volume's intrinsic affine transformation.
|
|
1233
|
+
Transform a direction ``uvw`` defined in volume index space to world space given the volume's intrinsic affine transformation.
|
|
1131
1234
|
"""
|
|
1132
1235
|
...
|
|
1133
1236
|
|
|
@@ -1135,7 +1238,7 @@ def volume_index_to_world_dir(id: uint64, uvw: vec3f) -> vec3f:
|
|
|
1135
1238
|
@over
|
|
1136
1239
|
def volume_world_to_index_dir(id: uint64, xyz: vec3f) -> vec3f:
|
|
1137
1240
|
"""
|
|
1138
|
-
Transform a direction defined in volume world space to the volume's index space
|
|
1241
|
+
Transform a direction ``xyz`` defined in volume world space to the volume's index space given the volume's intrinsic affine transformation.
|
|
1139
1242
|
"""
|
|
1140
1243
|
...
|
|
1141
1244
|
|
|
@@ -1161,7 +1264,7 @@ def rand_init(seed: int32, offset: int32) -> uint32:
|
|
|
1161
1264
|
@over
|
|
1162
1265
|
def randi(state: uint32) -> int:
|
|
1163
1266
|
"""
|
|
1164
|
-
Return a random integer
|
|
1267
|
+
Return a random integer in the range [0, 2^32).
|
|
1165
1268
|
"""
|
|
1166
1269
|
...
|
|
1167
1270
|
|
|
@@ -1169,7 +1272,7 @@ def randi(state: uint32) -> int:
|
|
|
1169
1272
|
@over
|
|
1170
1273
|
def randi(state: uint32, min: int32, max: int32) -> int:
|
|
1171
1274
|
"""
|
|
1172
|
-
Return a random integer between [min, max)
|
|
1275
|
+
Return a random integer between [min, max).
|
|
1173
1276
|
"""
|
|
1174
1277
|
...
|
|
1175
1278
|
|
|
@@ -1177,7 +1280,7 @@ def randi(state: uint32, min: int32, max: int32) -> int:
|
|
|
1177
1280
|
@over
|
|
1178
1281
|
def randf(state: uint32) -> float:
|
|
1179
1282
|
"""
|
|
1180
|
-
Return a random float between [0.0, 1.0)
|
|
1283
|
+
Return a random float between [0.0, 1.0).
|
|
1181
1284
|
"""
|
|
1182
1285
|
...
|
|
1183
1286
|
|
|
@@ -1185,7 +1288,7 @@ def randf(state: uint32) -> float:
|
|
|
1185
1288
|
@over
|
|
1186
1289
|
def randf(state: uint32, min: float32, max: float32) -> float:
|
|
1187
1290
|
"""
|
|
1188
|
-
Return a random float between [min, max)
|
|
1291
|
+
Return a random float between [min, max).
|
|
1189
1292
|
"""
|
|
1190
1293
|
...
|
|
1191
1294
|
|
|
@@ -1193,7 +1296,7 @@ def randf(state: uint32, min: float32, max: float32) -> float:
|
|
|
1193
1296
|
@over
|
|
1194
1297
|
def randn(state: uint32) -> float:
|
|
1195
1298
|
"""
|
|
1196
|
-
Sample a normal distribution
|
|
1299
|
+
Sample a normal distribution.
|
|
1197
1300
|
"""
|
|
1198
1301
|
...
|
|
1199
1302
|
|
|
@@ -1201,7 +1304,7 @@ def randn(state: uint32) -> float:
|
|
|
1201
1304
|
@over
|
|
1202
1305
|
def sample_cdf(state: uint32, cdf: Array[float32]) -> int:
|
|
1203
1306
|
"""
|
|
1204
|
-
Inverse
|
|
1307
|
+
Inverse-transform sample a cumulative distribution function.
|
|
1205
1308
|
"""
|
|
1206
1309
|
...
|
|
1207
1310
|
|
|
@@ -1209,7 +1312,7 @@ def sample_cdf(state: uint32, cdf: Array[float32]) -> int:
|
|
|
1209
1312
|
@over
|
|
1210
1313
|
def sample_triangle(state: uint32) -> vec2f:
|
|
1211
1314
|
"""
|
|
1212
|
-
Uniformly sample a triangle. Returns sample barycentric coordinates
|
|
1315
|
+
Uniformly sample a triangle. Returns sample barycentric coordinates.
|
|
1213
1316
|
"""
|
|
1214
1317
|
...
|
|
1215
1318
|
|
|
@@ -1217,7 +1320,7 @@ def sample_triangle(state: uint32) -> vec2f:
|
|
|
1217
1320
|
@over
|
|
1218
1321
|
def sample_unit_ring(state: uint32) -> vec2f:
|
|
1219
1322
|
"""
|
|
1220
|
-
Uniformly sample a ring in the xy plane
|
|
1323
|
+
Uniformly sample a ring in the xy plane.
|
|
1221
1324
|
"""
|
|
1222
1325
|
...
|
|
1223
1326
|
|
|
@@ -1225,7 +1328,7 @@ def sample_unit_ring(state: uint32) -> vec2f:
|
|
|
1225
1328
|
@over
|
|
1226
1329
|
def sample_unit_disk(state: uint32) -> vec2f:
|
|
1227
1330
|
"""
|
|
1228
|
-
Uniformly sample a disk in the xy plane
|
|
1331
|
+
Uniformly sample a disk in the xy plane.
|
|
1229
1332
|
"""
|
|
1230
1333
|
...
|
|
1231
1334
|
|
|
@@ -1233,7 +1336,7 @@ def sample_unit_disk(state: uint32) -> vec2f:
|
|
|
1233
1336
|
@over
|
|
1234
1337
|
def sample_unit_sphere_surface(state: uint32) -> vec3f:
|
|
1235
1338
|
"""
|
|
1236
|
-
Uniformly sample a unit sphere surface
|
|
1339
|
+
Uniformly sample a unit sphere surface.
|
|
1237
1340
|
"""
|
|
1238
1341
|
...
|
|
1239
1342
|
|
|
@@ -1241,7 +1344,7 @@ def sample_unit_sphere_surface(state: uint32) -> vec3f:
|
|
|
1241
1344
|
@over
|
|
1242
1345
|
def sample_unit_sphere(state: uint32) -> vec3f:
|
|
1243
1346
|
"""
|
|
1244
|
-
Uniformly sample a unit sphere
|
|
1347
|
+
Uniformly sample a unit sphere.
|
|
1245
1348
|
"""
|
|
1246
1349
|
...
|
|
1247
1350
|
|
|
@@ -1249,7 +1352,7 @@ def sample_unit_sphere(state: uint32) -> vec3f:
|
|
|
1249
1352
|
@over
|
|
1250
1353
|
def sample_unit_hemisphere_surface(state: uint32) -> vec3f:
|
|
1251
1354
|
"""
|
|
1252
|
-
Uniformly sample a unit hemisphere surface
|
|
1355
|
+
Uniformly sample a unit hemisphere surface.
|
|
1253
1356
|
"""
|
|
1254
1357
|
...
|
|
1255
1358
|
|
|
@@ -1257,7 +1360,7 @@ def sample_unit_hemisphere_surface(state: uint32) -> vec3f:
|
|
|
1257
1360
|
@over
|
|
1258
1361
|
def sample_unit_hemisphere(state: uint32) -> vec3f:
|
|
1259
1362
|
"""
|
|
1260
|
-
Uniformly sample a unit hemisphere
|
|
1363
|
+
Uniformly sample a unit hemisphere.
|
|
1261
1364
|
"""
|
|
1262
1365
|
...
|
|
1263
1366
|
|
|
@@ -1265,7 +1368,7 @@ def sample_unit_hemisphere(state: uint32) -> vec3f:
|
|
|
1265
1368
|
@over
|
|
1266
1369
|
def sample_unit_square(state: uint32) -> vec2f:
|
|
1267
1370
|
"""
|
|
1268
|
-
Uniformly sample a unit square
|
|
1371
|
+
Uniformly sample a unit square.
|
|
1269
1372
|
"""
|
|
1270
1373
|
...
|
|
1271
1374
|
|
|
@@ -1273,7 +1376,7 @@ def sample_unit_square(state: uint32) -> vec2f:
|
|
|
1273
1376
|
@over
|
|
1274
1377
|
def sample_unit_cube(state: uint32) -> vec3f:
|
|
1275
1378
|
"""
|
|
1276
|
-
Uniformly sample a unit cube
|
|
1379
|
+
Uniformly sample a unit cube.
|
|
1277
1380
|
"""
|
|
1278
1381
|
...
|
|
1279
1382
|
|
|
@@ -1283,8 +1386,8 @@ def poisson(state: uint32, lam: float32) -> uint32:
|
|
|
1283
1386
|
"""
|
|
1284
1387
|
Generate a random sample from a Poisson distribution.
|
|
1285
1388
|
|
|
1286
|
-
|
|
1287
|
-
|
|
1389
|
+
:param state: RNG state
|
|
1390
|
+
:param lam: The expected value of the distribution
|
|
1288
1391
|
"""
|
|
1289
1392
|
...
|
|
1290
1393
|
|
|
@@ -1292,7 +1395,7 @@ def poisson(state: uint32, lam: float32) -> uint32:
|
|
|
1292
1395
|
@over
|
|
1293
1396
|
def noise(state: uint32, x: float32) -> float:
|
|
1294
1397
|
"""
|
|
1295
|
-
Non-periodic Perlin-style noise in
|
|
1398
|
+
Non-periodic Perlin-style noise in 1D.
|
|
1296
1399
|
"""
|
|
1297
1400
|
...
|
|
1298
1401
|
|
|
@@ -1300,7 +1403,7 @@ def noise(state: uint32, x: float32) -> float:
|
|
|
1300
1403
|
@over
|
|
1301
1404
|
def noise(state: uint32, xy: vec2f) -> float:
|
|
1302
1405
|
"""
|
|
1303
|
-
Non-periodic Perlin-style noise in
|
|
1406
|
+
Non-periodic Perlin-style noise in 2D.
|
|
1304
1407
|
"""
|
|
1305
1408
|
...
|
|
1306
1409
|
|
|
@@ -1308,7 +1411,7 @@ def noise(state: uint32, xy: vec2f) -> float:
|
|
|
1308
1411
|
@over
|
|
1309
1412
|
def noise(state: uint32, xyz: vec3f) -> float:
|
|
1310
1413
|
"""
|
|
1311
|
-
Non-periodic Perlin-style noise in
|
|
1414
|
+
Non-periodic Perlin-style noise in 3D.
|
|
1312
1415
|
"""
|
|
1313
1416
|
...
|
|
1314
1417
|
|
|
@@ -1316,7 +1419,7 @@ def noise(state: uint32, xyz: vec3f) -> float:
|
|
|
1316
1419
|
@over
|
|
1317
1420
|
def noise(state: uint32, xyzt: vec4f) -> float:
|
|
1318
1421
|
"""
|
|
1319
|
-
Non-periodic Perlin-style noise in
|
|
1422
|
+
Non-periodic Perlin-style noise in 4D.
|
|
1320
1423
|
"""
|
|
1321
1424
|
...
|
|
1322
1425
|
|
|
@@ -1324,7 +1427,7 @@ def noise(state: uint32, xyzt: vec4f) -> float:
|
|
|
1324
1427
|
@over
|
|
1325
1428
|
def pnoise(state: uint32, x: float32, px: int32) -> float:
|
|
1326
1429
|
"""
|
|
1327
|
-
Periodic Perlin-style noise in
|
|
1430
|
+
Periodic Perlin-style noise in 1D.
|
|
1328
1431
|
"""
|
|
1329
1432
|
...
|
|
1330
1433
|
|
|
@@ -1332,7 +1435,7 @@ def pnoise(state: uint32, x: float32, px: int32) -> float:
|
|
|
1332
1435
|
@over
|
|
1333
1436
|
def pnoise(state: uint32, xy: vec2f, px: int32, py: int32) -> float:
|
|
1334
1437
|
"""
|
|
1335
|
-
Periodic Perlin-style noise in
|
|
1438
|
+
Periodic Perlin-style noise in 2D.
|
|
1336
1439
|
"""
|
|
1337
1440
|
...
|
|
1338
1441
|
|
|
@@ -1340,7 +1443,7 @@ def pnoise(state: uint32, xy: vec2f, px: int32, py: int32) -> float:
|
|
|
1340
1443
|
@over
|
|
1341
1444
|
def pnoise(state: uint32, xyz: vec3f, px: int32, py: int32, pz: int32) -> float:
|
|
1342
1445
|
"""
|
|
1343
|
-
Periodic Perlin-style noise in
|
|
1446
|
+
Periodic Perlin-style noise in 3D.
|
|
1344
1447
|
"""
|
|
1345
1448
|
...
|
|
1346
1449
|
|
|
@@ -1348,13 +1451,13 @@ def pnoise(state: uint32, xyz: vec3f, px: int32, py: int32, pz: int32) -> float:
|
|
|
1348
1451
|
@over
|
|
1349
1452
|
def pnoise(state: uint32, xyzt: vec4f, px: int32, py: int32, pz: int32, pt: int32) -> float:
|
|
1350
1453
|
"""
|
|
1351
|
-
Periodic Perlin-style noise in
|
|
1454
|
+
Periodic Perlin-style noise in 4D.
|
|
1352
1455
|
"""
|
|
1353
1456
|
...
|
|
1354
1457
|
|
|
1355
1458
|
|
|
1356
1459
|
@over
|
|
1357
|
-
def curlnoise(state: uint32, xy: vec2f) -> vec2f:
|
|
1460
|
+
def curlnoise(state: uint32, xy: vec2f, octaves: uint32, lacunarity: float32, gain: float32) -> vec2f:
|
|
1358
1461
|
"""
|
|
1359
1462
|
Divergence-free vector field based on the gradient of a Perlin noise function.
|
|
1360
1463
|
"""
|
|
@@ -1362,7 +1465,7 @@ def curlnoise(state: uint32, xy: vec2f) -> vec2f:
|
|
|
1362
1465
|
|
|
1363
1466
|
|
|
1364
1467
|
@over
|
|
1365
|
-
def curlnoise(state: uint32, xyz: vec3f) -> vec3f:
|
|
1468
|
+
def curlnoise(state: uint32, xyz: vec3f, octaves: uint32, lacunarity: float32, gain: float32) -> vec3f:
|
|
1366
1469
|
"""
|
|
1367
1470
|
Divergence-free vector field based on the curl of three Perlin noise functions.
|
|
1368
1471
|
"""
|
|
@@ -1370,7 +1473,7 @@ def curlnoise(state: uint32, xyz: vec3f) -> vec3f:
|
|
|
1370
1473
|
|
|
1371
1474
|
|
|
1372
1475
|
@over
|
|
1373
|
-
def curlnoise(state: uint32, xyzt: vec4f) -> vec3f:
|
|
1476
|
+
def curlnoise(state: uint32, xyzt: vec4f, octaves: uint32, lacunarity: float32, gain: float32) -> vec3f:
|
|
1374
1477
|
"""
|
|
1375
1478
|
Divergence-free vector field based on the curl of three Perlin noise functions.
|
|
1376
1479
|
"""
|
|
@@ -1380,40 +1483,42 @@ def curlnoise(state: uint32, xyzt: vec4f) -> vec3f:
|
|
|
1380
1483
|
@over
|
|
1381
1484
|
def printf():
|
|
1382
1485
|
"""
|
|
1383
|
-
Allows printing formatted strings
|
|
1486
|
+
Allows printing formatted strings using C-style format specifiers.
|
|
1384
1487
|
"""
|
|
1385
1488
|
...
|
|
1386
1489
|
|
|
1387
1490
|
|
|
1388
1491
|
@over
|
|
1389
|
-
def tid() -> int:
|
|
1492
|
+
def tid() -> Tuple[int, int]:
|
|
1390
1493
|
"""
|
|
1391
|
-
Return the current thread
|
|
1392
|
-
|
|
1494
|
+
Return the current thread indices for a 2D kernel launch. Use ``i,j = wp.tid()`` syntax to retrieve the
|
|
1495
|
+
coordinates inside the kernel thread grid. This function may not be called from user-defined Warp functions.
|
|
1393
1496
|
"""
|
|
1394
1497
|
...
|
|
1395
1498
|
|
|
1396
1499
|
|
|
1397
1500
|
@over
|
|
1398
|
-
def tid() -> Tuple[int, int]:
|
|
1501
|
+
def tid() -> Tuple[int, int, int]:
|
|
1399
1502
|
"""
|
|
1400
|
-
Return the current thread indices for a
|
|
1503
|
+
Return the current thread indices for a 3D kernel launch. Use ``i,j,k = wp.tid()`` syntax to retrieve the
|
|
1504
|
+
coordinates inside the kernel thread grid. This function may not be called from user-defined Warp functions.
|
|
1401
1505
|
"""
|
|
1402
1506
|
...
|
|
1403
1507
|
|
|
1404
1508
|
|
|
1405
1509
|
@over
|
|
1406
|
-
def tid() -> Tuple[int, int, int]:
|
|
1510
|
+
def tid() -> Tuple[int, int, int, int]:
|
|
1407
1511
|
"""
|
|
1408
|
-
Return the current thread indices for a
|
|
1512
|
+
Return the current thread indices for a 4D kernel launch. Use ``i,j,k,l = wp.tid()`` syntax to retrieve the
|
|
1513
|
+
coordinates inside the kernel thread grid. This function may not be called from user-defined Warp functions.
|
|
1409
1514
|
"""
|
|
1410
1515
|
...
|
|
1411
1516
|
|
|
1412
1517
|
|
|
1413
1518
|
@over
|
|
1414
|
-
def
|
|
1519
|
+
def select(cond: bool, arg1: Any, arg2: Any):
|
|
1415
1520
|
"""
|
|
1416
|
-
|
|
1521
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1417
1522
|
"""
|
|
1418
1523
|
...
|
|
1419
1524
|
|
|
@@ -1421,7 +1526,7 @@ def tid() -> Tuple[int, int, int, int]:
|
|
|
1421
1526
|
@over
|
|
1422
1527
|
def select(cond: bool, arg1: Any, arg2: Any):
|
|
1423
1528
|
"""
|
|
1424
|
-
Select between two arguments, if cond is
|
|
1529
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1425
1530
|
"""
|
|
1426
1531
|
...
|
|
1427
1532
|
|
|
@@ -1429,7 +1534,7 @@ def select(cond: bool, arg1: Any, arg2: Any):
|
|
|
1429
1534
|
@over
|
|
1430
1535
|
def select(cond: int8, arg1: Any, arg2: Any):
|
|
1431
1536
|
"""
|
|
1432
|
-
Select between two arguments, if cond is
|
|
1537
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1433
1538
|
"""
|
|
1434
1539
|
...
|
|
1435
1540
|
|
|
@@ -1437,7 +1542,7 @@ def select(cond: int8, arg1: Any, arg2: Any):
|
|
|
1437
1542
|
@over
|
|
1438
1543
|
def select(cond: uint8, arg1: Any, arg2: Any):
|
|
1439
1544
|
"""
|
|
1440
|
-
Select between two arguments, if cond is
|
|
1545
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1441
1546
|
"""
|
|
1442
1547
|
...
|
|
1443
1548
|
|
|
@@ -1445,7 +1550,7 @@ def select(cond: uint8, arg1: Any, arg2: Any):
|
|
|
1445
1550
|
@over
|
|
1446
1551
|
def select(cond: int16, arg1: Any, arg2: Any):
|
|
1447
1552
|
"""
|
|
1448
|
-
Select between two arguments, if cond is
|
|
1553
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1449
1554
|
"""
|
|
1450
1555
|
...
|
|
1451
1556
|
|
|
@@ -1453,7 +1558,7 @@ def select(cond: int16, arg1: Any, arg2: Any):
|
|
|
1453
1558
|
@over
|
|
1454
1559
|
def select(cond: uint16, arg1: Any, arg2: Any):
|
|
1455
1560
|
"""
|
|
1456
|
-
Select between two arguments, if cond is
|
|
1561
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1457
1562
|
"""
|
|
1458
1563
|
...
|
|
1459
1564
|
|
|
@@ -1461,7 +1566,7 @@ def select(cond: uint16, arg1: Any, arg2: Any):
|
|
|
1461
1566
|
@over
|
|
1462
1567
|
def select(cond: int32, arg1: Any, arg2: Any):
|
|
1463
1568
|
"""
|
|
1464
|
-
Select between two arguments, if cond is
|
|
1569
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1465
1570
|
"""
|
|
1466
1571
|
...
|
|
1467
1572
|
|
|
@@ -1469,7 +1574,7 @@ def select(cond: int32, arg1: Any, arg2: Any):
|
|
|
1469
1574
|
@over
|
|
1470
1575
|
def select(cond: uint32, arg1: Any, arg2: Any):
|
|
1471
1576
|
"""
|
|
1472
|
-
Select between two arguments, if cond is
|
|
1577
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1473
1578
|
"""
|
|
1474
1579
|
...
|
|
1475
1580
|
|
|
@@ -1477,7 +1582,7 @@ def select(cond: uint32, arg1: Any, arg2: Any):
|
|
|
1477
1582
|
@over
|
|
1478
1583
|
def select(cond: int64, arg1: Any, arg2: Any):
|
|
1479
1584
|
"""
|
|
1480
|
-
Select between two arguments, if cond is
|
|
1585
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1481
1586
|
"""
|
|
1482
1587
|
...
|
|
1483
1588
|
|
|
@@ -1485,7 +1590,7 @@ def select(cond: int64, arg1: Any, arg2: Any):
|
|
|
1485
1590
|
@over
|
|
1486
1591
|
def select(cond: uint64, arg1: Any, arg2: Any):
|
|
1487
1592
|
"""
|
|
1488
|
-
Select between two arguments, if cond is
|
|
1593
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1489
1594
|
"""
|
|
1490
1595
|
...
|
|
1491
1596
|
|
|
@@ -1493,7 +1598,7 @@ def select(cond: uint64, arg1: Any, arg2: Any):
|
|
|
1493
1598
|
@over
|
|
1494
1599
|
def select(arr: Array[Any], arg1: Any, arg2: Any):
|
|
1495
1600
|
"""
|
|
1496
|
-
Select between two arguments, if
|
|
1601
|
+
Select between two arguments, if ``arr`` is null then return ``arg1``, otherwise return ``arg2``
|
|
1497
1602
|
"""
|
|
1498
1603
|
...
|
|
1499
1604
|
|
|
@@ -1501,7 +1606,7 @@ def select(arr: Array[Any], arg1: Any, arg2: Any):
|
|
|
1501
1606
|
@over
|
|
1502
1607
|
def atomic_add(a: Array[Any], i: int32, value: Any):
|
|
1503
1608
|
"""
|
|
1504
|
-
Atomically add ``value`` onto
|
|
1609
|
+
Atomically add ``value`` onto ``a[i]``.
|
|
1505
1610
|
"""
|
|
1506
1611
|
...
|
|
1507
1612
|
|
|
@@ -1509,7 +1614,7 @@ def atomic_add(a: Array[Any], i: int32, value: Any):
|
|
|
1509
1614
|
@over
|
|
1510
1615
|
def atomic_add(a: Array[Any], i: int32, j: int32, value: Any):
|
|
1511
1616
|
"""
|
|
1512
|
-
Atomically add ``value`` onto
|
|
1617
|
+
Atomically add ``value`` onto ``a[i,j]``.
|
|
1513
1618
|
"""
|
|
1514
1619
|
...
|
|
1515
1620
|
|
|
@@ -1517,7 +1622,7 @@ def atomic_add(a: Array[Any], i: int32, j: int32, value: Any):
|
|
|
1517
1622
|
@over
|
|
1518
1623
|
def atomic_add(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
|
|
1519
1624
|
"""
|
|
1520
|
-
Atomically add ``value`` onto
|
|
1625
|
+
Atomically add ``value`` onto ``a[i,j,k]``.
|
|
1521
1626
|
"""
|
|
1522
1627
|
...
|
|
1523
1628
|
|
|
@@ -1525,7 +1630,71 @@ def atomic_add(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
|
|
|
1525
1630
|
@over
|
|
1526
1631
|
def atomic_add(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
|
|
1527
1632
|
"""
|
|
1528
|
-
Atomically add ``value`` onto
|
|
1633
|
+
Atomically add ``value`` onto ``a[i,j,k,l]``.
|
|
1634
|
+
"""
|
|
1635
|
+
...
|
|
1636
|
+
|
|
1637
|
+
|
|
1638
|
+
@over
|
|
1639
|
+
def atomic_add(a: FabricArray[Any], i: int32, value: Any):
|
|
1640
|
+
"""
|
|
1641
|
+
Atomically add ``value`` onto ``a[i]``.
|
|
1642
|
+
"""
|
|
1643
|
+
...
|
|
1644
|
+
|
|
1645
|
+
|
|
1646
|
+
@over
|
|
1647
|
+
def atomic_add(a: FabricArray[Any], i: int32, j: int32, value: Any):
|
|
1648
|
+
"""
|
|
1649
|
+
Atomically add ``value`` onto ``a[i,j]``.
|
|
1650
|
+
"""
|
|
1651
|
+
...
|
|
1652
|
+
|
|
1653
|
+
|
|
1654
|
+
@over
|
|
1655
|
+
def atomic_add(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
|
|
1656
|
+
"""
|
|
1657
|
+
Atomically add ``value`` onto ``a[i,j,k]``.
|
|
1658
|
+
"""
|
|
1659
|
+
...
|
|
1660
|
+
|
|
1661
|
+
|
|
1662
|
+
@over
|
|
1663
|
+
def atomic_add(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
|
|
1664
|
+
"""
|
|
1665
|
+
Atomically add ``value`` onto ``a[i,j,k,l]``.
|
|
1666
|
+
"""
|
|
1667
|
+
...
|
|
1668
|
+
|
|
1669
|
+
|
|
1670
|
+
@over
|
|
1671
|
+
def atomic_add(a: IndexedFabricArray[Any], i: int32, value: Any):
|
|
1672
|
+
"""
|
|
1673
|
+
Atomically add ``value`` onto ``a[i]``.
|
|
1674
|
+
"""
|
|
1675
|
+
...
|
|
1676
|
+
|
|
1677
|
+
|
|
1678
|
+
@over
|
|
1679
|
+
def atomic_add(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
|
|
1680
|
+
"""
|
|
1681
|
+
Atomically add ``value`` onto ``a[i,j]``.
|
|
1682
|
+
"""
|
|
1683
|
+
...
|
|
1684
|
+
|
|
1685
|
+
|
|
1686
|
+
@over
|
|
1687
|
+
def atomic_add(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
|
|
1688
|
+
"""
|
|
1689
|
+
Atomically add ``value`` onto ``a[i,j,k]``.
|
|
1690
|
+
"""
|
|
1691
|
+
...
|
|
1692
|
+
|
|
1693
|
+
|
|
1694
|
+
@over
|
|
1695
|
+
def atomic_add(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
|
|
1696
|
+
"""
|
|
1697
|
+
Atomically add ``value`` onto ``a[i,j,k,l]``.
|
|
1529
1698
|
"""
|
|
1530
1699
|
...
|
|
1531
1700
|
|
|
@@ -1533,7 +1702,7 @@ def atomic_add(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any
|
|
|
1533
1702
|
@over
|
|
1534
1703
|
def atomic_sub(a: Array[Any], i: int32, value: Any):
|
|
1535
1704
|
"""
|
|
1536
|
-
Atomically subtract ``value`` onto
|
|
1705
|
+
Atomically subtract ``value`` onto ``a[i]``.
|
|
1537
1706
|
"""
|
|
1538
1707
|
...
|
|
1539
1708
|
|
|
@@ -1541,7 +1710,7 @@ def atomic_sub(a: Array[Any], i: int32, value: Any):
|
|
|
1541
1710
|
@over
|
|
1542
1711
|
def atomic_sub(a: Array[Any], i: int32, j: int32, value: Any):
|
|
1543
1712
|
"""
|
|
1544
|
-
Atomically subtract ``value`` onto
|
|
1713
|
+
Atomically subtract ``value`` onto ``a[i,j]``.
|
|
1545
1714
|
"""
|
|
1546
1715
|
...
|
|
1547
1716
|
|
|
@@ -1549,7 +1718,7 @@ def atomic_sub(a: Array[Any], i: int32, j: int32, value: Any):
|
|
|
1549
1718
|
@over
|
|
1550
1719
|
def atomic_sub(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
|
|
1551
1720
|
"""
|
|
1552
|
-
Atomically subtract ``value`` onto
|
|
1721
|
+
Atomically subtract ``value`` onto ``a[i,j,k]``.
|
|
1553
1722
|
"""
|
|
1554
1723
|
...
|
|
1555
1724
|
|
|
@@ -1557,7 +1726,71 @@ def atomic_sub(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
|
|
|
1557
1726
|
@over
|
|
1558
1727
|
def atomic_sub(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
|
|
1559
1728
|
"""
|
|
1560
|
-
Atomically subtract ``value`` onto
|
|
1729
|
+
Atomically subtract ``value`` onto ``a[i,j,k,l]``.
|
|
1730
|
+
"""
|
|
1731
|
+
...
|
|
1732
|
+
|
|
1733
|
+
|
|
1734
|
+
@over
|
|
1735
|
+
def atomic_sub(a: FabricArray[Any], i: int32, value: Any):
|
|
1736
|
+
"""
|
|
1737
|
+
Atomically subtract ``value`` onto ``a[i]``.
|
|
1738
|
+
"""
|
|
1739
|
+
...
|
|
1740
|
+
|
|
1741
|
+
|
|
1742
|
+
@over
|
|
1743
|
+
def atomic_sub(a: FabricArray[Any], i: int32, j: int32, value: Any):
|
|
1744
|
+
"""
|
|
1745
|
+
Atomically subtract ``value`` onto ``a[i,j]``.
|
|
1746
|
+
"""
|
|
1747
|
+
...
|
|
1748
|
+
|
|
1749
|
+
|
|
1750
|
+
@over
|
|
1751
|
+
def atomic_sub(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
|
|
1752
|
+
"""
|
|
1753
|
+
Atomically subtract ``value`` onto ``a[i,j,k]``.
|
|
1754
|
+
"""
|
|
1755
|
+
...
|
|
1756
|
+
|
|
1757
|
+
|
|
1758
|
+
@over
|
|
1759
|
+
def atomic_sub(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
|
|
1760
|
+
"""
|
|
1761
|
+
Atomically subtract ``value`` onto ``a[i,j,k,l]``.
|
|
1762
|
+
"""
|
|
1763
|
+
...
|
|
1764
|
+
|
|
1765
|
+
|
|
1766
|
+
@over
|
|
1767
|
+
def atomic_sub(a: IndexedFabricArray[Any], i: int32, value: Any):
|
|
1768
|
+
"""
|
|
1769
|
+
Atomically subtract ``value`` onto ``a[i]``.
|
|
1770
|
+
"""
|
|
1771
|
+
...
|
|
1772
|
+
|
|
1773
|
+
|
|
1774
|
+
@over
|
|
1775
|
+
def atomic_sub(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
|
|
1776
|
+
"""
|
|
1777
|
+
Atomically subtract ``value`` onto ``a[i,j]``.
|
|
1778
|
+
"""
|
|
1779
|
+
...
|
|
1780
|
+
|
|
1781
|
+
|
|
1782
|
+
@over
|
|
1783
|
+
def atomic_sub(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
|
|
1784
|
+
"""
|
|
1785
|
+
Atomically subtract ``value`` onto ``a[i,j,k]``.
|
|
1786
|
+
"""
|
|
1787
|
+
...
|
|
1788
|
+
|
|
1789
|
+
|
|
1790
|
+
@over
|
|
1791
|
+
def atomic_sub(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
|
|
1792
|
+
"""
|
|
1793
|
+
Atomically subtract ``value`` onto ``a[i,j,k,l]``.
|
|
1561
1794
|
"""
|
|
1562
1795
|
...
|
|
1563
1796
|
|
|
@@ -1565,7 +1798,9 @@ def atomic_sub(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any
|
|
|
1565
1798
|
@over
|
|
1566
1799
|
def atomic_min(a: Array[Any], i: int32, value: Any):
|
|
1567
1800
|
"""
|
|
1568
|
-
Compute the minimum of ``value`` and ``
|
|
1801
|
+
Compute the minimum of ``value`` and ``a[i]`` and atomically update the array.
|
|
1802
|
+
|
|
1803
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1569
1804
|
"""
|
|
1570
1805
|
...
|
|
1571
1806
|
|
|
@@ -1573,7 +1808,9 @@ def atomic_min(a: Array[Any], i: int32, value: Any):
|
|
|
1573
1808
|
@over
|
|
1574
1809
|
def atomic_min(a: Array[Any], i: int32, j: int32, value: Any):
|
|
1575
1810
|
"""
|
|
1576
|
-
Compute the minimum of ``value`` and ``
|
|
1811
|
+
Compute the minimum of ``value`` and ``a[i,j]`` and atomically update the array.
|
|
1812
|
+
|
|
1813
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1577
1814
|
"""
|
|
1578
1815
|
...
|
|
1579
1816
|
|
|
@@ -1581,7 +1818,9 @@ def atomic_min(a: Array[Any], i: int32, j: int32, value: Any):
|
|
|
1581
1818
|
@over
|
|
1582
1819
|
def atomic_min(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
|
|
1583
1820
|
"""
|
|
1584
|
-
Compute the minimum of ``value`` and ``
|
|
1821
|
+
Compute the minimum of ``value`` and ``a[i,j,k]`` and atomically update the array.
|
|
1822
|
+
|
|
1823
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1585
1824
|
"""
|
|
1586
1825
|
...
|
|
1587
1826
|
|
|
@@ -1589,7 +1828,89 @@ def atomic_min(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
|
|
|
1589
1828
|
@over
|
|
1590
1829
|
def atomic_min(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
|
|
1591
1830
|
"""
|
|
1592
|
-
Compute the minimum of ``value`` and ``
|
|
1831
|
+
Compute the minimum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
|
|
1832
|
+
|
|
1833
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1834
|
+
"""
|
|
1835
|
+
...
|
|
1836
|
+
|
|
1837
|
+
|
|
1838
|
+
@over
|
|
1839
|
+
def atomic_min(a: FabricArray[Any], i: int32, value: Any):
|
|
1840
|
+
"""
|
|
1841
|
+
Compute the minimum of ``value`` and ``a[i]`` and atomically update the array.
|
|
1842
|
+
|
|
1843
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1844
|
+
"""
|
|
1845
|
+
...
|
|
1846
|
+
|
|
1847
|
+
|
|
1848
|
+
@over
|
|
1849
|
+
def atomic_min(a: FabricArray[Any], i: int32, j: int32, value: Any):
|
|
1850
|
+
"""
|
|
1851
|
+
Compute the minimum of ``value`` and ``a[i,j]`` and atomically update the array.
|
|
1852
|
+
|
|
1853
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1854
|
+
"""
|
|
1855
|
+
...
|
|
1856
|
+
|
|
1857
|
+
|
|
1858
|
+
@over
|
|
1859
|
+
def atomic_min(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
|
|
1860
|
+
"""
|
|
1861
|
+
Compute the minimum of ``value`` and ``a[i,j,k]`` and atomically update the array.
|
|
1862
|
+
|
|
1863
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1864
|
+
"""
|
|
1865
|
+
...
|
|
1866
|
+
|
|
1867
|
+
|
|
1868
|
+
@over
|
|
1869
|
+
def atomic_min(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
|
|
1870
|
+
"""
|
|
1871
|
+
Compute the minimum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
|
|
1872
|
+
|
|
1873
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1874
|
+
"""
|
|
1875
|
+
...
|
|
1876
|
+
|
|
1877
|
+
|
|
1878
|
+
@over
|
|
1879
|
+
def atomic_min(a: IndexedFabricArray[Any], i: int32, value: Any):
|
|
1880
|
+
"""
|
|
1881
|
+
Compute the minimum of ``value`` and ``a[i]`` and atomically update the array.
|
|
1882
|
+
|
|
1883
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1884
|
+
"""
|
|
1885
|
+
...
|
|
1886
|
+
|
|
1887
|
+
|
|
1888
|
+
@over
|
|
1889
|
+
def atomic_min(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
|
|
1890
|
+
"""
|
|
1891
|
+
Compute the minimum of ``value`` and ``a[i,j]`` and atomically update the array.
|
|
1892
|
+
|
|
1893
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1894
|
+
"""
|
|
1895
|
+
...
|
|
1896
|
+
|
|
1897
|
+
|
|
1898
|
+
@over
|
|
1899
|
+
def atomic_min(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
|
|
1900
|
+
"""
|
|
1901
|
+
Compute the minimum of ``value`` and ``a[i,j,k]`` and atomically update the array.
|
|
1902
|
+
|
|
1903
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1904
|
+
"""
|
|
1905
|
+
...
|
|
1906
|
+
|
|
1907
|
+
|
|
1908
|
+
@over
|
|
1909
|
+
def atomic_min(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
|
|
1910
|
+
"""
|
|
1911
|
+
Compute the minimum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
|
|
1912
|
+
|
|
1913
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1593
1914
|
"""
|
|
1594
1915
|
...
|
|
1595
1916
|
|
|
@@ -1597,7 +1918,9 @@ def atomic_min(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any
|
|
|
1597
1918
|
@over
|
|
1598
1919
|
def atomic_max(a: Array[Any], i: int32, value: Any):
|
|
1599
1920
|
"""
|
|
1600
|
-
Compute the maximum of ``value`` and ``
|
|
1921
|
+
Compute the maximum of ``value`` and ``a[i]`` and atomically update the array.
|
|
1922
|
+
|
|
1923
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1601
1924
|
"""
|
|
1602
1925
|
...
|
|
1603
1926
|
|
|
@@ -1605,7 +1928,9 @@ def atomic_max(a: Array[Any], i: int32, value: Any):
|
|
|
1605
1928
|
@over
|
|
1606
1929
|
def atomic_max(a: Array[Any], i: int32, j: int32, value: Any):
|
|
1607
1930
|
"""
|
|
1608
|
-
Compute the maximum of ``value`` and ``
|
|
1931
|
+
Compute the maximum of ``value`` and ``a[i,j]`` and atomically update the array.
|
|
1932
|
+
|
|
1933
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1609
1934
|
"""
|
|
1610
1935
|
...
|
|
1611
1936
|
|
|
@@ -1613,7 +1938,9 @@ def atomic_max(a: Array[Any], i: int32, j: int32, value: Any):
|
|
|
1613
1938
|
@over
|
|
1614
1939
|
def atomic_max(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
|
|
1615
1940
|
"""
|
|
1616
|
-
Compute the maximum of ``value`` and ``
|
|
1941
|
+
Compute the maximum of ``value`` and ``a[i,j,k]`` and atomically update the array.
|
|
1942
|
+
|
|
1943
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1617
1944
|
"""
|
|
1618
1945
|
...
|
|
1619
1946
|
|
|
@@ -1621,7 +1948,89 @@ def atomic_max(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
|
|
|
1621
1948
|
@over
|
|
1622
1949
|
def atomic_max(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
|
|
1623
1950
|
"""
|
|
1624
|
-
Compute the maximum of ``value`` and ``
|
|
1951
|
+
Compute the maximum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
|
|
1952
|
+
|
|
1953
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1954
|
+
"""
|
|
1955
|
+
...
|
|
1956
|
+
|
|
1957
|
+
|
|
1958
|
+
@over
|
|
1959
|
+
def atomic_max(a: FabricArray[Any], i: int32, value: Any):
|
|
1960
|
+
"""
|
|
1961
|
+
Compute the maximum of ``value`` and ``a[i]`` and atomically update the array.
|
|
1962
|
+
|
|
1963
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1964
|
+
"""
|
|
1965
|
+
...
|
|
1966
|
+
|
|
1967
|
+
|
|
1968
|
+
@over
|
|
1969
|
+
def atomic_max(a: FabricArray[Any], i: int32, j: int32, value: Any):
|
|
1970
|
+
"""
|
|
1971
|
+
Compute the maximum of ``value`` and ``a[i,j]`` and atomically update the array.
|
|
1972
|
+
|
|
1973
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1974
|
+
"""
|
|
1975
|
+
...
|
|
1976
|
+
|
|
1977
|
+
|
|
1978
|
+
@over
|
|
1979
|
+
def atomic_max(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
|
|
1980
|
+
"""
|
|
1981
|
+
Compute the maximum of ``value`` and ``a[i,j,k]`` and atomically update the array.
|
|
1982
|
+
|
|
1983
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1984
|
+
"""
|
|
1985
|
+
...
|
|
1986
|
+
|
|
1987
|
+
|
|
1988
|
+
@over
|
|
1989
|
+
def atomic_max(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
|
|
1990
|
+
"""
|
|
1991
|
+
Compute the maximum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
|
|
1992
|
+
|
|
1993
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1994
|
+
"""
|
|
1995
|
+
...
|
|
1996
|
+
|
|
1997
|
+
|
|
1998
|
+
@over
|
|
1999
|
+
def atomic_max(a: IndexedFabricArray[Any], i: int32, value: Any):
|
|
2000
|
+
"""
|
|
2001
|
+
Compute the maximum of ``value`` and ``a[i]`` and atomically update the array.
|
|
2002
|
+
|
|
2003
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
2004
|
+
"""
|
|
2005
|
+
...
|
|
2006
|
+
|
|
2007
|
+
|
|
2008
|
+
@over
|
|
2009
|
+
def atomic_max(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
|
|
2010
|
+
"""
|
|
2011
|
+
Compute the maximum of ``value`` and ``a[i,j]`` and atomically update the array.
|
|
2012
|
+
|
|
2013
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
2014
|
+
"""
|
|
2015
|
+
...
|
|
2016
|
+
|
|
2017
|
+
|
|
2018
|
+
@over
|
|
2019
|
+
def atomic_max(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
|
|
2020
|
+
"""
|
|
2021
|
+
Compute the maximum of ``value`` and ``a[i,j,k]`` and atomically update the array.
|
|
2022
|
+
|
|
2023
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
2024
|
+
"""
|
|
2025
|
+
...
|
|
2026
|
+
|
|
2027
|
+
|
|
2028
|
+
@over
|
|
2029
|
+
def atomic_max(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
|
|
2030
|
+
"""
|
|
2031
|
+
Compute the maximum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
|
|
2032
|
+
|
|
2033
|
+
Note that for vectors and matrices the operation is only atomic on a per-component basis.
|
|
1625
2034
|
"""
|
|
1626
2035
|
...
|
|
1627
2036
|
|
|
@@ -1629,7 +2038,7 @@ def atomic_max(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any
|
|
|
1629
2038
|
@over
|
|
1630
2039
|
def lerp(a: Float, b: Float, t: Float) -> Float:
|
|
1631
2040
|
"""
|
|
1632
|
-
Linearly interpolate two values a and b using factor t
|
|
2041
|
+
Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``
|
|
1633
2042
|
"""
|
|
1634
2043
|
...
|
|
1635
2044
|
|
|
@@ -1637,7 +2046,7 @@ def lerp(a: Float, b: Float, t: Float) -> Float:
|
|
|
1637
2046
|
@over
|
|
1638
2047
|
def lerp(a: Vector[Any, Float], b: Vector[Any, Float], t: Float) -> Vector[Any, Float]:
|
|
1639
2048
|
"""
|
|
1640
|
-
Linearly interpolate two values a and b using factor t
|
|
2049
|
+
Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``
|
|
1641
2050
|
"""
|
|
1642
2051
|
...
|
|
1643
2052
|
|
|
@@ -1645,7 +2054,7 @@ def lerp(a: Vector[Any, Float], b: Vector[Any, Float], t: Float) -> Vector[Any,
|
|
|
1645
2054
|
@over
|
|
1646
2055
|
def lerp(a: Matrix[Any, Any, Float], b: Matrix[Any, Any, Float], t: Float) -> Matrix[Any, Any, Float]:
|
|
1647
2056
|
"""
|
|
1648
|
-
Linearly interpolate two values a and b using factor t
|
|
2057
|
+
Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``
|
|
1649
2058
|
"""
|
|
1650
2059
|
...
|
|
1651
2060
|
|
|
@@ -1653,7 +2062,7 @@ def lerp(a: Matrix[Any, Any, Float], b: Matrix[Any, Any, Float], t: Float) -> Ma
|
|
|
1653
2062
|
@over
|
|
1654
2063
|
def lerp(a: Quaternion[Float], b: Quaternion[Float], t: Float) -> Quaternion[Float]:
|
|
1655
2064
|
"""
|
|
1656
|
-
Linearly interpolate two values a and b using factor t
|
|
2065
|
+
Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``
|
|
1657
2066
|
"""
|
|
1658
2067
|
...
|
|
1659
2068
|
|
|
@@ -1661,7 +2070,7 @@ def lerp(a: Quaternion[Float], b: Quaternion[Float], t: Float) -> Quaternion[Flo
|
|
|
1661
2070
|
@over
|
|
1662
2071
|
def lerp(a: Transformation[Float], b: Transformation[Float], t: Float) -> Transformation[Float]:
|
|
1663
2072
|
"""
|
|
1664
|
-
Linearly interpolate two values a and b using factor t
|
|
2073
|
+
Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``
|
|
1665
2074
|
"""
|
|
1666
2075
|
...
|
|
1667
2076
|
|
|
@@ -1669,7 +2078,8 @@ def lerp(a: Transformation[Float], b: Transformation[Float], t: Float) -> Transf
|
|
|
1669
2078
|
@over
|
|
1670
2079
|
def smoothstep(edge0: Float, edge1: Float, x: Float) -> Float:
|
|
1671
2080
|
"""
|
|
1672
|
-
Smoothly interpolate between two values edge0 and edge1 using a factor x
|
|
2081
|
+
Smoothly interpolate between two values ``edge0`` and ``edge1`` using a factor ``x``,
|
|
2082
|
+
and return a result between 0 and 1 using a cubic Hermite interpolation after clamping.
|
|
1673
2083
|
"""
|
|
1674
2084
|
...
|
|
1675
2085
|
|
|
@@ -1677,7 +2087,7 @@ def smoothstep(edge0: Float, edge1: Float, x: Float) -> Float:
|
|
|
1677
2087
|
@over
|
|
1678
2088
|
def expect_near(arg1: Float, arg2: Float, tolerance: Float):
|
|
1679
2089
|
"""
|
|
1680
|
-
Prints an error to stdout if arg1 and arg2 are not closer than tolerance in magnitude
|
|
2090
|
+
Prints an error to stdout if ``arg1`` and ``arg2`` are not closer than tolerance in magnitude
|
|
1681
2091
|
"""
|
|
1682
2092
|
...
|
|
1683
2093
|
|
|
@@ -1685,7 +2095,7 @@ def expect_near(arg1: Float, arg2: Float, tolerance: Float):
|
|
|
1685
2095
|
@over
|
|
1686
2096
|
def expect_near(arg1: vec3f, arg2: vec3f, tolerance: float32):
|
|
1687
2097
|
"""
|
|
1688
|
-
Prints an error to stdout if any element of arg1 and arg2 are not closer than tolerance in magnitude
|
|
2098
|
+
Prints an error to stdout if any element of ``arg1`` and ``arg2`` are not closer than tolerance in magnitude
|
|
1689
2099
|
"""
|
|
1690
2100
|
...
|
|
1691
2101
|
|
|
@@ -1693,7 +2103,15 @@ def expect_near(arg1: vec3f, arg2: vec3f, tolerance: float32):
|
|
|
1693
2103
|
@over
|
|
1694
2104
|
def lower_bound(arr: Array[Scalar], value: Scalar) -> int:
|
|
1695
2105
|
"""
|
|
1696
|
-
Search a sorted array for the closest element greater than or equal to value
|
|
2106
|
+
Search a sorted array ``arr`` for the closest element greater than or equal to ``value``.
|
|
2107
|
+
"""
|
|
2108
|
+
...
|
|
2109
|
+
|
|
2110
|
+
|
|
2111
|
+
@over
|
|
2112
|
+
def lower_bound(arr: Array[Scalar], arr_begin: int32, arr_end: int32, value: Scalar) -> int:
|
|
2113
|
+
"""
|
|
2114
|
+
Search a sorted array ``arr`` in the range [arr_begin, arr_end) for the closest element greater than or equal to ``value``.
|
|
1697
2115
|
"""
|
|
1698
2116
|
...
|
|
1699
2117
|
|
|
@@ -1848,6 +2266,12 @@ def mul(x: Matrix[Any, Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scal
|
|
|
1848
2266
|
...
|
|
1849
2267
|
|
|
1850
2268
|
|
|
2269
|
+
@over
|
|
2270
|
+
def mul(x: Vector[Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Vector[Any, Scalar]:
|
|
2271
|
+
""" """
|
|
2272
|
+
...
|
|
2273
|
+
|
|
2274
|
+
|
|
1851
2275
|
@over
|
|
1852
2276
|
def mul(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]):
|
|
1853
2277
|
""" """
|
|
@@ -1890,18 +2314,36 @@ def div(x: Vector[Any, Scalar], y: Scalar) -> Vector[Any, Scalar]:
|
|
|
1890
2314
|
...
|
|
1891
2315
|
|
|
1892
2316
|
|
|
2317
|
+
@over
|
|
2318
|
+
def div(x: Scalar, y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
|
|
2319
|
+
""" """
|
|
2320
|
+
...
|
|
2321
|
+
|
|
2322
|
+
|
|
1893
2323
|
@over
|
|
1894
2324
|
def div(x: Matrix[Any, Any, Scalar], y: Scalar) -> Matrix[Any, Any, Scalar]:
|
|
1895
2325
|
""" """
|
|
1896
2326
|
...
|
|
1897
2327
|
|
|
1898
2328
|
|
|
2329
|
+
@over
|
|
2330
|
+
def div(x: Scalar, y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
|
|
2331
|
+
""" """
|
|
2332
|
+
...
|
|
2333
|
+
|
|
2334
|
+
|
|
1899
2335
|
@over
|
|
1900
2336
|
def div(x: Quaternion[Scalar], y: Scalar) -> Quaternion[Scalar]:
|
|
1901
2337
|
""" """
|
|
1902
2338
|
...
|
|
1903
2339
|
|
|
1904
2340
|
|
|
2341
|
+
@over
|
|
2342
|
+
def div(x: Scalar, y: Quaternion[Scalar]) -> Quaternion[Scalar]:
|
|
2343
|
+
""" """
|
|
2344
|
+
...
|
|
2345
|
+
|
|
2346
|
+
|
|
1905
2347
|
@over
|
|
1906
2348
|
def floordiv(x: Scalar, y: Scalar) -> Scalar:
|
|
1907
2349
|
""" """
|