Solid Modeling CS418 Computer Graphics John C. Hart
Implicit Surfaces f =0 f < 0 1 f > 0 (0,0) • Real function f ( x , y , z ) • Classifies points in space • Image synthesis (sometimes) Circle example f ( x , y ) = x 2 + y 2 – 1 – inside f > 0 – outside f < 0 – on the surface f = 0 • CAGD: inside f < 0, outside f > 0 f = 0 f = 0 z = f ( x , y ) f > 0 f < 0 f > 0 f < 0
Why Use Implicits? • v. polygons – smoother – compact, fewer higher-level primitives – harder to display in real time • v. parametric patches – easier to blend – no topology problems – lower degree – harder to parameterize – easier to ray trace – well defined interior
Surface Normals f < 0 f > 0 1 (0,0) • Surface normal is parallel to the f (x,y)=0 function gradient ∇ f ( x , y ) ∇ f ( x , y , z ) = ( δ f / δ x , δ f / δ y , δ f / δ z ) Circle example f ( x , y ) = x 2 + y 2 – 1 • Gradient not necessarily unit length ∇ f ( x , y ) = (2 x , 2 y ) n = ∇ f ( x , y , z )/|| ∇ f ( x , y , z )|| • Gradient points in direction of increasing f – Outward when f < 0 denotes interior – Inward when f > 0 denotes interior z = f ( x , y )
Smoothness • Surface f -1 (0) is a smooth ∇ f ( x , y , z ) ≠ (0,0,0) “manifold” if zero is a “regular” value of f • Surface is “manifold” if the ∇ f ( x , y , z ) = (0,0,0) infinitesimal neighborhood around any point can be deformed into a simple flat region • Zero is a “regular” value means ∇ f ( x , y , z ) ≠ (0,0,0) that at any point (x,y,z) where f(x,y,z) = 0, then ∇ f ( x , y , z ) ≠ (0,0,0)
Plane • Plane bounds half-space x N f > 0 • Specify plane with point p and normal N p • Points in plane x are perp. to x normal N f < 0 • f is distance if || N || = 1 f ( x ) = ( x - p ) ⋅ N
Quadrics z f (x , y , z ) = Ax 2 + 2 Bxy + 2 Cxz + 2 Dx + Ey 2 + 2 Fyz + 2 Gy + Hz 2 + 2 Iz + J x y
Quadrics z f (x , y , z ) = Ax 2 + 2 Bxy + 2 Cxz + 2 Dx + Ey 2 + 2 Fyz + 2 Gy + Hz 2 + 2 Iz + J x 2 + y 2 + z 2 – 1 = 0 • Sphere: x y
Quadrics z f (x , y , z ) = Ax 2 + 2 Bxy + 2 Cxz + 2 Dx + Ey 2 + 2 Fyz + 2 Gy + Hz 2 + 2 Iz + J x 2 + y 2 + z 2 – 1 = 0 • Sphere: x 2 + y 2 – 1 = 0 • Cylinder: x y
Quadrics z f (x , y , z ) = Ax 2 + 2 Bxy + 2 Cxz + 2 Dx + Ey 2 + 2 Fyz + 2 Gy + Hz 2 + 2 Iz + J x 2 + y 2 + z 2 – 1 = 0 • Sphere: x 2 + y 2 – 1 = 0 • Cylinder: x 2 + y 2 – z 2 = 0 • Cone: x y
Quadrics z f (x , y , z ) = Ax 2 + 2 Bxy + 2 Cxz + 2 Dx + Ey 2 + 2 Fyz + 2 Gy + Hz 2 + 2 Iz + J x 2 + y 2 + z 2 – 1 = 0 • Sphere: x 2 + y 2 – 1 = 0 • Cylinder: x 2 + y 2 – z 2 = 0 • Cone: • Paraboloid: x 2 + y 2 – z = 0 x y
Homogeneous Quadrics f (x , y , z ) = Ax 2 + 2 Bxy + 2 Cxz + 2 Dx + Ey 2 + 2 Fyz + 2 Gy + Hz 2 + 2 Iz + J A B C D x B E F G y [ ] = ( , , ) 1 f x y z x y z C F H I z 1 D G I J f ( x ) = x T Q x
Transforming Quadrics • Given a quadric Q with implicit surface x T Q x = 0 • What is the matrix Q ’ of the quadric transformed by M z z x y x y x T Q x = 0 x T Q’ x = 0
Transforming Quadrics • Given a quadric Q with implicit surface x T Q x = 0 • What is the matrix Q ’ of the quadric transformed by M • Let x ’ = M x • Find Q ’ such that x ’ T Q ’ x ’ = 0 z z x T Q x = 0 x ’ T Q’ x ’ = 0 M x y x y
Transforming Quadrics • Given a quadric Q with implicit surface x T Q x = 0 • What is the matrix Q ’ of the quadric transformed by M • Let x ’ = M x • Find Q ’ such that x ’ T Q ’ x ’ = 0 • Since x = M -1 x ’ we have ( M -1 x ’) T Q ( M -1 x ’) = 0 x ’ T ( M -1 ) T Q M -1 x ’ = 0 • So Q ’ = ( M -1 ) T Q M -1
Transforming Quadrics • Given a quadric Q with implicit surface x T Q x = 0 • What is the matrix Q ’ of the quadric transformed by M • Let x ’ = M x • Find Q ’ such that x ’ T Q ’ x ’ = 0 • Since x = M -1 x ’ we have ( M -1 x ’) T Q ( M -1 x ’) = 0 x ’ T ( M -1 ) T Q M -1 x ’ = 0 • So Q ’ = ( M -1 ) T Q M -1 (Since x is homogeneous, and we’re evaluating x T Q x = 0 we don’t care about scale, so we can use the easier-to-compute adjoint M* instead of the inverse M -1 .)
Torus • Product of two implicit circles r ( x – R ) 2 + z 2 – r 2 = 0 ( x + R ) 2 + z 2 – r 2 = 0 R (( x – R ) 2 + z 2 – r 2 )(( x + R ) 2 + z 2 – r 2 ) ( x 2 – Rx + R 2 + z 2 – r 2 ) ( x 2 + Rx + R 2 + z 2 – r 2 ) x 4 +2 x 2 z 2 + z 4 – 2 x 2 r 2 –2 z 2 r 2 + r 4 + 2 x 2 R 2 +2 z 2 R 2 –2 r 2 R 2 + R 4 ( x 2 + z 2 – r 2 – R 2 ) 2 + 4 z 2 R 2 – 4 r 2 R 2 • Surface of rotation replace x 2 with x 2 + y 2 f ( x , y , z ) = ( x 2 + y 2 + z 2 – r 2 – R 2 ) 2 + 4 R 2 ( z 2 – r 2 )
Constructive Solid Geometry • Let shape F be implicitly defined by f ( x ) • Let shape G be implicitly defined by g ( x ) F G f < 0 f < 0 g < 0 g < 0
Constructive Solid Geometry • Let shape F be implicitly defined by f ( x ) • Let shape G be implicitly defined by g ( x ) F G • The union H = F ∪ G is defined by h ( x ) = min f ( x ), g ( x ) f < 0 f < 0 g < 0 g < 0 H = F ∪ G
Constructive Solid Geometry • Let shape F be implicitly defined by f ( x ) • Let shape G be implicitly defined by g ( x ) F G • The union H = F ∪ G is defined by h ( x ) = min f ( x ), g ( x ) f < 0 • The intersection H = F ∩ G is defined by f < 0 g < 0 g < 0 h ( x ) = max f ( x ), g ( x ) H = F ∩ G
Constructive Solid Geometry • Let shape F be implicitly defined by f ( x ) • Let shape G be implicitly defined by g ( x ) F G • The union H = F ∪ G is defined by h ( x ) = min f ( x ), g ( x ) f < 0 • The intersection H = F ∩ G is defined by f < 0 g < 0 g < 0 h ( x ) = max f ( x ), g ( x ) • The difference H = F – G is defined by h ( x ) = max f ( x ), - g ( x ) H = F – G
Blobs • Gaussian e - r ² • Radius function r ² ( x ) = ( x – c ) ⋅ ( x – c ) • Gaussian sphere f ( x ) = - T + e - r ²( x ) • For this formulation of implicit surfaces, function is positive inside the object
Blobs • Union of spheres f ( x ) = - T + min e - r 1 ²( x ) , e - r 2 ²( x )
Blobs • Union of spheres f ( x ) = - T + min e - r 1 ²( x ) , e - r 2 ²( x )
Blobs • Union of spheres f ( x ) = - T + min e - r 1 ²( x ) , e - r 2 ²( x ) • Blended union of spheres f ( x ) = - T + e - r 1 ²( x ) + e - r 2 ²( x )
Blobs • Union of spheres f ( x ) = - T + min e - r 1 ²( x ) , e - r 2 ²( x ) • Blended union of spheres f ( x ) = - T + e - r 1 ²( x ) + e - r 2 ²( x )
Recommend
More recommend