warp-lang 1.3.1__py3-none-manylinux2014_x86_64.whl → 1.3.2__py3-none-manylinux2014_x86_64.whl

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

Potentially problematic release.


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

warp/native/svd.h CHANGED
@@ -38,10 +38,20 @@
38
38
  namespace wp
39
39
  {
40
40
 
41
- #define _gamma 5.828427124 // FOUR_GAMMA_SQUARED = sqrt(8)+3;
42
- #define _cstar 0.923879532 // cos(pi/8)
43
- #define _sstar 0.3826834323 // sin(p/8)
44
- #define _EPSILON 1e-6
41
+
42
+ template<typename Type>
43
+ struct _svd_config {
44
+ static constexpr float QR_GIVENS_EPSILON = 1.e-6f;
45
+ static constexpr int JACOBI_ITERATIONS = 4;
46
+ };
47
+
48
+ template<>
49
+ struct _svd_config<double> {
50
+ static constexpr double QR_GIVENS_EPSILON = 1.e-12;
51
+ static constexpr int JACOBI_ITERATIONS = 8;
52
+ };
53
+
54
+
45
55
 
46
56
  // TODO: replace sqrt with rsqrt
47
57
 
@@ -149,9 +159,13 @@ void approximateGivensQuaternion(Type a11, Type a12, Type a22, Type &ch, Type &s
149
159
  * Given givens angle computed by approximateGivensAngles,
150
160
  * compute the corresponding rotation quaternion.
151
161
  */
162
+ constexpr double _gamma = 5.82842712474619; // FOUR_GAMMA_SQUARED = sqrt(8)+3;
163
+ constexpr double _cstar = 0.9238795325112867; // cos(pi/8)
164
+ constexpr double _sstar = 0.3826834323650898; // sin(p/8)
165
+
152
166
  ch = Type(2)*(a11-a22);
153
167
  sh = a12;
154
- bool b = _gamma*sh*sh < ch*ch;
168
+ bool b = Type(_gamma)*sh*sh < ch*ch;
155
169
  Type w = Type(1) / sqrt(ch*ch+sh*sh);
156
170
  ch=b?w*ch:Type(_cstar);
157
171
  sh=b?w*sh:Type(_sstar);
@@ -230,7 +244,8 @@ void jacobiEigenanlysis( // symmetric matrix
230
244
  Type * qV)
231
245
  {
232
246
  qV[3]=1; qV[0]=0;qV[1]=0;qV[2]=0; // follow same indexing convention as GLM
233
- for (int i=0;i<4;i++)
247
+ constexpr int ITERS = _svd_config<Type>::JACOBI_ITERATIONS;
248
+ for (int i=0;i<ITERS;i++)
234
249
  {
235
250
  // we wish to eliminate the maximum off-diagonal element
236
251
  // on every iteration, but cycling over all 3 possible rotations
@@ -279,7 +294,7 @@ void QRGivensQuaternion(Type a1, Type a2, Type &ch, Type &sh)
279
294
  {
280
295
  // a1 = pivot point on diagonal
281
296
  // a2 = lower triangular entry we want to annihilate
282
- Type epsilon = _EPSILON;
297
+ const Type epsilon = _svd_config<Type>::QR_GIVENS_EPSILON;
283
298
  Type rho = accurateSqrt(a1*a1 + a2*a2);
284
299
 
285
300
  sh = rho > epsilon ? a2 : Type(0);
warp/native/warp.cpp CHANGED
@@ -1019,6 +1019,7 @@ WP_API void cuda_stream_synchronize(void* stream) {}
1019
1019
  WP_API void cuda_stream_wait_event(void* stream, void* event) {}
1020
1020
  WP_API void cuda_stream_wait_stream(void* stream, void* other_stream, void* event) {}
1021
1021
  WP_API int cuda_stream_is_capturing(void* stream) { return 0; }
1022
+ WP_API uint64_t cuda_stream_get_capture_id(void* stream) { return 0; }
1022
1023
 
1023
1024
  WP_API void* cuda_event_create(void* context, unsigned flags) { return NULL; }
1024
1025
  WP_API void cuda_event_destroy(void* event) {}
warp/native/warp.cu CHANGED
@@ -2263,6 +2263,11 @@ int cuda_stream_is_capturing(void* stream)
2263
2263
  return int(status != cudaStreamCaptureStatusNone);
2264
2264
  }
2265
2265
 
2266
+ uint64_t cuda_stream_get_capture_id(void* stream)
2267
+ {
2268
+ return get_capture_id(static_cast<CUstream>(stream));
2269
+ }
2270
+
2266
2271
  void* cuda_event_create(void* context, unsigned flags)
2267
2272
  {
2268
2273
  ContextGuard guard(context, true);
warp/native/warp.h CHANGED
@@ -295,6 +295,7 @@ extern "C"
295
295
  WP_API void cuda_stream_wait_event(void* stream, void* event);
296
296
  WP_API void cuda_stream_wait_stream(void* stream, void* other_stream, void* event);
297
297
  WP_API int cuda_stream_is_capturing(void* stream);
298
+ WP_API uint64_t cuda_stream_get_capture_id(void* stream);
298
299
 
299
300
  WP_API void* cuda_event_create(void* context, unsigned flags);
300
301
  WP_API void cuda_event_destroy(void* event);
warp/sim/collide.py CHANGED
@@ -53,7 +53,7 @@ def triangle_closest_point_barycentric(a: wp.vec3, b: wp.vec3, c: wp.vec3, p: wp
53
53
  va = d3 * d6 - d5 * d4
54
54
  w = (d4 - d3) / ((d4 - d3) + (d5 - d6))
55
55
  if va <= 0.0 and (d4 - d3) >= 0.0 and (d5 - d6) >= 0.0:
56
- return wp.vec3(0.0, w, 1.0 - w)
56
+ return wp.vec3(0.0, 1.0 - w, w)
57
57
 
58
58
  denom = 1.0 / (va + vb + vc)
59
59
  v = vb * denom
warp/sim/model.py CHANGED
@@ -2516,16 +2516,16 @@ class ModelBuilder:
2516
2516
  )
2517
2517
  if last_dynamic_body > -1:
2518
2518
  self.shape_body[shape] = body_data[last_dynamic_body]["id"]
2519
+ source_m = body_data[last_dynamic_body]["mass"]
2520
+ source_com = body_data[last_dynamic_body]["com"]
2519
2521
  # add inertia to last_dynamic_body
2520
2522
  m = body_data[child_body]["mass"]
2521
- com = body_data[child_body]["com"]
2523
+ com = wp.transform_point(incoming_xform, body_data[child_body]["com"])
2522
2524
  inertia = body_data[child_body]["inertia"]
2523
2525
  body_data[last_dynamic_body]["inertia"] += wp.sim.transform_inertia(
2524
2526
  m, inertia, incoming_xform.p, incoming_xform.q
2525
2527
  )
2526
2528
  body_data[last_dynamic_body]["mass"] += m
2527
- source_m = body_data[last_dynamic_body]["mass"]
2528
- source_com = body_data[last_dynamic_body]["com"]
2529
2529
  body_data[last_dynamic_body]["com"] = (m * com + source_m * source_com) / (m + source_m)
2530
2530
  body_data[last_dynamic_body]["shapes"].append(shape)
2531
2531
  # indicate to recompute inverse mass, inertia for this body
@@ -2594,6 +2594,19 @@ class ModelBuilder:
2594
2594
  # sort joints so they appear in the same order as before
2595
2595
  retained_joints.sort(key=lambda x: x["original_id"])
2596
2596
 
2597
+ joint_remap = {}
2598
+ for i, joint in enumerate(retained_joints):
2599
+ joint_remap[joint["original_id"]] = i
2600
+ # update articulation_start
2601
+ for i, old_i in enumerate(self.articulation_start):
2602
+ while old_i not in joint_remap:
2603
+ old_i += 1
2604
+ if old_i >= self.joint_count:
2605
+ break
2606
+ self.articulation_start[i] = joint_remap.get(old_i, old_i)
2607
+ # remove empty articulation starts, i.e. where the start and end are the same
2608
+ self.articulation_start = list(set(self.articulation_start))
2609
+
2597
2610
  self.joint_name.clear()
2598
2611
  self.joint_type.clear()
2599
2612
  self.joint_parent.clear()
warp/sim/utils.py CHANGED
@@ -311,7 +311,7 @@ def load_mesh(filename: str, method: str = None):
311
311
  import os
312
312
 
313
313
  if not os.path.exists(filename):
314
- raise ValueError(f"File not found: {filename}")
314
+ raise FileNotFoundError(f"File not found: {filename}")
315
315
 
316
316
  def load_mesh_with_method(method):
317
317
  if method == "meshio":