deformable 0.1.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.
- deformable/__init__.py +191 -0
- deformable/cancel_flag.py +43 -0
- deformable/conversion.py +176 -0
- deformable/deformable.dll +0 -0
- deformable/embedding.py +159 -0
- deformable/errors.py +150 -0
- deformable/handles.py +97 -0
- deformable/library.py +410 -0
- deformable/license.py +154 -0
- deformable/material_regions.py +48 -0
- deformable/mesh_verification.py +187 -0
- deformable/meshes.py +179 -0
- deformable/native.py +401 -0
- deformable/simulation.py +468 -0
- deformable/tools.py +340 -0
- deformable/values.py +116 -0
- deformable-0.1.0.dist-info/METADATA +14 -0
- deformable-0.1.0.dist-info/RECORD +19 -0
- deformable-0.1.0.dist-info/WHEEL +4 -0
deformable/native.py
ADDED
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
"""The C structs of deformable.h as ctypes structures, field for field and in the header's order.
|
|
2
|
+
|
|
3
|
+
Handles are opaque, so they cross as plain void pointers. tests/test_native.py checks every structure here against the
|
|
4
|
+
header, so neither side can change alone.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import ctypes
|
|
10
|
+
|
|
11
|
+
Status = ctypes.c_int32
|
|
12
|
+
Enumeration = ctypes.c_int32
|
|
13
|
+
Boolean = ctypes.c_uint8
|
|
14
|
+
Handle = ctypes.c_void_p
|
|
15
|
+
Index = ctypes.c_uint32
|
|
16
|
+
Count = ctypes.c_size_t
|
|
17
|
+
|
|
18
|
+
TetrahedronIndices = Index * 4
|
|
19
|
+
TriangleIndices = Index * 3
|
|
20
|
+
EdgeIndices = Index * 2
|
|
21
|
+
Colour = ctypes.c_double * 4
|
|
22
|
+
Weights = ctypes.c_double * 4
|
|
23
|
+
Pixel = ctypes.c_uint8 * 3
|
|
24
|
+
FloatVector = ctypes.c_float * 3
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class Vector2(ctypes.Structure):
|
|
28
|
+
"""DeformableVector2."""
|
|
29
|
+
|
|
30
|
+
_fields_ = [("x", ctypes.c_double), ("y", ctypes.c_double)]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class Vector3(ctypes.Structure):
|
|
34
|
+
"""DeformableVector3."""
|
|
35
|
+
|
|
36
|
+
_fields_ = [("x", ctypes.c_double), ("y", ctypes.c_double), ("z", ctypes.c_double)]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class Matrix3(ctypes.Structure):
|
|
40
|
+
"""DeformableMatrix3."""
|
|
41
|
+
|
|
42
|
+
_fields_ = [("rows", Vector3 * 3)]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class AffineTransform(ctypes.Structure):
|
|
46
|
+
"""DeformableAffineTransform."""
|
|
47
|
+
|
|
48
|
+
_fields_ = [("linear", Matrix3), ("translation", Vector3)]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class ErrorDetails(ctypes.Structure):
|
|
52
|
+
"""DeformableErrorDetails."""
|
|
53
|
+
|
|
54
|
+
_fields_ = [("status", Status), ("first_index", Index), ("second_index", Index)]
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class LicenseStatus(ctypes.Structure):
|
|
58
|
+
"""DeformableLicenseStatus."""
|
|
59
|
+
|
|
60
|
+
_fields_ = [
|
|
61
|
+
("state", Enumeration),
|
|
62
|
+
("days_left", ctypes.c_uint32),
|
|
63
|
+
("tetrahedron_limit", ctypes.c_uint32),
|
|
64
|
+
("usable", Boolean),
|
|
65
|
+
("needs_online", Boolean),
|
|
66
|
+
("has_license_key", Boolean),
|
|
67
|
+
("message", ctypes.c_char * 64),
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class TetrahedralMeshView(ctypes.Structure):
|
|
72
|
+
"""DeformableTetrahedralMeshView."""
|
|
73
|
+
|
|
74
|
+
_fields_ = [
|
|
75
|
+
("positions", ctypes.POINTER(Vector3)),
|
|
76
|
+
("position_count", Count),
|
|
77
|
+
("tetrahedrons", ctypes.POINTER(TetrahedronIndices)),
|
|
78
|
+
("tetrahedron_count", Count),
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class PolygonMeshView(ctypes.Structure):
|
|
83
|
+
"""DeformablePolygonMeshView."""
|
|
84
|
+
|
|
85
|
+
_fields_ = [
|
|
86
|
+
("positions", ctypes.POINTER(Vector3)),
|
|
87
|
+
("position_count", Count),
|
|
88
|
+
("polygon_sizes", ctypes.POINTER(Index)),
|
|
89
|
+
("polygon_count", Count),
|
|
90
|
+
("polygon_vertices", ctypes.POINTER(Index)),
|
|
91
|
+
("corner_count", Count),
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class TriangleSurfaceView(ctypes.Structure):
|
|
96
|
+
"""DeformableTriangleSurfaceView."""
|
|
97
|
+
|
|
98
|
+
_fields_ = [
|
|
99
|
+
("positions", ctypes.POINTER(Vector3)),
|
|
100
|
+
("position_count", Count),
|
|
101
|
+
("triangles", ctypes.POINTER(TriangleIndices)),
|
|
102
|
+
("triangle_count", Count),
|
|
103
|
+
]
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class SurfaceMeshView(ctypes.Structure):
|
|
107
|
+
"""DeformableSurfaceMeshView."""
|
|
108
|
+
|
|
109
|
+
_fields_ = [
|
|
110
|
+
("mesh", PolygonMeshView),
|
|
111
|
+
("normals", ctypes.POINTER(Vector3)),
|
|
112
|
+
("normal_count", Count),
|
|
113
|
+
("uvs", ctypes.POINTER(Vector2)),
|
|
114
|
+
("uv_set_count", Count),
|
|
115
|
+
("colours", ctypes.POINTER(Colour)),
|
|
116
|
+
("colour_count", Count),
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class Anisotropy(ctypes.Structure):
|
|
121
|
+
"""DeformableAnisotropy."""
|
|
122
|
+
|
|
123
|
+
_fields_ = [("scale", ctypes.c_double), ("direction", Vector3)]
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class AutocageParameters(ctypes.Structure):
|
|
127
|
+
"""DeformableAutocageParameters."""
|
|
128
|
+
|
|
129
|
+
_fields_ = [
|
|
130
|
+
("scale_gap", ctypes.c_double),
|
|
131
|
+
("target_face_count", ctypes.c_int32),
|
|
132
|
+
("target_tetrahedron_count", ctypes.c_int32),
|
|
133
|
+
]
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class FaceHole(ctypes.Structure):
|
|
137
|
+
"""DeformableFaceHole."""
|
|
138
|
+
|
|
139
|
+
_fields_ = [("face", Index), ("first_corner", Index), ("corner_count", Index)]
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class TriangulateParameters(ctypes.Structure):
|
|
143
|
+
"""DeformableTriangulateParameters."""
|
|
144
|
+
|
|
145
|
+
_fields_ = [
|
|
146
|
+
("maximum_area", ctypes.c_double),
|
|
147
|
+
("quality", ctypes.c_double),
|
|
148
|
+
("anisotropy", Anisotropy * 2),
|
|
149
|
+
("watertight", Boolean),
|
|
150
|
+
]
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
class TriangulationView(ctypes.Structure):
|
|
154
|
+
"""DeformableTriangulationView."""
|
|
155
|
+
|
|
156
|
+
_fields_ = [
|
|
157
|
+
("surface", TriangleSurfaceView),
|
|
158
|
+
("source_polygons", ctypes.POINTER(Index)),
|
|
159
|
+
("source_polygon_count", Count),
|
|
160
|
+
]
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
class DensityRegion(ctypes.Structure):
|
|
164
|
+
"""DeformableDensityRegion."""
|
|
165
|
+
|
|
166
|
+
_fields_ = [("points", ctypes.POINTER(Vector3)), ("point_count", Count), ("scale", ctypes.c_double)]
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class TetrahedralizeParameters(ctypes.Structure):
|
|
170
|
+
"""DeformableTetrahedralizeParameters."""
|
|
171
|
+
|
|
172
|
+
_fields_ = [
|
|
173
|
+
("maximum_edge_length", ctypes.c_double),
|
|
174
|
+
("anisotropy", Anisotropy * 2),
|
|
175
|
+
("density_regions", ctypes.POINTER(DensityRegion)),
|
|
176
|
+
("density_region_count", Count),
|
|
177
|
+
]
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
class TetrahedralizationView(ctypes.Structure):
|
|
181
|
+
"""DeformableTetrahedralizationView."""
|
|
182
|
+
|
|
183
|
+
_fields_ = [
|
|
184
|
+
("mesh", TetrahedralMeshView),
|
|
185
|
+
("skipped_density_regions", ctypes.POINTER(Count)),
|
|
186
|
+
("skipped_density_region_count", Count),
|
|
187
|
+
]
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class MeshChecks(ctypes.Structure):
|
|
191
|
+
"""DeformableMeshChecks."""
|
|
192
|
+
|
|
193
|
+
_fields_ = [
|
|
194
|
+
("angle_threshold_degrees", ctypes.c_double),
|
|
195
|
+
("gap_threshold", ctypes.c_double),
|
|
196
|
+
("planar_threshold", ctypes.c_double),
|
|
197
|
+
("check_uv_consistency", Boolean),
|
|
198
|
+
("uv_threshold", ctypes.c_double),
|
|
199
|
+
("same_uv", Boolean),
|
|
200
|
+
("convex", Boolean),
|
|
201
|
+
("watertight", Boolean),
|
|
202
|
+
("self_intersection", Enumeration),
|
|
203
|
+
]
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
class MeshIssue(ctypes.Structure):
|
|
207
|
+
"""DeformableMeshIssue."""
|
|
208
|
+
|
|
209
|
+
_fields_ = [
|
|
210
|
+
("kind", Enumeration),
|
|
211
|
+
("vertex", Index),
|
|
212
|
+
("face", Index),
|
|
213
|
+
("hole", Index),
|
|
214
|
+
("corner", Index),
|
|
215
|
+
("uv_set", Index),
|
|
216
|
+
("island", Index),
|
|
217
|
+
("container", Index),
|
|
218
|
+
("use_count", Index),
|
|
219
|
+
("hole_count", Index),
|
|
220
|
+
("island_count", Index),
|
|
221
|
+
("edge", EdgeIndices),
|
|
222
|
+
("corners", EdgeIndices),
|
|
223
|
+
("inward", Boolean),
|
|
224
|
+
("distance", ctypes.c_double),
|
|
225
|
+
("relative_distance", ctypes.c_double),
|
|
226
|
+
("degrees", ctypes.c_double),
|
|
227
|
+
("relative_deviation", ctypes.c_double),
|
|
228
|
+
("interior_angle_degrees", ctypes.c_double),
|
|
229
|
+
("vertices", ctypes.POINTER(Index)),
|
|
230
|
+
("vertex_count", Count),
|
|
231
|
+
("edges", ctypes.POINTER(EdgeIndices)),
|
|
232
|
+
("edge_count", Count),
|
|
233
|
+
("uncontained", ctypes.POINTER(Index)),
|
|
234
|
+
("uncontained_count", Count),
|
|
235
|
+
]
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
class PixelGrid(ctypes.Structure):
|
|
239
|
+
"""DeformablePixelGrid."""
|
|
240
|
+
|
|
241
|
+
_fields_ = [
|
|
242
|
+
("width", ctypes.c_uint32),
|
|
243
|
+
("height", ctypes.c_uint32),
|
|
244
|
+
("pixels", ctypes.POINTER(Pixel)),
|
|
245
|
+
("pixel_count", Count),
|
|
246
|
+
]
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
class SplinterImageParameters(ctypes.Structure):
|
|
250
|
+
"""DeformableSplinterImageParameters."""
|
|
251
|
+
|
|
252
|
+
_fields_ = [("size", Vector3), ("origin", Vector3), ("allow_nonconvex", Boolean)]
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
class MaterialParameters(ctypes.Structure):
|
|
256
|
+
"""DeformableMaterialParameters."""
|
|
257
|
+
|
|
258
|
+
_fields_ = [
|
|
259
|
+
("youngs_modulus", ctypes.c_double),
|
|
260
|
+
("poissons_ratio", ctypes.c_double),
|
|
261
|
+
("density", ctypes.c_double),
|
|
262
|
+
("toughness", ctypes.c_double),
|
|
263
|
+
("youngs_damping", ctypes.c_double),
|
|
264
|
+
("yield_strain", ctypes.c_double),
|
|
265
|
+
("maximum_yield", ctypes.c_double),
|
|
266
|
+
("creep_fraction", ctypes.c_double),
|
|
267
|
+
("wake_up_radius", ctypes.c_double),
|
|
268
|
+
("friction", ctypes.c_double),
|
|
269
|
+
]
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
class TetrahedronMaterials(ctypes.Structure):
|
|
273
|
+
"""DeformableTetrahedronMaterials."""
|
|
274
|
+
|
|
275
|
+
_fields_ = [
|
|
276
|
+
("assignment", Enumeration),
|
|
277
|
+
("material", Index),
|
|
278
|
+
("materials", ctypes.POINTER(Index)),
|
|
279
|
+
("material_count", Count),
|
|
280
|
+
]
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
class ObjectOptions(ctypes.Structure):
|
|
284
|
+
"""DeformableObjectOptions."""
|
|
285
|
+
|
|
286
|
+
_fields_ = [("self_collision", Boolean), ("disabled", Boolean)]
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
class GlueParameters(ctypes.Structure):
|
|
290
|
+
"""DeformableGlueParameters."""
|
|
291
|
+
|
|
292
|
+
_fields_ = [("spring_constant", ctypes.c_double), ("damping_coefficient", ctypes.c_double)]
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
class Plane(ctypes.Structure):
|
|
296
|
+
"""DeformablePlane."""
|
|
297
|
+
|
|
298
|
+
_fields_ = [("normal", Vector3), ("offset", ctypes.c_double)]
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
class ConvexRegion(ctypes.Structure):
|
|
302
|
+
"""DeformableConvexRegion."""
|
|
303
|
+
|
|
304
|
+
_fields_ = [("planes", ctypes.POINTER(Plane)), ("plane_count", Count)]
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
class MaterialRegion(ctypes.Structure):
|
|
308
|
+
"""DeformableMaterialRegion."""
|
|
309
|
+
|
|
310
|
+
_fields_ = [("mesh", PolygonMeshView), ("to_mesh_space", AffineTransform)]
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
class DrivenVertex(ctypes.Structure):
|
|
314
|
+
"""DeformableDrivenVertex."""
|
|
315
|
+
|
|
316
|
+
_fields_ = [("vertex", Index), ("target", Vector3)]
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
class StepReport(ctypes.Structure):
|
|
320
|
+
"""DeformableStepReport."""
|
|
321
|
+
|
|
322
|
+
_fields_ = [("substeps_run", ctypes.c_uint32), ("outcome", Enumeration)]
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
class TetrahedronState(ctypes.Structure):
|
|
326
|
+
"""DeformableTetrahedronState."""
|
|
327
|
+
|
|
328
|
+
_fields_ = [
|
|
329
|
+
("corners", Vector3 * 4),
|
|
330
|
+
("island", ctypes.c_uint32),
|
|
331
|
+
("strain_measure", ctypes.c_double),
|
|
332
|
+
("flags", ctypes.c_uint32),
|
|
333
|
+
]
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
class FaceEvent(ctypes.Structure):
|
|
337
|
+
"""DeformableFaceEvent."""
|
|
338
|
+
|
|
339
|
+
_fields_ = [("tetrahedron", Index), ("exposed_faces", ctypes.c_uint8)]
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
class SimulationStatistics(ctypes.Structure):
|
|
343
|
+
"""DeformableSimulationStatistics."""
|
|
344
|
+
|
|
345
|
+
_fields_ = [
|
|
346
|
+
("systems", ctypes.c_uint64),
|
|
347
|
+
("conjugate_gradient_updates", ctypes.c_uint64),
|
|
348
|
+
("contacts", Count),
|
|
349
|
+
("islands", Count),
|
|
350
|
+
]
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
class PreparationParameters(ctypes.Structure):
|
|
354
|
+
"""DeformablePreparationParameters."""
|
|
355
|
+
|
|
356
|
+
_fields_ = [
|
|
357
|
+
("clip_mode", Enumeration),
|
|
358
|
+
("uv_scale", ctypes.c_double),
|
|
359
|
+
("splinter_cage", ctypes.POINTER(PolygonMeshView)),
|
|
360
|
+
]
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
class SkinningOptions(ctypes.Structure):
|
|
364
|
+
"""DeformableSkinningOptions."""
|
|
365
|
+
|
|
366
|
+
_fields_ = [("show_inner_faces", Boolean), ("start_splintered", Boolean)]
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
class SurfaceEmbeddingView(ctypes.Structure):
|
|
370
|
+
"""DeformableSurfaceEmbeddingView."""
|
|
371
|
+
|
|
372
|
+
_fields_ = [
|
|
373
|
+
("surface", SurfaceMeshView),
|
|
374
|
+
("corner_flags", ctypes.POINTER(ctypes.c_uint32)),
|
|
375
|
+
("corner_flag_count", Count),
|
|
376
|
+
("source_faces", ctypes.POINTER(ctypes.c_int32)),
|
|
377
|
+
("source_face_count", Count),
|
|
378
|
+
("vertex_tetrahedrons", ctypes.POINTER(Index)),
|
|
379
|
+
("vertex_tetrahedron_count", Count),
|
|
380
|
+
("vertex_weights", ctypes.POINTER(Weights)),
|
|
381
|
+
("vertex_weight_count", Count),
|
|
382
|
+
("normal_weights", ctypes.POINTER(Weights)),
|
|
383
|
+
("normal_weight_count", Count),
|
|
384
|
+
("brick_tetrahedrons", ctypes.POINTER(Index)),
|
|
385
|
+
("brick_tetrahedron_count", Count),
|
|
386
|
+
("vertex_cell_tetrahedrons", ctypes.POINTER(Index)),
|
|
387
|
+
("vertex_cell_tetrahedron_count", Count),
|
|
388
|
+
]
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
class DeformedSurfaceView(ctypes.Structure):
|
|
392
|
+
"""DeformableDeformedSurfaceView."""
|
|
393
|
+
|
|
394
|
+
_fields_ = [
|
|
395
|
+
("positions", ctypes.POINTER(FloatVector)),
|
|
396
|
+
("position_count", Count),
|
|
397
|
+
("normals", ctypes.POINTER(FloatVector)),
|
|
398
|
+
("normal_count", Count),
|
|
399
|
+
("hidden_faces", ctypes.POINTER(ctypes.c_uint8)),
|
|
400
|
+
("face_count", Count),
|
|
401
|
+
]
|