###### Descriptions and Examples for the POV-Ray Raytracerby Friedrich A. Lohmüller     POV-Ray Examples - How To Make Objects for POV-Ray
Italiano
Français
Deutsch

Home
- POV-Ray Tutorial

- POV-Ray Examples
Index of Content
- Geometry
- Pawn
- Wireframe Cube
- Octagon
- Egg Shape
- Star
- Optical Lens
- Chessboard
- Regular Tetrahedron
- Penrose Triangle
- Yin & Yang
- Fishblob
- Threefold
- Trefoil
- Architecture

- Engineering

# Star

###### The construction of a simple star shape. Example for the using of the "intersection" and/or "difference". Objects:   "box", "sphere". Methods: "#declare", "union{...}", "intersection", "difference". Click here for an example!

 The construction step by step:

We start with a "box". To get a clearly defined length of the rays we scale the box by the square root of 2. (Then the diagonals of it's surfaces have a length of 2 units!)

```
box { <-1,-1,-1>,< 1,1,1>
scale <1,1,1>*sqrt(2)
}```

We rotate the box around the z axis by 45 degrees.

```  box { <-1,-1,-1>,< 1,1,1>
scale <1,1,1>*sqrt(2)
rotate<0,0,45>
}```

Then the box is scaled in y direction and after this it is turned around the x axis by 45 degrees. We use the declare statement to make this shape now to a new object called "Ray_Profile".

```  #declare Ray_Profile =
box { <-1,-1,-1>,< 1,1,1>
scale <1,1,1>*sqrt(2)
rotate<0,0,45>
scale <1,0.36,1>
rotate<45,0,0>
}```

The new object is now mirrored at the xy plane in z direction by "scale<1,1,-1>". Then we make an intersection of the original shape and it's mirror image..

``` intersection{
object{ Ray_Profile }
object{ Ray_Profile scale<1,1,-1>}
}```

To be able to make also stars with an odd number of rays we need to subtract ( = intersection with the inverse shape) a box to get rid of the left part of our ray shape. This shape now we declare as a new object called "'Ray"..

```#declare Ray =
intersection{
object{ Ray_Profile }
object{ Ray_Profile scale<1,1,-1>}
box{<-2,-1,-1>,<0,1,1> inverse}
}```

The rays of a star were arranged finally by a while loop rotating them around the y axis. For the right image the rays were made more slender by applying " scale<1,0,5,0.5> ".
The resulting star shape has a radius of 2 units.

```union{
#local Nr = 0;     // start
#local EndNr = 5;  // end
#while (Nr < EndNr)
object{Ray rotate<0,Nr*360/EndNr,0>}
#local Nr = Nr + 1;// next Nr
#end // ------------- end of loop
rotate<0,0,0>
translate<0,0,0>
} // end of union```

##### Scene file for POV-Ray:"star0.txt" or "star0.pov"
top
 © Friedrich A. Lohmüller, 2009 www.f-lohmueller.de