Presentation is loading. Please wait.

Presentation is loading. Please wait.

Constructive Solid Geometry Mel Slater

Similar presentations

Presentation on theme: "Constructive Solid Geometry Mel Slater"— Presentation transcript:

1 Constructive Solid Geometry Mel Slater

2 Introduction Quadric Surfaces Ray Intersections with Quadrics Set Operations Ray Classification

3 Quadric Surfaces Consider a sphere And also a cylinder: These are special cases of a general class of object called quadrics.

4 Quadric Surfaces Let Q be a 4*4 matrix Let p = (x,y,z,1) s(x,y,z) = p T Qp = 0. The quadric is the boundary and the interior of the surface defined by the equation, and hence consists of p T Qp  0.

5 Quadric Surfaces Note that the highest power of any coordinate is 2 (hence quadric). Note that the a,…,j are given constants Special cases a,…,j of define different types of surface. Multiplying out we get:

6 Plane Sphere Cylinder Special Cases

7 Cone Paraboloid

8 More Properties Given a quadric the normal at point p is given by 2p T Q. If all the points p on a quadric are transformed, eg, q = pM then the result is also a quadric –where M is a transformation matrix.

9 Ray Intersection The beauty of the quadric representation is that the unified representation requires only one ray-intersection algorithm. Let p(t) = p + tv, t  0 –Be the parametric equation of the ray that starts at p in direction p. Substitute p(t) into p T Qp = 0 and solve the quadratic equation for t. This will give –Complex results if no intersection –Two equal values of t if tangent –Two real values – the entry and exit points otherwise. –(What happens in the case of a plane?)

10 Set Operations The quadrics represent solid objects –Unlike boundary representations for mesh and B-Spline approaches We can use set operations such as union, intersection and difference to combine such solids together.

11 Regularising Operation Given a point p we define the ‘open ball’. A boundary point in any point-set S is a point p such that for any  >0 B(p,  ) will contain points in S and also in not-S. S is an open set if it does not contain its boundary. Closure(S) = S  boundary(S)

12 Regularising Operation Interior(S) = S – boundary(S) Regularisation(S) = closure(interior(S)) For any set operation it is the regularisation of the result that is required. A op* B = regularisation(A op B) –where op is any operator such as union, difference, intersection

13 Example Intersection results in illegal set (a)Is the set, which is closed in (b) with interior in (c) and regularisation in (d)

14 CSG Operations We can define set operations such as , ,  (not) and difference -. We can make formulae expressing more complex objects as combinations of simpler objects, eg –A  B – C –((A  B)  C)-D Each can be expressed as a binary operator tree.

15 ((A  B)  C)-D A B C D   - Each expression can be represented as a binary operator tree.

16 CSG Data Structure typedef struct _csgtree –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.

17 Intersecting a Ray Pseudo code for ray-tree intersection

18 Intersecting a Ray The result will be a sequence of intersection points along the ray, represented by the parametric values –t 0, t 1, t 2, …,t n –where there are n intersections Each individual intersection with a solid will result (typically) in two values.

19 Combine Function Shows how the result of the left and right solids combine together. Note that the set operations therefore occur at a 2D level.

20 Examples all_mach/omega/doc/Examples/jpg/csg.jpg visualization/domainpara/algebraic2/parameterization/ gallery/Reconstruction/Csg/

21 Summary Unified 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 solids CSG does not require quadrics, it can work other types of solid representation.

Download ppt "Constructive Solid Geometry Mel Slater"

Similar presentations

Ads by Google