Imprudence:Build Math Expressions

From Kokua Wiki
Jump to: navigation, search
Type an expression into a number input field and press the Enter key to evaluate it.

Build Math Expressions are a feature available beginning in Imprudence 1.1.0, developed by Aimee Trescothick. They allow builders to perform simple math operations within the number input fields in the Build floater's Object and Texture tabs.

To use a build math expression, type in the expression into an input field and press Enter. The expression will be evaluated, and the result used for the new value of that field.


Available Variables, Constants, and Operators

Note: Variable, constant, and function names are case-insensitive. I.e. "PX", "px", "pX", and "Px" are all valid and mean the same thing.



  • PX, PY, PZ: X, Y, and Z Position
  • SX, SY, SZ: X, Y, and Z Size
  • RX, RY, RZ: X, Y, and Z Rotation
  • CB, CE: Path Cut Begin and End
  • HLW: Hollow
  • SKW: Skew
  • PB, PE: Profile Cut (aka Slice, Dimple) Begin and End
  • TB, TE: Twist Begin and End
  • SHX, SHY: X and Y Shear
  • HLX, HLY: X and Y Hole Size
  • TPX, TPY: X and Y Taper
  • ROF: Radius Offset
  • REV: Revolutions


  • TSU, TSV: U and V Texture Repeats per face
  • TOU, TOV: U and V Texture Offset
  • TRNS: Transparency
  • TROT: Texture rotation
  • GLOW: Glow


  • PI: π (3.14159...)
  • TWO_PI: 2π (6.28319...)
  • PI_BY_TWO: π/2 (1.57080...)
  • SQRT2: Square root of 2 (1.41421...)
  • DEG_TO_RAD: π/180 (0.01745...)
  • RAD_TO_DEG: 180/π (57.29578...)
  • GRAVITY: -9.8


  • +: Addition
  • -: Subtraction
  • *: Multiplication
  • /: Division
  • ( ): Grouping

New Operators in 1.3

In Imprudence 1.3.0 and later, you can use the following mathematical functions in build expressions:

  • SIN(theta): Sine
  • ASIN(theta): Arcsine (inverse sine)
  • COS(theta): Cosine
  • ACOS(theta): Arccosine (inverse cosine)
  • TAN(theta): Tangent
  • ATAN(theta): Arctangent (inverse tangent)
  • ATAN2(y,x): Atan2
  • SQRT(x): Square root
  • LOG(x): Natural logarithm (logx)
  • EXP(x): Natural exponent (ℯx)
  • ABS(x): Absolute value
  • MIN(a,b): Minimum (smaller) of the two values
  • MAX(a,b): Maximum (greater) of the two values


Input Field Expression Result
Z Rotation 90 / 4 Z Rotation changes to 22.50°
X Position PX + 20 X Position increases by 20m
X Size SZ - 0.2 X Size changes to the current Z Size minus 0.2m
Twist End (TB - 45) * 2 Twist End changes to the current Twist Begin, minus 45°, then all multiplied by 2.
Glow TRANS * 0.5 Glow changes to half of the current Transparency.
Texture Rotation -RX Texture Rotation changes to the opposite of the object's X Rotation
Profile Cut Begin px / (1000 + pi * -hlw) Left as an exercise for the reader!