Body
- class tissue_forge.models.vertex.solver.Body
The mesh body is a volume-enclosing object of mesh surfaces.
The mesh body consists of at least four mesh surfaces.
The mesh body can have a state vector, which represents a uniform amount of substance enclosed in the volume of the body.
- property id: int
- property actors
Object actors
- property surfaces
Surfaces that define the body
- property vertices
Vertices that define the body
- property connected_bodies
bodies in contact
- property adjacent_bodies
adjacent bodies
- property density
density of the body
- property centroid
centroid of the body
- property velocity
velocity of the body
- property area
area of the body
- property volume
volume of the body
- property mass
mass of the body
- property body_forces
body forces bound to the body
- property surface_area_constraints
surface area constraints bound to the body
- property volume_constraints
volume constraints bound to the body
- static create(*args) TissueForge::models::vertex::BodyHandle
Overload 1: Construct a body from a set of surfaces
Overload 2: Construct a body from a mesh
- definedBy(*args) bool
- destroy() HRESULT
- validate() bool
- position_changed() HRESULT
- toString() std::string
Get a JSON string representation
- update_internals() void
Update all internal data and parents
- replace(toInsert: _vertex_solver_Surface, toRemove: _vertex_solver_Surface) HRESULT
Replace a surface with a surface
- type() TissueForge::models::vertex::BodyType *
Get the body type
- become(btype: _vertex_solver_BodyType) HRESULT
Become a different type
- Parameters:
btype (
BodyType
) – the type to become
- find_vertex(dir: fVector3) TissueForge::models::vertex::Vertex *
Find a vertex that defines this body
- Parameters:
dir (
FVector3
) – direction to look with respect to the centroid
- find_surface(dir: fVector3) TissueForge::models::vertex::Surface *
Find a surface that defines this body
- Parameters:
dir (
FVector3
) – direction to look with respect to the centroid
- neighbor_surfaces(s: _vertex_solver_Surface) std::vector< TissueForge::models::vertex::Surface *,std::allocator< TissueForge::models::vertex::Surface * > >
Get the neighboring surfaces of a surface on this body.
Two surfaces are a neighbor on this body if they define the body and share a vertex
- Parameters:
s (
Surface
) – a surface of the body
- get_vertex_area(v: _vertex_solver_Vertex) FloatP_t
Get the surface area contribution of a vertex to this body
- Parameters:
v (
Vertex
) – a vertex
- get_vertex_volume(v: _vertex_solver_Vertex) FloatP_t
Get the volume contribution of a vertex to this body
- Parameters:
v (
Vertex
) – a vertex
- get_vertex_mass(v: _vertex_solver_Vertex) FloatP_t
Get the mass contribution of a vertex to this body
- Parameters:
v (
Vertex
) – a vertex
- find_interface(b: _vertex_solver_Body) std::vector< TissueForge::models::vertex::Surface *,std::allocator< TissueForge::models::vertex::Surface * > >
Get the surfaces that define the interface between this body and another body
- Parameters:
b (
Body
) – a body
- contact_area(other: _vertex_solver_Body) FloatP_t
Get the contacting surface area of this body with another body
- Parameters:
other (
Body
) – a body
Get the vertices that define both this body and another body
- Parameters:
other (
Body
) – a body
- is_outside(pos: fVector3) bool
Test whether a point is outside. Test is performed using the nearest surface
- Parameters:
pos (
FVector3
) – position- Return type:
boolean
- Returns:
true if the point is outside
- split(cp_pos: fVector3, cp_norm: fVector3, stype: _vertex_solver_SurfaceType = None) TissueForge::models::vertex::Body *
Split into two bodies. The split is defined by a cut plane
- Parameters:
cp_pos (
FVector3
) – position on the cut planecp_norm (
FVector3
) – cut plane normalstype (
SurfaceType
) – type of newly created surface. taken from connected surfaces if not specified
- classmethod destroy_c(b)
Destroy a body.
Any resulting surfaces without a body are also destroyed.
- Parameters:
b – body to destroy or its handle
- __str__() str
Return str(self).
- __lt__(rhs) bool
Return self<value.
- __gt__(rhs) bool
Return self>value.
- __le__(rhs) bool
Return self<=value.
- __ge__(rhs) bool
Return self>=value.
- __eq__(rhs) bool
Return self==value.
- __ne__(rhs) bool
Return self!=value.
- class tissue_forge.models.vertex.solver.BodyHandle(_id: int const & = -1)
A handle to a
Body
.The engine allocates
Body
memory in blocks, andBody
values get moved around all the time, so their addresses change.This is a safe way to work with a
Body
.- property id
- property surfaces
surfaces that define the body
- property vertices
vertices that define the body
- property connected_bodies
bodies in contact
- property adjacent_bodies
adjacent bodies
- property density
density of the body
- property centroid
centroid of the body
- property velocity
velocity of the body
- property area
area of the body
- property volume
volume of the body
- property mass
mass of the body
- property body_forces
body forces bound to the body
- property surface_area_constraints
surface area constraints bound to the body
- property volume_constraints
volume constraints bound to the body
- definedBy(*args) bool
Overload 1:
Test whether defined by a vertex
- Parameters:
v (
VertexHandle
) – a vertex- Return type:
boolean
- Returns:
true if defined by a vertex
Overload 2:
Test whether defined by a surface
- Parameters:
s (
SurfaceHandle
) – a surface- Return type:
boolean
- Returns:
true if defined by a surface
- destroy() HRESULT
Destroy the body.
- validate() bool
Validate the body
- position_changed() HRESULT
Update internal data due to a change in position
- toString() std::string
Get a JSON string representation
- static fromString(s: std::string const &) TissueForge::models::vertex::BodyHandle
Create an instance from a JSON string representation
- Parameters:
s (string) – a JSON string
- add(s: _vertex_solver_SurfaceHandle) HRESULT
Add a surface
- Parameters:
s (
SurfaceHandle
) – a surface
- remove(s: _vertex_solver_SurfaceHandle) HRESULT
Remove a surface
- Parameters:
s (
SurfaceHandle
) – a surface
- replace(toInsert: _vertex_solver_SurfaceHandle, toRemove: _vertex_solver_SurfaceHandle) HRESULT
Replace a surface with a surface
- Parameters:
toInsert (
SurfaceHandle
) – surface to inserttoRemove (
SurfaceHandle
) – surface to remove
- type() TissueForge::models::vertex::BodyType *
Get the body type
- become(btype: _vertex_solver_BodyType) HRESULT
Become a different type
- Parameters:
btype (
BodyType
) – the type to become
- find_vertex(dir: fVector3) TissueForge::models::vertex::VertexHandle
Find a vertex that defines this body
- Parameters:
dir (
FVector3
) – direction to look with respect to the centroid
- find_surface(dir: fVector3) TissueForge::models::vertex::SurfaceHandle
Find a surface that defines this body
- Parameters:
dir (
FVector3
) – direction to look with respect to the centroid
- neighbor_surfaces(s: _vertex_solver_SurfaceHandle) std::vector< TissueForge::models::vertex::SurfaceHandle,std::allocator< TissueForge::models::vertex::SurfaceHandle > >
Get the neighboring surfaces of a surface on this body.
Two surfaces are a neighbor on this body if they define the body and share a vertex
- Parameters:
s (
SurfaceHandle
) – a surface of the body
- get_vertex_area(v: _vertex_solver_VertexHandle) FloatP_t
Get the surface area contribution of a vertex to this body
- Parameters:
v (
VertexHandle
) – a vertex
- get_vertex_volume(v: _vertex_solver_VertexHandle) FloatP_t
Get the volume contribution of a vertex to this body
- Parameters:
v (
VertexHandle
) – a vertex
- get_vertex_mass(v: _vertex_solver_VertexHandle) FloatP_t
Get the mass contribution of a vertex to this body
- Parameters:
v (
VertexHandle
) – a vertex
- find_interface(b: _vertex_solver_BodyHandle) std::vector< TissueForge::models::vertex::SurfaceHandle,std::allocator< TissueForge::models::vertex::SurfaceHandle > >
Get the surfaces that define the interface between this body and another body
- Parameters:
b (
BodyHandle
) – a body
- contact_area(other: _vertex_solver_BodyHandle) FloatP_t
Get the contacting surface area of this body with another body
- Parameters:
other (
BodyHandle
) – a body
Get the vertices that define both this body and another body
- Parameters:
other (
BodyHandle
) – a body
- is_outside(pos: fVector3) bool
Test whether a point is outside. Test is performed using the nearest surface
- Parameters:
pos (
FVector3
) – position- Return type:
boolean
- Returns:
true if the point is outside
- split(cp_pos: fVector3, cp_norm: fVector3, stype: _vertex_solver_SurfaceType = None) TissueForge::models::vertex::BodyHandle
Split into two bodies. The split is defined by a cut plane
- Parameters:
cp_pos (
FVector3
) – position on the cut planecp_norm (
FVector3
) – cut plane normalstype (
SurfaceType
) – type of newly created surface. taken from connected surfaces if not specified
- __str__() str
Return str(self).
- __lt__(rhs) bool
Return self<value.
- __gt__(rhs) bool
Return self>value.
- __le__(rhs) bool
Return self<=value.
- __ge__(rhs) bool
Return self>=value.
- __eq__(rhs) bool
Return self==value.
- __ne__(rhs) bool
Return self!=value.
- class tissue_forge.models.vertex.solver.BodyTypeSpec
Interface for class-centric design of BodyType
- density: float | None = None
Mass density
- surface_area_lam: float | None = None
Surface area constraint Lagrange multiplier
- surface_area_val: float | None = None
Surface area constraint target value
- volume_lam: float | None = None
Volume constraint Lagrange multiplier
- volume_val: float | None = None
Volume constraint target value
- adhesion: Dict[str, float] | None = None
Adhesion by name and parameter
- classmethod get() _vertex_solver_BodyType
Get the engine type that corresponds to this class.
The type is automatically registered as necessary.
- Returns:
registered type instance
- classmethod body_force() _vertex_solver_BodyForce | None
body force actor generator according to specs, if any
- classmethod surface_area_constaint() _vertex_solver_SurfaceAreaConstraint | None
surface area constaint actor generator according to specs, if any
- classmethod volume_constraint() _vertex_solver_VolumeConstraint | None
volume constraint actor generator according to specs, if any
- static bind_adhesion(specs: List[Type]) Dict[str, Dict[str, _vertex_solver_Adhesion]]
Bind adhesion to all registered types according to all passed specifications
- class tissue_forge.models.vertex.solver.BodyType(MeshObjType)
Mesh body type
Can be used as a factory to create mesh body instances with processes and properties that correspond to the type.
- property name
Name of this body type
- property registered: bool
Tests whether this type is registered
- property density
Mass density
- property instances
List of instances that belong to this type
- property instance_ids
List of instance ids that belong to this type
- property num_instances: int
Number of instances that belong to this type
- property body_forces
body forces bound to the type
- property surface_area_constraints
surface area constraints bound to the type
- property volume_constraints
volume constraints bound to the type
- toString() std::string
Get a JSON string representation
- static fromString(str: std::string const &) TissueForge::models::vertex::BodyType *
Create from a JSON string representation.
The returned type is automatically registered with the solver.
- Parameters:
str (string) – a string, as returned by
toString
- static find_from_name(_name: std::string const &) TissueForge::models::vertex::BodyType *
Get a registered type by name
- register_type() HRESULT
Registers a type with the engine.
Note that this occurs automatically, unless noReg==true in constructor.
- get() TissueForge::models::vertex::BodyType *
Get the type engine instance
- add(i: _vertex_solver_BodyHandle) HRESULT
Add an instance
- Parameters:
i (
BodyHandle
) – instance
- remove(i: _vertex_solver_BodyHandle) HRESULT
Remove an instance
- Parameters:
i (
BodyHandle
) – instance
- __call__(*args) TissueForge::models::vertex::BodyHandle
Overload 1:
Construct a body of this type from a set of surfaces
Overload 2:
Construct a body of this type from a mesh
- extend(base: _vertex_solver_SurfaceHandle, pos: fVector3) TissueForge::models::vertex::BodyHandle
Create a body from a surface in the mesh and a position
- Parameters:
base (
SurfaceHandle
) – surfacepos (
FVector3
) – position
- extrude(base: _vertex_solver_SurfaceHandle, normLen: FloatP_t const &) TissueForge::models::vertex::BodyHandle
Create a body from a surface in a mesh by extruding along the outward-facing normal of the surface
todo: add support for extruding at an angle
- Parameters:
base (
SurfaceHandle
) – surfacenormLen (float) – length along which to extrude
- __str__() str
Return str(self).
- __lt__(rhs) bool
Return self<value.
- __gt__(rhs) bool
Return self>value.
- __le__(rhs) bool
Return self<=value.
- __ge__(rhs) bool
Return self>=value.
- __eq__(rhs) bool
Return self==value.
- __ne__(rhs) bool
Return self!=value.
- __len__() int
- __getitem__(index: int)
- __contains__(item)