Methods
# static circlesToBuffers(circles) → {Float32Array}
Converts an array of circles to a WebGPU-compatible buffer Packs circle properties into a single Float32Array in the format: [density, offsetX, offsetY, radius, density, offsetX, offsetY, radius, ...]
Parameters:
Name | Type | Description |
---|---|---|
circles |
Array.<Circle>
|
Array of circles to convert |
Packed buffer data for WebGPU
Float32Array
Example
const circles = [{ density: 0.5, offset: [1, 2], radius: 0.3 }];
const buffer = CircleHelper.circlesToBuffers(circles);
// buffer = Float32Array([0.5, 1, 2, 0.3])
# static createRandomCircles(numCircle, maxX, maxY, sampleropt) → {Array.<Circle>}
Creates an array of random circles within specified bounds
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
numCircle |
number
|
Number of circles to create |
||
maxX |
number
|
Maximum X coordinate |
||
maxY |
number
|
Maximum Y coordinate |
||
sampler |
function
|
<optional> |
Math.random | Random number generator function |
Array of randomly generated circles
Array.<Circle>