The Scatter API
Overview
- scatter
- scattervec
They contain the same functionality. The only differ in that scattervec takes a single vec (vector) instead of three floats for x,y,z.
API: scatter
arc(count, x, y, z, r, start=0.0, end=90.0, random=False)
Calculate the points along an circular arc.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count
|
int
|
The number of points to generate. |
required |
x
|
float
|
The start point. |
required |
y
|
float
|
The start point. |
required |
z
|
float
|
The start point. |
required |
r
|
float
|
The radius of the arc. |
required |
start
|
float
|
The angle to start at in degrees. Default is 0. |
0.0
|
end
|
float
|
The angle to end at in degrees default 360. Default is 90.0. |
90.0
|
random
|
bool
|
Should the points be randomly placed along the arc (True), or evenly spaced (False)? |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
points |
Generator
|
A generator of Vec3 |
box(count, x, y, z, x2, y2, z2, centered=False, ax=0, ay=0, az=0, degrees=True)
Calculate the points within a box.
If centered is True, x,y,z are the center of the box, and x2,y2,z2 are the width, height, and depth, respectively.
Otherwise, x,y,z are left, bottom, and front, respectively, while x2,y2,z2 are right, top, and back.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count
|
int
|
The number of points to generate |
required |
x
|
float
|
The start point/origin. If |
required |
y
|
float
|
The start point/origin. If |
required |
z
|
float
|
The start point/origin. If |
required |
x2
|
float
|
If |
required |
y2
|
float
|
If |
required |
z2
|
float
|
If |
required |
center
|
bool
|
When True, x,y,z are the center point. Default is False. |
required |
ax
|
float
|
Rotate the box around the x axis by this amount. |
0
|
ay
|
float
|
Rotate the box around the y axis by this amount. |
0
|
az
|
float
|
Rotate the box around the z axis by this amount. |
0
|
degrees
|
bool
|
True if the axis rotation values use degrees, False if they use radians. Default is True. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
points |
Generator
|
A generator of Vec3 |
box_fill(cw, ch, cd, x, y, z, w, h, d, random=False, ax=0, ay=0, az=0, degrees=True)
Calculate the points within a box. The box is subdivided to ideally avoid overlap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cw
|
int
|
The number of points to generate for each line width (x) |
required |
ch
|
int
|
The number of points to generate for each line height (y) |
required |
cd
|
int
|
The number of points to generate for each line width (z) |
required |
x
|
float
|
The start point/origin |
required |
y
|
float
|
The start point/origin |
required |
z
|
float
|
The start point/origin |
required |
w
|
float
|
The width |
required |
h
|
float
|
The height |
required |
d
|
float
|
The depth |
required |
random
|
bool
|
When True, points will be randomly placed. When False, points will be evenly placed. Default is True. |
False
|
ax
|
float
|
Rotate the box around the x axis by this amount. Default is 0. |
0
|
ay
|
float
|
Rotate the box around the y axis by this amount. Default is 0. |
0
|
az
|
float
|
Rotate the box around the z axis by this amount. Default is 0. |
0
|
degrees
|
bool
|
True if the axis rotation values use degrees, False if they use radians. Default is True. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
points |
Generator
|
A generator of Vec3 |
line(count, start_x, start_y, start_z, end_x, end_y, end_z, random=False)
Calculate the points along a line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count
|
int
|
The number of points to generate |
required |
start_x
|
float
|
The start point/origin |
required |
start_y
|
float
|
The start point/origin |
required |
start_z
|
float
|
The start point/origin |
required |
end_x
|
float
|
The end point/origin |
required |
end_y
|
float
|
The end point/origin |
required |
end_z
|
float
|
The end point/origin |
required |
random
|
bool
|
Should the points be placed randomly along the line? Default is False. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
points |
Generator
|
A generator of Vec3 |
rect_fill(cw, cd, x, y, z, w, d, random=False, ax=0, ay=0, az=0, degrees=True)
Calculate the points within a rect. This assumes it to be flat on the y axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cw
|
int
|
The number of points to generate for each line width (x) |
required |
cd
|
int
|
The number of points to generate for each line depth (z) |
required |
x
|
float
|
The start point |
required |
y
|
float
|
The start point |
required |
z
|
float
|
The start point |
required |
w
|
float
|
The width (x) |
required |
d
|
float
|
The depth (z) |
required |
random
|
bool
|
When True, points will be randomly placed. When False, points will be evenly placed. Default is True. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
points |
Generator
|
A generator of Vec3 |
ring(ca, cr, x, y, z, outer_r, inner_r=0, start=0.0, end=90.0, random=False)
Calculate the points on rings with each ring has same count.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ca
|
int
|
The number of points to generate on each ring |
required |
cr
|
int
|
The number of rings |
required |
x
|
float
|
The start point/origin |
required |
y
|
float
|
The start point/origin |
required |
z
|
float
|
The start point/origin |
required |
outer_r
|
float
|
The radius |
required |
inner_r
|
float
|
The inner radius. Default is 0. |
0
|
start
|
float
|
degrees start angle. Default is 0. |
0.0
|
end
|
float
|
degrees start angle. Default is 90.0. |
90.0
|
random
|
bool
|
When True, points will be randomly placed. When False, points will be evenly placed. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
points |
Generator
|
A generator of Vec3 |
ring_density(counts, x, y, z, outer_r, inner_r=0, start=0.0, end=90.0, random=False)
Calculate the points on rings with each ring specifying count in array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
counts
|
list[int]
|
The number of points to generate per ring. |
required |
x
|
float
|
The start point/origin |
required |
y
|
float
|
The start point/origin |
required |
z
|
float
|
The start point/origin |
required |
outer_r
|
float
|
The radius of the outer ring. |
required |
inner_r
|
float
|
The inner radius of the ring. Default is 0. |
0
|
start
|
float
|
Start angle, in degrees. |
0.0
|
end
|
float
|
Start angle, in degrees. |
90.0
|
random
|
bool
|
When true pointw will be randomly placed. When false points will be evenly placed. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
points |
Generator
|
A generator of Vec3 |
sphere(count, x, y, z, r, outer=0, top_only=False, ring=False)
Calculate the points within a sphere or ring.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count
|
int
|
The number of points to generate. |
required |
x
|
float
|
The start point/origin |
required |
y
|
float
|
The start point/origin |
required |
z
|
float
|
The start point/origin |
required |
r
|
float
|
The radius. If |
required |
outer
|
float
|
The outer radius of the ring or sphere. Default is 0. |
0
|
top_only
|
bool
|
Generate only the top hemisphere. Default is False. |
False
|
ring
|
bool
|
Generate a flat ring. Default is False. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
points |
Generator
|
A generator of Vec3 |
API: scattervec
arc(count, v, r, start=0.0, end=90.0, random=False)
Calculate the points along an circular arc.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count
|
int
|
The number of points to generate. |
required |
v
|
Vec3
|
The center point/origin |
required |
r
|
float
|
The radius of the arc. |
required |
start
|
float
|
The angle to start at in degrees. Default is 0. |
0.0
|
end
|
float
|
The angle to end at in degrees default 360. Default is 90.0. |
90.0
|
random
|
bool
|
Should the points be randomly placed along the arc (True), or evenly spaced (False)? |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
points |
Generator
|
A generator of Vec3 |
box(count, v1, v2, centered=False, a=None, degrees=True)
Calculate the points within a box.
If centered is True, v1 is the center of the box, and v2 contains the width, height, and depth, respectively.
Otherwise, v1 is the left, bottom, and front, while v2 is right, top, and back.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count
|
int
|
The number of points to generate |
required |
v1
|
Vec3
|
The start point/origin. If |
required |
v2
|
Vec3
|
The size of the box. If |
required |
center
|
bool
|
When True, x,y,z are the center point. Default is False. |
required |
a
|
Vec3
|
Rotate the box around the x axis by this amount. |
None
|
degrees
|
bool
|
True if the axis rotation value uses degrees, False if it uses radians. Default is True. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
points |
Generator
|
A generator of Vec3 |
box_fill(cw, ch, cd, v, w, h, d, random=False)
Calculate the points within a box. The box is subdivided to ideally avoid overlap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cw
|
int
|
The number of points to generate for each line width (x) |
required |
ch
|
int
|
The number of points to generate for each line height (y) |
required |
cd
|
int
|
The number of points to generate for each line width (z) |
required |
v
|
Vec3
|
The start point/origin |
required |
w
|
float
|
The width |
required |
h
|
float
|
The height |
required |
d
|
float
|
The depth |
required |
random
|
bool
|
When True, points will be randomly placed. When False, points will be evenly placed. Default is True. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
points |
Generator
|
A generator of Vec3 |
line(count, start, end, random=False)
Calculate the points along a line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count
|
int
|
The number of points to generate |
required |
start
|
Vec3
|
The start point/origin |
required |
end
|
Vec3
|
The end point/origin |
required |
random
|
bool
|
Should the points be placed randomly along the line? Default is False. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
points |
Generator
|
A generator of Vec3 |
rect_fill(cw, cd, v, w, d, random=False)
Calculate the points within a rect. This assumes it to be flat on the y axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cw
|
int
|
The number of points to generate for each line width (x) |
required |
cd
|
int
|
The number of points to generate for each line depth (z) |
required |
v
|
Vec3
|
The start point |
required |
w
|
float
|
The width (x) |
required |
d
|
float
|
The depth (z) |
required |
random
|
bool
|
When True, points will be randomly placed. When False, points will be evenly placed. Default is True. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
points |
Generator
|
A generator of Vec3 |
ring(ca, cr, v, outer_r, inner_r=0, start=0.0, end=90.0, random=False)
Calculate the points on rings with each ring has same count.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ca
|
int
|
The number of points to generate on each ring |
required |
cr
|
int
|
The number of rings |
required |
v
|
Vec3
|
The start point/origin |
required |
outer_r
|
float
|
The radius |
required |
inner_r
|
float
|
The radius inner. Default is 0. |
0
|
start
|
float
|
Degrees start angle. Default is 0. |
0.0
|
end
|
float
|
Degrees start angle. Default is 99.0. |
90.0
|
random
|
bool
|
When True, points will be randomly placed. When False, points will be evenly placed. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
points |
Generator
|
A generator of Vec3 |
ring_density(counts, v, outer_r, inner_r=0, start=0.0, end=90.0, random=False)
Calculate the points on rings with each ring specifying count in array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
counts
|
list[int]
|
The number of points to generate per ring. |
required |
v
|
Vec3
|
The start point/origin |
required |
outer_r
|
float
|
The radius of the outer ring. |
required |
inner_r
|
float
|
The inner radius of the ring. Default is 0. |
0
|
start
|
float
|
Start angle, in degrees. |
0.0
|
end
|
float
|
Start angle, in degrees. |
90.0
|
random
|
bool
|
When true pointw will be randomly placed. When false points will be evenly placed. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
points |
Generator
|
A generator of Vec3 |
sphere(count, v, r, outer=0, top_only=False, ring=False)
Calculate the points within a sphere or ring.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count
|
int
|
The number of points to generate. |
required |
v
|
Vec3
|
The start point/origin |
required |
r
|
float
|
The radius. If |
required |
outer
|
float
|
The outer radius of the ring or sphere. Default is 0. |
0
|
top_only
|
bool
|
Generate only the top hemisphere. Default is False. |
False
|
ring
|
bool
|
Generate a flat ring. Default is False. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
points |
Generator
|
A generator of Vec3 |