Math Functions¶
Complete reference for mathematical functions available in Nodo expressions.
Basic Math¶
abs¶
Returns the absolute value of x.Examples:
sqrt¶
Returns the square root of x.Examples:
pow¶
Returns base raised to the power of exponent.Examples:
exp¶
Returns e^x (Euler's number raised to x).Examples:
log¶
Examples:
Rounding¶
floor¶
Rounds down to nearest integer.Examples:
ceil¶
Rounds up to nearest integer.Examples:
round¶
Rounds to nearest integer.Examples:
trunc¶
Removes decimal part (rounds toward zero).Examples:
Min/Max¶
min¶
Returns the smallest value.Examples:
max¶
Returns the largest value.Examples:
clamp¶
Constrains value between min and max.Examples:
Trigonometry (Degrees)¶
All trigonometric functions use degrees, not radians.
sin¶
Sine function.Examples:
cos¶
Cosine function.Examples:
tan¶
Tangent function.Examples:
asin¶
Arc sine (inverse sine), returns degrees.Examples:
acos¶
Arc cosine (inverse cosine), returns degrees.Examples:
atan¶
Arc tangent (inverse tangent), returns degrees.Examples:
atan2¶
Two-argument arc tangent (handles quadrants correctly).Examples:
Interpolation¶
lerp¶
Linear interpolation from a to b by factor t (0 to 1).Examples:
smoothstep¶
Smooth hermite interpolation (ease in/out).Examples:
Returns 0 if x ≤ edge0, 1 if x ≥ edge1, smooth interpolation between.
Modulo & Sign¶
mod / %¶
Modulo (remainder after division).Examples:
sign¶
Returns sign of x: -1, 0, or 1.Examples:
Utility Functions¶
fract¶
Returns fractional part of x (x - floor(x)).Examples:
fmod¶
Floating-point remainder.Examples:
Constants¶
PI¶
Pi constant (3.14159265359...).Examples:
E¶
Euler's number (2.71828...).Examples:
Type Conversion¶
int¶
Converts to integer (truncates decimals).Examples:
float¶
Converts to floating-point number.Examples:
bool¶
Converts to boolean (0 = false, non-zero = true).Examples:
str¶
Converts to string.Examples:
Vector Functions¶
length¶
Returns magnitude of vector.Examples:
normalize¶
Returns unit vector (length = 1).Examples:
dot¶
Dot product of two vectors.Examples:
cross¶
Cross product of two vectors.Examples:
distance¶
Distance between two points.Examples:
Practical Examples¶
Circular Arrangement¶
# Position on circle
x = cos($index * 360 / $count) * $radius
z = sin($index * 360 / $count) * $radius
Damped Oscillation¶
# Sine wave with decay
amplitude = exp(-$index / 10) * $base_amp
offset = sin($index * 36) * amplitude
Responsive Scaling¶
# Scale based on input range
normalized = ($value - $min) / ($max - $min)
scaled = $out_min + normalized * ($out_max - $out_min)
Grid Snapping¶
# Snap to nearest grid point
snapped_x = round($x / $grid_size) * $grid_size
snapped_y = round($y / $grid_size) * $grid_size
Falloff¶
# Distance-based falloff
distance_ratio = distance($point, $center) / $max_distance
falloff = 1.0 - clamp(distance_ratio, 0, 1)
smooth_falloff = smoothstep(0, 1, falloff)
Alternating Pattern¶
See Also¶
- Expression Syntax - Language reference
- Channel References - Referencing parameters
- Graph Parameters - Creating reusable parameters
Pro Tip: Combine functions for complex effects: