Colliders
FluxRender.physics.ImageCollider
ImageCollider(image_path: str, center: Sequence[float] = (0.0, 0.0), x_scale: float | None = None, y_scale: float | None = None)
Bases: Collider
A solid collider generated from an external RGBA image file.
It uses the image's alpha channel to define solid obstacle boundaries within the fluid simulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_path
|
str
|
The local file path to the image (e.g., a transparent PNG). Pixels with over 50% opacity are converted into impenetrable concrete blocks in the LBM grid. |
required |
center
|
Sequence[float]
|
The (x, y) spatial coordinates in world space where the exact center of the image will be anchored. |
(0.0, 0.0)
|
x_scale
|
float
|
The exact physical width the image should occupy in world space.
If omitted, it scales proportionally based on the provided |
None
|
y_scale
|
float
|
The exact physical height the image should occupy in world space.
If omitted, it scales proportionally based on the provided |
None
|
Example
Importing a car profile as a solid wind tunnel obstacle:
Source code in FluxRender/physics.py
FluxRender.physics.EquationCollider
EquationCollider(equation_function: Callable[[float, float], bool], color: Sequence[float] = (1.0, 1.0, 1.0, 1.0))
Bases: Collider
A solid collider defined by a mathematical inequality.
It evaluates spatial coordinates (x, y) to generate solid boundaries for the fluid simulation based on the provided boolean function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
equation_function
|
Callable
|
A mathematical function taking |
required |
color
|
Sequence[float]
|
The RGBA color used to render the solid mask overlay on the visual screen. |
(1.0, 1.0, 1.0, 1.0)
|
Example
Creating a simple circular pillar and a solid floor boundary:
import FluxRender as fr
# A solid circular pillar centered at (0, 0) with a radius of 1.5
pillar = fr.EquationCollider(
equation_function=lambda x, y: (x**2 + y**2) <= 1.5**2,
)
Creating a flower shape using a polar equation: