notes geometry
play

Notes Geometry The plane is easy Assignment 1 due today - PowerPoint PPT Presentation

Notes Geometry The plane is easy Assignment 1 due today Interference: y<0 Collision: y became negative Normal: constant (0,1,0) Can work out other analytic cases (e.g. sphere) More generally: triangle meshes and level


  1. Notes Geometry � The plane is easy � Assignment 1 due today • Interference: y<0 • Collision: y became negative • Normal: constant (0,1,0) � Can work out other analytic cases (e.g. sphere) � More generally: triangle meshes and level sets • Heightfields sometimes useful - permit a few simplifications in speeding up tests - but special case • Splines and subdivision surfaces generally too complicated, and not worth the effort • Blobbies, metaballs, and other implicits are usually not as well behaved as level sets • Point-set surfaces: becoming a hot topic cs533d-term1-2005 1 cs533d-term1-2005 2 Implicit Surfaces Testing Implicit Surfaces � Define surface as where some scalar function of � Interference is simple: x,y,z is zero: • Is F(x,y,z)<0? • {x,y,z | F(x,y,z)=0} � Collision is a little trickier: � Interior (can only do closed surfaces!) is where • Assume constant velocity function is negative x(t+h)=x(t)+hv • Then solve for h: F(x(t+h))=0 • {x,y,z | F(x,y,z)<0} • This is the same as ray-tracing implicit surfaces… � Outside is where it � s positive • But if moving, then need to solve • {x,y,z | F(x,y,z)>0} F(x(t+h), t+h)=0 � Ground is F=y • Try to bound when collision can occur (find a sign � Example: F=x 2 +y 2 +z 2 -1 is the unit sphere change in F) then use secant search cs533d-term1-2005 3 cs533d-term1-2005 4

  2. Implicit Surface Normals Building Implicit Surfaces n = � F � Outward normal at surface is just � Planes and spheres are useful, but want to be � F able to represent (approximate) any object � Obviously can write down any sort of functions, � Most obvious thing to use for normal at a point but want better control inside the object (or anywhere in space) is the • Exercise: write down functions for some common same formula shapes (e.g. cylinder?) • Gradient is steepest-descent direction, so hopefully � Constructive Solid Geometry (CSG) points to closest spot on surface: direction to closest surface point is parallel to normal there • Look at set operations on two objects • We really want the implicit function to be monotone as � [Complement, Union, Intersection, …] we move towards/away from the surface • Using primitive F() � s, build up one massive F() • But only sharp edges… cs533d-term1-2005 5 cs533d-term1-2005 6 Getting back to particles Problems with these � “Metaballs”, “blobbies”, … � They work beautifully for some things! � Take your particle system, and write an implicit • Some machine parts, water droplets, goo, … function: � � x � x i � But, the more complex the surface, the more � F ( x ) = � i f � t � � expensive F() is to evaluate � � r i i • Need to get into more complicated data structures to • Kernel function f is something smooth like a Gaussian speed up to acceptable f ( x ) = e � x 2 � Hard to directly approximate any given geometry • Strength � and radius r of each particle (and its position x) are up to you � Monotonicity - how reliable is the normal? • Threshold t is also up to you (controls how thick the object is) � See make_blobbies for one choice… cs533d-term1-2005 7 cs533d-term1-2005 8

  3. Signed Distance Defining Signed Distance � Generally use the letter � instead of F � Note infinitely many different F represent the � ( x ) same surface � Magnitude is the distance from the � What � s the nicest F we can pick? surface � Obviously want smooth enough for gradient • Note that function is zero only at surface (almost everywhere) � Sign of � (x) indicates inside (<0) or � It would be nice if gradient really did point to outside(>0) closest point on surface � Really nice (for repulsions etc.) if value indicated � [examples: plane, sphere, 1d] how far from surface � The answer: signed distance cs533d-term1-2005 9 cs533d-term1-2005 10 Closest Point Property Unit Gradient Property � Gradient is steepest-ascent direction � Look along line from closest point on surface to x • Therefore, in direction of closest point on surface (shortest distance between two points � Value is distance along line is a straight line) � Therefore directional derivative is 1: � The closest point is by definition distance � � � n = 1 | � | away � So closest point on surface from x is � But plug in the formula for n [work out] � � = 1 � So gradient is unit length: x � � ( x ) � � � � cs533d-term1-2005 11 cs533d-term1-2005 12

  4. Aside: Eikonal equation Aside: Spherical particles � � = 1 � There � s a PDE! � We have been assuming our particles were just points • Called the Eikonal equation • Important for all sorts of things � With signed distance, can simulate • Later in the course: figure out signed distance nonzero radius spheres function by solving the PDE… • Sphere of radius r intersects object if and only if � (x)<r • i.e. if and only if � (x)-r<0 • So looks just like points and an “expanded” version of the original implicit surface - normals are exactly the same, … cs533d-term1-2005 13 cs533d-term1-2005 14 Level Sets Building Level Sets � Use a discretized approximation of � � We � ll get into level sets more later on • Lots of tools for constructing them from other � Instead of carrying around an exact formula store samples of � on a grid (or other structure) representations, for sculpting them directly, or simulating them… � Interpolate between grid points to get full � For now: can assume given definition (fast to evaluate!) • Almost always use trilinear [work out] � Or CSG: union and intersection with min and � If the grid is fine enough, can approximate any max [show 1d] well-behaved closed surface • Just do it grid point by grid point • But if the features of the geometry are the same size • Note that weird stuff could happen at sub-grid as the grid spacing or smaller, expect BAD behaviour resolution (with trilinear interpolation) � Note that properties of signed distance only hold � Or evaluate from analytical formula approximately! cs533d-term1-2005 15 cs533d-term1-2005 16

  5. Normals Evaluating outside the grid � We do have a function F defined everywhere (with � Check if evaluation point x is outside the grid interpolation) � If outside - that � s enough for interference test • Could take its gradient and normalize � But repulsion forces etc. may need an actual value • But (with trilinear) it � s not smooth enough � Most reasonable extrapolation: � Instead use numerical approximation for gradient: • A = distance to closest point on grid � � g i , j , k = � i + 1, j , k � � i � 1, j , k , � i , j + 1, k � � i , j � 1, k , � i , j , k + 1 � � i , j , k � 1 • B = � at that point � � 2 � x 2 � y 2 � z • Lower bound on distance, correct asymptotically and continuous � � (if level set doesn � t come to boundary of grid): sign( B ) A 2 + B 2 • Then, use trilinear interpolation to get (continuous) approximate gradient anywhere • Or instead apply finite difference formula to 6 trilinearly • Or upper bound on distance: interpolated points (mathematically equivalent) B + sign( B ) A • Normalize to get unit-length normal cs533d-term1-2005 17 cs533d-term1-2005 18 Triangles Triangle intersection � Given x 1 , x 2 , x 3 the plane normal is � The best approach: reduce to simple predicates • Spend the effort making them exact, accurate, or at n = ( x 2 � x 1 ) � ( x 3 � x 1 ) least consistent ( x 2 � x 1 ) � ( x 3 � x 1 ) • Then it � s just some logic on top • Common idea in computational geometry � Interference with a closed mesh � In this case, predicate is sign of signed volume • Cast a ray to infinity, parity of number of (is a tetrahedra inside-out?) � � intersections gives inside/outside x 1 � x 0 y 1 � y 0 z 1 � z 0 � � ( ) = sign det x 2 � x 0 y 2 � y 0 z 2 � z 0 � So intersection is more fundamental orient x 0 ,x 1 ,x 2 ,x 3 � � • The same problem as in ray-tracing x 3 � x 0 y 3 � y 0 z 3 � z 0 � � cs533d-term1-2005 19 cs533d-term1-2005 20

Recommend


More recommend