###### 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

# Wireframe Cube

###### Construction of a cube shaped wireframe object. Example for the using of the basic POV-Ray statements. Objects: "sphere", "cylinder". Methods: "#declare", "union{...}", "object{...}" Note: This only an exercise to become more familiar with 3D coordinates and with the methodes. You can get the same result by using #include "shapes.inc" and the macro "object{ Wire_Box(<-1,-1,-1>,<1,1,1>, 0.20, 0)} .

The construction in details:

The tubes are arranged symetrically arround the center. The corners are made by spheres of the same radius as the cylinders. Defining the radius using the "#declare"-statement makes it easy to change it. The complete cube is defined as a new object named "BigCube1", easy to use it repeatedly by the statement

```object{ BigCube1
rotate<...> translate<...>}```
- as the next example demonstrates.

#### ```//====== Cube formed by tubes ===== #declare R = 0.20; //radius of tubes #declare BigCube1 = union{ // 8 Corners sphere{<-1,-1,-1>,R} sphere{< 1,-1,-1>,R} sphere{<-1,-1, 1>,R} sphere{< 1,-1, 1>,R} sphere{<-1, 1,-1>,R} sphere{< 1, 1,-1>,R} sphere{<-1, 1, 1>,R} sphere{< 1, 1, 1>,R} // 4 in x direction cylinder {<-1,-1,-1>,< 1,-1,-1>,R} cylinder {<-1,-1, 1>,< 1,-1, 1>,R} cylinder {<-1, 1,-1>,< 1, 1,-1>,R} cylinder {<-1, 1, 1>,< 1, 1, 1>,R} // 4 in y direction cylinder {<-1,-1,-1>,<-1, 1,-1>,R} cylinder {<-1,-1, 1>,<-1, 1, 1>,R} cylinder {< 1,-1,-1>,< 1, 1,-1>,R} cylinder {< 1,-1, 1>,< 1, 1, 1>,R} // 4 in z direction cylinder {<-1,-1,-1>,<-1,-1, 1>,R} cylinder {<-1, 1,-1>,<-1, 1, 1>,R} cylinder {< 1,-1,-1>,< 1,-1, 1>,R} cylinder {< 1, 1,-1>,< 1, 1, 1>,R} texture{pigment{color rgb<1,0.8,0>} finish{ diffuse 0.9 phong 1}} }//-- End of wireframed cube ------- //------------- Draw it ----------- object{BigCube1 scale 0.7 rotate<0,60,0> translate<0,1.2,0>} //------------------------------ end```

We'll get the following image:

### Variations on the theme:

Changing the line in the description marked with //<---1
as follows:

`camera {Cam1}`
and the lines starting with the mark //<---2
as follows:
```        color_map{[0    color Blue]
[0.45 color White]
[0.55 color White]
[1.0  color Blue]}
scale 2 translate<0,-1,0>}```
and the line with the mark //<---3
as follows:
`#declare R = 0.25 //radius of tubes`
and also the lines from the mark //<---4
as follows:
```texture{
Polished_Chrome
pigment{quick_color rgb<1,0.8,0>}
finish {diffuse 0.9 phong 1}}
}//-- end of wireframe cube ---------
//----------- drawing  --------------
union{
object{ BigCube1 scale 0.7
translate< 0.0, 0.0, 0.0>}
object{ BigCube1 scale 0.4
translate< 0.7, 0.7,-0.7>}
rotate<-45,65,0>
rotate<10,0,0>
translate<0.3,0.8,0>}
--------------------------------- end ```
This results in following image:

top

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