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

Home
- POV-Ray Tutorial
   Loops,
   Sine, Cosine
   and POV-Ray
   1. Linear Waves
   2. Concentric waves
 >3. Flying Carpets
                                              - Download

About flying carpets

In addition to the possibility of design the y-modulation symmetric to an axis of rotation you can use factors which are depending from the x or z direction as well by sin(A) and cos(A).

#declare Ball =
 sphere{<0,0,0>,0.25
   texture{
     pigment{color rgb<1,0.65,0.0>}
     finish {diffuse 0.9 phong 1}
    }// end of texture
 }// end of sphere

#declare E = 5;
#declare Z = -E;    // start value Z
#declare EndZ = E;  // end value Z
#declare Step = 0.2;// step value
//------- loop start Z:
#while ( Z < EndZ + Step)

  #declare X = -E; // start value X
  #declare EndX = E; // end value X
  //------ loop start X:
  #while ( X < EndX + Step)

  object{ Ball
  translate<X,0.1*X*sin(Z)
              +0.1*Z*cos(X),Z>}

  #declare X = X+Step;//next X value
  #end // --------------- loop end X

#declare Z = Z+Step;//next Z value
#end // --------------- loop end Z

With a little variation you will get the classic flying carpet:

object{Ball
 translate<X,0.05*(X*sin(X-Z)
             +Z*cos(X*Z)),Z>}

A variation with more parallel waves you will get by this modulation:

 object{Ball
  translate<X,0.05*X*sin(X-2*Z)
           + 0.1*Z*cos(3*X-Z),Z>}

A great chaotic heap of snakes brings the following variation:

object{Ball
 translate<X,0.1*X*sin(X-Z)
  - 0.2*((Z/X)+1)*cos(X*Z),Z>}

top

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