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

Overview by Table
about the most important commands for a quick orientation

Definition of the points:
Following vectors are predefined in POV-Ray:
  o = <0,0,0>,(center of the world)
  x = <1,0,0>, y = <0,1,0>, z = <0,0,1>
Define variables for our own point and vectors, i.e.:
  P1 = < 2, 1.5, -3>;
  V1 = < -3, 1.25, 1>;
In sample file "a_geo_00.pov" predefined is:
Rp = 0.105 = radius of the points,
Rl = 0.055 = radius of the lines
and also the basic colors here.
Representation of objects:
(Most of here used macros are defined   in my include file analytical_g.inc
Alternativly: download analytical_g.txt and save it with the name "analytical_g.inc"  .)
Textures of the template scene file "a_geo_00.pov"
or template scene file "a_geo_00.txt"

Punkt P1: .......................   sphere{ P1, Rp pigment{ color Red } }
 
Unambiguous marking of positions:
  1) Wire_box-Method :  object{ Wire_Box( o, P,Rl/2,0) pigment{ color Yellow }},
  2) Suporting cylinder in y direction:     object{ Show_Y_( P, Rl/2) pigment{ color Yellow } }.
  3) Suporting cylinder in y direction with projections of xz components:     object{ Show_Yxz( P, Rl/2) pigment{ color Yellow } }.

Line section P1P2: ..............   cylinder{ P1, P2, Rl pigment{ color Green}}
Straight line P1P2: ................  cylinder{ P1–10*(P2-P1), P2+10*(P2-P1), Rl pigment{ color Green}}
Vector P1P2: ..................  object{ Vector (P1, P2, Rl) pigment{ color Green}}
Distance marker P1P2:   object{ Distance_Marker(P1, P2, Rl) pigment{ color Green}}

Triangle P1P2P3: ..............   triangle { P1, P2, P3 pigment{ color Yellow transmit 0.5 }
  Normal vector on triangle P1P2P3: .........   object{ Triangle_Normal (P1, P2, P3) pigment{ color Yellow }
  Mass center of a triangle P1P2P3:   object{ Triangle_Mass_Center (P1, P2, P3) pigment{ color Yellow }
  Area of a triangle P1P2P3: ...........   Triangle_Area ( P1, P2, P3 )
  Circumference of a triangle P1P2P3: .........   Triangle_Circum ( P1, P2, P3 )
Plane
  by Parameters: .....   object{ Plane_Dir( Start, Dir1, Dir2, Start, End ) pigment{ color Green}}
  by Normal Representation, N=<A,B,C>, D: .....    object{ Plane_Nor( Normal, D, Start, End) pigment{ color Green}}
  Normal Representation, with N and a point P: ...   object{ Plane_NoP( Normal, P, Start, End) pigment{ color Green}}

Point of intersection of straght line and plane
  Line by i.e. start point and direction #declare P = <x1,x2,x3> #declare Dir = <d1,d2,d3>
  Plane declared as an object: #declare Plane = ...; s.o.
  #declare Point_of_intersection = trace ( Plane, A, Dir )
With normal vector in the point of intersection - name predeclared by: #declare Normal = <0,0,0>
  #declare Point_of_intersection = trace ( Plane, A, Dir, Normal)

Circle (M,r) around axis:
  Circle line: ...............   object{ Circle_Line ( Center, Radius, Rl, Axis) pigment{ color Yellow }}
  Circle area .............   object{ Circle_Disc ( Center, Radius, Axis) pigment{ color Yellow transmit 0.5 }}
Circum circle of a triangle P1P2P3:
  Circle line: ...............   object{ Circle_Line_out( P1, P2, P3, Rl) pigment{ color Yellow }}
  Circle area .............   object{ Circle_Disc_out( P1, P2, P3 ) pigment{ color Yellow transmit 0.5 }}
  Circumcircle center.   object{ Triangle_M_out( P1, P2, P3 ) pigment{ color Green }}
  Circumcircle radius .........   Triangle_R_out( P1, P2, P3 )
Incircle of a triangle P1P2P3:
  Circle line: ...............   object{ Circle_Line_in ( P1, P2, P3, Rl) pigment{ color Yellow }}
  Circle area .............   object{ Circle_Disc_in ( P1, P2, P3 ) pigment{ color Yellow transmit 0.5 }}
  Incircle center ..   object{ Triangle_M_in ( P1, P2, P3 ) pigment{ color Green }}
  Incircle radius ...........   Triangle_R_in ( P1, P2, P3 )

Tetrahedron
  by edge vectors V1,V2,V3: object{ Tetrahedron_by_Edges ( V1,V2,V3, Rl,Rp, Filled) pigment{ color Green transmit 0.5}}
  by corners P1P2P3P4: .... object{ Tetrahedron_by_Corners ( P0,P1,P2,P3, Rl,Rp, Filled) pigment{ color Green transmit 0.5}}

Parallelepiped
  by edge vectors V1,V2,V3: object{ Parallelepiped_by_Edges ( V1,V2,V3, Rl,Rp, Filled) pigment{ color Green transmit 0.5}}
  by corners P1P2P3P4: .... object{ Parallelepiped_by_Corners( P0,P1,P2,P3, Rl,Rp, Filled) pigment{ color Green transmit 0.5}}

Sphere with center M and radius R: ...........   sphere { Center, R   pigment{ color White }
Ellipsoid, center M, radii Rx,Ry,Rz: ..   sphere { Center, R scale   pigment{ color Green transmit 0.5 }
Cylinder, centers of the ends M1 and M2
and radius R:
...................................................   cylinder { M1,M1, R   pigment{ color Green transmit 0.5 }
Cone with base center M1,
base radius R1 and top at M2:
.........................   cone { M1,R1, M2, 0   pigment{ color Green transmit 0.5 }
Truncated cone, centers of the ends M1, M2
and radii R1 and R2:
.....................................   cone { M1,R1, M2, R2   pigment{ color Green transmit 0.5 }

Text objects to add a caption + caculated values to objects:
Caption "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} 
Caption "|PQ|"
+ value:
text{ ttf "ARIAL.TTF"
      concat( "|PQ| = " , str(vlength( Q-P),3,4)
            ), 0.1, 0
      scale 0.35 rotate<20,-45,0>
      translate P+<0.4,0.3,0>
      pigment{ color rgb<1,0,0.25> }  no_shadow } 
Caption "N"
+ vector:
text{ ttf "ARIAL.TTF"
      concat( "M(PQ) = (" , vstr(3,(P+Q)/2,"/",0,1) , ")"
            ), 0.1, 0
      scale 0.35 rotate<20,-45,0>
      translate (P + Q)/2 + <0.4,0.3,0>
      pigment{ color Violet }  no_shadow }

top

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