warp-lang 1.0.0b5__py3-none-manylinux2014_x86_64.whl → 1.0.0b6__py3-none-manylinux2014_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- docs/conf.py +3 -4
- examples/env/env_ant.py +1 -1
- examples/env/env_cartpole.py +1 -1
- examples/env/env_humanoid.py +1 -1
- examples/example_dem.py +28 -26
- examples/example_diffray.py +37 -30
- examples/example_fluid.py +7 -3
- examples/example_jacobian_ik.py +1 -1
- examples/example_mesh_intersect.py +10 -7
- examples/example_nvdb.py +3 -3
- examples/example_render_opengl.py +19 -10
- examples/example_sim_cartpole.py +9 -5
- examples/example_sim_cloth.py +29 -25
- examples/example_sim_fk_grad.py +2 -2
- examples/example_sim_fk_grad_torch.py +3 -3
- examples/example_sim_grad_bounce.py +11 -8
- examples/example_sim_grad_cloth.py +12 -9
- examples/example_sim_granular.py +2 -2
- examples/example_sim_granular_collision_sdf.py +13 -13
- examples/example_sim_neo_hookean.py +3 -3
- examples/example_sim_particle_chain.py +2 -2
- examples/example_sim_quadruped.py +8 -5
- examples/example_sim_rigid_chain.py +8 -5
- examples/example_sim_rigid_contact.py +13 -10
- examples/example_sim_rigid_fem.py +2 -2
- examples/example_sim_rigid_gyroscopic.py +2 -2
- examples/example_sim_rigid_kinematics.py +1 -1
- examples/example_sim_trajopt.py +3 -2
- examples/fem/example_apic_fluid.py +5 -7
- examples/fem/example_diffusion_mgpu.py +18 -16
- warp/__init__.py +3 -2
- warp/bin/warp.so +0 -0
- warp/build_dll.py +29 -9
- warp/builtins.py +206 -7
- warp/codegen.py +58 -38
- warp/config.py +3 -1
- warp/context.py +234 -128
- warp/fem/__init__.py +2 -2
- warp/fem/cache.py +2 -1
- warp/fem/field/nodal_field.py +18 -17
- warp/fem/geometry/hexmesh.py +11 -6
- warp/fem/geometry/quadmesh_2d.py +16 -12
- warp/fem/geometry/tetmesh.py +19 -8
- warp/fem/geometry/trimesh_2d.py +18 -7
- warp/fem/integrate.py +341 -196
- warp/fem/quadrature/__init__.py +1 -1
- warp/fem/quadrature/pic_quadrature.py +138 -53
- warp/fem/quadrature/quadrature.py +81 -9
- warp/fem/space/__init__.py +1 -1
- warp/fem/space/basis_space.py +169 -51
- warp/fem/space/grid_2d_function_space.py +2 -2
- warp/fem/space/grid_3d_function_space.py +2 -2
- warp/fem/space/hexmesh_function_space.py +2 -2
- warp/fem/space/partition.py +9 -6
- warp/fem/space/quadmesh_2d_function_space.py +2 -2
- warp/fem/space/shape/cube_shape_function.py +27 -15
- warp/fem/space/shape/square_shape_function.py +29 -18
- warp/fem/space/tetmesh_function_space.py +2 -2
- warp/fem/space/topology.py +10 -0
- warp/fem/space/trimesh_2d_function_space.py +2 -2
- warp/fem/utils.py +10 -5
- warp/native/array.h +49 -8
- warp/native/builtin.h +31 -14
- warp/native/cuda_util.cpp +8 -3
- warp/native/cuda_util.h +1 -0
- warp/native/exports.h +1177 -1108
- warp/native/intersect.h +4 -4
- warp/native/intersect_adj.h +8 -8
- warp/native/mat.h +65 -6
- warp/native/mesh.h +126 -5
- warp/native/quat.h +28 -4
- warp/native/vec.h +76 -14
- warp/native/warp.cu +1 -6
- warp/render/render_opengl.py +261 -109
- warp/sim/import_mjcf.py +13 -7
- warp/sim/import_urdf.py +14 -14
- warp/sim/inertia.py +17 -18
- warp/sim/model.py +67 -67
- warp/sim/render.py +1 -1
- warp/sparse.py +6 -6
- warp/stubs.py +19 -81
- warp/tape.py +1 -1
- warp/tests/__main__.py +3 -6
- 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/{test_kinematics.py → disabled_kinematics.py} +10 -12
- warp/tests/run_coverage_serial.py +31 -0
- warp/tests/test_adam.py +102 -106
- warp/tests/test_arithmetic.py +39 -40
- warp/tests/test_array.py +46 -48
- warp/tests/test_array_reduce.py +25 -19
- warp/tests/test_atomic.py +62 -26
- warp/tests/test_bool.py +16 -11
- warp/tests/test_builtins_resolution.py +1292 -0
- warp/tests/test_bvh.py +9 -12
- warp/tests/test_closest_point_edge_edge.py +53 -57
- warp/tests/test_codegen.py +164 -134
- warp/tests/test_compile_consts.py +13 -19
- warp/tests/test_conditional.py +30 -32
- warp/tests/test_copy.py +9 -12
- warp/tests/test_ctypes.py +90 -98
- warp/tests/test_dense.py +20 -14
- warp/tests/test_devices.py +34 -35
- warp/tests/test_dlpack.py +74 -75
- warp/tests/test_examples.py +215 -97
- warp/tests/test_fabricarray.py +15 -21
- warp/tests/test_fast_math.py +14 -11
- warp/tests/test_fem.py +280 -97
- warp/tests/test_fp16.py +19 -15
- warp/tests/test_func.py +177 -194
- warp/tests/test_generics.py +71 -77
- warp/tests/test_grad.py +83 -32
- warp/tests/test_grad_customs.py +7 -9
- warp/tests/test_hash_grid.py +6 -10
- warp/tests/test_import.py +9 -23
- warp/tests/test_indexedarray.py +19 -21
- warp/tests/test_intersect.py +15 -9
- warp/tests/test_large.py +17 -19
- warp/tests/test_launch.py +14 -17
- warp/tests/test_lerp.py +63 -63
- warp/tests/test_lvalue.py +84 -35
- warp/tests/test_marching_cubes.py +9 -13
- warp/tests/test_mat.py +388 -3004
- warp/tests/test_mat_lite.py +9 -12
- warp/tests/test_mat_scalar_ops.py +2889 -0
- warp/tests/test_math.py +10 -11
- warp/tests/test_matmul.py +104 -100
- warp/tests/test_matmul_lite.py +72 -98
- warp/tests/test_mesh.py +35 -32
- warp/tests/test_mesh_query_aabb.py +18 -25
- warp/tests/test_mesh_query_point.py +39 -23
- warp/tests/test_mesh_query_ray.py +9 -21
- warp/tests/test_mlp.py +8 -9
- warp/tests/test_model.py +89 -93
- warp/tests/test_modules_lite.py +15 -25
- warp/tests/test_multigpu.py +87 -114
- warp/tests/test_noise.py +10 -12
- warp/tests/test_operators.py +14 -21
- warp/tests/test_options.py +10 -11
- warp/tests/test_pinned.py +16 -18
- warp/tests/test_print.py +16 -20
- warp/tests/test_quat.py +121 -88
- warp/tests/test_rand.py +12 -13
- warp/tests/test_reload.py +27 -32
- warp/tests/test_rounding.py +7 -10
- warp/tests/test_runlength_encode.py +105 -106
- warp/tests/test_smoothstep.py +8 -9
- warp/tests/test_snippet.py +13 -22
- warp/tests/test_sparse.py +30 -29
- warp/tests/test_spatial.py +179 -174
- warp/tests/test_streams.py +100 -107
- warp/tests/test_struct.py +98 -67
- warp/tests/test_tape.py +11 -17
- warp/tests/test_torch.py +89 -86
- warp/tests/test_transient_module.py +9 -12
- warp/tests/test_types.py +328 -50
- warp/tests/test_utils.py +217 -218
- warp/tests/test_vec.py +133 -2133
- warp/tests/test_vec_lite.py +8 -11
- warp/tests/test_vec_scalar_ops.py +2099 -0
- warp/tests/test_volume.py +391 -382
- warp/tests/test_volume_write.py +122 -135
- warp/tests/unittest_serial.py +35 -0
- warp/tests/unittest_suites.py +291 -0
- warp/tests/{test_base.py → unittest_utils.py} +138 -25
- warp/tests/{test_misc.py → unused_test_misc.py} +13 -5
- warp/tests/{test_debug.py → walkthough_debug.py} +2 -15
- warp/thirdparty/unittest_parallel.py +257 -54
- warp/types.py +119 -98
- warp/utils.py +14 -0
- {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/METADATA +2 -1
- {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/RECORD +182 -178
- {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/WHEEL +1 -1
- warp/tests/test_all.py +0 -239
- warp/tests/test_conditional_unequal_types_kernels.py +0 -14
- warp/tests/test_coverage.py +0 -38
- warp/tests/test_unresolved_func.py +0 -7
- warp/tests/test_unresolved_symbol.py +0 -7
- /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-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/LICENSE.md +0 -0
- {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/top_level.txt +0 -0
warp/builtins.py
CHANGED
|
@@ -116,6 +116,7 @@ add_builtin(
|
|
|
116
116
|
value_func=sametype_value_func(Float),
|
|
117
117
|
doc="Return the square root of ``x``, where ``x`` is positive.",
|
|
118
118
|
group="Scalar Math",
|
|
119
|
+
require_original_output_arg=True,
|
|
119
120
|
)
|
|
120
121
|
add_builtin(
|
|
121
122
|
"cbrt",
|
|
@@ -123,6 +124,7 @@ add_builtin(
|
|
|
123
124
|
value_func=sametype_value_func(Float),
|
|
124
125
|
doc="Return the cube root of ``x``.",
|
|
125
126
|
group="Scalar Math",
|
|
127
|
+
require_original_output_arg=True,
|
|
126
128
|
)
|
|
127
129
|
add_builtin(
|
|
128
130
|
"tan",
|
|
@@ -165,6 +167,7 @@ add_builtin(
|
|
|
165
167
|
value_func=sametype_value_func(Float),
|
|
166
168
|
doc="Return the tanh of ``x``.",
|
|
167
169
|
group="Scalar Math",
|
|
170
|
+
require_original_output_arg=True,
|
|
168
171
|
)
|
|
169
172
|
add_builtin(
|
|
170
173
|
"degrees",
|
|
@@ -208,6 +211,7 @@ add_builtin(
|
|
|
208
211
|
value_func=sametype_value_func(Float),
|
|
209
212
|
doc="Return the value of the exponential function :math:`e^x`.",
|
|
210
213
|
group="Scalar Math",
|
|
214
|
+
require_original_output_arg=True,
|
|
211
215
|
)
|
|
212
216
|
add_builtin(
|
|
213
217
|
"pow",
|
|
@@ -215,6 +219,7 @@ add_builtin(
|
|
|
215
219
|
value_func=sametype_value_func(Float),
|
|
216
220
|
doc="Return the result of ``x`` raised to power of ``y``.",
|
|
217
221
|
group="Scalar Math",
|
|
222
|
+
require_original_output_arg=True,
|
|
218
223
|
)
|
|
219
224
|
|
|
220
225
|
add_builtin(
|
|
@@ -405,6 +410,7 @@ add_builtin(
|
|
|
405
410
|
value_func=sametype_scalar_value_func,
|
|
406
411
|
group="Vector Math",
|
|
407
412
|
doc="Compute the length of a vector ``x``.",
|
|
413
|
+
require_original_output_arg=True,
|
|
408
414
|
)
|
|
409
415
|
add_builtin(
|
|
410
416
|
"length",
|
|
@@ -412,6 +418,7 @@ add_builtin(
|
|
|
412
418
|
value_func=sametype_scalar_value_func,
|
|
413
419
|
group="Vector Math",
|
|
414
420
|
doc="Compute the length of a quaternion ``x``.",
|
|
421
|
+
require_original_output_arg=True,
|
|
415
422
|
)
|
|
416
423
|
add_builtin(
|
|
417
424
|
"length_sq",
|
|
@@ -433,6 +440,7 @@ add_builtin(
|
|
|
433
440
|
value_func=sametype_value_func(vector(length=Any, dtype=Scalar)),
|
|
434
441
|
group="Vector Math",
|
|
435
442
|
doc="Compute the normalized value of ``x``. If ``length(x)`` is 0 then the zero vector is returned.",
|
|
443
|
+
require_original_output_arg=True,
|
|
436
444
|
)
|
|
437
445
|
add_builtin(
|
|
438
446
|
"normalize",
|
|
@@ -465,6 +473,7 @@ add_builtin(
|
|
|
465
473
|
value_func=value_func_mat_inv,
|
|
466
474
|
group="Vector Math",
|
|
467
475
|
doc="Return the inverse of a 2x2 matrix ``m``.",
|
|
476
|
+
require_original_output_arg=True,
|
|
468
477
|
)
|
|
469
478
|
|
|
470
479
|
add_builtin(
|
|
@@ -473,6 +482,7 @@ add_builtin(
|
|
|
473
482
|
value_func=value_func_mat_inv,
|
|
474
483
|
group="Vector Math",
|
|
475
484
|
doc="Return the inverse of a 3x3 matrix ``m``.",
|
|
485
|
+
require_original_output_arg=True,
|
|
476
486
|
)
|
|
477
487
|
|
|
478
488
|
add_builtin(
|
|
@@ -481,6 +491,7 @@ add_builtin(
|
|
|
481
491
|
value_func=value_func_mat_inv,
|
|
482
492
|
group="Vector Math",
|
|
483
493
|
doc="Return the inverse of a 4x4 matrix ``m``.",
|
|
494
|
+
require_original_output_arg=True,
|
|
484
495
|
)
|
|
485
496
|
|
|
486
497
|
|
|
@@ -580,6 +591,7 @@ add_builtin(
|
|
|
580
591
|
value_func=sametype_value_func(vector(length=Any, dtype=Scalar)),
|
|
581
592
|
group="Vector Math",
|
|
582
593
|
doc="Component-wise division of two 2D vectors.",
|
|
594
|
+
require_original_output_arg=True,
|
|
583
595
|
)
|
|
584
596
|
|
|
585
597
|
add_builtin(
|
|
@@ -595,6 +607,7 @@ add_builtin(
|
|
|
595
607
|
value_func=sametype_value_func(matrix(shape=(Any, Any), dtype=Scalar)),
|
|
596
608
|
group="Vector Math",
|
|
597
609
|
doc="Component-wise division of two 2D vectors.",
|
|
610
|
+
require_original_output_arg=True,
|
|
598
611
|
)
|
|
599
612
|
|
|
600
613
|
|
|
@@ -1082,6 +1095,7 @@ add_builtin(
|
|
|
1082
1095
|
value_func=lambda arg_types, kwds, _: quaternion(dtype=infer_scalar_type(arg_types)),
|
|
1083
1096
|
group="Quaternion Math",
|
|
1084
1097
|
doc="Linearly interpolate between two quaternions.",
|
|
1098
|
+
require_original_output_arg=True,
|
|
1085
1099
|
)
|
|
1086
1100
|
add_builtin(
|
|
1087
1101
|
"quat_to_matrix",
|
|
@@ -1469,7 +1483,7 @@ add_builtin(
|
|
|
1469
1483
|
value_type=bvh_query_t,
|
|
1470
1484
|
group="Geometry",
|
|
1471
1485
|
doc="""Construct an axis-aligned bounding box query against a BVH object. This query can be used to iterate over all bounds
|
|
1472
|
-
inside a BVH.
|
|
1486
|
+
inside a BVH.
|
|
1473
1487
|
|
|
1474
1488
|
:param id: The BVH identifier
|
|
1475
1489
|
:param lower: The lower bound of the bounding box in BVH space
|
|
@@ -1482,7 +1496,7 @@ add_builtin(
|
|
|
1482
1496
|
value_type=bvh_query_t,
|
|
1483
1497
|
group="Geometry",
|
|
1484
1498
|
doc="""Construct a ray query against a BVH object. This query can be used to iterate over all bounds
|
|
1485
|
-
that intersect the ray.
|
|
1499
|
+
that intersect the ray.
|
|
1486
1500
|
|
|
1487
1501
|
:param id: The BVH identifier
|
|
1488
1502
|
:param start: The start of the ray in BVH space
|
|
@@ -1525,6 +1539,28 @@ add_builtin(
|
|
|
1525
1539
|
:param face: Returns the index of the closest face
|
|
1526
1540
|
:param bary_u: Returns the barycentric u coordinate of the closest point
|
|
1527
1541
|
:param bary_v: Returns the barycentric v coordinate of the closest point""",
|
|
1542
|
+
hidden=True,
|
|
1543
|
+
)
|
|
1544
|
+
|
|
1545
|
+
add_builtin(
|
|
1546
|
+
"mesh_query_point",
|
|
1547
|
+
input_types={
|
|
1548
|
+
"id": uint64,
|
|
1549
|
+
"point": vec3,
|
|
1550
|
+
"max_dist": float,
|
|
1551
|
+
},
|
|
1552
|
+
value_type=mesh_query_point_t,
|
|
1553
|
+
group="Geometry",
|
|
1554
|
+
doc="""Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
|
|
1555
|
+
|
|
1556
|
+
Identifies the sign of the distance using additional ray-casts to determine if the point is inside or outside.
|
|
1557
|
+
This method is relatively robust, but does increase computational cost.
|
|
1558
|
+
See below for additional sign determination methods.
|
|
1559
|
+
|
|
1560
|
+
:param id: The mesh identifier
|
|
1561
|
+
:param point: The point in space to query
|
|
1562
|
+
:param max_dist: Mesh faces above this distance will not be considered by the query""",
|
|
1563
|
+
require_original_output_arg=True,
|
|
1528
1564
|
)
|
|
1529
1565
|
|
|
1530
1566
|
add_builtin(
|
|
@@ -1549,6 +1585,26 @@ add_builtin(
|
|
|
1549
1585
|
:param face: Returns the index of the closest face
|
|
1550
1586
|
:param bary_u: Returns the barycentric u coordinate of the closest point
|
|
1551
1587
|
:param bary_v: Returns the barycentric v coordinate of the closest point""",
|
|
1588
|
+
hidden=True,
|
|
1589
|
+
)
|
|
1590
|
+
|
|
1591
|
+
add_builtin(
|
|
1592
|
+
"mesh_query_point_no_sign",
|
|
1593
|
+
input_types={
|
|
1594
|
+
"id": uint64,
|
|
1595
|
+
"point": vec3,
|
|
1596
|
+
"max_dist": float,
|
|
1597
|
+
},
|
|
1598
|
+
value_type=mesh_query_point_t,
|
|
1599
|
+
group="Geometry",
|
|
1600
|
+
doc="""Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
|
|
1601
|
+
|
|
1602
|
+
This method does not compute the sign of the point (inside/outside) which makes it faster than other point query methods.
|
|
1603
|
+
|
|
1604
|
+
:param id: The mesh identifier
|
|
1605
|
+
:param point: The point in space to query
|
|
1606
|
+
:param max_dist: Mesh faces above this distance will not be considered by the query""",
|
|
1607
|
+
require_original_output_arg=True,
|
|
1552
1608
|
)
|
|
1553
1609
|
|
|
1554
1610
|
add_builtin(
|
|
@@ -1573,6 +1629,26 @@ add_builtin(
|
|
|
1573
1629
|
:param face: Returns the index of the furthest face
|
|
1574
1630
|
:param bary_u: Returns the barycentric u coordinate of the furthest point
|
|
1575
1631
|
:param bary_v: Returns the barycentric v coordinate of the furthest point""",
|
|
1632
|
+
hidden=True,
|
|
1633
|
+
)
|
|
1634
|
+
|
|
1635
|
+
add_builtin(
|
|
1636
|
+
"mesh_query_furthest_point_no_sign",
|
|
1637
|
+
input_types={
|
|
1638
|
+
"id": uint64,
|
|
1639
|
+
"point": vec3,
|
|
1640
|
+
"min_dist": float,
|
|
1641
|
+
},
|
|
1642
|
+
value_type=mesh_query_point_t,
|
|
1643
|
+
group="Geometry",
|
|
1644
|
+
doc="""Computes the furthest point on the mesh with identifier `id` to the given point in space.
|
|
1645
|
+
|
|
1646
|
+
This method does not compute the sign of the point (inside/outside).
|
|
1647
|
+
|
|
1648
|
+
:param id: The mesh identifier
|
|
1649
|
+
:param point: The point in space to query
|
|
1650
|
+
:param min_dist: Mesh faces below this distance will not be considered by the query""",
|
|
1651
|
+
require_original_output_arg=True,
|
|
1576
1652
|
)
|
|
1577
1653
|
|
|
1578
1654
|
add_builtin(
|
|
@@ -1606,6 +1682,32 @@ add_builtin(
|
|
|
1606
1682
|
:param bary_v: Returns the barycentric v coordinate of the closest point
|
|
1607
1683
|
:param epsilon: Epsilon treating distance values as equal, when locating the minimum distance vertex/face/edge, as a
|
|
1608
1684
|
fraction of the average edge length, also for treating closest point as being on edge/vertex default 1e-3""",
|
|
1685
|
+
hidden=True,
|
|
1686
|
+
)
|
|
1687
|
+
|
|
1688
|
+
add_builtin(
|
|
1689
|
+
"mesh_query_point_sign_normal",
|
|
1690
|
+
input_types={
|
|
1691
|
+
"id": uint64,
|
|
1692
|
+
"point": vec3,
|
|
1693
|
+
"max_dist": float,
|
|
1694
|
+
"epsilon": float,
|
|
1695
|
+
},
|
|
1696
|
+
defaults={"epsilon": 1.0e-3},
|
|
1697
|
+
value_type=mesh_query_point_t,
|
|
1698
|
+
group="Geometry",
|
|
1699
|
+
doc="""Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
|
|
1700
|
+
|
|
1701
|
+
Identifies the sign of the distance (inside/outside) using the angle-weighted pseudo normal.
|
|
1702
|
+
This approach to sign determination is robust for well conditioned meshes that are watertight and non-self intersecting.
|
|
1703
|
+
It is also comparatively fast to compute.
|
|
1704
|
+
|
|
1705
|
+
:param id: The mesh identifier
|
|
1706
|
+
:param point: The point in space to query
|
|
1707
|
+
:param max_dist: Mesh faces above this distance will not be considered by the query
|
|
1708
|
+
:param epsilon: Epsilon treating distance values as equal, when locating the minimum distance vertex/face/edge, as a
|
|
1709
|
+
fraction of the average edge length, also for treating closest point as being on edge/vertex default 1e-3""",
|
|
1710
|
+
require_original_output_arg=True,
|
|
1609
1711
|
)
|
|
1610
1712
|
|
|
1611
1713
|
add_builtin(
|
|
@@ -1642,6 +1744,35 @@ add_builtin(
|
|
|
1642
1744
|
:param bary_v: Returns the barycentric v coordinate of the closest point
|
|
1643
1745
|
:param accuracy: Accuracy for computing the winding number with fast winding number method utilizing second-order dipole approximation, default 2.0
|
|
1644
1746
|
:param threshold: The threshold of the winding number to be considered inside, default 0.5""",
|
|
1747
|
+
hidden=True,
|
|
1748
|
+
)
|
|
1749
|
+
|
|
1750
|
+
add_builtin(
|
|
1751
|
+
"mesh_query_point_sign_winding_number",
|
|
1752
|
+
input_types={
|
|
1753
|
+
"id": uint64,
|
|
1754
|
+
"point": vec3,
|
|
1755
|
+
"max_dist": float,
|
|
1756
|
+
"accuracy": float,
|
|
1757
|
+
"threshold": float,
|
|
1758
|
+
},
|
|
1759
|
+
defaults={"accuracy": 2.0, "threshold": 0.5},
|
|
1760
|
+
value_type=mesh_query_point_t,
|
|
1761
|
+
group="Geometry",
|
|
1762
|
+
doc="""Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given point in space.
|
|
1763
|
+
|
|
1764
|
+
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
|
|
1765
|
+
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
|
|
1766
|
+
but also the most expensive.
|
|
1767
|
+
|
|
1768
|
+
.. note:: The :class:`Mesh` object must be constructed with ``support_winding_number=True`` for this method to return correct results.
|
|
1769
|
+
|
|
1770
|
+
:param id: The mesh identifier
|
|
1771
|
+
:param point: The point in space to query
|
|
1772
|
+
:param max_dist: Mesh faces above this distance will not be considered by the query
|
|
1773
|
+
:param accuracy: Accuracy for computing the winding number with fast winding number method utilizing second-order dipole approximation, default 2.0
|
|
1774
|
+
:param threshold: The threshold of the winding number to be considered inside, default 0.5""",
|
|
1775
|
+
require_original_output_arg=True,
|
|
1645
1776
|
)
|
|
1646
1777
|
|
|
1647
1778
|
add_builtin(
|
|
@@ -1660,7 +1791,7 @@ add_builtin(
|
|
|
1660
1791
|
},
|
|
1661
1792
|
value_type=builtins.bool,
|
|
1662
1793
|
group="Geometry",
|
|
1663
|
-
doc="""Computes the closest ray hit on the :class:`Mesh` with identifier ``id``, returns ``True`` if a
|
|
1794
|
+
doc="""Computes the closest ray hit on the :class:`Mesh` with identifier ``id``, returns ``True`` if a hit < ``max_t`` is found.
|
|
1664
1795
|
|
|
1665
1796
|
:param id: The mesh identifier
|
|
1666
1797
|
:param start: The start point of the ray
|
|
@@ -1669,9 +1800,29 @@ add_builtin(
|
|
|
1669
1800
|
:param t: Returns the distance of the closest hit along the ray
|
|
1670
1801
|
:param bary_u: Returns the barycentric u coordinate of the closest hit
|
|
1671
1802
|
:param bary_v: Returns the barycentric v coordinate of the closest hit
|
|
1672
|
-
:param sign: Returns a value > 0 if the
|
|
1803
|
+
:param sign: Returns a value > 0 if the ray hit in front of the face, returns < 0 otherwise
|
|
1673
1804
|
:param normal: Returns the face normal
|
|
1674
1805
|
:param face: Returns the index of the hit face""",
|
|
1806
|
+
hidden=True,
|
|
1807
|
+
)
|
|
1808
|
+
|
|
1809
|
+
add_builtin(
|
|
1810
|
+
"mesh_query_ray",
|
|
1811
|
+
input_types={
|
|
1812
|
+
"id": uint64,
|
|
1813
|
+
"start": vec3,
|
|
1814
|
+
"dir": vec3,
|
|
1815
|
+
"max_t": float,
|
|
1816
|
+
},
|
|
1817
|
+
value_type=mesh_query_ray_t,
|
|
1818
|
+
group="Geometry",
|
|
1819
|
+
doc="""Computes the closest ray hit on the :class:`Mesh` with identifier ``id``.
|
|
1820
|
+
|
|
1821
|
+
:param id: The mesh identifier
|
|
1822
|
+
:param start: The start point of the ray
|
|
1823
|
+
:param dir: The ray direction (should be normalized)
|
|
1824
|
+
:param max_t: The maximum distance along the ray to check for intersections""",
|
|
1825
|
+
require_original_output_arg=True,
|
|
1675
1826
|
)
|
|
1676
1827
|
|
|
1677
1828
|
add_builtin(
|
|
@@ -1681,7 +1832,6 @@ add_builtin(
|
|
|
1681
1832
|
group="Geometry",
|
|
1682
1833
|
doc="""Construct an axis-aligned bounding box query against a :class:`Mesh`.
|
|
1683
1834
|
This query can be used to iterate over all triangles inside a volume.
|
|
1684
|
-
Returns an object that is used to track state during mesh traversal.
|
|
1685
1835
|
|
|
1686
1836
|
:param id: The mesh identifier
|
|
1687
1837
|
:param lower: The lower bound of the bounding box in mesh space
|
|
@@ -1719,7 +1869,7 @@ add_builtin(
|
|
|
1719
1869
|
value_type=hash_grid_query_t,
|
|
1720
1870
|
group="Geometry",
|
|
1721
1871
|
doc="Construct a point query against a :class:`HashGrid`. This query can be used to iterate over all neighboring points "
|
|
1722
|
-
"within a fixed radius from the query point.
|
|
1872
|
+
"within a fixed radius from the query point.",
|
|
1723
1873
|
)
|
|
1724
1874
|
|
|
1725
1875
|
add_builtin(
|
|
@@ -2956,6 +3106,23 @@ def mul_matvec_value_func(arg_types, kwds, _):
|
|
|
2956
3106
|
return vector(length=arg_types[0]._shape_[0], dtype=arg_types[0]._wp_scalar_type_)
|
|
2957
3107
|
|
|
2958
3108
|
|
|
3109
|
+
def mul_vecmat_value_func(arg_types, kwds, _):
|
|
3110
|
+
if arg_types is None:
|
|
3111
|
+
return vector(length=Any, dtype=Scalar)
|
|
3112
|
+
|
|
3113
|
+
if arg_types[1]._wp_scalar_type_ != arg_types[0]._wp_scalar_type_:
|
|
3114
|
+
raise RuntimeError(
|
|
3115
|
+
f"Can't multiply vector and matrix with different types {arg_types[1]._wp_scalar_type_}, {arg_types[0]._wp_scalar_type_}"
|
|
3116
|
+
)
|
|
3117
|
+
|
|
3118
|
+
if arg_types[1]._shape_[0] != arg_types[0]._length_:
|
|
3119
|
+
raise RuntimeError(
|
|
3120
|
+
f"Can't multiply vector with length {arg_types[0]._length_} and matrix of shape {arg_types[1]._shape_}"
|
|
3121
|
+
)
|
|
3122
|
+
|
|
3123
|
+
return vector(length=arg_types[1]._shape_[1], dtype=arg_types[1]._wp_scalar_type_)
|
|
3124
|
+
|
|
3125
|
+
|
|
2959
3126
|
def mul_matmat_value_func(arg_types, kwds, _):
|
|
2960
3127
|
if arg_types is None:
|
|
2961
3128
|
return matrix(length=Any, dtype=Scalar)
|
|
@@ -3030,6 +3197,13 @@ add_builtin(
|
|
|
3030
3197
|
doc="",
|
|
3031
3198
|
group="Operators",
|
|
3032
3199
|
)
|
|
3200
|
+
add_builtin(
|
|
3201
|
+
"mul",
|
|
3202
|
+
input_types={"x": vector(length=Any, dtype=Scalar), "y": matrix(shape=(Any, Any), dtype=Scalar)},
|
|
3203
|
+
value_func=mul_vecmat_value_func,
|
|
3204
|
+
doc="",
|
|
3205
|
+
group="Operators",
|
|
3206
|
+
)
|
|
3033
3207
|
add_builtin(
|
|
3034
3208
|
"mul",
|
|
3035
3209
|
input_types={"x": matrix(shape=(Any, Any), dtype=Scalar), "y": matrix(shape=(Any, Any), dtype=Scalar)},
|
|
@@ -3065,7 +3239,11 @@ add_builtin(
|
|
|
3065
3239
|
)
|
|
3066
3240
|
|
|
3067
3241
|
add_builtin(
|
|
3068
|
-
"div",
|
|
3242
|
+
"div",
|
|
3243
|
+
input_types={"x": Scalar, "y": Scalar},
|
|
3244
|
+
value_func=sametype_value_func(Scalar),
|
|
3245
|
+
doc="", group="Operators",
|
|
3246
|
+
require_original_output_arg=True,
|
|
3069
3247
|
)
|
|
3070
3248
|
add_builtin(
|
|
3071
3249
|
"div",
|
|
@@ -3074,6 +3252,13 @@ add_builtin(
|
|
|
3074
3252
|
doc="",
|
|
3075
3253
|
group="Operators",
|
|
3076
3254
|
)
|
|
3255
|
+
add_builtin(
|
|
3256
|
+
"div",
|
|
3257
|
+
input_types={"x": Scalar, "y": vector(length=Any, dtype=Scalar)},
|
|
3258
|
+
value_func=scalar_mul_value_func(vector(length=Any, dtype=Scalar)),
|
|
3259
|
+
doc="",
|
|
3260
|
+
group="Operators",
|
|
3261
|
+
)
|
|
3077
3262
|
add_builtin(
|
|
3078
3263
|
"div",
|
|
3079
3264
|
input_types={"x": matrix(shape=(Any, Any), dtype=Scalar), "y": Scalar},
|
|
@@ -3081,6 +3266,13 @@ add_builtin(
|
|
|
3081
3266
|
doc="",
|
|
3082
3267
|
group="Operators",
|
|
3083
3268
|
)
|
|
3269
|
+
add_builtin(
|
|
3270
|
+
"div",
|
|
3271
|
+
input_types={"x": Scalar, "y": matrix(shape=(Any, Any), dtype=Scalar)},
|
|
3272
|
+
value_func=scalar_mul_value_func(matrix(shape=(Any, Any), dtype=Scalar)),
|
|
3273
|
+
doc="",
|
|
3274
|
+
group="Operators",
|
|
3275
|
+
)
|
|
3084
3276
|
add_builtin(
|
|
3085
3277
|
"div",
|
|
3086
3278
|
input_types={"x": quaternion(dtype=Scalar), "y": Scalar},
|
|
@@ -3088,6 +3280,13 @@ add_builtin(
|
|
|
3088
3280
|
doc="",
|
|
3089
3281
|
group="Operators",
|
|
3090
3282
|
)
|
|
3283
|
+
add_builtin(
|
|
3284
|
+
"div",
|
|
3285
|
+
input_types={"x": Scalar, "y": quaternion(dtype=Scalar)},
|
|
3286
|
+
value_func=scalar_mul_value_func(quaternion(dtype=Scalar)),
|
|
3287
|
+
doc="",
|
|
3288
|
+
group="Operators",
|
|
3289
|
+
)
|
|
3091
3290
|
|
|
3092
3291
|
add_builtin(
|
|
3093
3292
|
"floordiv",
|