Introduction Quadric Surfaces Ray Intersections with Quadrics Set Operations Ray Classification
Quadric Surfaces Consider a sphere And also a cylinder: These are special cases of a general class of object called quadrics.
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.
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:
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.
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?)
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.
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)
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
Example Intersection results in illegal set (a)Is the set, which is closed in (b) with interior in (c) and regularisation in (d)
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.
((A B) C)-D A B C D - Each expression can be represented as a binary operator tree.
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.
Intersecting a Ray Pseudo code for ray-tree intersection
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.
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.
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.