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
|
Visualization of Mathematical Functions in Coordinate Systems
Plotting of mathematical functions with POV-Ray
Objects: "plane, cylinder, cone, sphere"
Methods: "color_map, layered textures, #macro, #while"
|
For the visualization of mathematical functions we take the squared plane as a background
with 2d axes.
For getting a quadratic field of view we have to use a resolution like
[600x600, No AA, mosaic]
width="600"
height="60" 0
Antialias=Off
+SP16
+B1024
in our quickres.ini file for POV-Ray.
Alternativly we can add the line +h600 +w600
to the commandline of our POV-Ray Editor.
For plotting a funktion like "f(x) = 0.5*x + 3" we use small spheres
added together by a while loop:
union{
#declare X = -5.5; // start X
#declare EndX = 5.5; // end X
#while ( X < EndX )
sphere{ <0,0,0>,0.025
pigment{ color rgb<1,0.65,0>}
translate< X,0.5*X+3, 0>}
#declare X = X + 0.002; // next Nr
#end // --------------- end of loop
} // end of union
//------------------------------------ end |
Attention: Write "X" (capital letter!), not "x".
( The lowercase letter "x" is a reserved keyword abbreviation
for the vector "<1,0,0;>" ! )
POV-Ray version 3.1, 3.5, 3.6:
Write "X*X" for "x2",
or "(X-2)*(X-2)*(X-2)" for "(x-2)3".
If we want to plott a function with terms in which a division by zero error
meight occur, we can prevent the loop from this error by
an #if statement, although this is not necessary because POV-Ray
is able to recognize a denominator with zero value.
Sample:
union{
#declare X = -5.5; // start X
#declare EndX = 5.5; // end X
#while ( X < EndX )
#if ( (X - 2 != 0) )
sphere{ <0,0,0>,0.025
pigment{ color rgb<1,0.65,0> }
translate< X, 1/4*3/(X-2)-3, 0>}
#end
#declare X = X + 0.001; // next Nr
#end // --------------- end of loop
} // end of union
//--------------------------------------- end |
|
Samples of mathematical functions
Download scenery file for POV-Ray here:
Sample 1: povfun1.pov,
Sample 2: povfun2.pov,
Sample 3: povfun3.pov,
Sample 4: povfun4.pov,
Sample 5: povfun5.pov,
Sample 6: povfun6.pov.
For additional samples see section "math functions"
of my "Insert Menu Add-on"..
List of the mathematical functions in POV-Ray.
|
Mathematical functions Samples
|
|