3d modeling parametric curves & surfaces

58
3D Modeling Parametric Curves & Surfaces Shandong University Spring 2013

Upload: others

Post on 16-Oct-2021

16 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 3D Modeling Parametric Curves & Surfaces

3D ModelingParametric Curves & Surfaces

Shandong UniversitySpring 2013

Page 2: 3D Modeling Parametric Curves & Surfaces

3D Object Representations

• Raw data– Point cloud– Range image– Polygon soup

• Surfaces– Mesh– Subdivision– Parametric– Implicit

• Solids– Voxels– BSP tree– CSG– Sweep

• High-level structures– Scene graph– Skeleton– Application specific

Page 3: 3D Modeling Parametric Curves & Surfaces

Parametric Surfaces

• Applications– Design of smooth surfaces in cars, ships, etc.

Page 4: 3D Modeling Parametric Curves & Surfaces

Continuity

• When two curves are joined, we typically want some degree of continuity across the boundary (the knot)

• Geometric Continuity– G0: The curves touch at the join point.– G1: The curves also share a common tangent

direction at the join point.– G2: The curves also share a common center of

curvature at the join point.

Page 5: 3D Modeling Parametric Curves & Surfaces

Continuity

• Parametric Continuity– C−1: curves include discontinuities

– C0: curves are joined

– C1: first derivatives are continuous

– C2: first and second derivatives are continuous

– Cn: first through nth derivatives are continuous

Page 6: 3D Modeling Parametric Curves & Surfaces

Continuity

Parametric (red) and Geometric (black) Continuity comparison

Page 7: 3D Modeling Parametric Curves & Surfaces

Parametric Curves

• Boundary defined by parametric functions:

• Example: line segment

V0

V1

u

Page 8: 3D Modeling Parametric Curves & Surfaces

Parametric Curves

• Boundary defined by parametric functions:

• Example: ellipse

cossin

Page 9: 3D Modeling Parametric Curves & Surfaces

Parametric Curves

• How can we define arbitrary curves?

u

Page 10: 3D Modeling Parametric Curves & Surfaces

Parametric Curves

• How can we define arbitrary curves?

• Use functions that “blend” control pointsV0

V1

u

Page 11: 3D Modeling Parametric Curves & Surfaces

Parametric Curves

• More generally:

Page 12: 3D Modeling Parametric Curves & Surfaces

Parametric Curves

• What B(u) functions should we use?

V0

V1

Page 13: 3D Modeling Parametric Curves & Surfaces

Parametric Curves

• What B(u) functions should we use?

Page 14: 3D Modeling Parametric Curves & Surfaces

Parametric Polynomial Curves

• Polynomial blending functions:

• Advantages of polynomials– Easy to compute– Easy differentiation– Easy to derive curve properties

Page 15: 3D Modeling Parametric Curves & Surfaces

Parametric Polynomial Curves

• Polynomial blending functions:

• What degree polynomial?– Easy to compute– Easy to control– Expressive

Page 16: 3D Modeling Parametric Curves & Surfaces

Parametric Cubic Curves

• Why cubic?– lower-degree polynomials give too little

flexibility in controlling the shape of the curve

– higher-degree polynomials can introduce unwanted wiggles and require more computation

– lowest degree that allows specification of endpoints and their derivatives

– lowest degree that is not planar in 3D

Page 17: 3D Modeling Parametric Curves & Surfaces

Parametric Cubic Curves

• General form:

3 2

3 2

3 2

3 2

( )

( )

( )

[ 1]

( ) [ ( ) ( ) ( )]

x x x x

y y y y

z z z z

x y z

x y z

x y z

x y z

x u a u b u c u d

y u a u b u c u d

z u a u b u c u da a ab b b

C T u u uc c cd d d

Q u x u y u z u T C

Page 18: 3D Modeling Parametric Curves & Surfaces

Major Types of Parametric Cubic Curves

• Cubic Bézier– defined by two endpoints and two other points

that control the endpoint tangent vectors• Hermite

– defined by two endpoints and two tangent vectors

• Splines– several kinds, each defined by four points– uniform B-splines, non-uniform B-splines, ß-

splines

Page 19: 3D Modeling Parametric Curves & Surfaces

Bézier Curves

• In 1962, Pierre Bézier, an engineer of French Renault Car company, proposed a new kind of curve representation, and finally developed a system UNISURF for car surface design in 1972.

Page 20: 3D Modeling Parametric Curves & Surfaces

Bézier Curves

• Two contributors– Pierre Bézier (at Renault)– Paul de Casteljau (at Citroen)

• Curve Q(u) is defined by nested interpolation:

’s are control points, , … , is control polygon

Page 21: 3D Modeling Parametric Curves & Surfaces

Basic properties of Bézier curves

• Endpoint interpolation:

• Convex hull:– Curve is contained within convex hull of control

polygon

• Transformational invariance

• Symmetrydefined by , … , ≡ defined by

, … ,

Page 22: 3D Modeling Parametric Curves & Surfaces

More Properties

• General case: Bernstein polynomials

• Degree: polynomial of degree n

• Tangents:

Page 23: 3D Modeling Parametric Curves & Surfaces

Some Bézier Curves

Page 24: 3D Modeling Parametric Curves & Surfaces

Some Bézier Curves

Animation of a quadratic Béziercurve, t in [0,1]

Animation of a cubic Béziercurve, t in [0,1]

Page 25: 3D Modeling Parametric Curves & Surfaces

Cubic Bézier Curves

, , ,

Page 26: 3D Modeling Parametric Curves & Surfaces

Hermite Curves

• Given: two points and two tangent vectors– Similarity to cubic Bézier curves– Other two Bézier control points along those

tangents• Call the points and , and the tangents and

• So given two points and vectors, find the coefficients of etc.

Page 27: 3D Modeling Parametric Curves & Surfaces

Hermite Curves

• We can treat x in the mapping as a vector. Its components can be explicitly written as

3

1 0 1 0 2

1 0 1 0

1 0 1 0

2 3 0 02 3 0 11 1 0 01 2 1 0 1

ux x x x x

uy y y y y

uz z z z z

Page 28: 3D Modeling Parametric Curves & Surfaces

Longer Curves

• A single cubic Bezier or Hermite curve can only capture a small class of curves– At most 2 inflection points

• One solution is to raise the degree– Allows more control, at the expense of more control

points and higher degree polynomials– Control is not local, one control point influences entire

curve• Alternate, most common solution is to join pieces of cubic

curve together into piecewise cubic curves– Total curve can be broken into pieces, each of which is

cubic– Local control: Each control point only influences a limited

part of the curve– Interaction and design is much easier

Page 29: 3D Modeling Parametric Curves & Surfaces

Piecewise Bézier Curve

“knot”P0,0

P0,1 P0,2

P0,3

P1,0

P1,1

P1,2

P1,3

Page 30: 3D Modeling Parametric Curves & Surfaces

Continuity

• Question: – How do we ensure that two Hermite curves are

C1 across a knot?

• Question: – How do we ensure that two Bézier curves are C0,

or C1, or C2 across a knot?

Page 31: 3D Modeling Parametric Curves & Surfaces

Achieving Continuity

• For Hermite curves, the user specifies the derivatives, so C1 is achieved simply by sharing points and derivatives across the knot

• For Bézier curves:– They interpolate their endpoints, so C0 is achieved

by sharing control points– The parametric derivative is a constant multiple of

the vector joining the first/last 2 control points– So C1 is achieved by setting P0,3=P1,0=J, and making

P0,2 and J and P1,1 collinear, with J-P0,2=P1,1-J– C2 comes from further constraints on P0,1 and P1,2

Page 32: 3D Modeling Parametric Curves & Surfaces

Bézier Continuity

P0,0

P0,1 P0,2

J

P1,1

P1,2

P1,3

Page 33: 3D Modeling Parametric Curves & Surfaces

B-Spline Curves

• Why to introduce B-Spline?– Bezier curve/surface has many advantages, but

they have two main shortcomings:• Bezier curve/surface cannot be modified

locally• It is very complex to satisfy geometric

continuity conditions for Bezier curves or surfaces joining.

• Why not use lower degree piecewise polynomial with continuous joining?– that’s Spline

Page 34: 3D Modeling Parametric Curves & Surfaces

B-Spline Curves

• Formula of B-Spline Curve.

• Pi (i=0,1,…,n) are control points.• Ni,k(t) (i=0,1,...,n) are the i-th B-Spline basis function

of order k. • B-Spline basis function is an order k (degree k -1)

piecewise polynomial.

Page 35: 3D Modeling Parametric Curves & Surfaces

B-Spline Curves

• Definition of B-Spline Basis Function

Page 36: 3D Modeling Parametric Curves & Surfaces

B-Spline Curves

Cubic B-Spline n=3, k=4

p0

p1

p2

p3

p(u) = (–1/6p0+1/2p1–1/2p2+1/6p3)u3 +( 1/2p0 – p1+1/2p2 )u2 +(–1/2p0 + 1/2p2 )u +

1/6p0+2/3p1+1/6p2

but makes more sense as…

p(u) = (–1/6u3 + 1/2u2 – 1/2u + 1/6)p0 +( 1/2u3 – u2 + 2/3)p1 +(–1/2u3 + 1/2u2 + 1/2u + 1/6)p2 +( 1/6u3 )p3

Page 37: 3D Modeling Parametric Curves & Surfaces

B-Spline Curves

• In matrix form

, , ,

Page 38: 3D Modeling Parametric Curves & Surfaces

B-Spline Curves

• Examples:

Page 39: 3D Modeling Parametric Curves & Surfaces

B-Spline Curves

• Properties:– Local – Continuity

• P(t) is Ck-1-r continuous at a node of repetitiveness r.– Convex hull– Piecewise polynomial– Geometry invariant– Affine invariant– Flexibility

Page 40: 3D Modeling Parametric Curves & Surfaces

How to Choose a Spline

• Hermite curves are good for single segments where you know the parametric derivative or want easy control of it

• Bézier curves are good for single segments or patches where a user controls the points

• B-splines are good for large continuous curves and surfaces

• NURBS are the most general, and are good when that generality is useful, or when conic sections must be accurately represented (CAD)

Page 41: 3D Modeling Parametric Curves & Surfaces

Parametric Surfaces

• Boundary defined by parametric functions:,,,

Page 42: 3D Modeling Parametric Curves & Surfaces

Parametric Surfaces

• Boundary defined by parametric functions:,,,

• Example: quadrilateral

, 1 1 1, 1 1 1, 1 1 1

Page 43: 3D Modeling Parametric Curves & Surfaces

Parametric Surfaces

• Boundary defined by parametric functions:,,,

• Example: quadrilateral

, 1 1 1, 1 1 1, 1 1 1

Page 44: 3D Modeling Parametric Curves & Surfaces

Parametric Surfaces

• Boundary defined by parametric functions:,,,

• Example: ellipsoid

, cos cos, cos sin, sin

Page 45: 3D Modeling Parametric Curves & Surfaces

Parametric Surfaces

Advantage: easy to enumerate points on surface.

Disadvantage: need piecewise-parametric surfaceto describe complex shape.

Page 46: 3D Modeling Parametric Curves & Surfaces

Piecewise Polynomial Parametric Surfaces

• Surface is partitioned into parametric patches:

Page 47: 3D Modeling Parametric Curves & Surfaces

Parametric Patches

• Each patch is defined by blending control points

Same ideas as parametric curves!

Page 48: 3D Modeling Parametric Curves & Surfaces

Parametric Patches

• Point Q(u,v) on the patch is the tensor product of parametric curves defined by the control points

Page 49: 3D Modeling Parametric Curves & Surfaces

Parametric Bicubic Patches

• Point Q(u,v) on any patch is defined by combining control points with polynomial blending functions:

,

, ,

, ,

, ,

, ,

, ,

, ,

, ,

, ,

,

Where M is a matrix describing the blending functions for a parametric cubic curve (e.g., Bézier, B-spline, etc.)

Page 50: 3D Modeling Parametric Curves & Surfaces

Bézier Patches

, é

, ,

, ,

, ,

, ,

, ,

, ,

, ,

, ,

é

é

1 3331

630

3 1300

000

Page 51: 3D Modeling Parametric Curves & Surfaces

Bézier Patches

• The patch interpolates its corner points– Comes from the interpolation property of the

underlying curves• The tangent plane at each corner interpolates the

corner vertex and the two neighboring edge vertices

• The patch lies within the convex hull of its control vertices– The basis functions sum to one and are positive

everywhere

Page 52: 3D Modeling Parametric Curves & Surfaces

Bézier Patches

• A patch mesh is just many patches joined together along their edges– Patches meet along complete edges– Each patch must be a quadrilateral

OKNot OK Not OK Not OK

Page 53: 3D Modeling Parametric Curves & Surfaces

Bézier Surfaces

• Continuity constraints are similar to the ones for Bézier splines

Page 54: 3D Modeling Parametric Curves & Surfaces

Bézier Surfaces

• C0 continuity requires aligning boundary curves

Page 55: 3D Modeling Parametric Curves & Surfaces

Bézier Surfaces

• C1 continuity requires aligning boundary curves and derivatives

Page 56: 3D Modeling Parametric Curves & Surfaces

B-Spline Patches

,

, ,

, ,

, ,

, ,

, ,

, ,

, ,

, ,

1/6 1/21/21/21/6

102/3

1/2 1/61/21/21/6

000

Page 57: 3D Modeling Parametric Curves & Surfaces

Parametric Surfaces

• Advantages:– Easy to enumerate points on surface– Possible to describe complex shapes

• Disadvantages:– Control mesh must be quadrilaterals– Continuity constraints difficult to maintain– Hard to find intersections

Page 58: 3D Modeling Parametric Curves & Surfaces

Summary

Feature Polygon Mesh Subdivision Surface

Parametric Surface

AccurateConciseIntuitive specificationLocal supportAffine invariantArbitrary topologyGuaranteed continuityNatural parameterizationEfficient displayEfficient intersections

NoNoNoYesYesYesNoNoYesNo

YesYesNoYesYesYesYesNoYesNo

YesYesYesYesYesNoYesYesYesNo