Quadric Solids

(7-7-98)

Solid Quadrics

Included here is a program called closequad that reads RIB files with quadrics and adds Disk and Patch statements to give the appearance of a solid object.

The image below was created with the following commands using closequad:

      % closequad hyperboloid.rib | prman 
      % closequad paraboloid.rib | prman 
      % closequad sphere.rib | prman  
      % closequad torus.rib | prman 
      % closequad cylinder.rib | prman 
      % closequad cone.rib | prman  
      % showbits *.tif

Taking a paraboloid as an example, you can see how bicubic patches were used by looking at the RIB output from closequad. In the image below a tool called ribbish (part of the Affine Toolkit) was used to remove the Disk top and bottom:

      % closequad paraboloid.rib | ribbish -Disk | prman


closequad.c

The closequad.c program needs the Affine Toolkit Libraries and Headers to build. An example Makefile and example RIBs used to create the above images are given below.


cone.rib

Display "cone.tif" "file" "rgb"
Format 250 250 1
Clipping 0.001 1000
Projection "perspective"
Translate 0 0 2
WorldBegin
LightSource "distantlight" 1 "intensity" [1.0]
LightSource "ambientlight" 2 "intensity" [0.3]
Surface "paintedplastic" "texturename" ["grid2.tex"]
Rotate 65 1 0 0 
Cone 1 1 300
WorldEnd

cylinder.rib

Display "cylinder.tif" "file" "rgb"
Format 250 250 1
Clipping 0.001 1000
Projection "perspective"
Translate 0 0 2
WorldBegin
LightSource "distantlight" 1 "intensity" [1.0]
LightSource "ambientlight" 2 "intensity" [0.3]
Surface "paintedplastic" "texturename" ["grid2.tex"]
Rotate 65 1 0 0 
Rotate -35 0 0 1
Cylinder 1 -0.5 0.5 300
WorldEnd

hyperboloid.rib

Display "hyberboloid.tif" "file" "rgb"
Format 250 250 1
Clipping 0.001 1000
Projection "perspective"
Translate 0 0 5
WorldBegin
LightSource "distantlight" 1 "intensity" [1.0]
LightSource "ambientlight" 2 "intensity" [0.3]
Surface "paintedplastic" "texturename" ["grid2.tex"]
Rotate 45 1 0 0 
Rotate -55 0 0 1
Hyperboloid -1 -1 -2  3 1 2 240
#Sides 1
#Rotate 65 1 0 0 
#Hyperboloid 2.5 0 -2.5  -2.5 0 2.5  70
#Hyperboloid 0 2.5 2.5  0 -2.5 2.5  70
#Hyperboloid 0 2.5 -2.5  0 -2.5 2.5  70
#Hyperboloid -1 -1 -2  3 1 2 0
WorldEnd

paraboloid.rib

Display "paraboloid.tif" "file" "rgb"
Format 250 250 1
Clipping 0.001 1000
Projection "perspective"
Translate 0 0 2
WorldBegin
LightSource "distantlight" 1 "intensity" [1.0]
LightSource "ambientlight" 2 "intensity" [0.3]
Surface "paintedplastic" "texturename" ["grid2.tex"]
Rotate 45 1 0 0
Paraboloid 1 0.1 1 300
WorldEnd

sphere.rib

Display "sphere.tif" "file" "rgb"
Format 250 250 1
Clipping 0.001 1000
Projection "perspective"
Translate 0 0 2
WorldBegin
LightSource "distantlight" 1 "intensity" [1.0]
LightSource "ambientlight" 2 "intensity" [0.3]
Surface "paintedplastic" "texturename" ["grid2.tex"]
Rotate 55 1 0 0 
Rotate -55 0 0 1
Sphere 1 -0.75 0.5 240 
WorldEnd

torus.rib

Display "torus.tif" "file" "rgb"
Format 250 250 1
Clipping 0.001 1000
Projection "perspective"
Translate 0 0 4
WorldBegin
LightSource "distantlight" 1 "intensity" [1.0]
LightSource "ambientlight" 2 "intensity" [0.3]
Surface "paintedplastic" "texturename" ["grid2.tex"]
Rotate 65 1 0 0 
Torus 2 0.5 45 180 260
WorldEnd

Makefile

# 
# Copyright (c) 1996, 1997 Thomas E. Burge.  All rights reserved.  
# 
# Affine is a trademark of Thomas E. Burge
#
# THIS SOFTWARE IS DISTRIBUTED "AS-IS" WITHOUT WARRANTY OF ANY KIND
# AND WITHOUT ANY GUARANTEE OF MERCHANTABILITY OR FITNESS FOR A 
# PARTICULAR PURPOSE.  
#
# In no event shall Thomas E. Burge be liable for any indirect or
# consequential damages or loss of data resulting from use or performance 
# of this software.
# 
# Permission is granted to include compiled versions of this code in
# noncommercially sold software provided the following copyrights and
# notices appear in all software and any related documentation:
#
#                  The Affine Libraries and Tools are 
#               Copyright (c) 1995, 1996 Thomas E. Burge.  
#                          All rights reserved.
#
# Also refer to any additional requirements presently required by Pixar 
# in regards to the RenderMan (R) Interface Procedures and Protocol.
#
# Those wishing to distribute this software commercially and those wishing 
# to redistribute the source code must get written permission from the 
# author, Thomas E. Burge.  
#
# Basically for now, I would like folks to get the source code directly 
# from me rather than to have a bunch of different versions circulating
# about.
#
#
# Affine Toolkit
#
# FILE:  Makefile for SGI 5.3 and 6.X
#
# PROGRAMS/LIBRARIES:  closequad libributil.a 
#
#
#
TARGETPATH= .
INCPATHS= -I. -I../../affine/include -I../../zlib
LIBPATHS= -L../../affine/lib
LIBS=
HEADERS=
ZLIB=-lz
ZLIB_PATH=../../zlib

# For SGI C++ compiler:
#CC = CC
#CFLAGS= -g -ansi -fullwarn ${INCPATHS}

# For SGI C compiler:
CC= cc
CFLAGS= -g -ansi -fullwarn ${INCPATHS} 
CFLAGS32= -n32 -mips4
LFLAGS32= -n32 -mips4

# For SGI version of gcc:
#CC= gcc
# Note: The -g option gets the following message:
#        cc1: warning: `-g' option not supported on this version of GCC
#CFLAGS= -I/usr/freeware/lib/gcc-lib/mips-sgi-irix5.3/2.6.3/include  \
#	-Wall ${INCPATHS}

#COPTS=-DRIB_MEMORY_TESTS -DRIB_ZLIB
COPTS=-DRIB_ZLIB

.c.o:
	${CC} -c $< ${CFLAGS} ${CFLAGS32} ${COPTS} ${INCPATHS} 

all: ./closequad

clean:
	-rm     ../bin/closequad closequad.o
./closequad: closequad.o 
	${CC} ${LFLAGS32} -o ./closequad closequad.o ${LIBPATHS} \
	-lributil -lm



[Affine Toolkit]
[RIB Utilities] [Bitmap Utilities] [Handy Little Utilities]
[Libraries] [Using the Libraries]