Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmueller
Deutsch Deutsch

Home
back to overview
- POV-Ray Tutorials

  - Analytical Geometry
    with POV-Ray
    - Index -
  - Insert Menu Add-on
    & Download
 
  - Basics
    Possibilities and Needs

    Points & Lines
    - Points in 3D
    - Line Sections, Straight,
      Vectors, Distance Markers
    - Surfaces & Planes
   > Output of Results,
      Captions
    - Points of Intersection
    - Circles
    Solids
    - Tetrahedron
    - Parallelepiped
    - Round Solids
    -
  - Overview by Table
      on "analytical_g.inc"
  - Vector Analysis
      with POV-Ray
  - Righthanded & Lefthanded
    Systems of Coordinates
    and the Cross Product

  - Samples from
    Analytical Geometry
    - Parallelogram of the
        Middles of the Edges
    - Trace Points of a Straight Line
    - Calculations about a Triangle
    - Area of a Parallelogram
        and Cross Product
    - Shadow of a Pyramid
    - Hit a plane || yz-plane
    - Angle of triangle & yz-plane
                                       

Analytical Geometry with POV-Ray

The Captions of Objects     and the Output of Results

For the captions of objects and the output of results we use the built-in text object of POV-Ray.

1. Output 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. Output of numerical values:
The value of a variable A as a string we get by the string function str( A, L, P).
Here A is the variable, followed by the number of digits to be shown. (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:
Output 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. Output 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:
Output 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. Output 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 commands, which are very 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
top

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