Documentation ¶
Overview ¶
Package particled implements a new image type that stores each (original) pixel with constant colour at variable location. This enables colour-physics systems to be implemented on top.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GravityCalculation ¶
func GravityCalculation(pix kdtree.Point, pixs *kdtree.KDTree, timestep float64, options map[string]any)
GravityCalculation performs the simple gravity equation to one pixicle. The options parameter contains the keys ..., which map to values ...:
- "likeness" : func(i,j int) float64 : returns likeness between two colourIndexes.
- "..."
Types ¶
type Calculation ¶
type Calculation func(pix kdtree.Point, pixs *kdtree.KDTree, timestep float64, options map[string]any)
Calculation is a type alias for a function which calculates the new position and velocity of pix, based on pixs, timestep and options
type Particled ¶
type Particled struct { // Particles is a pointer to a slice of all pixicles Pixicles *kdtree.KDTree // Palette holds the used colourpalette for this image Palette color.Palette // Calc is a function that calculates the new position and // velocity of a pixicle, given the set of all pixicles in the image Calc Calculation Options map[string]any Timestep float64 // contains filtered or unexported fields }
Particled is a type of image that stores pixels at variable locations. Each pixel is represented as a Pixicle.
func FromPaletted ¶
func FromPaletted(paletted *image.Paletted, Calc Calculation, timestep float64, options map[string]any) *Particled
FromPaletted creates a particled image from a paletted image
func (*Particled) ColorModel ¶
ColorModel returns the Image's color model.
func (*Particled) Iterate ¶
func (p *Particled) Iterate()
Iterate runs through one timestep of the physics loop.
func (Particled) Simulate ¶
Simulate creates a slice of paletted frames using the particled starting point
func (*Particled) ToPaletted ¶
ToPaletted converts the Particled image back to a Paletted image.
type Pixicle ¶
type Pixicle struct { // Colour, contains the index of some palette Colour int // Velocity is the 2d speed that the particle currently has Velocity geom.Vec // Mass is the constant movement inertia value of this Pixicle. Mass float64 // Position stores the high-accuracy location of the Pixicle. Position geom.Vec // contains filtered or unexported fields }
Pixicle is a Pixel Particle It has a constant colour, constant mass, and variable speed. The colour is stored as an index of some color.palette
func (*Pixicle) Dimensions ¶
Dimensions returns the amount of Dimensions for this pixicle