warp-lang 0.10.1__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 +10 -4
- warp/__init__.pyi +1 -0
- warp/bin/warp-clang.dll +0 -0
- warp/bin/warp.dll +0 -0
- warp/build.py +5 -3
- warp/build_dll.py +29 -9
- warp/builtins.py +868 -507
- warp/codegen.py +1074 -638
- warp/config.py +3 -3
- warp/constants.py +6 -0
- warp/context.py +715 -222
- 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 +147 -44
- warp/native/builtin.h +122 -149
- warp/native/bvh.cpp +73 -325
- warp/native/bvh.cu +406 -23
- warp/native/bvh.h +34 -43
- warp/native/clang/clang.cpp +13 -8
- warp/native/crt.h +2 -0
- warp/native/cuda_crt.h +5 -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 -952
- warp/native/fabric.h +228 -0
- warp/native/hashgrid.cpp +4 -4
- warp/native/hashgrid.h +22 -2
- warp/native/intersect.h +22 -7
- warp/native/intersect_adj.h +8 -8
- warp/native/intersect_tri.h +1 -1
- warp/native/marching.cu +157 -161
- warp/native/mat.h +80 -19
- warp/native/matnn.h +2 -2
- warp/native/mesh.cpp +33 -108
- warp/native/mesh.cu +114 -23
- warp/native/mesh.h +446 -46
- 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 +1 -1
- warp/native/reduce.cu +10 -12
- warp/native/runlength_encode.cu +6 -10
- warp/native/scan.cu +8 -11
- warp/native/sparse.cpp +4 -4
- warp/native/sparse.cu +164 -154
- warp/native/spatial.h +2 -2
- warp/native/temp_buffer.h +14 -30
- warp/native/vec.h +107 -23
- warp/native/volume.h +120 -0
- warp/native/warp.cpp +560 -30
- warp/native/warp.cu +431 -44
- warp/native/warp.h +13 -4
- warp/optim/__init__.py +1 -0
- warp/optim/linear.py +922 -0
- warp/optim/sgd.py +92 -0
- warp/render/render_opengl.py +335 -119
- warp/render/render_usd.py +11 -11
- warp/sim/__init__.py +2 -2
- warp/sim/articulation.py +385 -185
- warp/sim/collide.py +8 -0
- 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 +158 -16
- warp/sim/model.py +795 -291
- warp/sim/render.py +3 -3
- warp/sim/utils.py +3 -0
- warp/sparse.py +640 -150
- warp/stubs.py +606 -267
- warp/tape.py +61 -10
- warp/tests/__main__.py +3 -6
- warp/tests/assets/curlnoise_golden.npy +0 -0
- warp/tests/assets/pnoise_golden.npy +0 -0
- 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 +212 -97
- warp/tests/test_array_reduce.py +57 -23
- 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 +42 -18
- warp/tests/test_closest_point_edge_edge.py +54 -57
- warp/tests/test_codegen.py +208 -130
- 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 +75 -75
- 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 -86
- warp/tests/test_generics.py +194 -49
- warp/tests/test_grad.py +178 -109
- 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 +32 -31
- warp/tests/test_intersect.py +18 -9
- warp/tests/test_large.py +141 -0
- warp/tests/test_launch.py +14 -41
- 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 +517 -2898
- 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 +140 -22
- 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 +168 -20
- warp/tests/test_smoothstep.py +9 -11
- warp/tests/test_snippet.py +143 -0
- warp/tests/test_sparse.py +261 -63
- warp/tests/test_spatial.py +276 -243
- warp/tests/test_streams.py +110 -85
- warp/tests/test_struct.py +268 -63
- 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 -2050
- 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 +9 -6
- warp/types.py +1089 -366
- warp/utils.py +93 -387
- warp_lang-0.11.0.dist-info/METADATA +238 -0
- warp_lang-0.11.0.dist-info/RECORD +332 -0
- {warp_lang-0.10.1.dist-info → warp_lang-0.11.0.dist-info}/WHEEL +1 -1
- warp/tests/test_all.py +0 -219
- 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.10.1.dist-info/METADATA +0 -21
- warp_lang-0.10.1.dist-info/RECORD +0 -188
- /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.10.1.dist-info → warp_lang-0.11.0.dist-info}/LICENSE.md +0 -0
- {warp_lang-0.10.1.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
|
|
@@ -66,7 +70,6 @@ from warp.context import (
|
|
|
66
70
|
)
|
|
67
71
|
from warp.context import set_module_options, get_module_options, get_module
|
|
68
72
|
from warp.context import capture_begin, capture_end, capture_launch
|
|
69
|
-
from warp.context import print_builtins, export_builtins, export_stubs
|
|
70
73
|
from warp.context import Kernel, Function, Launch
|
|
71
74
|
from warp.context import Stream, get_stream, set_stream, synchronize_stream
|
|
72
75
|
from warp.context import Event, record_event, wait_event, wait_stream
|
|
@@ -89,6 +92,10 @@ from warp.constants import *
|
|
|
89
92
|
|
|
90
93
|
from . import builtins
|
|
91
94
|
|
|
95
|
+
import warp.config
|
|
96
|
+
|
|
97
|
+
__version__ = warp.config.version
|
|
98
|
+
|
|
92
99
|
|
|
93
100
|
@over
|
|
94
101
|
def min(x: Scalar, y: Scalar) -> Scalar:
|
|
@@ -101,7 +108,7 @@ def min(x: Scalar, y: Scalar) -> Scalar:
|
|
|
101
108
|
@over
|
|
102
109
|
def min(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
|
|
103
110
|
"""
|
|
104
|
-
Return the element
|
|
111
|
+
Return the element-wise minimum of two vectors.
|
|
105
112
|
"""
|
|
106
113
|
...
|
|
107
114
|
|
|
@@ -109,7 +116,7 @@ def min(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
|
|
|
109
116
|
@over
|
|
110
117
|
def min(v: Vector[Any, Scalar]) -> Scalar:
|
|
111
118
|
"""
|
|
112
|
-
Return the minimum element of a vector
|
|
119
|
+
Return the minimum element of a vector ``v``.
|
|
113
120
|
"""
|
|
114
121
|
...
|
|
115
122
|
|
|
@@ -125,7 +132,7 @@ def max(x: Scalar, y: Scalar) -> Scalar:
|
|
|
125
132
|
@over
|
|
126
133
|
def max(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
|
|
127
134
|
"""
|
|
128
|
-
Return the element
|
|
135
|
+
Return the element-wise maximum of two vectors.
|
|
129
136
|
"""
|
|
130
137
|
...
|
|
131
138
|
|
|
@@ -133,7 +140,7 @@ def max(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
|
|
|
133
140
|
@over
|
|
134
141
|
def max(v: Vector[Any, Scalar]) -> Scalar:
|
|
135
142
|
"""
|
|
136
|
-
Return the maximum element of a vector
|
|
143
|
+
Return the maximum element of a vector ``v``.
|
|
137
144
|
"""
|
|
138
145
|
...
|
|
139
146
|
|
|
@@ -141,7 +148,7 @@ def max(v: Vector[Any, Scalar]) -> Scalar:
|
|
|
141
148
|
@over
|
|
142
149
|
def clamp(x: Scalar, a: Scalar, b: Scalar) -> Scalar:
|
|
143
150
|
"""
|
|
144
|
-
Clamp the value of x to the range [a, b].
|
|
151
|
+
Clamp the value of ``x`` to the range [a, b].
|
|
145
152
|
"""
|
|
146
153
|
...
|
|
147
154
|
|
|
@@ -149,7 +156,7 @@ def clamp(x: Scalar, a: Scalar, b: Scalar) -> Scalar:
|
|
|
149
156
|
@over
|
|
150
157
|
def abs(x: Scalar) -> Scalar:
|
|
151
158
|
"""
|
|
152
|
-
Return the absolute value of x
|
|
159
|
+
Return the absolute value of ``x``.
|
|
153
160
|
"""
|
|
154
161
|
...
|
|
155
162
|
|
|
@@ -157,7 +164,7 @@ def abs(x: Scalar) -> Scalar:
|
|
|
157
164
|
@over
|
|
158
165
|
def sign(x: Scalar) -> Scalar:
|
|
159
166
|
"""
|
|
160
|
-
Return -1 if x < 0, return 1 otherwise.
|
|
167
|
+
Return -1 if ``x`` < 0, return 1 otherwise.
|
|
161
168
|
"""
|
|
162
169
|
...
|
|
163
170
|
|
|
@@ -165,7 +172,7 @@ def sign(x: Scalar) -> Scalar:
|
|
|
165
172
|
@over
|
|
166
173
|
def step(x: Scalar) -> Scalar:
|
|
167
174
|
"""
|
|
168
|
-
Return 1.0 if x < 0.0, return 0.0 otherwise.
|
|
175
|
+
Return 1.0 if ``x`` < 0.0, return 0.0 otherwise.
|
|
169
176
|
"""
|
|
170
177
|
...
|
|
171
178
|
|
|
@@ -173,7 +180,7 @@ def step(x: Scalar) -> Scalar:
|
|
|
173
180
|
@over
|
|
174
181
|
def nonzero(x: Scalar) -> Scalar:
|
|
175
182
|
"""
|
|
176
|
-
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.
|
|
177
184
|
"""
|
|
178
185
|
...
|
|
179
186
|
|
|
@@ -181,7 +188,7 @@ def nonzero(x: Scalar) -> Scalar:
|
|
|
181
188
|
@over
|
|
182
189
|
def sin(x: Float) -> Float:
|
|
183
190
|
"""
|
|
184
|
-
Return the sine of x in radians.
|
|
191
|
+
Return the sine of ``x`` in radians.
|
|
185
192
|
"""
|
|
186
193
|
...
|
|
187
194
|
|
|
@@ -189,7 +196,7 @@ def sin(x: Float) -> Float:
|
|
|
189
196
|
@over
|
|
190
197
|
def cos(x: Float) -> Float:
|
|
191
198
|
"""
|
|
192
|
-
Return the cosine of x in radians.
|
|
199
|
+
Return the cosine of ``x`` in radians.
|
|
193
200
|
"""
|
|
194
201
|
...
|
|
195
202
|
|
|
@@ -197,7 +204,7 @@ def cos(x: Float) -> Float:
|
|
|
197
204
|
@over
|
|
198
205
|
def acos(x: Float) -> Float:
|
|
199
206
|
"""
|
|
200
|
-
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].
|
|
201
208
|
"""
|
|
202
209
|
...
|
|
203
210
|
|
|
@@ -205,7 +212,7 @@ def acos(x: Float) -> Float:
|
|
|
205
212
|
@over
|
|
206
213
|
def asin(x: Float) -> Float:
|
|
207
214
|
"""
|
|
208
|
-
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].
|
|
209
216
|
"""
|
|
210
217
|
...
|
|
211
218
|
|
|
@@ -213,7 +220,15 @@ def asin(x: Float) -> Float:
|
|
|
213
220
|
@over
|
|
214
221
|
def sqrt(x: Float) -> Float:
|
|
215
222
|
"""
|
|
216
|
-
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``.
|
|
217
232
|
"""
|
|
218
233
|
...
|
|
219
234
|
|
|
@@ -221,7 +236,7 @@ def sqrt(x: Float) -> Float:
|
|
|
221
236
|
@over
|
|
222
237
|
def tan(x: Float) -> Float:
|
|
223
238
|
"""
|
|
224
|
-
Return tangent of x in radians.
|
|
239
|
+
Return the tangent of ``x`` in radians.
|
|
225
240
|
"""
|
|
226
241
|
...
|
|
227
242
|
|
|
@@ -229,7 +244,7 @@ def tan(x: Float) -> Float:
|
|
|
229
244
|
@over
|
|
230
245
|
def atan(x: Float) -> Float:
|
|
231
246
|
"""
|
|
232
|
-
Return
|
|
247
|
+
Return the arctangent of ``x`` in radians.
|
|
233
248
|
"""
|
|
234
249
|
...
|
|
235
250
|
|
|
@@ -237,7 +252,7 @@ def atan(x: Float) -> Float:
|
|
|
237
252
|
@over
|
|
238
253
|
def atan2(y: Float, x: Float) -> Float:
|
|
239
254
|
"""
|
|
240
|
-
Return atan2 of x.
|
|
255
|
+
Return the 2-argument arctangent, atan2, of the point ``(x, y)`` in radians.
|
|
241
256
|
"""
|
|
242
257
|
...
|
|
243
258
|
|
|
@@ -245,7 +260,7 @@ def atan2(y: Float, x: Float) -> Float:
|
|
|
245
260
|
@over
|
|
246
261
|
def sinh(x: Float) -> Float:
|
|
247
262
|
"""
|
|
248
|
-
Return the sinh of x
|
|
263
|
+
Return the sinh of ``x``.
|
|
249
264
|
"""
|
|
250
265
|
...
|
|
251
266
|
|
|
@@ -253,7 +268,7 @@ def sinh(x: Float) -> Float:
|
|
|
253
268
|
@over
|
|
254
269
|
def cosh(x: Float) -> Float:
|
|
255
270
|
"""
|
|
256
|
-
Return the cosh of x
|
|
271
|
+
Return the cosh of ``x``.
|
|
257
272
|
"""
|
|
258
273
|
...
|
|
259
274
|
|
|
@@ -261,7 +276,7 @@ def cosh(x: Float) -> Float:
|
|
|
261
276
|
@over
|
|
262
277
|
def tanh(x: Float) -> Float:
|
|
263
278
|
"""
|
|
264
|
-
Return the tanh of x
|
|
279
|
+
Return the tanh of ``x``.
|
|
265
280
|
"""
|
|
266
281
|
...
|
|
267
282
|
|
|
@@ -269,7 +284,7 @@ def tanh(x: Float) -> Float:
|
|
|
269
284
|
@over
|
|
270
285
|
def degrees(x: Float) -> Float:
|
|
271
286
|
"""
|
|
272
|
-
Convert radians into degrees.
|
|
287
|
+
Convert ``x`` from radians into degrees.
|
|
273
288
|
"""
|
|
274
289
|
...
|
|
275
290
|
|
|
@@ -277,7 +292,7 @@ def degrees(x: Float) -> Float:
|
|
|
277
292
|
@over
|
|
278
293
|
def radians(x: Float) -> Float:
|
|
279
294
|
"""
|
|
280
|
-
Convert degrees into radians.
|
|
295
|
+
Convert ``x`` from degrees into radians.
|
|
281
296
|
"""
|
|
282
297
|
...
|
|
283
298
|
|
|
@@ -285,7 +300,7 @@ def radians(x: Float) -> Float:
|
|
|
285
300
|
@over
|
|
286
301
|
def log(x: Float) -> Float:
|
|
287
302
|
"""
|
|
288
|
-
Return the natural
|
|
303
|
+
Return the natural logarithm (base-e) of ``x``, where ``x`` is positive.
|
|
289
304
|
"""
|
|
290
305
|
...
|
|
291
306
|
|
|
@@ -293,7 +308,7 @@ def log(x: Float) -> Float:
|
|
|
293
308
|
@over
|
|
294
309
|
def log2(x: Float) -> Float:
|
|
295
310
|
"""
|
|
296
|
-
Return the
|
|
311
|
+
Return the binary logarithm (base-2) of ``x``, where ``x`` is positive.
|
|
297
312
|
"""
|
|
298
313
|
...
|
|
299
314
|
|
|
@@ -301,7 +316,7 @@ def log2(x: Float) -> Float:
|
|
|
301
316
|
@over
|
|
302
317
|
def log10(x: Float) -> Float:
|
|
303
318
|
"""
|
|
304
|
-
Return the
|
|
319
|
+
Return the common logarithm (base-10) of ``x``, where ``x`` is positive.
|
|
305
320
|
"""
|
|
306
321
|
...
|
|
307
322
|
|
|
@@ -309,7 +324,7 @@ def log10(x: Float) -> Float:
|
|
|
309
324
|
@over
|
|
310
325
|
def exp(x: Float) -> Float:
|
|
311
326
|
"""
|
|
312
|
-
Return
|
|
327
|
+
Return the value of the exponential function :math:`e^x`.
|
|
313
328
|
"""
|
|
314
329
|
...
|
|
315
330
|
|
|
@@ -317,7 +332,7 @@ def exp(x: Float) -> Float:
|
|
|
317
332
|
@over
|
|
318
333
|
def pow(x: Float, y: Float) -> Float:
|
|
319
334
|
"""
|
|
320
|
-
Return the result of x raised to power of y
|
|
335
|
+
Return the result of ``x`` raised to power of ``y``.
|
|
321
336
|
"""
|
|
322
337
|
...
|
|
323
338
|
|
|
@@ -325,9 +340,9 @@ def pow(x: Float, y: Float) -> Float:
|
|
|
325
340
|
@over
|
|
326
341
|
def round(x: Float) -> Float:
|
|
327
342
|
"""
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
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()`.
|
|
331
346
|
"""
|
|
332
347
|
...
|
|
333
348
|
|
|
@@ -335,9 +350,8 @@ def round(x: Float) -> Float:
|
|
|
335
350
|
@over
|
|
336
351
|
def rint(x: Float) -> Float:
|
|
337
352
|
"""
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
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()`.
|
|
341
355
|
"""
|
|
342
356
|
...
|
|
343
357
|
|
|
@@ -345,10 +359,10 @@ def rint(x: Float) -> Float:
|
|
|
345
359
|
@over
|
|
346
360
|
def trunc(x: Float) -> Float:
|
|
347
361
|
"""
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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()`.
|
|
352
366
|
"""
|
|
353
367
|
...
|
|
354
368
|
|
|
@@ -356,7 +370,7 @@ def trunc(x: Float) -> Float:
|
|
|
356
370
|
@over
|
|
357
371
|
def floor(x: Float) -> Float:
|
|
358
372
|
"""
|
|
359
|
-
|
|
373
|
+
Return the largest integer that is less than or equal to ``x``.
|
|
360
374
|
"""
|
|
361
375
|
...
|
|
362
376
|
|
|
@@ -364,7 +378,16 @@ def floor(x: Float) -> Float:
|
|
|
364
378
|
@over
|
|
365
379
|
def ceil(x: Float) -> Float:
|
|
366
380
|
"""
|
|
367
|
-
|
|
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)``.
|
|
368
391
|
"""
|
|
369
392
|
...
|
|
370
393
|
|
|
@@ -396,7 +419,7 @@ def ddot(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Scalar:
|
|
|
396
419
|
@over
|
|
397
420
|
def argmin(v: Vector[Any, Scalar]) -> uint32:
|
|
398
421
|
"""
|
|
399
|
-
Return the index of the minimum element of a vector
|
|
422
|
+
Return the index of the minimum element of a vector ``v``.
|
|
400
423
|
"""
|
|
401
424
|
...
|
|
402
425
|
|
|
@@ -404,7 +427,7 @@ def argmin(v: Vector[Any, Scalar]) -> uint32:
|
|
|
404
427
|
@over
|
|
405
428
|
def argmax(v: Vector[Any, Scalar]) -> uint32:
|
|
406
429
|
"""
|
|
407
|
-
Return the index of the maximum element of a vector
|
|
430
|
+
Return the index of the maximum element of a vector ``v``.
|
|
408
431
|
"""
|
|
409
432
|
...
|
|
410
433
|
|
|
@@ -412,7 +435,7 @@ def argmax(v: Vector[Any, Scalar]) -> uint32:
|
|
|
412
435
|
@over
|
|
413
436
|
def outer(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Matrix[Any, Any, Scalar]:
|
|
414
437
|
"""
|
|
415
|
-
Compute the outer product x*y^T for two
|
|
438
|
+
Compute the outer product ``x*y^T`` for two vectors.
|
|
416
439
|
"""
|
|
417
440
|
...
|
|
418
441
|
|
|
@@ -420,7 +443,7 @@ def outer(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Matrix[Any, Any, Sc
|
|
|
420
443
|
@over
|
|
421
444
|
def cross(x: Vector[3, Scalar], y: Vector[3, Scalar]) -> Vector[3, Scalar]:
|
|
422
445
|
"""
|
|
423
|
-
Compute the cross product of two
|
|
446
|
+
Compute the cross product of two 3D vectors.
|
|
424
447
|
"""
|
|
425
448
|
...
|
|
426
449
|
|
|
@@ -428,7 +451,7 @@ def cross(x: Vector[3, Scalar], y: Vector[3, Scalar]) -> Vector[3, Scalar]:
|
|
|
428
451
|
@over
|
|
429
452
|
def skew(x: Vector[3, Scalar]):
|
|
430
453
|
"""
|
|
431
|
-
Compute the skew
|
|
454
|
+
Compute the skew-symmetric 3x3 matrix for a 3D vector ``x``.
|
|
432
455
|
"""
|
|
433
456
|
...
|
|
434
457
|
|
|
@@ -436,7 +459,7 @@ def skew(x: Vector[3, Scalar]):
|
|
|
436
459
|
@over
|
|
437
460
|
def length(x: Vector[Any, Float]) -> Scalar:
|
|
438
461
|
"""
|
|
439
|
-
Compute the length of a vector
|
|
462
|
+
Compute the length of a vector ``x``.
|
|
440
463
|
"""
|
|
441
464
|
...
|
|
442
465
|
|
|
@@ -444,7 +467,7 @@ def length(x: Vector[Any, Float]) -> Scalar:
|
|
|
444
467
|
@over
|
|
445
468
|
def length(x: Quaternion[Float]) -> Scalar:
|
|
446
469
|
"""
|
|
447
|
-
Compute the length of a quaternion
|
|
470
|
+
Compute the length of a quaternion ``x``.
|
|
448
471
|
"""
|
|
449
472
|
...
|
|
450
473
|
|
|
@@ -452,7 +475,7 @@ def length(x: Quaternion[Float]) -> Scalar:
|
|
|
452
475
|
@over
|
|
453
476
|
def length_sq(x: Vector[Any, Scalar]) -> Scalar:
|
|
454
477
|
"""
|
|
455
|
-
Compute the squared length of a
|
|
478
|
+
Compute the squared length of a 2D vector ``x``.
|
|
456
479
|
"""
|
|
457
480
|
...
|
|
458
481
|
|
|
@@ -460,7 +483,7 @@ def length_sq(x: Vector[Any, Scalar]) -> Scalar:
|
|
|
460
483
|
@over
|
|
461
484
|
def length_sq(x: Quaternion[Scalar]) -> Scalar:
|
|
462
485
|
"""
|
|
463
|
-
Compute the squared length of a quaternion
|
|
486
|
+
Compute the squared length of a quaternion ``x``.
|
|
464
487
|
"""
|
|
465
488
|
...
|
|
466
489
|
|
|
@@ -468,7 +491,7 @@ def length_sq(x: Quaternion[Scalar]) -> Scalar:
|
|
|
468
491
|
@over
|
|
469
492
|
def normalize(x: Vector[Any, Float]) -> Vector[Any, Scalar]:
|
|
470
493
|
"""
|
|
471
|
-
Compute the normalized value of x
|
|
494
|
+
Compute the normalized value of ``x``. If ``length(x)`` is 0 then the zero vector is returned.
|
|
472
495
|
"""
|
|
473
496
|
...
|
|
474
497
|
|
|
@@ -476,7 +499,7 @@ def normalize(x: Vector[Any, Float]) -> Vector[Any, Scalar]:
|
|
|
476
499
|
@over
|
|
477
500
|
def normalize(x: Quaternion[Float]) -> Quaternion[Scalar]:
|
|
478
501
|
"""
|
|
479
|
-
Compute the normalized value of x
|
|
502
|
+
Compute the normalized value of ``x``. If ``length(x)`` is 0, then the zero quaternion is returned.
|
|
480
503
|
"""
|
|
481
504
|
...
|
|
482
505
|
|
|
@@ -484,7 +507,7 @@ def normalize(x: Quaternion[Float]) -> Quaternion[Scalar]:
|
|
|
484
507
|
@over
|
|
485
508
|
def transpose(m: Matrix[Any, Any, Scalar]):
|
|
486
509
|
"""
|
|
487
|
-
Return the transpose of the matrix m
|
|
510
|
+
Return the transpose of the matrix ``m``.
|
|
488
511
|
"""
|
|
489
512
|
...
|
|
490
513
|
|
|
@@ -492,7 +515,7 @@ def transpose(m: Matrix[Any, Any, Scalar]):
|
|
|
492
515
|
@over
|
|
493
516
|
def inverse(m: Matrix[2, 2, Float]) -> Matrix[Any, Any, Float]:
|
|
494
517
|
"""
|
|
495
|
-
Return the inverse of a 2x2 matrix m
|
|
518
|
+
Return the inverse of a 2x2 matrix ``m``.
|
|
496
519
|
"""
|
|
497
520
|
...
|
|
498
521
|
|
|
@@ -500,7 +523,7 @@ def inverse(m: Matrix[2, 2, Float]) -> Matrix[Any, Any, Float]:
|
|
|
500
523
|
@over
|
|
501
524
|
def inverse(m: Matrix[3, 3, Float]) -> Matrix[Any, Any, Float]:
|
|
502
525
|
"""
|
|
503
|
-
Return the inverse of a 3x3 matrix m
|
|
526
|
+
Return the inverse of a 3x3 matrix ``m``.
|
|
504
527
|
"""
|
|
505
528
|
...
|
|
506
529
|
|
|
@@ -508,7 +531,7 @@ def inverse(m: Matrix[3, 3, Float]) -> Matrix[Any, Any, Float]:
|
|
|
508
531
|
@over
|
|
509
532
|
def inverse(m: Matrix[4, 4, Float]) -> Matrix[Any, Any, Float]:
|
|
510
533
|
"""
|
|
511
|
-
Return the inverse of a 4x4 matrix m
|
|
534
|
+
Return the inverse of a 4x4 matrix ``m``.
|
|
512
535
|
"""
|
|
513
536
|
...
|
|
514
537
|
|
|
@@ -516,7 +539,7 @@ def inverse(m: Matrix[4, 4, Float]) -> Matrix[Any, Any, Float]:
|
|
|
516
539
|
@over
|
|
517
540
|
def determinant(m: Matrix[2, 2, Float]) -> Scalar:
|
|
518
541
|
"""
|
|
519
|
-
Return the determinant of a 2x2 matrix m
|
|
542
|
+
Return the determinant of a 2x2 matrix ``m``.
|
|
520
543
|
"""
|
|
521
544
|
...
|
|
522
545
|
|
|
@@ -524,7 +547,7 @@ def determinant(m: Matrix[2, 2, Float]) -> Scalar:
|
|
|
524
547
|
@over
|
|
525
548
|
def determinant(m: Matrix[3, 3, Float]) -> Scalar:
|
|
526
549
|
"""
|
|
527
|
-
Return the determinant of a 3x3 matrix m
|
|
550
|
+
Return the determinant of a 3x3 matrix ``m``.
|
|
528
551
|
"""
|
|
529
552
|
...
|
|
530
553
|
|
|
@@ -532,7 +555,7 @@ def determinant(m: Matrix[3, 3, Float]) -> Scalar:
|
|
|
532
555
|
@over
|
|
533
556
|
def determinant(m: Matrix[4, 4, Float]) -> Scalar:
|
|
534
557
|
"""
|
|
535
|
-
Return the determinant of a 4x4 matrix m
|
|
558
|
+
Return the determinant of a 4x4 matrix ``m``.
|
|
536
559
|
"""
|
|
537
560
|
...
|
|
538
561
|
|
|
@@ -540,7 +563,7 @@ def determinant(m: Matrix[4, 4, Float]) -> Scalar:
|
|
|
540
563
|
@over
|
|
541
564
|
def trace(m: Matrix[Any, Any, Scalar]) -> Scalar:
|
|
542
565
|
"""
|
|
543
|
-
Return the trace of the matrix m
|
|
566
|
+
Return the trace of the matrix ``m``.
|
|
544
567
|
"""
|
|
545
568
|
...
|
|
546
569
|
|
|
@@ -548,7 +571,7 @@ def trace(m: Matrix[Any, Any, Scalar]) -> Scalar:
|
|
|
548
571
|
@over
|
|
549
572
|
def diag(d: Vector[Any, Scalar]) -> Matrix[Any, Any, Scalar]:
|
|
550
573
|
"""
|
|
551
|
-
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.
|
|
552
575
|
"""
|
|
553
576
|
...
|
|
554
577
|
|
|
@@ -556,7 +579,7 @@ def diag(d: Vector[Any, Scalar]) -> Matrix[Any, Any, Scalar]:
|
|
|
556
579
|
@over
|
|
557
580
|
def get_diag(m: Matrix[Any, Any, Scalar]) -> Vector[Any, Scalar]:
|
|
558
581
|
"""
|
|
559
|
-
Returns a vector containing the diagonal elements of the square matrix
|
|
582
|
+
Returns a vector containing the diagonal elements of the square matrix ``m``.
|
|
560
583
|
"""
|
|
561
584
|
...
|
|
562
585
|
|
|
@@ -564,7 +587,7 @@ def get_diag(m: Matrix[Any, Any, Scalar]) -> Vector[Any, Scalar]:
|
|
|
564
587
|
@over
|
|
565
588
|
def cw_mul(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
|
|
566
589
|
"""
|
|
567
|
-
Component
|
|
590
|
+
Component-wise multiplication of two 2D vectors.
|
|
568
591
|
"""
|
|
569
592
|
...
|
|
570
593
|
|
|
@@ -572,7 +595,7 @@ def cw_mul(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar
|
|
|
572
595
|
@over
|
|
573
596
|
def cw_mul(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
|
|
574
597
|
"""
|
|
575
|
-
Component
|
|
598
|
+
Component-wise multiplication of two 2D vectors.
|
|
576
599
|
"""
|
|
577
600
|
...
|
|
578
601
|
|
|
@@ -580,7 +603,7 @@ def cw_mul(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[A
|
|
|
580
603
|
@over
|
|
581
604
|
def cw_div(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
|
|
582
605
|
"""
|
|
583
|
-
Component
|
|
606
|
+
Component-wise division of two 2D vectors.
|
|
584
607
|
"""
|
|
585
608
|
...
|
|
586
609
|
|
|
@@ -588,7 +611,7 @@ def cw_div(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar
|
|
|
588
611
|
@over
|
|
589
612
|
def cw_div(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
|
|
590
613
|
"""
|
|
591
|
-
Component
|
|
614
|
+
Component-wise division of two 2D vectors.
|
|
592
615
|
"""
|
|
593
616
|
...
|
|
594
617
|
|
|
@@ -652,7 +675,7 @@ def quat_rotate(q: Quaternion[Float], p: Vector[3, Float]) -> Vector[3, Scalar]:
|
|
|
652
675
|
@over
|
|
653
676
|
def quat_rotate_inv(q: Quaternion[Float], p: Vector[3, Float]) -> Vector[3, Scalar]:
|
|
654
677
|
"""
|
|
655
|
-
Rotate a vector the inverse of a quaternion.
|
|
678
|
+
Rotate a vector by the inverse of a quaternion.
|
|
656
679
|
"""
|
|
657
680
|
...
|
|
658
681
|
|
|
@@ -684,7 +707,7 @@ def transform_identity() -> transformf:
|
|
|
684
707
|
@over
|
|
685
708
|
def transform_get_translation(t: Transformation[Float]) -> Vector[3, Scalar]:
|
|
686
709
|
"""
|
|
687
|
-
Return the translational part of a transform
|
|
710
|
+
Return the translational part of a transform ``t``.
|
|
688
711
|
"""
|
|
689
712
|
...
|
|
690
713
|
|
|
@@ -692,7 +715,7 @@ def transform_get_translation(t: Transformation[Float]) -> Vector[3, Scalar]:
|
|
|
692
715
|
@over
|
|
693
716
|
def transform_get_rotation(t: Transformation[Float]) -> Quaternion[Scalar]:
|
|
694
717
|
"""
|
|
695
|
-
Return the rotational part of a transform
|
|
718
|
+
Return the rotational part of a transform ``t``.
|
|
696
719
|
"""
|
|
697
720
|
...
|
|
698
721
|
|
|
@@ -708,7 +731,7 @@ def transform_multiply(a: Transformation[Float], b: Transformation[Float]) -> Tr
|
|
|
708
731
|
@over
|
|
709
732
|
def transform_point(t: Transformation[Scalar], p: Vector[3, Scalar]) -> Vector[3, Scalar]:
|
|
710
733
|
"""
|
|
711
|
-
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).
|
|
712
735
|
"""
|
|
713
736
|
...
|
|
714
737
|
|
|
@@ -716,9 +739,11 @@ def transform_point(t: Transformation[Scalar], p: Vector[3, Scalar]) -> Vector[3
|
|
|
716
739
|
@over
|
|
717
740
|
def transform_point(m: Matrix[4, 4, Scalar], p: Vector[3, Scalar]) -> Vector[3, Scalar]:
|
|
718
741
|
"""
|
|
719
|
-
Apply the transform to a point ``p`` treating the
|
|
720
|
-
|
|
721
|
-
|
|
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.
|
|
722
747
|
"""
|
|
723
748
|
...
|
|
724
749
|
|
|
@@ -726,7 +751,7 @@ def transform_point(m: Matrix[4, 4, Scalar], p: Vector[3, Scalar]) -> Vector[3,
|
|
|
726
751
|
@over
|
|
727
752
|
def transform_vector(t: Transformation[Scalar], v: Vector[3, Scalar]) -> Vector[3, Scalar]:
|
|
728
753
|
"""
|
|
729
|
-
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).
|
|
730
755
|
"""
|
|
731
756
|
...
|
|
732
757
|
|
|
@@ -734,9 +759,11 @@ def transform_vector(t: Transformation[Scalar], v: Vector[3, Scalar]) -> Vector[
|
|
|
734
759
|
@over
|
|
735
760
|
def transform_vector(m: Matrix[4, 4, Scalar], v: Vector[3, Scalar]) -> Vector[3, Scalar]:
|
|
736
761
|
"""
|
|
737
|
-
Apply the transform to a vector ``v`` treating the
|
|
738
|
-
|
|
739
|
-
|
|
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.
|
|
740
767
|
"""
|
|
741
768
|
...
|
|
742
769
|
|
|
@@ -744,7 +771,7 @@ def transform_vector(m: Matrix[4, 4, Scalar], v: Vector[3, Scalar]) -> Vector[3,
|
|
|
744
771
|
@over
|
|
745
772
|
def transform_inverse(t: Transformation[Float]) -> Transformation[Float]:
|
|
746
773
|
"""
|
|
747
|
-
Compute the inverse of the
|
|
774
|
+
Compute the inverse of the transformation ``t``.
|
|
748
775
|
"""
|
|
749
776
|
...
|
|
750
777
|
|
|
@@ -752,7 +779,7 @@ def transform_inverse(t: Transformation[Float]) -> Transformation[Float]:
|
|
|
752
779
|
@over
|
|
753
780
|
def spatial_dot(a: Vector[6, Float], b: Vector[6, Float]) -> Scalar:
|
|
754
781
|
"""
|
|
755
|
-
Compute the dot product of two
|
|
782
|
+
Compute the dot product of two 6D screw vectors.
|
|
756
783
|
"""
|
|
757
784
|
...
|
|
758
785
|
|
|
@@ -760,7 +787,7 @@ def spatial_dot(a: Vector[6, Float], b: Vector[6, Float]) -> Scalar:
|
|
|
760
787
|
@over
|
|
761
788
|
def spatial_cross(a: Vector[6, Float], b: Vector[6, Float]) -> Vector[6, Float]:
|
|
762
789
|
"""
|
|
763
|
-
Compute the cross
|
|
790
|
+
Compute the cross product of two 6D screw vectors.
|
|
764
791
|
"""
|
|
765
792
|
...
|
|
766
793
|
|
|
@@ -768,7 +795,7 @@ def spatial_cross(a: Vector[6, Float], b: Vector[6, Float]) -> Vector[6, Float]:
|
|
|
768
795
|
@over
|
|
769
796
|
def spatial_cross_dual(a: Vector[6, Float], b: Vector[6, Float]) -> Vector[6, Float]:
|
|
770
797
|
"""
|
|
771
|
-
Compute the dual cross
|
|
798
|
+
Compute the dual cross product of two 6D screw vectors.
|
|
772
799
|
"""
|
|
773
800
|
...
|
|
774
801
|
|
|
@@ -776,7 +803,7 @@ def spatial_cross_dual(a: Vector[6, Float], b: Vector[6, Float]) -> Vector[6, Fl
|
|
|
776
803
|
@over
|
|
777
804
|
def spatial_top(a: Vector[6, Float]):
|
|
778
805
|
"""
|
|
779
|
-
Return the top (first) part of a
|
|
806
|
+
Return the top (first) part of a 6D screw vector.
|
|
780
807
|
"""
|
|
781
808
|
...
|
|
782
809
|
|
|
@@ -784,7 +811,7 @@ def spatial_top(a: Vector[6, Float]):
|
|
|
784
811
|
@over
|
|
785
812
|
def spatial_bottom(a: Vector[6, Float]):
|
|
786
813
|
"""
|
|
787
|
-
Return the bottom (second) part of a
|
|
814
|
+
Return the bottom (second) part of a 6D screw vector.
|
|
788
815
|
"""
|
|
789
816
|
...
|
|
790
817
|
|
|
@@ -826,11 +853,13 @@ def mlp(
|
|
|
826
853
|
:param weights: A layer's network weights with dimensions ``(m, n)``.
|
|
827
854
|
:param bias: An array with dimensions ``(n)``.
|
|
828
855
|
:param activation: A ``wp.func`` function that takes a single scalar float as input and returns a scalar float as output
|
|
829
|
-
: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()``
|
|
830
858
|
:param x: The feature matrix with dimensions ``(n, b)``
|
|
831
859
|
:param out: The network output with dimensions ``(m, b)``
|
|
832
860
|
|
|
833
|
-
: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).
|
|
834
863
|
"""
|
|
835
864
|
...
|
|
836
865
|
|
|
@@ -838,12 +867,12 @@ def mlp(
|
|
|
838
867
|
@over
|
|
839
868
|
def bvh_query_aabb(id: uint64, lower: vec3f, upper: vec3f) -> bvh_query_t:
|
|
840
869
|
"""
|
|
841
|
-
Construct an axis-aligned bounding box query against a
|
|
842
|
-
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.
|
|
843
872
|
|
|
844
|
-
:param id: The
|
|
845
|
-
:param lower: The lower bound of the bounding box in
|
|
846
|
-
: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
|
|
847
876
|
"""
|
|
848
877
|
...
|
|
849
878
|
|
|
@@ -851,12 +880,12 @@ def bvh_query_aabb(id: uint64, lower: vec3f, upper: vec3f) -> bvh_query_t:
|
|
|
851
880
|
@over
|
|
852
881
|
def bvh_query_ray(id: uint64, start: vec3f, dir: vec3f) -> bvh_query_t:
|
|
853
882
|
"""
|
|
854
|
-
Construct a ray query against a
|
|
855
|
-
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.
|
|
856
885
|
|
|
857
|
-
:param id: The
|
|
858
|
-
:param start: The start of the ray in
|
|
859
|
-
: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
|
|
860
889
|
"""
|
|
861
890
|
...
|
|
862
891
|
|
|
@@ -864,141 +893,105 @@ def bvh_query_ray(id: uint64, start: vec3f, dir: vec3f) -> bvh_query_t:
|
|
|
864
893
|
@over
|
|
865
894
|
def bvh_query_next(query: bvh_query_t, index: int32) -> bool:
|
|
866
895
|
"""
|
|
867
|
-
Move to the next bound returned by the query.
|
|
868
|
-
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.
|
|
869
898
|
"""
|
|
870
899
|
...
|
|
871
900
|
|
|
872
901
|
|
|
873
902
|
@over
|
|
874
|
-
def mesh_query_point(
|
|
875
|
-
id: uint64, point: vec3f, max_dist: float32, inside: float32, face: int32, bary_u: float32, bary_v: float32
|
|
876
|
-
) -> bool:
|
|
903
|
+
def mesh_query_point(id: uint64, point: vec3f, max_dist: float32) -> mesh_query_point_t:
|
|
877
904
|
"""
|
|
878
|
-
Computes the closest point on the
|
|
905
|
+
Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
|
|
879
906
|
|
|
880
|
-
Identifies the sign of the distance using additional ray-casts to determine if the point is inside or outside.
|
|
881
|
-
|
|
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.
|
|
882
910
|
|
|
883
911
|
:param id: The mesh identifier
|
|
884
912
|
:param point: The point in space to query
|
|
885
913
|
:param max_dist: Mesh faces above this distance will not be considered by the query
|
|
886
|
-
: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
|
|
887
|
-
:param face: Returns the index of the closest face
|
|
888
|
-
:param bary_u: Returns the barycentric u coordinate of the closest point
|
|
889
|
-
:param bary_v: Returns the barycentric v coordinate of the closest point
|
|
890
914
|
"""
|
|
891
915
|
...
|
|
892
916
|
|
|
893
917
|
|
|
894
918
|
@over
|
|
895
|
-
def mesh_query_point_no_sign(
|
|
896
|
-
id: uint64, point: vec3f, max_dist: float32, face: int32, bary_u: float32, bary_v: float32
|
|
897
|
-
) -> bool:
|
|
919
|
+
def mesh_query_point_no_sign(id: uint64, point: vec3f, max_dist: float32) -> mesh_query_point_t:
|
|
898
920
|
"""
|
|
899
|
-
Computes the closest point on the
|
|
921
|
+
Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
|
|
900
922
|
|
|
901
923
|
This method does not compute the sign of the point (inside/outside) which makes it faster than other point query methods.
|
|
902
924
|
|
|
903
925
|
:param id: The mesh identifier
|
|
904
926
|
:param point: The point in space to query
|
|
905
927
|
:param max_dist: Mesh faces above this distance will not be considered by the query
|
|
906
|
-
:param face: Returns the index of the closest face
|
|
907
|
-
:param bary_u: Returns the barycentric u coordinate of the closest point
|
|
908
|
-
:param bary_v: Returns the barycentric v coordinate of the closest point
|
|
909
928
|
"""
|
|
910
929
|
...
|
|
911
930
|
|
|
912
931
|
|
|
913
932
|
@over
|
|
914
|
-
def
|
|
915
|
-
id: uint64,
|
|
916
|
-
point: vec3f,
|
|
917
|
-
max_dist: float32,
|
|
918
|
-
inside: float32,
|
|
919
|
-
face: int32,
|
|
920
|
-
bary_u: float32,
|
|
921
|
-
bary_v: float32,
|
|
922
|
-
epsilon: float32,
|
|
923
|
-
) -> bool:
|
|
933
|
+
def mesh_query_furthest_point_no_sign(id: uint64, point: vec3f, min_dist: float32) -> mesh_query_point_t:
|
|
924
934
|
"""
|
|
925
|
-
Computes the
|
|
935
|
+
Computes the furthest point on the mesh with identifier `id` to the given point in space.
|
|
926
936
|
|
|
927
|
-
|
|
928
|
-
|
|
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.
|
|
929
954
|
|
|
930
955
|
:param id: The mesh identifier
|
|
931
956
|
:param point: The point in space to query
|
|
932
957
|
:param max_dist: Mesh faces above this distance will not be considered by the query
|
|
933
|
-
:param
|
|
934
|
-
|
|
935
|
-
:param bary_u: Returns the barycentric u coordinate of the closest point
|
|
936
|
-
:param bary_v: Returns the barycentric v coordinate of the closest point
|
|
937
|
-
:param epsilon: Epsilon treating distance values as equal, when locating the minimum distance vertex/face/edge, as a fraction of the average edge length, also for treating closest point as being on edge/vertex default 1e-3
|
|
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
|
|
938
960
|
"""
|
|
939
961
|
...
|
|
940
962
|
|
|
941
963
|
|
|
942
964
|
@over
|
|
943
965
|
def mesh_query_point_sign_winding_number(
|
|
944
|
-
id: uint64,
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
face: int32,
|
|
949
|
-
bary_u: float32,
|
|
950
|
-
bary_v: float32,
|
|
951
|
-
accuracy: float32,
|
|
952
|
-
threshold: float32,
|
|
953
|
-
) -> bool:
|
|
954
|
-
"""
|
|
955
|
-
Computes the closest point on the mesh with identifier `id` to the given point in space. Returns ``True`` if a point < ``max_dist`` is found.
|
|
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.
|
|
956
970
|
|
|
957
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
|
|
958
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
|
|
959
973
|
but also the most expensive.
|
|
960
974
|
|
|
961
|
-
|
|
975
|
+
.. note:: The :class:`Mesh` object must be constructed with ``support_winding_number=True`` for this method to return correct results.
|
|
962
976
|
|
|
963
977
|
:param id: The mesh identifier
|
|
964
978
|
:param point: The point in space to query
|
|
965
979
|
:param max_dist: Mesh faces above this distance will not be considered by the query
|
|
966
|
-
:param
|
|
967
|
-
:param face: Returns the index of the closest face
|
|
968
|
-
:param bary_u: Returns the barycentric u coordinate of the closest point
|
|
969
|
-
:param bary_v: Returns the barycentric v coordinate of the closest point
|
|
970
|
-
:param accuracy: Accuracy for computing the winding number with fast winding number method utilizing second order dipole approximation, default 2.0
|
|
980
|
+
:param accuracy: Accuracy for computing the winding number with fast winding number method utilizing second-order dipole approximation, default 2.0
|
|
971
981
|
:param threshold: The threshold of the winding number to be considered inside, default 0.5
|
|
972
982
|
"""
|
|
973
983
|
...
|
|
974
984
|
|
|
975
985
|
|
|
976
986
|
@over
|
|
977
|
-
def mesh_query_ray(
|
|
978
|
-
id: uint64,
|
|
979
|
-
start: vec3f,
|
|
980
|
-
dir: vec3f,
|
|
981
|
-
max_t: float32,
|
|
982
|
-
t: float32,
|
|
983
|
-
bary_u: float32,
|
|
984
|
-
bary_v: float32,
|
|
985
|
-
sign: float32,
|
|
986
|
-
normal: vec3f,
|
|
987
|
-
face: int32,
|
|
988
|
-
) -> bool:
|
|
987
|
+
def mesh_query_ray(id: uint64, start: vec3f, dir: vec3f, max_t: float32) -> mesh_query_ray_t:
|
|
989
988
|
"""
|
|
990
|
-
Computes the closest ray hit on the
|
|
989
|
+
Computes the closest ray hit on the :class:`Mesh` with identifier ``id``.
|
|
991
990
|
|
|
992
991
|
:param id: The mesh identifier
|
|
993
992
|
:param start: The start point of the ray
|
|
994
993
|
:param dir: The ray direction (should be normalized)
|
|
995
994
|
:param max_t: The maximum distance along the ray to check for intersections
|
|
996
|
-
:param t: Returns the distance of the closest hit along the ray
|
|
997
|
-
:param bary_u: Returns the barycentric u coordinate of the closest hit
|
|
998
|
-
:param bary_v: Returns the barycentric v coordinate of the closest hit
|
|
999
|
-
:param sign: Returns a value > 0 if the hit ray hit front of the face, returns < 0 otherwise
|
|
1000
|
-
:param normal: Returns the face normal
|
|
1001
|
-
:param face: Returns the index of the hit face
|
|
1002
995
|
"""
|
|
1003
996
|
...
|
|
1004
997
|
|
|
@@ -1006,8 +999,8 @@ def mesh_query_ray(
|
|
|
1006
999
|
@over
|
|
1007
1000
|
def mesh_query_aabb(id: uint64, lower: vec3f, upper: vec3f) -> mesh_query_aabb_t:
|
|
1008
1001
|
"""
|
|
1009
|
-
Construct an axis-aligned bounding box query against a
|
|
1010
|
-
|
|
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.
|
|
1011
1004
|
|
|
1012
1005
|
:param id: The mesh identifier
|
|
1013
1006
|
:param lower: The lower bound of the bounding box in mesh space
|
|
@@ -1019,8 +1012,8 @@ def mesh_query_aabb(id: uint64, lower: vec3f, upper: vec3f) -> mesh_query_aabb_t
|
|
|
1019
1012
|
@over
|
|
1020
1013
|
def mesh_query_aabb_next(query: mesh_query_aabb_t, index: int32) -> bool:
|
|
1021
1014
|
"""
|
|
1022
|
-
Move to the next triangle overlapping the query bounding box.
|
|
1023
|
-
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.
|
|
1024
1017
|
"""
|
|
1025
1018
|
...
|
|
1026
1019
|
|
|
@@ -1028,7 +1021,7 @@ def mesh_query_aabb_next(query: mesh_query_aabb_t, index: int32) -> bool:
|
|
|
1028
1021
|
@over
|
|
1029
1022
|
def mesh_eval_position(id: uint64, face: int32, bary_u: float32, bary_v: float32) -> vec3f:
|
|
1030
1023
|
"""
|
|
1031
|
-
Evaluates the position on the
|
|
1024
|
+
Evaluates the position on the :class:`Mesh` given a face index and barycentric coordinates.
|
|
1032
1025
|
"""
|
|
1033
1026
|
...
|
|
1034
1027
|
|
|
@@ -1036,7 +1029,7 @@ def mesh_eval_position(id: uint64, face: int32, bary_u: float32, bary_v: float32
|
|
|
1036
1029
|
@over
|
|
1037
1030
|
def mesh_eval_velocity(id: uint64, face: int32, bary_u: float32, bary_v: float32) -> vec3f:
|
|
1038
1031
|
"""
|
|
1039
|
-
Evaluates the velocity on the
|
|
1032
|
+
Evaluates the velocity on the :class:`Mesh` given a face index and barycentric coordinates.
|
|
1040
1033
|
"""
|
|
1041
1034
|
...
|
|
1042
1035
|
|
|
@@ -1044,8 +1037,7 @@ def mesh_eval_velocity(id: uint64, face: int32, bary_u: float32, bary_v: float32
|
|
|
1044
1037
|
@over
|
|
1045
1038
|
def hash_grid_query(id: uint64, point: vec3f, max_dist: float32) -> hash_grid_query_t:
|
|
1046
1039
|
"""
|
|
1047
|
-
Construct a point query against a
|
|
1048
|
-
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.
|
|
1049
1041
|
"""
|
|
1050
1042
|
...
|
|
1051
1043
|
|
|
@@ -1062,8 +1054,10 @@ def hash_grid_query_next(query: hash_grid_query_t, index: int32) -> bool:
|
|
|
1062
1054
|
@over
|
|
1063
1055
|
def hash_grid_point_id(id: uint64, index: int32) -> int:
|
|
1064
1056
|
"""
|
|
1065
|
-
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
|
|
1066
1058
|
traversal occurs in a spatially coherent order.
|
|
1059
|
+
|
|
1060
|
+
Returns -1 if the :class:`HashGrid` has not been reserved.
|
|
1067
1061
|
"""
|
|
1068
1062
|
...
|
|
1069
1063
|
|
|
@@ -1134,7 +1128,17 @@ def closest_point_edge_edge(p1: vec3f, q1: vec3f, p2: vec3f, q2: vec3f, epsilon:
|
|
|
1134
1128
|
@over
|
|
1135
1129
|
def volume_sample_f(id: uint64, uvw: vec3f, sampling_mode: int32) -> float:
|
|
1136
1130
|
"""
|
|
1137
|
-
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.`
|
|
1138
1142
|
"""
|
|
1139
1143
|
...
|
|
1140
1144
|
|
|
@@ -1142,7 +1146,8 @@ def volume_sample_f(id: uint64, uvw: vec3f, sampling_mode: int32) -> float:
|
|
|
1142
1146
|
@over
|
|
1143
1147
|
def volume_lookup_f(id: uint64, i: int32, j: int32, k: int32) -> float:
|
|
1144
1148
|
"""
|
|
1145
|
-
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
|
|
1146
1151
|
"""
|
|
1147
1152
|
...
|
|
1148
1153
|
|
|
@@ -1150,7 +1155,7 @@ def volume_lookup_f(id: uint64, i: int32, j: int32, k: int32) -> float:
|
|
|
1150
1155
|
@over
|
|
1151
1156
|
def volume_store_f(id: uint64, i: int32, j: int32, k: int32, value: float32):
|
|
1152
1157
|
"""
|
|
1153
|
-
Store
|
|
1158
|
+
Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``.
|
|
1154
1159
|
"""
|
|
1155
1160
|
...
|
|
1156
1161
|
|
|
@@ -1158,7 +1163,8 @@ def volume_store_f(id: uint64, i: int32, j: int32, k: int32, value: float32):
|
|
|
1158
1163
|
@over
|
|
1159
1164
|
def volume_sample_v(id: uint64, uvw: vec3f, sampling_mode: int32) -> vec3f:
|
|
1160
1165
|
"""
|
|
1161
|
-
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.`
|
|
1162
1168
|
"""
|
|
1163
1169
|
...
|
|
1164
1170
|
|
|
@@ -1166,7 +1172,8 @@ def volume_sample_v(id: uint64, uvw: vec3f, sampling_mode: int32) -> vec3f:
|
|
|
1166
1172
|
@over
|
|
1167
1173
|
def volume_lookup_v(id: uint64, i: int32, j: int32, k: int32) -> vec3f:
|
|
1168
1174
|
"""
|
|
1169
|
-
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.
|
|
1170
1177
|
"""
|
|
1171
1178
|
...
|
|
1172
1179
|
|
|
@@ -1174,7 +1181,7 @@ def volume_lookup_v(id: uint64, i: int32, j: int32, k: int32) -> vec3f:
|
|
|
1174
1181
|
@over
|
|
1175
1182
|
def volume_store_v(id: uint64, i: int32, j: int32, k: int32, value: vec3f):
|
|
1176
1183
|
"""
|
|
1177
|
-
Store
|
|
1184
|
+
Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``.
|
|
1178
1185
|
"""
|
|
1179
1186
|
...
|
|
1180
1187
|
|
|
@@ -1182,7 +1189,7 @@ def volume_store_v(id: uint64, i: int32, j: int32, k: int32, value: vec3f):
|
|
|
1182
1189
|
@over
|
|
1183
1190
|
def volume_sample_i(id: uint64, uvw: vec3f) -> int:
|
|
1184
1191
|
"""
|
|
1185
|
-
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``.
|
|
1186
1193
|
"""
|
|
1187
1194
|
...
|
|
1188
1195
|
|
|
@@ -1190,7 +1197,8 @@ def volume_sample_i(id: uint64, uvw: vec3f) -> int:
|
|
|
1190
1197
|
@over
|
|
1191
1198
|
def volume_lookup_i(id: uint64, i: int32, j: int32, k: int32) -> int:
|
|
1192
1199
|
"""
|
|
1193
|
-
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.
|
|
1194
1202
|
"""
|
|
1195
1203
|
...
|
|
1196
1204
|
|
|
@@ -1198,7 +1206,7 @@ def volume_lookup_i(id: uint64, i: int32, j: int32, k: int32) -> int:
|
|
|
1198
1206
|
@over
|
|
1199
1207
|
def volume_store_i(id: uint64, i: int32, j: int32, k: int32, value: int32):
|
|
1200
1208
|
"""
|
|
1201
|
-
Store
|
|
1209
|
+
Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``.
|
|
1202
1210
|
"""
|
|
1203
1211
|
...
|
|
1204
1212
|
|
|
@@ -1206,7 +1214,7 @@ def volume_store_i(id: uint64, i: int32, j: int32, k: int32, value: int32):
|
|
|
1206
1214
|
@over
|
|
1207
1215
|
def volume_index_to_world(id: uint64, uvw: vec3f) -> vec3f:
|
|
1208
1216
|
"""
|
|
1209
|
-
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.
|
|
1210
1218
|
"""
|
|
1211
1219
|
...
|
|
1212
1220
|
|
|
@@ -1214,7 +1222,7 @@ def volume_index_to_world(id: uint64, uvw: vec3f) -> vec3f:
|
|
|
1214
1222
|
@over
|
|
1215
1223
|
def volume_world_to_index(id: uint64, xyz: vec3f) -> vec3f:
|
|
1216
1224
|
"""
|
|
1217
|
-
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.
|
|
1218
1226
|
"""
|
|
1219
1227
|
...
|
|
1220
1228
|
|
|
@@ -1222,7 +1230,7 @@ def volume_world_to_index(id: uint64, xyz: vec3f) -> vec3f:
|
|
|
1222
1230
|
@over
|
|
1223
1231
|
def volume_index_to_world_dir(id: uint64, uvw: vec3f) -> vec3f:
|
|
1224
1232
|
"""
|
|
1225
|
-
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.
|
|
1226
1234
|
"""
|
|
1227
1235
|
...
|
|
1228
1236
|
|
|
@@ -1230,7 +1238,7 @@ def volume_index_to_world_dir(id: uint64, uvw: vec3f) -> vec3f:
|
|
|
1230
1238
|
@over
|
|
1231
1239
|
def volume_world_to_index_dir(id: uint64, xyz: vec3f) -> vec3f:
|
|
1232
1240
|
"""
|
|
1233
|
-
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.
|
|
1234
1242
|
"""
|
|
1235
1243
|
...
|
|
1236
1244
|
|
|
@@ -1256,7 +1264,7 @@ def rand_init(seed: int32, offset: int32) -> uint32:
|
|
|
1256
1264
|
@over
|
|
1257
1265
|
def randi(state: uint32) -> int:
|
|
1258
1266
|
"""
|
|
1259
|
-
Return a random integer
|
|
1267
|
+
Return a random integer in the range [0, 2^32).
|
|
1260
1268
|
"""
|
|
1261
1269
|
...
|
|
1262
1270
|
|
|
@@ -1264,7 +1272,7 @@ def randi(state: uint32) -> int:
|
|
|
1264
1272
|
@over
|
|
1265
1273
|
def randi(state: uint32, min: int32, max: int32) -> int:
|
|
1266
1274
|
"""
|
|
1267
|
-
Return a random integer between [min, max)
|
|
1275
|
+
Return a random integer between [min, max).
|
|
1268
1276
|
"""
|
|
1269
1277
|
...
|
|
1270
1278
|
|
|
@@ -1272,7 +1280,7 @@ def randi(state: uint32, min: int32, max: int32) -> int:
|
|
|
1272
1280
|
@over
|
|
1273
1281
|
def randf(state: uint32) -> float:
|
|
1274
1282
|
"""
|
|
1275
|
-
Return a random float between [0.0, 1.0)
|
|
1283
|
+
Return a random float between [0.0, 1.0).
|
|
1276
1284
|
"""
|
|
1277
1285
|
...
|
|
1278
1286
|
|
|
@@ -1280,7 +1288,7 @@ def randf(state: uint32) -> float:
|
|
|
1280
1288
|
@over
|
|
1281
1289
|
def randf(state: uint32, min: float32, max: float32) -> float:
|
|
1282
1290
|
"""
|
|
1283
|
-
Return a random float between [min, max)
|
|
1291
|
+
Return a random float between [min, max).
|
|
1284
1292
|
"""
|
|
1285
1293
|
...
|
|
1286
1294
|
|
|
@@ -1288,7 +1296,7 @@ def randf(state: uint32, min: float32, max: float32) -> float:
|
|
|
1288
1296
|
@over
|
|
1289
1297
|
def randn(state: uint32) -> float:
|
|
1290
1298
|
"""
|
|
1291
|
-
Sample a normal distribution
|
|
1299
|
+
Sample a normal distribution.
|
|
1292
1300
|
"""
|
|
1293
1301
|
...
|
|
1294
1302
|
|
|
@@ -1296,7 +1304,7 @@ def randn(state: uint32) -> float:
|
|
|
1296
1304
|
@over
|
|
1297
1305
|
def sample_cdf(state: uint32, cdf: Array[float32]) -> int:
|
|
1298
1306
|
"""
|
|
1299
|
-
Inverse
|
|
1307
|
+
Inverse-transform sample a cumulative distribution function.
|
|
1300
1308
|
"""
|
|
1301
1309
|
...
|
|
1302
1310
|
|
|
@@ -1304,7 +1312,7 @@ def sample_cdf(state: uint32, cdf: Array[float32]) -> int:
|
|
|
1304
1312
|
@over
|
|
1305
1313
|
def sample_triangle(state: uint32) -> vec2f:
|
|
1306
1314
|
"""
|
|
1307
|
-
Uniformly sample a triangle. Returns sample barycentric coordinates
|
|
1315
|
+
Uniformly sample a triangle. Returns sample barycentric coordinates.
|
|
1308
1316
|
"""
|
|
1309
1317
|
...
|
|
1310
1318
|
|
|
@@ -1312,7 +1320,7 @@ def sample_triangle(state: uint32) -> vec2f:
|
|
|
1312
1320
|
@over
|
|
1313
1321
|
def sample_unit_ring(state: uint32) -> vec2f:
|
|
1314
1322
|
"""
|
|
1315
|
-
Uniformly sample a ring in the xy plane
|
|
1323
|
+
Uniformly sample a ring in the xy plane.
|
|
1316
1324
|
"""
|
|
1317
1325
|
...
|
|
1318
1326
|
|
|
@@ -1320,7 +1328,7 @@ def sample_unit_ring(state: uint32) -> vec2f:
|
|
|
1320
1328
|
@over
|
|
1321
1329
|
def sample_unit_disk(state: uint32) -> vec2f:
|
|
1322
1330
|
"""
|
|
1323
|
-
Uniformly sample a disk in the xy plane
|
|
1331
|
+
Uniformly sample a disk in the xy plane.
|
|
1324
1332
|
"""
|
|
1325
1333
|
...
|
|
1326
1334
|
|
|
@@ -1328,7 +1336,7 @@ def sample_unit_disk(state: uint32) -> vec2f:
|
|
|
1328
1336
|
@over
|
|
1329
1337
|
def sample_unit_sphere_surface(state: uint32) -> vec3f:
|
|
1330
1338
|
"""
|
|
1331
|
-
Uniformly sample a unit sphere surface
|
|
1339
|
+
Uniformly sample a unit sphere surface.
|
|
1332
1340
|
"""
|
|
1333
1341
|
...
|
|
1334
1342
|
|
|
@@ -1336,7 +1344,7 @@ def sample_unit_sphere_surface(state: uint32) -> vec3f:
|
|
|
1336
1344
|
@over
|
|
1337
1345
|
def sample_unit_sphere(state: uint32) -> vec3f:
|
|
1338
1346
|
"""
|
|
1339
|
-
Uniformly sample a unit sphere
|
|
1347
|
+
Uniformly sample a unit sphere.
|
|
1340
1348
|
"""
|
|
1341
1349
|
...
|
|
1342
1350
|
|
|
@@ -1344,7 +1352,7 @@ def sample_unit_sphere(state: uint32) -> vec3f:
|
|
|
1344
1352
|
@over
|
|
1345
1353
|
def sample_unit_hemisphere_surface(state: uint32) -> vec3f:
|
|
1346
1354
|
"""
|
|
1347
|
-
Uniformly sample a unit hemisphere surface
|
|
1355
|
+
Uniformly sample a unit hemisphere surface.
|
|
1348
1356
|
"""
|
|
1349
1357
|
...
|
|
1350
1358
|
|
|
@@ -1352,7 +1360,7 @@ def sample_unit_hemisphere_surface(state: uint32) -> vec3f:
|
|
|
1352
1360
|
@over
|
|
1353
1361
|
def sample_unit_hemisphere(state: uint32) -> vec3f:
|
|
1354
1362
|
"""
|
|
1355
|
-
Uniformly sample a unit hemisphere
|
|
1363
|
+
Uniformly sample a unit hemisphere.
|
|
1356
1364
|
"""
|
|
1357
1365
|
...
|
|
1358
1366
|
|
|
@@ -1360,7 +1368,7 @@ def sample_unit_hemisphere(state: uint32) -> vec3f:
|
|
|
1360
1368
|
@over
|
|
1361
1369
|
def sample_unit_square(state: uint32) -> vec2f:
|
|
1362
1370
|
"""
|
|
1363
|
-
Uniformly sample a unit square
|
|
1371
|
+
Uniformly sample a unit square.
|
|
1364
1372
|
"""
|
|
1365
1373
|
...
|
|
1366
1374
|
|
|
@@ -1368,7 +1376,7 @@ def sample_unit_square(state: uint32) -> vec2f:
|
|
|
1368
1376
|
@over
|
|
1369
1377
|
def sample_unit_cube(state: uint32) -> vec3f:
|
|
1370
1378
|
"""
|
|
1371
|
-
Uniformly sample a unit cube
|
|
1379
|
+
Uniformly sample a unit cube.
|
|
1372
1380
|
"""
|
|
1373
1381
|
...
|
|
1374
1382
|
|
|
@@ -1378,8 +1386,8 @@ def poisson(state: uint32, lam: float32) -> uint32:
|
|
|
1378
1386
|
"""
|
|
1379
1387
|
Generate a random sample from a Poisson distribution.
|
|
1380
1388
|
|
|
1381
|
-
|
|
1382
|
-
|
|
1389
|
+
:param state: RNG state
|
|
1390
|
+
:param lam: The expected value of the distribution
|
|
1383
1391
|
"""
|
|
1384
1392
|
...
|
|
1385
1393
|
|
|
@@ -1387,7 +1395,7 @@ def poisson(state: uint32, lam: float32) -> uint32:
|
|
|
1387
1395
|
@over
|
|
1388
1396
|
def noise(state: uint32, x: float32) -> float:
|
|
1389
1397
|
"""
|
|
1390
|
-
Non-periodic Perlin-style noise in
|
|
1398
|
+
Non-periodic Perlin-style noise in 1D.
|
|
1391
1399
|
"""
|
|
1392
1400
|
...
|
|
1393
1401
|
|
|
@@ -1395,7 +1403,7 @@ def noise(state: uint32, x: float32) -> float:
|
|
|
1395
1403
|
@over
|
|
1396
1404
|
def noise(state: uint32, xy: vec2f) -> float:
|
|
1397
1405
|
"""
|
|
1398
|
-
Non-periodic Perlin-style noise in
|
|
1406
|
+
Non-periodic Perlin-style noise in 2D.
|
|
1399
1407
|
"""
|
|
1400
1408
|
...
|
|
1401
1409
|
|
|
@@ -1403,7 +1411,7 @@ def noise(state: uint32, xy: vec2f) -> float:
|
|
|
1403
1411
|
@over
|
|
1404
1412
|
def noise(state: uint32, xyz: vec3f) -> float:
|
|
1405
1413
|
"""
|
|
1406
|
-
Non-periodic Perlin-style noise in
|
|
1414
|
+
Non-periodic Perlin-style noise in 3D.
|
|
1407
1415
|
"""
|
|
1408
1416
|
...
|
|
1409
1417
|
|
|
@@ -1411,7 +1419,7 @@ def noise(state: uint32, xyz: vec3f) -> float:
|
|
|
1411
1419
|
@over
|
|
1412
1420
|
def noise(state: uint32, xyzt: vec4f) -> float:
|
|
1413
1421
|
"""
|
|
1414
|
-
Non-periodic Perlin-style noise in
|
|
1422
|
+
Non-periodic Perlin-style noise in 4D.
|
|
1415
1423
|
"""
|
|
1416
1424
|
...
|
|
1417
1425
|
|
|
@@ -1419,7 +1427,7 @@ def noise(state: uint32, xyzt: vec4f) -> float:
|
|
|
1419
1427
|
@over
|
|
1420
1428
|
def pnoise(state: uint32, x: float32, px: int32) -> float:
|
|
1421
1429
|
"""
|
|
1422
|
-
Periodic Perlin-style noise in
|
|
1430
|
+
Periodic Perlin-style noise in 1D.
|
|
1423
1431
|
"""
|
|
1424
1432
|
...
|
|
1425
1433
|
|
|
@@ -1427,7 +1435,7 @@ def pnoise(state: uint32, x: float32, px: int32) -> float:
|
|
|
1427
1435
|
@over
|
|
1428
1436
|
def pnoise(state: uint32, xy: vec2f, px: int32, py: int32) -> float:
|
|
1429
1437
|
"""
|
|
1430
|
-
Periodic Perlin-style noise in
|
|
1438
|
+
Periodic Perlin-style noise in 2D.
|
|
1431
1439
|
"""
|
|
1432
1440
|
...
|
|
1433
1441
|
|
|
@@ -1435,7 +1443,7 @@ def pnoise(state: uint32, xy: vec2f, px: int32, py: int32) -> float:
|
|
|
1435
1443
|
@over
|
|
1436
1444
|
def pnoise(state: uint32, xyz: vec3f, px: int32, py: int32, pz: int32) -> float:
|
|
1437
1445
|
"""
|
|
1438
|
-
Periodic Perlin-style noise in
|
|
1446
|
+
Periodic Perlin-style noise in 3D.
|
|
1439
1447
|
"""
|
|
1440
1448
|
...
|
|
1441
1449
|
|
|
@@ -1443,13 +1451,13 @@ def pnoise(state: uint32, xyz: vec3f, px: int32, py: int32, pz: int32) -> float:
|
|
|
1443
1451
|
@over
|
|
1444
1452
|
def pnoise(state: uint32, xyzt: vec4f, px: int32, py: int32, pz: int32, pt: int32) -> float:
|
|
1445
1453
|
"""
|
|
1446
|
-
Periodic Perlin-style noise in
|
|
1454
|
+
Periodic Perlin-style noise in 4D.
|
|
1447
1455
|
"""
|
|
1448
1456
|
...
|
|
1449
1457
|
|
|
1450
1458
|
|
|
1451
1459
|
@over
|
|
1452
|
-
def curlnoise(state: uint32, xy: vec2f) -> vec2f:
|
|
1460
|
+
def curlnoise(state: uint32, xy: vec2f, octaves: uint32, lacunarity: float32, gain: float32) -> vec2f:
|
|
1453
1461
|
"""
|
|
1454
1462
|
Divergence-free vector field based on the gradient of a Perlin noise function.
|
|
1455
1463
|
"""
|
|
@@ -1457,7 +1465,7 @@ def curlnoise(state: uint32, xy: vec2f) -> vec2f:
|
|
|
1457
1465
|
|
|
1458
1466
|
|
|
1459
1467
|
@over
|
|
1460
|
-
def curlnoise(state: uint32, xyz: vec3f) -> vec3f:
|
|
1468
|
+
def curlnoise(state: uint32, xyz: vec3f, octaves: uint32, lacunarity: float32, gain: float32) -> vec3f:
|
|
1461
1469
|
"""
|
|
1462
1470
|
Divergence-free vector field based on the curl of three Perlin noise functions.
|
|
1463
1471
|
"""
|
|
@@ -1465,7 +1473,7 @@ def curlnoise(state: uint32, xyz: vec3f) -> vec3f:
|
|
|
1465
1473
|
|
|
1466
1474
|
|
|
1467
1475
|
@over
|
|
1468
|
-
def curlnoise(state: uint32, xyzt: vec4f) -> vec3f:
|
|
1476
|
+
def curlnoise(state: uint32, xyzt: vec4f, octaves: uint32, lacunarity: float32, gain: float32) -> vec3f:
|
|
1469
1477
|
"""
|
|
1470
1478
|
Divergence-free vector field based on the curl of three Perlin noise functions.
|
|
1471
1479
|
"""
|
|
@@ -1475,40 +1483,42 @@ def curlnoise(state: uint32, xyzt: vec4f) -> vec3f:
|
|
|
1475
1483
|
@over
|
|
1476
1484
|
def printf():
|
|
1477
1485
|
"""
|
|
1478
|
-
Allows printing formatted strings
|
|
1486
|
+
Allows printing formatted strings using C-style format specifiers.
|
|
1479
1487
|
"""
|
|
1480
1488
|
...
|
|
1481
1489
|
|
|
1482
1490
|
|
|
1483
1491
|
@over
|
|
1484
|
-
def tid() -> int:
|
|
1492
|
+
def tid() -> Tuple[int, int]:
|
|
1485
1493
|
"""
|
|
1486
|
-
Return the current thread
|
|
1487
|
-
|
|
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.
|
|
1488
1496
|
"""
|
|
1489
1497
|
...
|
|
1490
1498
|
|
|
1491
1499
|
|
|
1492
1500
|
@over
|
|
1493
|
-
def tid() -> Tuple[int, int]:
|
|
1501
|
+
def tid() -> Tuple[int, int, int]:
|
|
1494
1502
|
"""
|
|
1495
|
-
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.
|
|
1496
1505
|
"""
|
|
1497
1506
|
...
|
|
1498
1507
|
|
|
1499
1508
|
|
|
1500
1509
|
@over
|
|
1501
|
-
def tid() -> Tuple[int, int, int]:
|
|
1510
|
+
def tid() -> Tuple[int, int, int, int]:
|
|
1502
1511
|
"""
|
|
1503
|
-
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.
|
|
1504
1514
|
"""
|
|
1505
1515
|
...
|
|
1506
1516
|
|
|
1507
1517
|
|
|
1508
1518
|
@over
|
|
1509
|
-
def
|
|
1519
|
+
def select(cond: bool, arg1: Any, arg2: Any):
|
|
1510
1520
|
"""
|
|
1511
|
-
|
|
1521
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1512
1522
|
"""
|
|
1513
1523
|
...
|
|
1514
1524
|
|
|
@@ -1516,7 +1526,7 @@ def tid() -> Tuple[int, int, int, int]:
|
|
|
1516
1526
|
@over
|
|
1517
1527
|
def select(cond: bool, arg1: Any, arg2: Any):
|
|
1518
1528
|
"""
|
|
1519
|
-
Select between two arguments, if cond is
|
|
1529
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1520
1530
|
"""
|
|
1521
1531
|
...
|
|
1522
1532
|
|
|
@@ -1524,7 +1534,7 @@ def select(cond: bool, arg1: Any, arg2: Any):
|
|
|
1524
1534
|
@over
|
|
1525
1535
|
def select(cond: int8, arg1: Any, arg2: Any):
|
|
1526
1536
|
"""
|
|
1527
|
-
Select between two arguments, if cond is
|
|
1537
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1528
1538
|
"""
|
|
1529
1539
|
...
|
|
1530
1540
|
|
|
@@ -1532,7 +1542,7 @@ def select(cond: int8, arg1: Any, arg2: Any):
|
|
|
1532
1542
|
@over
|
|
1533
1543
|
def select(cond: uint8, arg1: Any, arg2: Any):
|
|
1534
1544
|
"""
|
|
1535
|
-
Select between two arguments, if cond is
|
|
1545
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1536
1546
|
"""
|
|
1537
1547
|
...
|
|
1538
1548
|
|
|
@@ -1540,7 +1550,7 @@ def select(cond: uint8, arg1: Any, arg2: Any):
|
|
|
1540
1550
|
@over
|
|
1541
1551
|
def select(cond: int16, arg1: Any, arg2: Any):
|
|
1542
1552
|
"""
|
|
1543
|
-
Select between two arguments, if cond is
|
|
1553
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1544
1554
|
"""
|
|
1545
1555
|
...
|
|
1546
1556
|
|
|
@@ -1548,7 +1558,7 @@ def select(cond: int16, arg1: Any, arg2: Any):
|
|
|
1548
1558
|
@over
|
|
1549
1559
|
def select(cond: uint16, arg1: Any, arg2: Any):
|
|
1550
1560
|
"""
|
|
1551
|
-
Select between two arguments, if cond is
|
|
1561
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1552
1562
|
"""
|
|
1553
1563
|
...
|
|
1554
1564
|
|
|
@@ -1556,7 +1566,7 @@ def select(cond: uint16, arg1: Any, arg2: Any):
|
|
|
1556
1566
|
@over
|
|
1557
1567
|
def select(cond: int32, arg1: Any, arg2: Any):
|
|
1558
1568
|
"""
|
|
1559
|
-
Select between two arguments, if cond is
|
|
1569
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1560
1570
|
"""
|
|
1561
1571
|
...
|
|
1562
1572
|
|
|
@@ -1564,7 +1574,7 @@ def select(cond: int32, arg1: Any, arg2: Any):
|
|
|
1564
1574
|
@over
|
|
1565
1575
|
def select(cond: uint32, arg1: Any, arg2: Any):
|
|
1566
1576
|
"""
|
|
1567
|
-
Select between two arguments, if cond is
|
|
1577
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1568
1578
|
"""
|
|
1569
1579
|
...
|
|
1570
1580
|
|
|
@@ -1572,7 +1582,7 @@ def select(cond: uint32, arg1: Any, arg2: Any):
|
|
|
1572
1582
|
@over
|
|
1573
1583
|
def select(cond: int64, arg1: Any, arg2: Any):
|
|
1574
1584
|
"""
|
|
1575
|
-
Select between two arguments, if cond is
|
|
1585
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1576
1586
|
"""
|
|
1577
1587
|
...
|
|
1578
1588
|
|
|
@@ -1580,7 +1590,7 @@ def select(cond: int64, arg1: Any, arg2: Any):
|
|
|
1580
1590
|
@over
|
|
1581
1591
|
def select(cond: uint64, arg1: Any, arg2: Any):
|
|
1582
1592
|
"""
|
|
1583
|
-
Select between two arguments, if cond is
|
|
1593
|
+
Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
|
|
1584
1594
|
"""
|
|
1585
1595
|
...
|
|
1586
1596
|
|
|
@@ -1588,7 +1598,7 @@ def select(cond: uint64, arg1: Any, arg2: Any):
|
|
|
1588
1598
|
@over
|
|
1589
1599
|
def select(arr: Array[Any], arg1: Any, arg2: Any):
|
|
1590
1600
|
"""
|
|
1591
|
-
Select between two arguments, if
|
|
1601
|
+
Select between two arguments, if ``arr`` is null then return ``arg1``, otherwise return ``arg2``
|
|
1592
1602
|
"""
|
|
1593
1603
|
...
|
|
1594
1604
|
|
|
@@ -1596,7 +1606,7 @@ def select(arr: Array[Any], arg1: Any, arg2: Any):
|
|
|
1596
1606
|
@over
|
|
1597
1607
|
def atomic_add(a: Array[Any], i: int32, value: Any):
|
|
1598
1608
|
"""
|
|
1599
|
-
Atomically add ``value`` onto
|
|
1609
|
+
Atomically add ``value`` onto ``a[i]``.
|
|
1600
1610
|
"""
|
|
1601
1611
|
...
|
|
1602
1612
|
|
|
@@ -1604,7 +1614,7 @@ def atomic_add(a: Array[Any], i: int32, value: Any):
|
|
|
1604
1614
|
@over
|
|
1605
1615
|
def atomic_add(a: Array[Any], i: int32, j: int32, value: Any):
|
|
1606
1616
|
"""
|
|
1607
|
-
Atomically add ``value`` onto
|
|
1617
|
+
Atomically add ``value`` onto ``a[i,j]``.
|
|
1608
1618
|
"""
|
|
1609
1619
|
...
|
|
1610
1620
|
|
|
@@ -1612,7 +1622,7 @@ def atomic_add(a: Array[Any], i: int32, j: int32, value: Any):
|
|
|
1612
1622
|
@over
|
|
1613
1623
|
def atomic_add(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
|
|
1614
1624
|
"""
|
|
1615
|
-
Atomically add ``value`` onto
|
|
1625
|
+
Atomically add ``value`` onto ``a[i,j,k]``.
|
|
1616
1626
|
"""
|
|
1617
1627
|
...
|
|
1618
1628
|
|
|
@@ -1620,7 +1630,71 @@ def atomic_add(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
|
|
|
1620
1630
|
@over
|
|
1621
1631
|
def atomic_add(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
|
|
1622
1632
|
"""
|
|
1623
|
-
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]``.
|
|
1624
1698
|
"""
|
|
1625
1699
|
...
|
|
1626
1700
|
|
|
@@ -1628,7 +1702,7 @@ def atomic_add(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any
|
|
|
1628
1702
|
@over
|
|
1629
1703
|
def atomic_sub(a: Array[Any], i: int32, value: Any):
|
|
1630
1704
|
"""
|
|
1631
|
-
Atomically subtract ``value`` onto
|
|
1705
|
+
Atomically subtract ``value`` onto ``a[i]``.
|
|
1632
1706
|
"""
|
|
1633
1707
|
...
|
|
1634
1708
|
|
|
@@ -1636,7 +1710,7 @@ def atomic_sub(a: Array[Any], i: int32, value: Any):
|
|
|
1636
1710
|
@over
|
|
1637
1711
|
def atomic_sub(a: Array[Any], i: int32, j: int32, value: Any):
|
|
1638
1712
|
"""
|
|
1639
|
-
Atomically subtract ``value`` onto
|
|
1713
|
+
Atomically subtract ``value`` onto ``a[i,j]``.
|
|
1640
1714
|
"""
|
|
1641
1715
|
...
|
|
1642
1716
|
|
|
@@ -1644,7 +1718,7 @@ def atomic_sub(a: Array[Any], i: int32, j: int32, value: Any):
|
|
|
1644
1718
|
@over
|
|
1645
1719
|
def atomic_sub(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
|
|
1646
1720
|
"""
|
|
1647
|
-
Atomically subtract ``value`` onto
|
|
1721
|
+
Atomically subtract ``value`` onto ``a[i,j,k]``.
|
|
1648
1722
|
"""
|
|
1649
1723
|
...
|
|
1650
1724
|
|
|
@@ -1652,7 +1726,71 @@ def atomic_sub(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
|
|
|
1652
1726
|
@over
|
|
1653
1727
|
def atomic_sub(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
|
|
1654
1728
|
"""
|
|
1655
|
-
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]``.
|
|
1656
1794
|
"""
|
|
1657
1795
|
...
|
|
1658
1796
|
|
|
@@ -1660,7 +1798,9 @@ def atomic_sub(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any
|
|
|
1660
1798
|
@over
|
|
1661
1799
|
def atomic_min(a: Array[Any], i: int32, value: Any):
|
|
1662
1800
|
"""
|
|
1663
|
-
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.
|
|
1664
1804
|
"""
|
|
1665
1805
|
...
|
|
1666
1806
|
|
|
@@ -1668,7 +1808,9 @@ def atomic_min(a: Array[Any], i: int32, value: Any):
|
|
|
1668
1808
|
@over
|
|
1669
1809
|
def atomic_min(a: Array[Any], i: int32, j: int32, value: Any):
|
|
1670
1810
|
"""
|
|
1671
|
-
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.
|
|
1672
1814
|
"""
|
|
1673
1815
|
...
|
|
1674
1816
|
|
|
@@ -1676,7 +1818,9 @@ def atomic_min(a: Array[Any], i: int32, j: int32, value: Any):
|
|
|
1676
1818
|
@over
|
|
1677
1819
|
def atomic_min(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
|
|
1678
1820
|
"""
|
|
1679
|
-
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.
|
|
1680
1824
|
"""
|
|
1681
1825
|
...
|
|
1682
1826
|
|
|
@@ -1684,7 +1828,89 @@ def atomic_min(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
|
|
|
1684
1828
|
@over
|
|
1685
1829
|
def atomic_min(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
|
|
1686
1830
|
"""
|
|
1687
|
-
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.
|
|
1688
1914
|
"""
|
|
1689
1915
|
...
|
|
1690
1916
|
|
|
@@ -1692,7 +1918,9 @@ def atomic_min(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any
|
|
|
1692
1918
|
@over
|
|
1693
1919
|
def atomic_max(a: Array[Any], i: int32, value: Any):
|
|
1694
1920
|
"""
|
|
1695
|
-
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.
|
|
1696
1924
|
"""
|
|
1697
1925
|
...
|
|
1698
1926
|
|
|
@@ -1700,7 +1928,9 @@ def atomic_max(a: Array[Any], i: int32, value: Any):
|
|
|
1700
1928
|
@over
|
|
1701
1929
|
def atomic_max(a: Array[Any], i: int32, j: int32, value: Any):
|
|
1702
1930
|
"""
|
|
1703
|
-
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.
|
|
1704
1934
|
"""
|
|
1705
1935
|
...
|
|
1706
1936
|
|
|
@@ -1708,7 +1938,9 @@ def atomic_max(a: Array[Any], i: int32, j: int32, value: Any):
|
|
|
1708
1938
|
@over
|
|
1709
1939
|
def atomic_max(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
|
|
1710
1940
|
"""
|
|
1711
|
-
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.
|
|
1712
1944
|
"""
|
|
1713
1945
|
...
|
|
1714
1946
|
|
|
@@ -1716,7 +1948,89 @@ def atomic_max(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
|
|
|
1716
1948
|
@over
|
|
1717
1949
|
def atomic_max(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
|
|
1718
1950
|
"""
|
|
1719
|
-
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.
|
|
1720
2034
|
"""
|
|
1721
2035
|
...
|
|
1722
2036
|
|
|
@@ -1724,7 +2038,7 @@ def atomic_max(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any
|
|
|
1724
2038
|
@over
|
|
1725
2039
|
def lerp(a: Float, b: Float, t: Float) -> Float:
|
|
1726
2040
|
"""
|
|
1727
|
-
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``
|
|
1728
2042
|
"""
|
|
1729
2043
|
...
|
|
1730
2044
|
|
|
@@ -1732,7 +2046,7 @@ def lerp(a: Float, b: Float, t: Float) -> Float:
|
|
|
1732
2046
|
@over
|
|
1733
2047
|
def lerp(a: Vector[Any, Float], b: Vector[Any, Float], t: Float) -> Vector[Any, Float]:
|
|
1734
2048
|
"""
|
|
1735
|
-
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``
|
|
1736
2050
|
"""
|
|
1737
2051
|
...
|
|
1738
2052
|
|
|
@@ -1740,7 +2054,7 @@ def lerp(a: Vector[Any, Float], b: Vector[Any, Float], t: Float) -> Vector[Any,
|
|
|
1740
2054
|
@over
|
|
1741
2055
|
def lerp(a: Matrix[Any, Any, Float], b: Matrix[Any, Any, Float], t: Float) -> Matrix[Any, Any, Float]:
|
|
1742
2056
|
"""
|
|
1743
|
-
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``
|
|
1744
2058
|
"""
|
|
1745
2059
|
...
|
|
1746
2060
|
|
|
@@ -1748,7 +2062,7 @@ def lerp(a: Matrix[Any, Any, Float], b: Matrix[Any, Any, Float], t: Float) -> Ma
|
|
|
1748
2062
|
@over
|
|
1749
2063
|
def lerp(a: Quaternion[Float], b: Quaternion[Float], t: Float) -> Quaternion[Float]:
|
|
1750
2064
|
"""
|
|
1751
|
-
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``
|
|
1752
2066
|
"""
|
|
1753
2067
|
...
|
|
1754
2068
|
|
|
@@ -1756,7 +2070,7 @@ def lerp(a: Quaternion[Float], b: Quaternion[Float], t: Float) -> Quaternion[Flo
|
|
|
1756
2070
|
@over
|
|
1757
2071
|
def lerp(a: Transformation[Float], b: Transformation[Float], t: Float) -> Transformation[Float]:
|
|
1758
2072
|
"""
|
|
1759
|
-
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``
|
|
1760
2074
|
"""
|
|
1761
2075
|
...
|
|
1762
2076
|
|
|
@@ -1764,7 +2078,8 @@ def lerp(a: Transformation[Float], b: Transformation[Float], t: Float) -> Transf
|
|
|
1764
2078
|
@over
|
|
1765
2079
|
def smoothstep(edge0: Float, edge1: Float, x: Float) -> Float:
|
|
1766
2080
|
"""
|
|
1767
|
-
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.
|
|
1768
2083
|
"""
|
|
1769
2084
|
...
|
|
1770
2085
|
|
|
@@ -1772,7 +2087,7 @@ def smoothstep(edge0: Float, edge1: Float, x: Float) -> Float:
|
|
|
1772
2087
|
@over
|
|
1773
2088
|
def expect_near(arg1: Float, arg2: Float, tolerance: Float):
|
|
1774
2089
|
"""
|
|
1775
|
-
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
|
|
1776
2091
|
"""
|
|
1777
2092
|
...
|
|
1778
2093
|
|
|
@@ -1780,7 +2095,7 @@ def expect_near(arg1: Float, arg2: Float, tolerance: Float):
|
|
|
1780
2095
|
@over
|
|
1781
2096
|
def expect_near(arg1: vec3f, arg2: vec3f, tolerance: float32):
|
|
1782
2097
|
"""
|
|
1783
|
-
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
|
|
1784
2099
|
"""
|
|
1785
2100
|
...
|
|
1786
2101
|
|
|
@@ -1788,7 +2103,7 @@ def expect_near(arg1: vec3f, arg2: vec3f, tolerance: float32):
|
|
|
1788
2103
|
@over
|
|
1789
2104
|
def lower_bound(arr: Array[Scalar], value: Scalar) -> int:
|
|
1790
2105
|
"""
|
|
1791
|
-
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``.
|
|
1792
2107
|
"""
|
|
1793
2108
|
...
|
|
1794
2109
|
|
|
@@ -1796,7 +2111,7 @@ def lower_bound(arr: Array[Scalar], value: Scalar) -> int:
|
|
|
1796
2111
|
@over
|
|
1797
2112
|
def lower_bound(arr: Array[Scalar], arr_begin: int32, arr_end: int32, value: Scalar) -> int:
|
|
1798
2113
|
"""
|
|
1799
|
-
Search a sorted array range [arr_begin, arr_end) for the closest element greater than or equal to value
|
|
2114
|
+
Search a sorted array ``arr`` in the range [arr_begin, arr_end) for the closest element greater than or equal to ``value``.
|
|
1800
2115
|
"""
|
|
1801
2116
|
...
|
|
1802
2117
|
|
|
@@ -1951,6 +2266,12 @@ def mul(x: Matrix[Any, Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scal
|
|
|
1951
2266
|
...
|
|
1952
2267
|
|
|
1953
2268
|
|
|
2269
|
+
@over
|
|
2270
|
+
def mul(x: Vector[Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Vector[Any, Scalar]:
|
|
2271
|
+
""" """
|
|
2272
|
+
...
|
|
2273
|
+
|
|
2274
|
+
|
|
1954
2275
|
@over
|
|
1955
2276
|
def mul(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]):
|
|
1956
2277
|
""" """
|
|
@@ -1993,18 +2314,36 @@ def div(x: Vector[Any, Scalar], y: Scalar) -> Vector[Any, Scalar]:
|
|
|
1993
2314
|
...
|
|
1994
2315
|
|
|
1995
2316
|
|
|
2317
|
+
@over
|
|
2318
|
+
def div(x: Scalar, y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
|
|
2319
|
+
""" """
|
|
2320
|
+
...
|
|
2321
|
+
|
|
2322
|
+
|
|
1996
2323
|
@over
|
|
1997
2324
|
def div(x: Matrix[Any, Any, Scalar], y: Scalar) -> Matrix[Any, Any, Scalar]:
|
|
1998
2325
|
""" """
|
|
1999
2326
|
...
|
|
2000
2327
|
|
|
2001
2328
|
|
|
2329
|
+
@over
|
|
2330
|
+
def div(x: Scalar, y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
|
|
2331
|
+
""" """
|
|
2332
|
+
...
|
|
2333
|
+
|
|
2334
|
+
|
|
2002
2335
|
@over
|
|
2003
2336
|
def div(x: Quaternion[Scalar], y: Scalar) -> Quaternion[Scalar]:
|
|
2004
2337
|
""" """
|
|
2005
2338
|
...
|
|
2006
2339
|
|
|
2007
2340
|
|
|
2341
|
+
@over
|
|
2342
|
+
def div(x: Scalar, y: Quaternion[Scalar]) -> Quaternion[Scalar]:
|
|
2343
|
+
""" """
|
|
2344
|
+
...
|
|
2345
|
+
|
|
2346
|
+
|
|
2008
2347
|
@over
|
|
2009
2348
|
def floordiv(x: Scalar, y: Scalar) -> Scalar:
|
|
2010
2349
|
""" """
|