程序代写代做代考 cse3431-lecture17-surfaces

cse3431-lecture17-surfaces

Surfaces

Formulations
Implicit: f(x,y,z) = 0
Normal

Explicit: z = f(x,y)

Parametric: x = fx(s,t), y = fy(s,t), z=fz(s,t)

Quadric surfaces

Sphere:

Quadric surfaces

f(x, y, z) = (x� x0)2 + (y � y0)2 + (z � z0)2 = R2

x(�, ✓) = Rcos(�)cos(✓) + x0

y(�, ✓) = Rcos(�)sin(✓) + y0

z(�, ✓) = Rsin(�) + z0

� ⇡/2  �  ⇡/2
� ⇡  ✓  ⇡

x

y

z


Quadric surfaces
Ellipsoid

f(x, y, z) = (
x� x0
Rx

)2 + (
y � y0
Ry

)2 + (
z � z0
Rz

)2 = 1

x(�, ✓) = Rxcos(�)cos(✓) + x0

y(�, ✓) = Rycos(�)sin(✓) + y0

z(�, ✓) = Rzsin(�) + z0

� ⇡/2  �  ⇡/2
� ⇡  ✓  ⇡

Height fields
y=f(x,z)

Typical height fields
Gaussian

Sinc

Parametric formulations
Ruled surfaces:
Linear combination of two curves
• Through every point on the surface there passes at least

one line that lies on the surface

P0(v)

P1(v)

Special cases
General cone

General Cylinder
P1 a translated version of P0

Bilinear patches
Both P1 and P0 are lines

Surfaces of revolution
Sweep profile curve around an axis:
C(v) = (X(v),Z(v))
P(u, v)=(X(v)cos(u),X(v)sin(u), Z(v))

X

Z

Example
Curve

Surface

Parametric surfaces from control
points (constraints)

Extension of the curve form to two dimensions
Curve: P(s) = SMG = [s3 s2 s 1]MG with s in [0,1]
Surface: P(s,t) = SMG(t) with s,t in [0,1]

Example: Bezier curve P (s) of four points P1,P2,P3,P4:

P (s) = SMG, s 2 [0, 1] or

x(s) y(s) z(s)


=


s3 s2 s 1


M


Gx Gy Gz


or


x(s) y(s) z(s)


=


s3 s2 s 1


M

2

66
4

P1,x P1,y P1,z
P2,x P2,y P2,z
P3,x P3,y P3,z
P4,x P4,y P4,z

3

77
5

Bezier Surfaces
Take a bezier curve P(s)
and let its control points
become bezier curves
P(s) = S M G(t)
G(t) = [P1(t) P2(t) P3(t) P4(t)]T

Where:
Pi(t) = T M Gi = TM[ Pi1 Pi2 Pi3 Pi4]T

Total: 4×4 = 16 control points

Pij, i=1,2,3,4, j =1,2,3,4

(transpose)

Tensor product representation (easier per
dimension)

Px(s, t) = SMGx(t) = SM

2

66
4

P1,x(t)
P2,x(t)
P3,x(t)
P4,x(t)

3

77
5 , where

Pi,x(t) = G
T
i,xM

TTT =

Pi1,x Pi2,x Pi3,x Pi4,x


MTTT

Together they give:

Px(s, t) = SMGx(t) = SM

2

66
4

P1,x(t)
P2,x(t)
P3,x(t)
P4,x(t)

3

77
5 = SM

2

66
4

GT1,xM
TT t

GT2,xM
TT t

GT3,xM
TT t

GT4,xM
TT t

3

77
5 !

Px(s, t) = SM

2

66
4

P11,x P12,x P13,x P14,x
P21,x P22,x P23,x P24,x
P31,x P32,x P33,x P34,x
P41,x P42,x P43,x P44,x

3

77
5M

TTT

Px(s, t) = SMGxM
TTT , (s, t) 2 [0, 1]⇥ [0, 1]

Similarly:

Py(s, t) = SMGyM
TTT , (s, t) 2 [0, 1]⇥ [0, 1]

Pz(s, t) = SMGzM
TTT , (s, t) 2 [0, 1]⇥ [0, 1]

Tensor product representation

More compactly:

P (s, t) = SMGMTTT , (s, t) 2 [0, 1]⇥ [0, 1] or

P (s, t) =

s3 s2 s 1


M

2

66
4

P11 P12 P13 P14
P21 P22 P23 P24
P31 P32 P33 P34
P41 P42 P43 P44

3

77
5M

T

2

66
4

t3

t2

t
1

3

77
5

Properties of Bezier surfaces

Affine Invariance
Convex Hull
Plane precision
Variation diminishing

Hermite surfaces
Constraints at the four corners:
• Position, Tangent, Twist t

s

Piecewise cubic bezier surfaces

G1 continuity
Common edge
Make 2 sets of 4 control
points collinear

Rendering parametric curves
and surfaces

Transform into primitives we know how to handle
Curves
• Line segments

Surfaces
• Quadrilaterals
• Triangles

Converting to quadrilaterals
Straightforward
Uniform subdivision

Evaluation of P(s,t) at each 

grid point

Isoparametric lines (islines)

become isoparametric 

curves

Isolines

Optimizations
x(s,t) = S M Gx MT TT

• M G MT remains constant over patch: precompute
• S M and MT TT remain constant over all patches:


precompute S M and store in Q[s]

Q[t] = QT[s] assuming equal subdivisions in s and t

Computing surface normals
Parametric surface P(u,v)
P(u,v) = U M G MT VT

Cubic Bezier patch forms
Pick the most convenient
• a)

• b)

P (s, t) = [ s3 s2 s 1 ]MGM

2

66
4

t3

t2

t
1

3

77
5 (s, t) 2 [0, 1]⇥ [0, 1]

P (s, t) =
3X

i=0

B3i (s)
3X

i=0

B3j (t)Pij , (s, t) 2 [0, 1]⇥ [0, 1]

where the Bernstein polynomials are

B30(v) = (1� v)
3, B31(v) = 3(1� v)

2v,

B32(v) = 3(1� v)v
2, B33(v) = u

3

General form of a cubic patch

P (s, t) =
15X

i=0

Bi(s, t)Gi, (s, t) 2 [0, 1]⇥ [0, 1]

where

Bi(s, t) : Cubic polynomials in two variables

Gi : Point or tangent constraints