home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 16
/
CD_ASCQ_16_0994.iso
/
news
/
4613
/
shapes.inc
< prev
next >
Wrap
Text File
|
1980-01-12
|
3KB
|
160 lines
// Real Ray Tracer
// Taken from Persistence of Vision Raytracer
/*
This file contains the following standard declared shapes :
Ellipsoid,Sphere
Cylinder_X,Cylinder_Y,Cylinder_Z
QCone_X,QCone_Y,QCone_Z
Plane_YZ,Plane_XZ,Plane_XY
Paraboloid_X,Paraboloid_Y,Paraboloid_Z
Hyperboloid,Hyperboloid_Y
UnitBox,UnitCube
Disk_X,Disk_Y,Disk_Z
*/
#declare Ellipsoid = quadric {
<1.0 1.0 1.0>
<0.0 0.0 0.0>
<0.0 0.0 0.0>
-1.0
}
#declare Sphere = quadric {
<1.0 1.0 1.0>
<0.0 0.0 0.0>
<0.0 0.0 0.0>
-1.0
}
#declare Cylinder_X = quadric {
<0.0 1.0 1.0>
<0.0 0.0 0.0>
<0.0 0.0 0.0>
-1.0
}
#declare Cylinder_Y = quadric {
<1.0 0.0 1.0>
<0.0 0.0 0.0>
<0.0 0.0 0.0>
-1.0
}
#declare Cylinder_Z = quadric {
<1.0 1.0 0.0>
<0.0 0.0 0.0>
<0.0 0.0 0.0>
-1.0
}
#declare QCone_X = quadric {
<-1.0 1.0 1.0>
<0.0 0.0 0.0>
<0.0 0.0 0.0>
0.0
}
#declare QCone_Y = quadric {
<1.0 -1.0 1.0>
<0.0 0.0 0.0>
<0.0 0.0 0.0>
0.0
}
#declare QCone_Z = quadric {
<1.0 1.0 -1.0>
<0.0 0.0 0.0>
<0.0 0.0 0.0>
0.0
}
#declare Cone_X = intersection {
object { QCone_X translate <1 0 0> }
slab { <1 0 0> -1 1 }
scale <1.0 0.5 0.5>
}
#declare Cone_Y = intersection {
object { QCone_Y translate <0 1 0> }
slab { <0 1 0> -1 1 }
scale <0.5 1.0 0.5>
}
#declare Cone_Z = intersection {
object { QCone_Z translate <0 0 1> }
slab { <0 0 1> -1 1 }
scale <0.5 0.5 1.0>
}
#declare Plane_YZ = plane { <1 0 0> 0 }
#declare Plane_XZ = plane { <0 1 0> 0 }
#declare Plane_XY = plane { <0 0 1> 0 }
/* y^2 + z^2 - x = 0 */
#declare Paraboloid_X = quadric {
< 0.0 1.0 1.0>
< 0.0 0.0 0.0>
<-1.0 0.0 0.0>
0.0
}
/* x^2 + z^2 - y = 0 */
#declare Paraboloid_Y = quadric {
<1.0 0.0 1.0>
<0.0 0.0 0.0>
<0.0 -1.0 0.0>
0.0
}
/* x^2 + y^2 - z = 0 */
#declare Paraboloid_Z = quadric {
<1.0 1.0 0.0>
<0.0 0.0 0.0>
<0.0 0.0 -1.0>
0.0
}
/* y - x^2 + z^2 = 0 */
#declare Hyperboloid = quadric {
<-1.0 0.0 1.0>
< 0.0 0.0 0.0>
< 0.0 1.0 0.0>
0.0
}
#declare Hyperboloid_Y = quadric { /* Vertical hyperboloid */
<1.0 -1.0 1.0> /* */
<0.0 0.0 0.0> /* \ / */
<0.0 0.0 0.0> /* Like this: ) ( */
-1.0 /* / \ */
}
#declare UnitBox = box { <-0.5 -0.5 -0.5> <0.5 0.5 0.5> }
#declare UnitCube = intersection {
intersection {
slab { <1.0 0.0 0.0> -0.5 0.5 }
slab { <0.0 1.0 0.0> -0.5 0.5 }
}
slab { <0.0 0.0 1.0> -0.5 0.5 }
}
#declare Disk_X = intersection { /* Capped cylinder, Length in x axis */
Cylinder_X
slab { <1.0 0.0 0.0> -1.0 1.0 }
}
#declare Disk_Y = intersection { /* Capped cylinder, Length in y axis */
Cylinder_Y
slab { <0.0 1.0 0.0> -1.0 1.0 }
}
#declare Disk_Z = intersection { /* Capped cylinder, Length in z axis */
Cylinder_Z
slab { <0.0 0.0 1.0> -1.0 1.0 }
}
end.