PBDTetEntity#

class genesis.engine.entities.pbd_entity.PBDTetEntity(scene, solver, material, morph, surface, particle_size, idx, particle_start, edge_start, vvert_start, vface_start)[source]#

Bases: ParticleEntity

PBD entity represented by tetrahedral elements.

Parameters:
  • scene (Scene) – The simulation scene this entity is part of.

  • solver (Solver) – The PBD solver instance managing this entity.

  • material (Material) – Material model defining physical properties such as density and compliance.

  • morph (Morph) – Morph object specifying shape and initial transform (position and rotation).

  • surface (Surface) – Surface or texture representation.

  • particle_size (float) – Target size for particle spacing.

  • idx (int) – Unique index of this entity within the scene.

  • particle_start (int) – Starting index of this entity’s particles in the global particle buffer.

  • edge_start (int) – Starting index of this entity’s edges in the global edge buffer.

  • vvert_start (int) – Starting index of this entity’s visual vertices.

  • vface_start (int) – Starting index of this entity’s visual faces.

sample()[source]#

Sample and preprocess the mesh for the PBD tetrahedral entity.

Applies transformation from the morph, stores mesh vertices and faces, and performs remeshing based on the particle size.

process_input(in_backward=False)[source]#

Push position, velocity, and activation target states into the simulator.

Parameters:

in_backward (bool, default=False) – Whether the simulation is in the backward (gradient) pass.

find_closest_particle(pos, b=0)[source]#

Find the index of the particle closest to a given position.

Parameters:
  • pos (array-like) – The target position to compare against.

  • b (int, optional) – The environment index, by default 0.

Returns:

closest_idx – The index of the closest particle.

Return type:

int

fix_particle(particle_idx, i_b)[source]#

Fix a particle’s position in the simulation.

Parameters:
  • particle_idx (int) – Index of the particle relative to this entity.

  • i_b (int) – Environment index.

Return type:

None

set_particle_position(particle_idx, pos)[source]#

Set the position of a specific particle.

Parameters:
  • particle_idx (int) – Index of the particle relative to this entity.

  • pos (array-like) – Target position to assign.

Return type:

None

set_particle_velocity(particle_idx, vel)[source]#

Set the velocity of a specific particle.

Parameters:
  • particle_idx (int) – Index of the particle relative to this entity.

  • vel (array-like) – Target velocity to assign.

Return type:

None

release_particle(particle_idx)[source]#

Release a fixed particle, allowing it to move freely.

Parameters:

particle_idx (int) – Index of the particle relative to this entity.

Return type:

None

property mesh#

Mesh.

property edges#

Edge array of the mesh.

property n_edges#

Number of edges in the mesh.