Skip to main content

Functions

Forest Effects provide access to a comprehensive list of Functions to provide many common mathematical expressions plus additional operations that are unique to Forest Pack. You'll find the full list including syntax, description and parameters in the list below. This information can also be accessed directly inside the Effects Editor .

Forest Functions

fpSurfaceHitZ

Syntax

fpSurfaceHitZ(p)

Description

Computes the projection of p onto the Forest surface (XY mode only). Returns z value

Parameters

P

Returns

Real


fpSurfaceHit

Syntax

fpSurfaceHit(p)

Description

Check if the projection of p hits onto the Forest surface (XY mode only). Returns 1 or 0.

Parameters

P

Returns

Vector


fpSurfaceHitNormal

Syntax

fpSurfaceHitNormal(p)

Description

Computes the projection of p onto the Forest surface (XY mode only). Returns normal vector

Parameters

P

Returns

Real


fpRandomGeom

Syntax

fpRandomGeom()

Description

Returns a random ID from the Geometry List. Can be assigned to fpItem.geomID

Parameters

none

Returns

Integer


Custom Functions

evaluateTexture

Syntax

evaluateTexture(texmap, uvw)

Description

Evaluate a Texture Map Parameter, using specified uvw coordinates (vector). Return value as vector

Parameters

Texmap, UVW

Returns

Vector


evaluateCurve

Syntax

evaluateCurve(curve, x)

Description

Returns Y value for the Curve Parameter on X position

Parameters

Curve, X

Returns

Real


insideSpline

Syntax

insideSpline(spline, pos)

Description

Returns 1 if specified position is inside the Spline, 0 if not. It works in 2D, using XY plane

Parameters

Spline, Position

Returns

Integer


distanceSpline

Syntax

distanceSpline(spline, pos)

Description

Returns nearest distance in 2D from position to the spline. It works in 2D, using XY plane

Parameters

Spline, Position

Returns

Real


nearestPosSpline

Syntax

nearestPosSpline(spline, pos)

Description

Returns nearest point from position to the spline. It works in 2D, using XY plane

Parameters

Spline, Position

Returns

Vector


nearestTangSpline

Syntax

nearestTangSpline(spline, pos)

Description

Returns tangent of nearest point from position to the spline. It works in 2D, using XY plane

Parameters

Spline, Position

Returns

Vector


Standard Functions

ln

Syntax

ln(p)

Description

Natural (base e) logarithm

Parameters

p

Returns

Real


log

Syntax

log(p)

Description

Common (base 10) logarithm

Parameters

p

Returns

Real


exp

Syntax

exp(p)

Description

Exponential function – exp(e) = e^p

Parameters

p

Returns

Real


pow

Syntax

pow(p,q)

Description

p to the power of q – p^q

Parameters

p

q

Returns

Real


sqrt

Syntax

sqrt(p)

Description

square root

Parameters

p

Returns

Real


abs

Syntax

abs(p)

Description

absolute value

Parameters

p

Returns

Real


min

Syntax

min(p, q)

Description

minimum: returns p or q depending on which is smaller

Parameters

p

Returns

Real


max

Syntax

max(p, q)

Description

maximum: returns p or q depending on which is larger

Parameters

p

Returns

Real


mod

Syntax

mod(p, q)

Description

remainder of p divided by q

Parameters

p

Returns

Real


ceil

Syntax

ceil(p)

Description

smallest integer greater than or equal to p

Parameters

p

Returns

Integer


floor

Syntax

floor(p)

Description

largest integer less than or equal to p

Parameters

p

Returns

Integer


round

Syntax

round(p)

Description

value of p rounded to the nearest integral

Parameters

p

Returns

Integer


trunc

Syntax

trunc(p)

Description

nearest integral not larger in magnitude than p

Parameters

p

Returns

Integer


Conditional Functions

if

Syntax

if(p,q,r)

Description

Conditional: if p is nonzero then returns q, otherwise r

Parameters

p

q

r

Returns

Any


Interpolation Functions

easeIn

Syntax

easeIn(x,x1,x2,y1,y2)

Description

Returns an ease-in interpolation between y1 and y2. Returns y1 when x < x1

Parameters

x

x1

x2

y1

y2

Returns

Real


easeOut

Syntax

easeOut(x,x1,x2,y1,y2)

Description

Returns an ease-out interpolation between y1 and y2. Returns y2 when x > x2

Parameters

x

x1

x2

y1

y2

Returns

Real


easeInOut

Syntax

easeInOut(x,x1,x2,y1,y2)

Description

Returns an ease-in-out interpolation between y1 and y2. Returns y1 when x < x1 and y2 when x > x2

Parameters

x

x1

x2

y1

y2

Returns

Real


Trigonometric Functions

sin

Syntax

sin(p)

Description

Sine of p (p expressed in radians)

Parameters

p

Returns

Real


cos

Syntax

cos(p)

Description

Cosine of p (p expressed in radians)

Parameters

p

Returns

Real


tan

Syntax

tan(p)

Description

Tangent of p (p expressed in radians)

Parameters

p

Returns

Real


asin

Syntax

asin(p)

Description

Arc sine of p (p expressed in radians)

Parameters

p

Returns

Real


acos

Syntax

acos(p)

Description

Arc cosine of p (p expressed in radians)

Parameters

p

Returns

Real


atan

Syntax

atan(p)

Description

Arc tangent of p (p expressed in radians)

Parameters

p

Returns

Real


atan2

Syntax

atan2(x,y)

Description

Returns the principal value of the arc tangent of y/x, expressed in radians

Parameters

x

y

Returns

Real


sinh

Syntax

sinh(p)

Description

Hyperbolic sine of p (p expressed in radians)

Parameters

p

Returns

Real


cosh

Syntax

cosh(p)

Description

Hyperbolic cosine of p (p expressed in radians)

Parameters

p

Returns

Real


tanh

Syntax

tanh(p)

Description

Hyperbolic tangent of p (p expressed in radians)

Parameters

p

Returns

Real


radToDeg

Syntax

radToDeg(p)

Description

Takes p in radians and returns the same angle in degrees

Parameters

p

Returns

Real


degToRad

Syntax

degToRad(p)

Description

Takes p in degrees and returns the same angle in radians

Parameters

p

Returns

Real


Vector Functions

length

Syntax

length(v)

Description

The length of v.

Parameters

v

Returns

Real


unit

Syntax

unit(v)

Description

Returns a unit vector in the same direction as v

Parameters

v

Returns

Vector


comp

Syntax

comp(v,i)

Description

I-th component, where i=0, 1, or 2. comp(5,6,7,1) = 6

Parameters

v

i

Returns

Real


dotprod

Syntax

dotprod(u,v)

Description

Dot product of vectors u and v. Same result can be obtained using u * v

Parameters

u

v

Returns

Vector


crossprod

Syntax

crossprod(u,v)

Description

Cross product of vectors u and v. Same result can be obtained using u ^ v

Parameters

u

v

Returns

Vector


Random Functions

randomReal

Syntax

randomReal(a,b)

Description

Returns a real random number in the range (a,b)

Parameters

a

b

Returns

Real


randomInt

Syntax

randomInt(a,b)

Description

Returns an integer random number in the range a,b

Parameters

a

b

Returns

Integer