2 Constructive Solid Geometry Methods Constructive Solid Geometry (CSG) performs solid modelling by generating a new object from two three dimensional objects using a set operationValid set operations includeUnionIntersectionDifference
5 Constructive Solid Geometry Methods (cont…) CSG usually starts with a small set of primitives such as blocks, pyramids, spheres and conesTwo objects re initially created and combined using some set operation to create a new objectThis object can then be combined with another primitive to make another new objectThis process continues until modelling complete
6 Constructive Solid Geometry Methods (cont…) CSG models are usually represented as CSG treesCSG Objectoper1obj1obj2oper3obj4oper2obj3
8 Ray-CastingRay-casting is typically used to implement CSG operators when objects are described with boundary representationsRay casting is applied by determining the objects that are intersected by a set of parallel lines emanating from the xy plane along the z axisThe xy plane is referred to as the firing plane
9 Ray-Casting (cont…)Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)
10 Ray-Casting (cont…)Surface intersections along each ray are calculated and these are sorted according to distance from the firing planeThe surface limits for the composite object are then determined by the specified set operation
11 Ray Casting ExampleImages taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)
12 CSG Data Structure typedef struct _csgtree } CSGTreePtr; Operator op;Quadric primitive;struct _csgtree *right;struct _csgtree *left;} CSGTreePtr;Each leaf node represents a primitive (usually a quadric primitive).‘op’ can also be ‘leaf’ rather than a combination operator.
13 Intersecting a RayPseudo code for ray-tree intersection
14 Intersecting a RayThe result will be a sequence of intersection points along a ray, represented by the parametric valuest0, t1, t2, …,tnwhere there are n intersectionsEach individual intersection with a solid will result (typically) in two values.
15 Combine FunctionShows how the result of the left and right solids combine together.Note that the set operations therefore occur at a 2D level.
17 SummaryUnified representation for quadric surfaces provides a simplicity and elegance for a wide class of shapes.CSG provides a simple methodology for combinations via set operations of solidsCSG does not require quadrics, it can work other types of solid representation.