For the captions of objects and the output of results
we use the built-in text object of POV-Ray.
1. Otuput of ASCII signs and text:
Sample: Caption of a point P with the letter "P"
text { ttf "ARIAL.TTF", "P",0.1,0
scale 0.5 rotate<20,-45,0>
translate P+< 0.2,0.3,0>
pigment{color Red } no_shadow }
2. Otuput of numerical values:
The value of a variable A as a string we get by the
function str( A, L, P).
Here A is the variable, followed by the number of digits to be shown.
der Zahl der anzuzeigenden Gesamtstellen der Zahl an
(If the number has less the L digits: If L is positiv it will be filled
up by spaces,
if L negativ it will be filled up with leading zeros),
P is the number of decimal places behind the point to be rounded.
Sample: Otuput of the length of a vector PQ
text{ ttf "ARIAL.TTF"
str(vlength( Q-P),5,4) , 0.1, 0
scale 0.35 rotate<20,-40,0>
translate P+< 0.4,0.3,0>
pigment{color rgb <1.0,0.0,0.25>} no_shadow }
2. Otuput of numbers and text:
For concatenating of two or more strings S1, S2 etc. to a new string
we use the function concat(S1,S2,...) .
If i.e. V= 3.5; so we get by concat(""|V| = ",str(A,4,2) the expression
"|V| = 3.50".
Sample: Otuput of the legth of a vector PQ with
the text "|PQ| ="
text{ ttf "ARIAL.TTF"
concat( "|PQ| = ",
str(vlength( Q-P),3,4)
), 0.1, 0
scale 0.35 rotate<20,-40,0>
translate M_PQ+< 0.4,0.0,0>
pigment{color rgb <1.0,0.0,0.25>} no_shadow }
3. Otuput of vectors:
Here we use the function vstr(N,V,S,L,P).
This converts a vector V to a formated string.
The parameter S is the sign used for separating the numbers,
N is the dimension (2 to 5) of the vector V. L and P are used like in str(A).
Sample: Coordinates of the middle M_PQ of PQ
#declare M_PQ = (P + Q)/2;
text{ ttf "ARIAL.TTF"
concat( "M(PQ) = (", vstr(3,(P+Q)/2,"/",0,1),")"
), 0.1, 0
scale 0.35 rotate<20,-40,0>
translate M_PQ+< 0.2,0.4,0>
texture { color <0.5,0.0,1.0>} no_shadow }
Some command which are useful specially for calculations:
vlength (V) the length of a vector,
vdot (V1, V2) the dot product of two vectors,
vcross (V1, V2) the cross product of two vectors,
VAngleD (V1, V2) the angle between two vectors in degrees,
or pi as a predefined constant value.
See also:
"Overview by Table" and
"Vector Analyis with POV-Ray"
|
Captions of objects and the output of results.
Click here for a complete description of this scene for POV-Ray:
".txt" file or
".pov" file
Captions of objects and the output of results.
Click here for a complete description of this scene for POV-Ray:
".txt" file or
".pov" file
|