Documentation ¶
Overview ¶
Package stam simulates dye in a 2-D incompressible fluid
as presented by Joe Stam in Real-Time Fluid Dynamics for Games in 2003 https://www.josstam.com/_files/ugd/cf1fd6_9989229efbd34a26ba5ccd913721a2ac.pdf
see "begin stam" comment below for code transliterated from the paper
Index ¶
- type Fluid
- func (fluid Fluid) AddDensity(i, j, n int, d float64)
- func (fluid Fluid) AddVelocity(i, j, n int, u, v float64)
- func (fluid Fluid) Density(i, j int) float64
- func (fl *Fluid) Level(min float64)
- func (fl Fluid) Max() (max float64)
- func (fl Fluid) Min() (min float64)
- func (fl *Fluid) Step()
- func (fluid Fluid) Velocity(i, j int) (u, v float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fluid ¶
Fluid is a fluid model
func NewFluid ¶
func NewFluid(gridSize int, visc, diff, dt float64, factory func(size int) ifc.Gridder) (fluid Fluid)
NewFluid creates a fluid model, given:
gridSize: width and height of grid in terms of cells note: a boundary layer wraps around the grid so that it ranges from 0,0 to size+1,size+1 visc: viscocity of fluid diff: diffusivity of dye in fluid dt: change in time per step factory: funcion returning an implementation of the Gridder interface
func (Fluid) AddDensity ¶
AddDensity adds dye to a square of cells
func (Fluid) AddVelocity ¶
AddVelocity adds velocity to a square of cells
Click to show internal directories.
Click to hide internal directories.