newton.solvers.style3d#
Style3D solver module.
This module provides helper functions for setting up Style3D cloth assets.
Use SolverStyle3D as the canonical public solver
import path.
Functions
- newton.solvers.style3d.add_cloth_grid(builder, *, pos, rot, vel, dim_x, dim_y, cell_x, cell_y, mass, reverse_winding=False, fix_left=False, fix_right=False, fix_top=False, fix_bottom=False, tri_aniso_ke=None, tri_ka=None, tri_kd=None, tri_drag=None, tri_lift=None, edge_aniso_ke=None, edge_kd=None, add_springs=False, spring_ke=None, spring_kd=None, particle_radius=None, custom_attributes_particles=None, custom_attributes_springs=None)#
Create a planar Style3D cloth grid.
Call
newton.solvers.SolverStyle3D.register_custom_attributes()before invoking this helper so the Style3D custom attributes are available on the builder. The grid usesmassper particle to compute panel density and then delegates tonewton.solvers.style3d.add_cloth_mesh().- Parameters:
builder (ModelBuilder) –
newton.ModelBuilderto populate.pos (Vec3) – World-space translation for the grid.
rot (Any) – World-space rotation for the grid.
vel (Vec3) – Initial velocity for all particles.
dim_x (int) – Number of grid cells along X (creates dim_x + 1 vertices).
dim_y (int) – Number of grid cells along Y (creates dim_y + 1 vertices).
cell_x (float) – Cell size along X in panel space.
cell_y (float) – Cell size along Y in panel space.
mass (float) – Mass per particle (used to compute density).
reverse_winding (bool) – If True, flip triangle winding.
fix_left (bool) – Fix particles on the left edge.
fix_right (bool) – Fix particles on the right edge.
fix_top (bool) – Fix particles on the top edge.
fix_bottom (bool) – Fix particles on the bottom edge.
tri_aniso_ke (Sequence[Vec3] | Vec3 | None) – Anisotropic stretch stiffness (weft, warp, shear).
tri_ka (float | None) – Triangle area stiffness.
tri_kd (float | None) – Triangle damping.
tri_drag (float | None) – Triangle drag coefficient.
tri_lift (float | None) – Triangle lift coefficient.
edge_aniso_ke (Sequence[Vec3] | Vec3 | None) – Anisotropic bending stiffness values.
edge_kd (float | None) – Edge damping.
add_springs (bool) – If True, add structural springs across mesh edges.
spring_ke (float | None) – Spring stiffness.
spring_kd (float | None) – Spring damping.
particle_radius (float | None) – Per-particle radius.
custom_attributes_particles (dict[str, Any] | None) – Extra custom attributes for particles.
custom_attributes_springs (dict[str, Any] | None) – Extra custom attributes for springs.
- newton.solvers.style3d.add_cloth_mesh(builder, *, pos, rot, vel, vertices, indices, density, scale=1.0, panel_verts=None, panel_indices=None, tri_aniso_ke=None, edge_aniso_ke=None, tri_ka=None, tri_kd=None, tri_drag=None, tri_lift=None, edge_kd=None, add_springs=False, spring_ke=None, spring_kd=None, particle_radius=None, custom_attributes_particles=None, custom_attributes_springs=None)#
Add a Style3D cloth mesh using
newton.ModelBuildercustom attributes.This helper uses
newton.ModelBuilder.add_particles(),newton.ModelBuilder.add_triangles(), andnewton.ModelBuilder.add_edges(). It computes panel-space rest data for anisotropic stretch and bending, then injects the Style3D custom attributes:style3d:tri_aniso_kestyle3d:edge_rest_areastyle3d:edge_bending_cotstyle3d:aniso_ke
It overwrites
newton.ModelBuilder.tri_posesandnewton.ModelBuilder.tri_areaswith panel rest data. Callnewton.solvers.SolverStyle3D.register_custom_attributes()before invoking this helper.- Parameters:
builder (ModelBuilder) –
newton.ModelBuilderto populate.pos (Vec3) – World-space translation for the mesh.
rot (Any) – World-space rotation for the mesh.
vel (Vec3) – Initial velocity for all particles.
vertices (Sequence[Vec3]) – 3D mesh vertices (list of positions).
indices (Sequence[int]) – Triangle indices (3 entries per face).
density (float) – Mass per unit area in panel space.
scale (float) – Uniform scale applied to
verticesandpanel_verts.panel_verts (Sequence[Vec2] | None) – 2D panel coordinates (UVs). Defaults to
verticesXY.panel_indices (Sequence[int] | None) – Triangle indices in panel space. Defaults to
indices.tri_aniso_ke (Sequence[Vec3] | Vec3 | None) – Anisotropic stretch stiffness (weft, warp, shear). Can be a single value or per-triangle list. Full lists are filtered to valid triangles after degenerates are removed.
edge_aniso_ke (Sequence[Vec3] | Vec3 | None) – Anisotropic bending stiffness values. Can be a single value or per-edge list (computed from mesh adjacency).
tri_ka (float | None) – Triangle area stiffness (defaults to
newton.ModelBuilder.default_tri_ka).tri_kd (float | None) – Triangle damping (defaults to
newton.ModelBuilder.default_tri_kd).tri_drag (float | None) – Triangle drag coefficient (defaults to
newton.ModelBuilder.default_tri_drag).tri_lift (float | None) – Triangle lift coefficient (defaults to
newton.ModelBuilder.default_tri_lift).edge_kd (float | None) – Edge damping (defaults to
newton.ModelBuilder.default_edge_kd).add_springs (bool) – If True, add structural springs across mesh edges.
spring_ke (float | None) – Spring stiffness (defaults to
newton.ModelBuilder.default_spring_ke).spring_kd (float | None) – Spring damping (defaults to
newton.ModelBuilder.default_spring_kd).particle_radius (float | None) – Per-particle radius (defaults to
newton.ModelBuilder.default_particle_radius).custom_attributes_particles (dict[str, Any] | None) – Extra custom attributes for particles.
custom_attributes_springs (dict[str, Any] | None) – Extra custom attributes for springs.