Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
Italiano Italiano
Français français
Deutsch Deutsch

Home
- POV-Ray Tutorial

  Coordinate Systems
  and 2D Functions

  - Squared Paper
  - Coordinate Systems
      with Axes
  - Macro for Grids
      with 2 Levels
  - 2D Functions
      Samples
  > Math Functions
      in POV-Ray
                                           

Mathematical Functions in POV-Ray

Attention:
Write "X" (capital letter!), not "x", also "Y" instead of "y" and "Z" instead of "z"

The many lowercase letters are reserved keywords in POV-Ray:
   x = <1,0,0;>, y = <0,1,0;>, z = <0,0,1;> !!!!
Write "X*X" for "x2", and "(X-2)*(X-2)*(X-2)" for "(x-2)3".


List of Mathematical Functions in POV-Ray:            
abs(X) = absolute value of X.
pow(X,Y) = exponentiation: X raised to the power Y
sqrt(X) = square root of X
 
int(X) = integer part of X
mod(X,Y)   = X modulo Y =((X/Y)-int(X/Y))*Y
div(X,Y) = integer part of (X/Y)
max(X,Y,...) = maximum of two or more float values
min(X,Y,...) = minimum of two or more float values
ceil(A) smallest integer value above A
floor(A) biggest integer value below A
select(A, B, C) If (A < 0) = B, if (A >= 0) = C.
select(A, B, C ,D)
      If (A < 0) = B, if (A = 0) = C, and if (A > 0) = D.
 
degrees(X) = converts radians to degrees.
radians(X) = converts degrees to radians = X*pi/180.0.
 
(In the following: all arguments X are in radians!)
sin(X) = sine of X
cos(X) = cosine of X
tan(X) = tangent of X
 
(In the following: the results are angles in radians!)
asin(X) = arc-sine of X
acos(X) = arc-cosine of X
atan2(X,Y) = arc-tangent of (X/Y)
 
sinh(X) = hyperbolic sine of X
cosh(X) = hyperbolic cosine of X
tanh(X) = hyperbolic tangent of X
 
asinh(X) = invers hyperbolic sine of X
acosh(X) = inverse hyperbolic cosine of X
atanh(X) = invers hyperbolic tangent of X
 
exp(X) = exponential of X.
log(X) = logarithm of X
ln(X)  = natural logarithm of X  
With the standard include file 'math.inc'
(we have to include this by ' #include"math.inc" !)
among others there are available these other functions:
The trigonometric functions with the arguments in degrees:
sind(X)
cosd(X)
tand(X)

asind(X)
acosd(X)
atand(X)
atan2d(X,Y) = atan( X/Y )

sgn(X) = -1 if (X < 0), +1 if (X >= 0)
Examples

mathematical functions
Download scene file for POV-Ray: fun01.pov.

 
mathematical functions
Download scene file for POV-Ray: fun02.pov.

 
mathematical functions
Download scene file for POV-Ray: fun03.pov.

 
mathematical functions
Download scene file for POV-Ray: fun04.pov.

 
top

© Friedrich A. Lohmüller, 2011
www.f-lohmueller.de