You are on page 1of 2

6.

837 Intro to Computer Graphics, Fall 2003


Assignment 1: Ray Casting
Scene description file grammar
file ::= camerabackgroundgroup
camera ::= orthographicCamera
orthographicCamera ::= OrthographicCamera{
centerVec3f
directionVec3f
upVec3f
sizefloat
}
background ::= Background{
colorVec3f
}
group ::= Group{
num_objectsint
(object3D|materialobject3D) ^ num_objects
}
object3D ::= group|sphere
sphere ::= Sphere{
centerVec3f
radiusfloat
}
material ::= Material{
diffuse_colorVec3f
}
Vec3f ::= floatfloatfloat
How to read a grammar:
Startwiththetoplevelrule,inthiscasefile.Toexpandarule,substitutetheappropriatedefinitions
foreachoftheelementsinbold.Somespecialnotation:
|means"OR"
^ n means"exactlynelements"

You might also like