Geometric Modeling An Example 2 Geomertic Modeling I - Center for - - PowerPoint PPT Presentation
Geometric Modeling An Example 2 Geomertic Modeling I - Center for - - PowerPoint PPT Presentation
Geometric Modeling An Example 2 Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion Outline Objective: Develop methods and algorithms to mathematically model shapes of real world objects Categories:
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
2
An Example
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
3
Outline
Objective: Develop methods and algorithms to mathematically model shapes of real world objects Categories:
Wire-frame representations Boundary representations
Primitive based Freeform based Meshes & subdivision
Volumetric representations
Freeform based Voxel Based Octree Based Trivariate Functions
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
4
Wire-Frame Representation
Object is represented as as a set of points and edges (a graph) containing topological information. Used for fast display in interactive systems. Can be ambiguous:
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
5
Ambiguity
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
6
Volumetric Representation
Voxel based
Space subdivided into equal size boxes – each has on/off flag according to if inside/outside object Scalar values (e.g. density) per voxel are also common Common in imaging applications (CT,MRI,Ultrasound) Memory consuming
Extension – Octree (recursive construction). Advantage: simple and robust Boolean operations, in/out tests, can represent and model the interior of the object. Disadvantage: memory consuming, non-smooth, time consuming to manipulate.
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
7
Display – Iso surfaces
Difficulty to display volumetric content. Instead we can represent the boundary of the volume, solving for T(u, v, w) = T0 Marching cubes – examine each individual cube (eight neighboring voxels) and locally decide the shape of the iso surface there. Result is a polygonal approximation of the iso surface.
- 3
- 3
- 3
+3
- 3
+3
- 3
+3
- 3
+3
- 4
+8 +8 +8
- 8
- 8
T0 = 0
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
8
Constructive Solid Geometry
Use set of volumetric primitives
Box, sphere, cylinder, cone, etc…
For constructing complex objects use Boolean operations
Union Intersection Subtraction Complement
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
9
CSG Trees
Operations performed recursively Final object stored as sequence (tree) of
- perations on
primitives Common in CAD packages –
mechanical parts fit well into primitive based framework
Can be extended with free-form primitives
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
10
Freeform Representation
Explicit form: z = z(x, y) Implicit form: f(x, y, z) = 0 Parametric form: S(u, v) = [x(u, v), y(u, v), z(u, v)] Example – origin-centered sphere of radius R: Explicit is a special case of implicit and parametric form
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
11
A representation of choice
What makes a good representation for solid modeling?
Ease/Intuitive shape manipulation Class of representable models Ease of display and evaluation Ease of query answering such as inside/outside, subdivision, interference Robustness and accuracy Closure under operations such as Booleans.
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
12
Intuitive Curve Editing
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
13
Splines – Free Form Curves
To allow control of curves need description via set of basis functions + coefficients Require geometric meaning of coefficients (base)
Approximate/interpolate set of positions, derivatives, etc..
Typically parametric
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
14
Polynomial Bases
Monomial basis {1, x, x2, x3, …}
Coefficients are geometrically meaningless Manipulation is not robust
Number of coefficients = polynomial rank We seek coefficients with geometrically intuitive meanings Polynomials are easy to analyze, derivatives remain polynomial, etc. Other polynomial bases (with better geometric intuition):
Lagrange (Interpolation scheme) Hermite (Interpolation scheme) Bezier (Approximation scheme) B-Spline (Approximation scheme)
A trajectory of a particle in Rd (planar/3-space/etc.). Single parameter t [t1,t2] – acts like “time”. Position = p(t) = (x(t), y(t)), or p(t) = (x(t), y(t), z(t)), Tangent velocity = v(t) = (x’(t), y’(t) {,z’(t)}) Examples:
p(t) = (cos(t), sin(t)) t [0,2) ||v(t)|| 1 p(t) = (cos(2t), sin(2t)) t [0,) ||v(t)|| 2 p(t) = ((1-t2)/(1+t2), 2t/(1+t2)) t (-,+) ||v(t)|| ?
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
15
Parametric Curves
v(t) = (x’(t),y’(t))
(x(t),y(t))
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
16
Mathematical Continuity
C1(t) & C2(t), t [0,1] - parametric curves Level of continuity of the curves at C1(1) and C2(0) is:
C-1: C1(1) C2(0) (discontinuous) C0: C1(1) = C2(0) (positional continuity) Ck, k > 0 : continuous up to kth derivative
Continuity of single curve inside its parameter domain is similarly defined - for polynomial bases it is C
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
17
Geometric Continuity
Mathematical continuity is too strong a requirement May be relaxed to geometric continuity
Gk, k 0 : Same as Ck Gk, k =1 : C'1(1) = C'2(0) Gk, k 0 : There is a reparameterization of C1(t) & C2(t), where the two are Ck
E.g.
C1(t)=[cos(t),sin(t)], t[/2,0] C2(t)=[cos(t),sin(t)], t[0,/2] C3(t)=[cos(2t),sin(2t)], t[0,/4] C1(t) & C2(t) are C1 (& G1) continuous C1(t) & C3(t) are G1 continuous (not C1)
C1 C2, C3
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
18
More on Continuity
Consider a set of points {Pi}i=0,n A piecewise constant interpolant will be C-1 A piecewise linear interpolant will be C0 Polyhedra are usually piecewise linear approximation
- f freeform polynomials
Polyhedra are C0 continuous Higher order polynomials posses better continuity
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
19
Cubic Hermite Basis
The set of polynomials of degree k is a linear vector space of degree k+1 The canonical, monomial basis for polynomials is {1, x, x2, x3,…} Define geometrically-oriented basis for cubic polynomials hi,j(t): i, j = 0,1, t[0,1] Has to satisfy:
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
20
Hermite Cubic Basis (cont’d)
The four cubics which satisfy these conditions are Obtained by solving four linear equations in four unknowns for each basis function Prove: Hermite cubic polynomials are linearly independent and form a basis for cubic polynomials
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
21
Hermite Cubic Basis (cont’d)
Lets solve for h00(t) as an example. h00(t) = a t3 + b t2 + c t + d must satisfy the following four constraints: Four equations and four unknown to solve for.
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
22
Hermite Cubic Basis (cont’d)
Let C(t) be a cubic polynomial defined as the linear combination: What are C(0), C(1), C’(0), C’(1) ? C(0) = P0, C(1) = P1, C’(0) = T0, C’(1) = T1 To generate a curve through P0 & P1 with slopes T0 & T1 use
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
23
Parametric Splines
So far we solve for a single explicit function C(t) Cannot represent closed curves such as a circle Solution: let Pi = (xi, yi) and Ti = (ti
x, ti y) be vector
functions Solve for each individual axis independently Here is an example of four Hermite cubics that approximate a circle
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
24
Cubic Splines
Standard spline input – set of points {Pi}i=0, n
No derivatives’ specified as input Can we prescribe derivatives values in order to achieve C2?
Interpolate by n cubic segments (4n DOF):
Derive {Ti}i=0 , n from C2 continuity constraints Solve 4n equations
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
25
Cubic Splines
Have two degrees of freedom left (to reach 4n DOF) Options
Natural end conditions: C1''(0) = 0, Cn''(1) = 0 Complete end conditions: C1'(0) = 0, Cn'(1) = 0 Prescribed end conditions (derivatives available at the ends): C1'(0) = T0, Cn'(1) = Tn Quadratic end conditions C1''(0) = C1''(1), Cn''(0) = Cn''(1), Periodic end conditions C1'(0) = Cn'(1), C1''(0) = Cn''(1),
Question: What parts of C(t) are affected as a result of a change in Pi ?
prescribed natural
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
26
The assumption t [0,1] (uniform parameterization) is arbitrary
Implicitly implies same curve length for each segment
Not natural if points are not equally spaced One alternative - chord-length parameterization: Question: Can chord-length parameterization be used for cubic Hermite splines?
Parameterization
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
27
Parameterization
Question: What do we need arc/chord length curves for? Uniform Chord- length [0,1] [0,1] [0,8] [0,1] [0,3] [0,1] [0,1] [0,4]
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
28
Bezier Curves
The Bezier curve is an approximation
- f a given control polygon (a polyline)
Denote by (t): t[0,1] Bezier curve of degree n is defined over n+1 control points, {Pi}i=0, n Have two formulations
Constructive Algebraic
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
29
De Casteljau Construction
(1/3) Select t[0,1] value. Then,
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
30
Algebraic Form of Bezier Curves
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
31
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
32
Algebraic Form of Bezier Curves
Bezier curve for set of control points {Pi}i=0, n : where {Bi
n(t)}i=0, n Bernstein basis of polynomial
- f degree n
Here is a Cubic case example:
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
33
Algebraic Form of Bezier Curves
why?
Curve is linear combination of basis functions Curve is affine combination of control points
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
34
Properties of Bezier Curves
(t) is polynomial of degree n (t) CH(P0,…,Pn) (0) = P0 and (1) = Pn '(0) = n(P1P0) and '(1) = n(PnPn-1) (t) is affine invariant and variation diminishing (t) is intuitive to control via Pi and it follows the general shape of the control polygon '(t) is a Bezier curve of one degree less Questions:
What is the shape of a Bezier curve whose control points lie on a line? How can one connect two Bezier curves with c0 continuity? c1 ? c2 ?
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
35
Bezier Curve Editing
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
36
Some Trivia
Bezier curves introduced nearly simultaneously by Pierre Bezier at Renault and Paul De Casteljau at Citroen (late 60s) Attributed to Bezier as he was the first to make the results public
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
37
Degree corresponds to number of control points
Global support: change in one control point affects the entire curve For large sets of points – curve deviates far from the points
Cannot represent conics exactly. Most noticeably circles
Can be resolved by introducing a more powerful representation
- f rational curves.
As an example, a 90 degrees arc as a rational Bezier curve:
P0
=(0,1)
P1
=(1,1)
P2
=(1,0)
Drawbacks of Bezier Curves
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
38
B-Spline Curves
Idea: Generate basis where functions are continuous across the domains while presenting local support For each parameter value only a finite set of basis functions is non zero. The parametric domain is subdivided into sections at parameter values denoted knots, {i }. The B-spline functions are then defined over the knots. The knots are denoted uniform knots if i - i-1 = c,
- constant. W.l.o.g.,
assume c = 1.
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
39
Uniform Cubic B-Spline Curves
Definition (uniform knot sequence, i - i-1 = 1):
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
40
Uniform Cubic B-Spline Curves
For any t [3, n]: (prove it!) For any t [3, n] at most four basis functions are non zero Any point on a cubic B-Spline is an affine combination
- f at most four control points
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
41
In general, B-Splines do not interpolate control points
in particular, the uniform cubic B-spline curves do not interpolate the end points of the curve. Why is the end points’ interpolation important?
Two ways are common to force endpoint interpolation:
Let P0 = P1 = P2 (same for other end) Add a new control point (same for other end) P-1 = 2P0 – P1 and a new basis function N-1
3(t).
Question:
What is the shape of the curve at the end points if the first method is used? What is the derivative vector of the curve at the end points if the first method is used?
Boundary Conditions for Cubic B-Spline Curves
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
42
Local Control of B-spline Curves
Control point Pi affects (t) only for t(i, i+4)
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
43
Intuitive B-spline Curve Editing
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
44
Properties of B-Spline Curves
For n control points, (t) is a piecewise polynomial of degree 3, defined over t[3, n) and for specific t = t0? (t) is affine invariant and variation diminishing (t) follows the general shape of the control polygon and it is intuitive and ease to control its shape Questions:
What is (i) equal to? What is '(i) equal to? What is the continuity of (t) ? Prove it!
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
45
From Curves to Surfaces
A curve is expressed as inner product of coefficients Pi and basis functions One way of extending curves into surfaces is to treat surface as a curves of curves. This approach is also known as tensor product surfaces Assume Pi is not constant, but are functions of a second, new parameter v:
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
46
From Curves to Surfaces (cont’d)
Then
- r
Question: What is the difference between u and v?
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
47
Intuitive Surface Editing
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
48
Basic Surface Properties
Partials (Tangents) and Normal Elliptic regions (Convex/Concave)
S(u, v) S(u0, v) S(u, v0) Isoparametric Curves
Hyperbolic regions (Saddle-like)
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
49
Surface constructors
Construction the geometry is a first stage in any synthetic image synthesis process There exist a set of high level, simple and intuitive, surface constructors for novice users:
Bilinear patch Ruled surface Boolean sum Surface of Revolution Extrusion surface Surface from curves (skinning) Swept surface
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
50
Bilinear Patches
Bilinear interpolation of 4 3D points - 2D analog of 1D linear interpolation between 2 points in the plane Given P00, P01, P10, P11 the parametric Bilinear surface for u,v[0,1] is: Questions:
What does an isoparametric curve of a Bilinear patch look like ? Can you represent the Bilinear patch as a Bezier surface? When is a Bilinear patch planar?
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
51
Ruled Surfaces
Given two curves a(t) and b(t), the corresponding ruled surface between them is constructed by
The corresponding points on a(t) and b(t) are connected by straight lines
Questions:
When is a ruled surface a bilinear patch? When is a bilinear patch a ruled surface?
S(u, v) = v a(u) + (1-v) b(u)
a(u) b(u)
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
52
Ruled Surfaces
http://www.bvd.co.il
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
53
Boolean Sum
Given four connected curves i i=1,2,3,4, Boolean sum S(u, v) fills the interior. Let, Then
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
54
Boolean Sum (cont’d)
S(u,v) interpolates the four i along its boundaries. For example, consider the u = 0 boundary: Question: Must i be coplanar?
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
55
Surface of Revolution
Rotate a, usually planar, curve around an axis Consider curve (t) = (x(t), 0, z(t)) and let Z be the axis of
- revolution. Then,
Question: sin and cos are not rational. Can we represent surfaces of revolution as rational?
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
56
Extrusion Surface
Extrusion of a, usually planar, curve along a linear segment. Consider curve (t) and vector Then
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
57
Surface from Curves (Skinning)
An intuitive surface fitting (approximation or interpolation) scheme Fit a surface through a set of prescribed curves: Question: Must the curves be planar? Closed?
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
58
Sweep Surface
A general surface construction scheme Rigid motion of one (cross section) curve along another (axis) curve: The cross section can change as it is swept along Question: Is an Extrusion as special case of sweep? Surface of revolution?
Geomertic Modeling I - Center for Graphics and Geometric Computing, Technion
59
Quiz
What surface constructors were used to create these models: