No functions match your search.

Attribute Functions

addpointattrib(geohandle, name, defval)

Adds a point attribute.

Returns: int (1 on success)
addpointattrib(0, "myattr", 0.0);
addprimattrib(geohandle, name, defval)

Adds a primitive attribute.

Returns: int (1 on success)
addprimattrib(0, "name", "");
addvertexattrib(geohandle, name, defval)

Adds a vertex attribute.

Returns: int (1 on success)
addvertexattrib(0, "uv", {0,0,0});
adddetailattrib(geohandle, name, defval)

Adds a detail attribute.

Returns: int (1 on success)
adddetailattrib(0, "total", 0);
point(geohandle, attribname, ptnum)

Reads a point attribute value.

Returns: attribute value
vector pos = point(0, "P", 10);
prim(geohandle, attribname, primnum)

Reads a primitive attribute value.

Returns: attribute value
string name = prim(0, "name", @primnum);
vertex(geohandle, attribname, linearidx)

Reads a vertex attribute value.

Returns: attribute value
vector uv = vertex(0, "uv", @vtxnum);
detail(geohandle, attribname, detailnum)

Reads a detail attribute value.

Returns: attribute value
int count = detail(0, "count", 0);
setpointattrib(geohandle, name, ptnum, value, mode)

Sets a point attribute value.

Returns: int (1 on success)
setpointattrib(0, "Cd", @ptnum, {1,0,0}, "set");
setprimattrib(geohandle, name, primnum, value, mode)

Sets a primitive attribute value.

Returns: int (1 on success)
setprimattrib(0, "name", @primnum, "piece_0", "set");
setvertexattrib(geohandle, name, primnum, vtxnum, value, mode)

Sets a vertex attribute value.

Returns: int (1 on success)
setvertexattrib(0, "uv", 0, 0, {0.5, 0.5, 0}, "set");
setdetailattrib(geohandle, name, value, mode)

Sets a detail attribute value.

Returns: int (1 on success)
setdetailattrib(0, "total", @numpt, "set");
attribsize(geohandle, attribclass, attribname)

Returns the size/component count of an attribute.

Returns: int
int sz = attribsize(0, "point", "P");
attribtype(geohandle, attribclass, attribname)

Returns the type of an attribute (0=int, 1=float, 2=string).

Returns: int
int tp = attribtype(0, "point", "Cd");
hasattrib(geohandle, attribclass, attribname)

Checks if an attribute exists.

Returns: int (0 or 1)
if(hasattrib(0, "point", "Cd")) { ... }

Geometry Functions

addpoint(geohandle, pos_or_ptnum)

Creates a new point.

Returns: int (new point number)
int pt = addpoint(0, {0, 1, 0});
addprim(geohandle, type, pt0, pt1, ...)

Creates a new primitive.

Returns: int (new prim number)
int pr = addprim(0, "poly", pt0, pt1, pt2);
addvertex(geohandle, primnum, ptnum)

Adds a vertex to a primitive.

Returns: int (vertex number)
addvertex(0, pr, pt);
removepoint(geohandle, ptnum, andprims)

Removes a point.

Returns: void
removepoint(0, @ptnum);
removeprim(geohandle, primnum, andpoints)

Removes a primitive.

Returns: void
removeprim(0, @primnum, 1);
npoints(geohandle)

Returns total number of points.

Returns: int
int n = npoints(0);
nprimitives(geohandle)

Returns total number of primitives.

Returns: int
int n = nprimitives(0);
nvertices(geohandle)

Returns total number of vertices.

Returns: int
int n = nvertices(0);
primpoints(geohandle, primnum)

Returns array of point numbers belonging to a primitive.

Returns: int[]
int pts[] = primpoints(0, @primnum);
pointprims(geohandle, ptnum)

Returns array of prim numbers connected to a point.

Returns: int[]
int prs[] = pointprims(0, @ptnum);
pointvertex(geohandle, ptnum)

Returns the first linear vertex index of a point.

Returns: int
int vtx = pointvertex(0, @ptnum);
vertexprim(geohandle, linearidx)

Returns the prim number of a vertex.

Returns: int
int pr = vertexprim(0, @vtxnum);
neighbours(geohandle, ptnum)

Returns array of connected neighbor point numbers.

Returns: int[]
int nbrs[] = neighbours(0, @ptnum);
neighbourcount(geohandle, ptnum)

Returns the number of connected neighbors.

Returns: int
int nc = neighbourcount(0, @ptnum);

Math Functions

abs(val)

Returns the absolute value.

Returns: float / int
float a = abs(-3.5);
ceil(val)

Rounds up to nearest integer.

Returns: float
float c = ceil(2.3); // 3.0
floor(val)

Rounds down to nearest integer.

Returns: float
float f = floor(2.7); // 2.0
round(val)

Rounds to nearest integer.

Returns: float
float r = round(2.5); // 3.0
rint(val)

Rounds to nearest integer.

Returns: int
int r = rint(2.5);
clamp(val, min, max)

Clamps value between min and max.

Returns: float
float c = clamp(val, 0.0, 1.0);
fit(val, omin, omax, nmin, nmax)

Remaps value from one range to another.

Returns: float
float f = fit(@P.y, -1, 1, 0, 1);
fit01(val, nmin, nmax)

Remaps value from 0–1 to new range.

Returns: float
float f = fit01(val, -1, 1);
fit10(val, nmin, nmax)

Remaps value from 1–0 to new range.

Returns: float
float f = fit10(val, 0, 10);
fit11(val, nmin, nmax)

Remaps value from -1..1 to new range.

Returns: float
float f = fit11(val, 0, 1);
min(a, b)

Returns the minimum of two values.

Returns: float / int
float m = min(a, b);
max(a, b)

Returns the maximum of two values.

Returns: float / int
float m = max(a, b);
pow(base, exp)

Returns base raised to the power of exp.

Returns: float
float p = pow(2.0, 3.0); // 8.0
sqrt(val)

Returns the square root.

Returns: float
float s = sqrt(16.0); // 4.0
log(val)

Returns the natural logarithm.

Returns: float
float l = log(2.718); // ~1.0
exp(val)

Returns e raised to the power val.

Returns: float
float e = exp(1.0); // ~2.718
radians(degrees)

Converts degrees to radians.

Returns: float
float r = radians(180.0); // PI
degrees(radians)

Converts radians to degrees.

Returns: float
float d = degrees(M_PI); // 180.0
sin(angle)

Returns the sine of angle in radians.

Returns: float
float s = sin(M_PI / 2); // 1.0
cos(angle)

Returns the cosine of angle in radians.

Returns: float
float c = cos(0); // 1.0
tan(angle)

Returns the tangent of angle in radians.

Returns: float
float t = tan(M_PI / 4); // 1.0
asin(val)

Returns the arcsine in radians.

Returns: float
float a = asin(1.0); // PI/2
acos(val)

Returns the arccosine in radians.

Returns: float
float a = acos(0.0); // PI/2
atan(val)

Returns the arctangent in radians.

Returns: float
float a = atan(1.0); // PI/4
atan2(y, x)

Returns the two-argument arctangent.

Returns: float
float a = atan2(1.0, 1.0); // PI/4

Vector Functions

cross(a, b)

Returns the cross product of two vectors.

Returns: vector
vector c = cross({1,0,0}, {0,1,0}); // {0,0,1}
dot(a, b)

Returns the dot product of two vectors.

Returns: float
float d = dot(@N, {0,1,0});
length(v)

Returns the magnitude of a vector.

Returns: float
float len = length(@P);
distance(a, b)

Returns the distance between two points.

Returns: float
float d = distance(@P, {0,0,0});
normalize(v)

Returns a unit vector in the same direction.

Returns: vector
vector n = normalize(@P);
lerp(a, b, t)

Linearly interpolates between a and b.

Returns: vector / float
vector mid = lerp(posA, posB, 0.5);
slerp(a, b, t)

Spherically interpolates between quaternions.

Returns: vector4
vector4 q = slerp(q1, q2, 0.5);
set(x, y, z)

Creates a vector from components.

Returns: vector
vector v = set(1, 2, 3);
reflect(dir, normal)

Reflects direction vector around normal.

Returns: vector
vector r = reflect(dir, @N);
refract(dir, normal, ior)

Refracts direction through surface.

Returns: vector
vector r = refract(dir, @N, 1.5);

Noise Functions

noise(pos)

Returns Perlin noise at position.

Returns: float / vector
float n = noise(@P * 5.0);
onoise(pos)

Returns original Perlin noise (range -1 to 1).

Returns: float / vector
float n = onoise(@P * 3.0);
snoise(pos)

Returns simplex noise.

Returns: float / vector
float n = snoise(@P * 4.0);
anoise(pos)

Returns anti-aliased noise.

Returns: float / vector
float n = anoise(@P * 2.0);
curlnoise(pos)

Returns curl of 3D noise (divergence-free).

Returns: vector
vector c = curlnoise(@P);
curlnoise2d(pos)

Returns 2D curl noise.

Returns: vector
vector c = curlnoise2d(@P);
rand(seed)

Returns pseudo-random value 0–1.

Returns: float / vector
float r = rand(@ptnum);
random(seed)

Returns random value (alternative to rand).

Returns: float
float r = random(@ptnum);
random_shash(string)

Returns random value from string hash.

Returns: float
float r = random_shash("seed_string");

String Functions

printf(format, ...)

Prints formatted string to console.

Returns: void
printf("Point %d: %g\n", @ptnum, @P.y);
sprintf(format, ...)

Returns a formatted string.

Returns: string
string s = sprintf("piece_%04d", @ptnum);
split(str, sep)

Splits string by separator.

Returns: string[]
string parts[] = split("a,b,c", ",");
join(arr, sep)

Joins string array with separator.

Returns: string
string s = join(parts, "_");
len(str_or_array)

Returns length of string or array.

Returns: int
int n = len("hello"); // 5
find(str, substr)

Finds first occurrence of substring.

Returns: int (-1 if not found)
int pos = find("hello", "ll");
replace(str, old, new)

Replaces all occurrences.

Returns: string
string s = replace("hello", "l", "r");
itoa(int_val)

Converts integer to string.

Returns: string
string s = itoa(42);
atoi(str)

Converts string to integer.

Returns: int
int n = atoi("42");
atof(str)

Converts string to float.

Returns: float
float f = atof("3.14");
startswith(str, prefix)

Checks if string starts with prefix.

Returns: int
if(startswith(s@name, "piece")) { ... }
endswith(str, suffix)

Checks if string ends with suffix.

Returns: int
if(endswith(s@name, ".bgeo")) { ... }
match(pattern, str)

Wildcard pattern matching.

Returns: int
if(match("piece_*", s@name)) { ... }

Matrix Functions

ident()

Returns an identity matrix.

Returns: matrix3 / matrix
matrix3 m = ident();
invert(m)

Returns the inverse of a matrix.

Returns: matrix
matrix mi = invert(m);
transpose(m)

Returns the transpose of a matrix.

Returns: matrix
matrix mt = transpose(m);
determinant(m)

Returns the determinant of a matrix.

Returns: float
float d = determinant(m);
maketransform(tx_order, rot_order, t, r, s)

Creates a transform matrix.

Returns: matrix
matrix m = maketransform(0, 0, {0,1,0}, {0,45,0}, {1,1,1});
cracktransform(tx_order, rot_order, component, pivot, m)

Extracts component from matrix.

Returns: vector
vector t = cracktransform(0, 0, 0, {0,0,0}, m);
optransform(objpath)

Returns the world transform of an object.

Returns: matrix
matrix m = optransform("/obj/geo1");
rotate(m, angle, axis)

Rotates a matrix around an axis.

Returns: void (modifies m)
rotate(m, radians(45), {0,1,0});
scale(m, s)

Scales a matrix.

Returns: void (modifies m)
scale(m, {2,2,2});
translate(m, t)

Translates a matrix.

Returns: void (modifies m)
translate(m, {1,0,0});

Point Cloud Functions

pcopen(geohandle, channel, pos, radius, maxpts)

Opens a point cloud for iteration.

Returns: int (handle)
int handle = pcopen(0, "P", @P, 1.0, 10);
pcfind(geohandle, channel, pos, radius, maxpts)

Finds nearby points, returns array.

Returns: int[]
int pts[] = pcfind(0, "P", @P, 0.5, 20);
pcfind_radius(geohandle, Pchannel, radchannel, pos, radius, maxpts)

Finds points with per-point radii.

Returns: int[]
int pts[] = pcfind_radius(0, "P", "pscale", @P, 1.0, 10);
pciterate(handle)

Advances to next point in cloud.

Returns: int (success)
while(pciterate(handle)) { pcimport(...); }
pcimport(handle, attribname, value)

Imports attribute from current cloud point.

Returns: int
pcimport(handle, "P", pos);
pcclose(handle)

Closes a point cloud handle.

Returns: void
pcclose(handle);
nearpoint(geohandle, pos)

Finds the closest point.

Returns: int
int pt = nearpoint(0, @P);
nearpoints(geohandle, pos, maxdist, maxpts)

Finds nearby points sorted by distance.

Returns: int[]
int pts[] = nearpoints(0, @P, 0.5, 10);

Group Functions

setpointgroup(geohandle, name, ptnum, value, mode)

Adds/removes point from group.

Returns: void
setpointgroup(0, "selected", @ptnum, 1, "set");
setprimgroup(geohandle, name, primnum, value, mode)

Adds/removes prim from group.

Returns: void
setprimgroup(0, "top", @primnum, 1, "set");
setvertexgroup(geohandle, name, primnum, vtxnum, value, mode)

Adds/removes vertex from group.

Returns: void
setvertexgroup(0, "border", @primnum, 0, 1, "set");
inpointgroup(geohandle, name, ptnum)

Checks if point is in group.

Returns: int
if(inpointgroup(0, "selected", @ptnum)) { ... }
inprimgroup(geohandle, name, primnum)

Checks if prim is in group.

Returns: int
if(inprimgroup(0, "top", @primnum)) { ... }
expandpointgroup(geohandle, name)

Returns all point numbers in group.

Returns: int[]
int pts[] = expandpointgroup(0, "selected");
expandprimgroup(geohandle, name)

Returns all prim numbers in group.

Returns: int[]
int prs[] = expandprimgroup(0, "top");
npointsgroup(geohandle, name)

Returns number of points in group.

Returns: int
int n = npointsgroup(0, "selected");
nprimitivesgroup(geohandle, name)

Returns number of prims in group.

Returns: int
int n = nprimitivesgroup(0, "top");

Channel / UI Functions

ch(name)

Reads a float channel parameter.

Returns: float
float val = ch("scale");
chf(name)

Reads a float channel (explicit).

Returns: float
float f = chf("amplitude");
chi(name)

Reads an integer channel.

Returns: int
int i = chi("divisions");
chs(name)

Reads a string channel.

Returns: string
string s = chs("filepath");
chv(name)

Reads a vector channel.

Returns: vector
vector v = chv("offset");
chramp(name, pos)

Evaluates a ramp parameter at position.

Returns: float / vector
float r = chramp("falloff", @curveu);

Geometry Query Functions

getbbox(geohandle, min, max)

Gets bounding box min and max.

Returns: void
vector mn, mx; getbbox(0, mn, mx);
getbbox_min(geohandle)

Returns bounding box minimum corner.

Returns: vector
vector mn = getbbox_min(0);
getbbox_max(geohandle)

Returns bounding box maximum corner.

Returns: vector
vector mx = getbbox_max(0);
getpointbbox(geohandle, min, max)

Gets point bounding box.

Returns: void
vector mn, mx; getpointbbox(0, mn, mx);
relpointbbox(geohandle, pos)

Returns normalized position within bounding box (0–1).

Returns: vector
vector rel = relpointbbox(0, @P);
xyzdist(geohandle, pos, primnum, primuv)

Finds closest distance to geometry surface.

Returns: float
float d = xyzdist(1, @P, prim, uv);
primuv(geohandle, attrib, primnum, uv)

Interpolates attribute at parametric UV on prim.

Returns: varies
vector p = primuv(1, "P", prim, uv);
surfacedist(geohandle, startgroup, attrib, ...)

Computes geodesic distance along surface.

Returns: float
float d = surfacedist(0, "startpts", "dist", "edge");
intersect(geohandle, rayorig, raydir, pos, uvw)

Casts a ray and finds intersection.

Returns: int (primnum, -1 if miss)
int hit = intersect(0, orig, dir, hitpos, hituvw);
sample_hemisphere(u1, u2, normal)

Samples a direction on a hemisphere.

Returns: vector
vector dir = sample_hemisphere(rand(@ptnum), rand(@ptnum+1), @N);

Quaternion Functions

quaternion(angle, axis)

Creates quaternion from angle/axis.

Returns: vector4
vector4 q = quaternion(radians(90), {0,1,0});
qrotate(quat, vec)

Rotates vector by quaternion.

Returns: vector
vector r = qrotate(q, {1,0,0});
qmultiply(q1, q2)

Multiplies two quaternions.

Returns: vector4
vector4 q = qmultiply(q1, q2);
qinvert(q)

Returns the inverse quaternion.

Returns: vector4
vector4 qi = qinvert(q);
eulertoquaternion(angles, order)

Converts euler angles to quaternion.

Returns: vector4
vector4 q = eulertoquaternion({0,45,0}, 0);
quaterniontoeuler(q, order)

Converts quaternion to euler angles.

Returns: vector
vector e = quaterniontoeuler(q, 0);
slerp(q1, q2, bias)

Spherical interpolation between quaternions.

Returns: vector4
vector4 q = slerp(q1, q2, 0.5);