Introduction to Computer Graphics Modeling (1) April 18, 2019 - - PowerPoint PPT Presentation

β–Ά
introduction to computer graphics modeling 1
SMART_READER_LITE
LIVE PREVIEW

Introduction to Computer Graphics Modeling (1) April 18, 2019 - - PowerPoint PPT Presentation

Introduction to Computer Graphics Modeling (1) April 18, 2019 Kenshi Takayama Some additional notes on quaternions 2 Another explanation for quaternions (overview) 1. Any rotation can be decomposed into even number of reflections 2.


slide-1
SLIDE 1

Introduction to Computer Graphics – Modeling (1) –

April 18, 2019 Kenshi Takayama

slide-2
SLIDE 2

Some additional notes on quaternions

2

slide-3
SLIDE 3

Another explanation for quaternions (overview)

  • 1. Any rotation can be decomposed

into even number of reflections

  • 2. Quaternions can concisely describe reflections in 3D

𝑆 Τ¦

𝑔 Τ¦

𝑦 = βˆ’ Τ¦ 𝑔 Τ¦ 𝑦 Τ¦ π‘”βˆ’1

  • 3. Combining two reflections equivalent to the rotation leads to the

formula

𝑆𝑕 𝑆 Τ¦

𝑔 Τ¦

𝑦 = cos πœ„

2 + πœ• sin πœ„ 2

Τ¦ 𝑦 cos πœ„

2 βˆ’ πœ• sin πœ„ 2

3

slide-4
SLIDE 4

Any rotation can be decomposed into even number of reflections

  • Mathematically proven
  • Valid for any dimensions
  • Not unique (of course!)

4

R

πœ„ 2 πœ„ 4

πœ„

R

πœ„ 2 3πœ„ 4

πœ„

πœ„ 2

πœ„

R

One way Another way

slide-5
SLIDE 5

Quaternions recap

  • Complex number: real + imaginary

𝑏 + 𝑐 𝐣

  • Quaternion: scalar + vector

𝑏 + Τ¦ 𝑀

  • Definition of quaternion multiplication:

𝑏1 + 𝑀1 𝑏2 + 𝑀2 ≔ 𝑏1𝑏2 βˆ’ 𝑀1 β‹… 𝑀2 + 𝑏1𝑀2 + 𝑏2𝑀1 + 𝑀1 Γ— 𝑀2

  • Pure vectors can take multiplication by interpreting them as quaternions:

𝑀1 𝑀2 = βˆ’π‘€1 β‹… 𝑀2 + 𝑀1 Γ— 𝑀2

  • Notable properties:
  • (Relevant later)

5

Τ¦ 𝑀 Τ¦ 𝑀 = βˆ’ Τ¦ 𝑀 2 Τ¦ π‘€βˆ’1 = βˆ’ Τ¦ 𝑀 Τ¦ 𝑀 2

If Τ¦ 𝑀 β‹… π‘₯ = 0 , then Τ¦ 𝑀 π‘₯ = βˆ’π‘₯ Τ¦ 𝑀

Τ¦ 𝑀 Γ— Τ¦ 𝑀 is always zero Scalar part Vector part Τ¦ 𝑀 π‘₯ = Τ¦ 𝑀 Γ— π‘₯ = βˆ’π‘₯ Γ— Τ¦ 𝑀 = βˆ’π‘₯ Τ¦ 𝑀 Multiplying Τ¦ 𝑀 to rhs produces 1

slide-6
SLIDE 6

Describing reflections using quaternions

  • Reflection of a point Τ¦

𝑦 across a plane

  • rthogonal to Τ¦

𝑔: 𝑆 Τ¦

𝑔 Τ¦

𝑦 ≔ βˆ’ Τ¦ 𝑔 Τ¦ 𝑦 Τ¦ π‘”βˆ’1

  • Holds essential properties of reflections:
  • Linearity:

𝑆 Τ¦

𝑔 𝑏 Τ¦

𝑦 + 𝑐 Τ¦ 𝑧 = 𝑏 𝑆 Τ¦

𝑔 Τ¦

𝑦 + 𝑐 𝑆 Τ¦

𝑔 Τ¦

𝑧

  • Τ¦

𝑔 gets mapped to βˆ’ Τ¦ 𝑔 :

𝑆 Τ¦

𝑔 Τ¦

𝑔 = βˆ’ Τ¦ 𝑔 Τ¦ 𝑔 Τ¦ π‘”βˆ’1 = βˆ’ Τ¦ 𝑔

  • If a point Τ¦

𝑦 satisfies Τ¦ 𝑦 β‹… Τ¦ 𝑔 = 0 (i.e. on the plane), Τ¦ 𝑦 doesn’t move:

𝑆 Τ¦

𝑔 Τ¦

𝑦 = βˆ’ Τ¦ 𝑔 Τ¦ 𝑦 Τ¦ π‘”βˆ’1 = βˆ’ βˆ’ Τ¦ 𝑦 Τ¦ 𝑔 Τ¦ π‘”βˆ’1 = Τ¦ 𝑦

6

Τ¦ 𝑦 𝑆 Τ¦

𝑔 Τ¦

𝑦 Τ¦ 𝑔 𝑃

https://math.stackexchange.com/a/7263

Because if Τ¦ 𝑦 β‹… Τ¦ 𝑔 = 0 , then Τ¦ 𝑔 Τ¦ 𝑦 = βˆ’ Τ¦ 𝑦 Τ¦ 𝑔

slide-7
SLIDE 7

Setup for rotation around arbitrary axis

  • Rotation axis (unit vector): πœ•
  • Rotation angle: πœ„
  • Point before rotation: Τ¦

𝑦

  • Point after rotation: Τ¦

𝑧 ≔ π‘†πœ•, πœ„ Τ¦ 𝑦

  • Think of local 2D coordinate system:
  • β€œRight” vector : 𝑣 ≔ Τ¦

𝑦 βˆ’ πœ• β‹… Τ¦ 𝑦 πœ•

  • β€œUp” vector: Τ¦

𝑀 ≔ πœ• Γ— Τ¦ 𝑦

  • Note that 𝑣

= Τ¦ 𝑀

  • (Let’s call it 𝑀)

7

πœ• πœ„ Τ¦ 𝑦 Τ¦ 𝑧 𝑣 Τ¦ 𝑀

https://thimbleprojects.org/kenshi84/50110/demo/quaternion-schematic.html

πœ• β‹… Τ¦ 𝑦 𝑀

𝑃

slide-8
SLIDE 8

Decompose rotation into two reflections

8

1st reflection:

Τ¦ 𝑔 ≔ Τ¦ 𝑀

2nd reflection:

Τ¦ 𝑕 ≔ βˆ’ sin πœ„

2 𝑣 + cos πœ„ 2 Τ¦

𝑀

Top view

Τ¦ 𝑔 Τ¦ 𝑕 πœ„

https://thimbleprojects.org/kenshi84/50110/demo/quaternion-schematic.html

πœ„ 2

slide-9
SLIDE 9

Combining two reflections

  • Formula: 𝑆𝑕 𝑆 Τ¦

𝑔 Τ¦

𝑦 = 𝑆𝑕 βˆ’ Τ¦ 𝑔 Τ¦ 𝑦 Τ¦ π‘”βˆ’1 = βˆ’ Τ¦ 𝑕 βˆ’ Τ¦ 𝑔 Τ¦ 𝑦 Τ¦ π‘”βˆ’1 Τ¦ π‘•βˆ’1 = Τ¦ 𝑕 Τ¦ 𝑔 Τ¦ 𝑦 Τ¦ π‘”βˆ’1 Τ¦ π‘•βˆ’1

  • Substitute

Τ¦ 𝑔 ≔ Τ¦ 𝑀, 𝑕 ≔ βˆ’ sin πœ„

2 𝑣 + cos πœ„ 2 Τ¦

𝑀 to the above

  • For the left part Τ¦

𝑕 Τ¦ 𝑔 :

Τ¦ 𝑕 β‹… Τ¦ 𝑔 = βˆ’ sin πœ„

2 𝑣 + cos πœ„ 2 Τ¦

𝑀 β‹… Τ¦ 𝑀 = 𝑀2 cos πœ„

2

Τ¦ 𝑕 Γ— Τ¦ 𝑔 = βˆ’ sin πœ„

2 𝑣 + cos πœ„ 2 Τ¦

𝑀 Γ— Τ¦ 𝑀 = βˆ’π‘€2 sin πœ„

2 πœ•

Therefore,

Τ¦ 𝑕 Τ¦ 𝑔 = βˆ’ Τ¦ 𝑕 β‹… Τ¦ 𝑔 + Τ¦ 𝑕 Γ— Τ¦ 𝑔 = βˆ’π‘€2 cos πœ„

2 + πœ• sin πœ„ 2

  • The right part Τ¦

π‘”βˆ’1 Τ¦ π‘•βˆ’1 = 𝑔 𝑕

𝑀4 is analogous: Τ¦

π‘”βˆ’1 Τ¦ π‘•βˆ’1 = βˆ’π‘€βˆ’2 cos πœ„

2 βˆ’ πœ• sin πœ„ 2

  • Finally, we get the formula:

π‘†πœ•, πœ„ Τ¦ 𝑦 = 𝑆𝑕 𝑆 Τ¦

𝑔 Τ¦

𝑦 = βˆ’π‘€2 cos πœ„

2 + πœ• sin πœ„ 2

Τ¦ 𝑦 βˆ’π‘€βˆ’2 cos πœ„

2 βˆ’ πœ• sin πœ„ 2

= cos πœ„

2 + πœ• sin πœ„ 2

Τ¦ 𝑦 cos πœ„

2 βˆ’ πœ• sin πœ„ 2 9

(because 𝑣 β‹… Τ¦ 𝑀 = 0 ) (because 𝑣 Γ— Τ¦ 𝑀 = 𝑀2πœ• )

slide-10
SLIDE 10
  • Any rotations (poses) can be

represented as unit quaternions

  • Points on hypersphere of 4D space
  • Fix πœ• and vary πœ„

 unit circle in 4D space

  • A pose after rotating 360Β°about a certain axis

is represented as another quaternion

  • One pose corresponds to two quaternions

(double cover)

  • A geodesic between two points π‘ž, π‘Ÿ on the

hypersphere represents interpolation of these poses

  • Should pick either π‘Ÿ or βˆ’π‘Ÿ which is closer to π‘ž (i.e. 4D dot product is positive)

Representing and blending poses using quaternions

10

ℝ4 π‘ž = cos πœ„

2 + πœ• sin πœ„ 2

π‘Ÿ βˆ’π‘Ÿ (1, 0,0,0) (-1, 0,0,0) (0, πœ•x,πœ•y,πœ•z) (0, -πœ•x,-πœ•y,-πœ•z) πœ„=0 πœ„=𝜌 πœ„=2𝜌 πœ„=3𝜌

slide-11
SLIDE 11

Normalize quaternions or not?

  • Any quaternions can be written as scaling of unit quaternions

π‘Ÿ = 𝑠 cos πœ„

2 + πœ• sin πœ„ 2 , π‘Ÿβˆ’1 = π‘ βˆ’1 cos πœ„ 2 βˆ’ πœ• sin πœ„ 2

  • In the rotation formula, the scaling part is cancelled

π‘Ÿ Τ¦ 𝑦 π‘Ÿβˆ’1 = 𝑠 cos πœ„

2 + πœ• sin πœ„ 2

Τ¦ 𝑦 π‘ βˆ’1 cos πœ„

2 βˆ’ πœ• sin πœ„ 2

= cos πœ„

2 + πœ• sin πœ„ 2

Τ¦ 𝑦 cos πœ„

2 βˆ’ πœ• sin πœ„ 2

 so, normalization isn’t needed?

  • In practice, don’t use quaternion mults for computing

coordinate transformation (because inefficient)

  • Just do explicit vector calc using axis & angle

Τ¦ 𝑦 βˆ’ πœ• β‹… Τ¦ 𝑦 πœ• cos πœ„ + πœ• Γ— Τ¦ 𝑦 sin πœ„ + πœ• β‹… Τ¦ 𝑦 πœ•

  • Can get axis & angle only after normalization
  • Un-normalized can cause artifact when interpolated

11

𝑠 = 1

π‘Ÿ1 π‘Ÿ2

π‘Ÿ1+π‘Ÿ2 2

slide-12
SLIDE 12

Modeling curves

12

slide-13
SLIDE 13

Parametric curves

  • X & Y coordinates defined by parameter t (β‰… time)
  • Example: Cycloid

𝑦 𝑒 = 𝑒 βˆ’ sin 𝑒 𝑧 𝑒 = 1 βˆ’ cos 𝑒

  • Tangent (aka. derivative, gradient) vector: 𝑦′ 𝑒 , 𝑧′ 𝑒
  • Polynomial curve: 𝑦 𝑒 = σ𝑗 𝑏𝑗𝑒𝑗

13

slide-14
SLIDE 14

Cubic Hermite curves

  • Cubic polynomial curve interpolating

derivative constraints at both ends (Hermite interpolation)

  • 4 constraints  4 DoF needed

 4 coefficients  cubic

  • 𝑦 𝑒 = 𝑏0 + 𝑏1𝑒 + 𝑏2𝑒2 + 𝑏3𝑒3
  • 𝑦′ 𝑒 = 𝑏1 + 2𝑏2𝑒 + 3𝑏3𝑒2
  • Coeffs determined by substituting

constrained values & derivatives

14

𝑦 0 = 𝑦0 𝑦 1 = 𝑦1 𝑦′(0) = 𝑦0

β€²

𝑦′ 1 = 𝑦1

β€²

𝑦 0 = 𝑏0 = 𝑦0 𝑦 1 = 𝑏0 + 𝑏1 + 𝑏2 + 𝑏3 = 𝑦1 𝑦′ 0 = 𝑏1 = 𝑦0

β€²

𝑦′ 1 = 𝑏1 + 2 𝑏2 + 3 𝑏3 = 𝑦1

β€²

 𝑏0 = 𝑦0 𝑏1 = 𝑦0

β€²

𝑏2 = βˆ’3 𝑦0 + 3 𝑦1 βˆ’ 2 𝑦0

β€² βˆ’ 𝑦1 β€²

𝑏3 = 2 𝑦0 βˆ’ 2 𝑦1 + 𝑦0

β€² + 𝑦1 β€² t x 1

slide-15
SLIDE 15

Bezier curves

  • Input: 3 control points (CPs) 𝑄0, 𝑄

1, 𝑄2

  • Coordinates of points in

arbitrary domain (2D, 3D, ...)

  • Output: Curve 𝑄 𝑒 satisfying

𝑄 0 = 𝑄0 𝑄 1 = 𝑄2 while being β€œpulled” by 𝑄

1

15

𝑄 𝑒 = 1 βˆ’ 𝑒 𝑄0 + 𝑒 𝑄2 𝑄 𝑒 = ? 𝑄

1

𝑄2 𝑄0

t=0 t=1

  • Eq. of line segment
  • Eq. of Bezier curve
slide-16
SLIDE 16

Bezier curves

  • 𝑄01 𝑒 = 1 βˆ’ 𝑒 𝑄0 + 𝑒 𝑄

1

  • 𝑄

12 𝑒 = 1 βˆ’ 𝑒 𝑄 1 + 𝑒 𝑄2

  • 𝑄01 0 = 𝑄0
  • 𝑄

12 1 = 𝑄2

  • Idea: ”Interpolate the interpolation”

As 𝑒 changes 0 β†’ 1 , smoothly transition from 𝑄01 to 𝑄

12

  • 𝑄012 𝑒 = 1 βˆ’ 𝑒 𝑄01 𝑒 + 𝑒 𝑄

12 𝑒

= 1 βˆ’ 𝑒 1 βˆ’ 𝑒 𝑄0 + 𝑒 𝑄

1 + 𝑒

1 βˆ’ 𝑒 𝑄

1 + 𝑒 𝑄2

= 1 βˆ’ 𝑒 2𝑄0 + 2𝑒 1 βˆ’ 𝑒 𝑄

1 + 𝑒2𝑄2

16

𝑄

1

𝑄2 𝑄0 𝑄

12 𝑒 𝑒 𝑒 𝑒 1 βˆ’ 𝑒 1 βˆ’ 𝑒

𝑄01 𝑒 𝑄012 𝑒

1 βˆ’ 𝑒 Quadratic Bezier curve

  • Eq. of line
  • Eq. of line
slide-17
SLIDE 17

Bezier curves

  • 𝑄01 𝑒 = 1 βˆ’ 𝑒 𝑄0 + 𝑒 𝑄

1

  • 𝑄

12 𝑒 = 1 βˆ’ 𝑒 𝑄 1 + 𝑒 𝑄2

  • 𝑄01 0 = 𝑄0
  • 𝑄

12 1 = 𝑄2

  • Idea: ”Interpolate the interpolation”

As 𝑒 changes 0 β†’ 1 , smoothly transition from 𝑄01 to 𝑄

12

  • 𝑄012 𝑒 = 1 βˆ’ 𝑒 𝑄01 𝑒 + 𝑒 𝑄

12 𝑒

= 1 βˆ’ 𝑒 1 βˆ’ 𝑒 𝑄0 + 𝑒 𝑄

1 + 𝑒

1 βˆ’ 𝑒 𝑄

1 + 𝑒 𝑄2

= 1 βˆ’ 𝑒 2𝑄0 + 2𝑒 1 βˆ’ 𝑒 𝑄

1 + 𝑒2𝑄2

17

𝑄

1

𝑄2 𝑄0

Quadratic Bezier curve

slide-18
SLIDE 18
  • Exact same idea applied to 4 points 𝑄0, 𝑄

1, 𝑄2 𝑄3:

  • As 𝑒 changes 0 β†’ 1, transition from 𝑄012 to 𝑄

123

  • 𝑄0123 𝑒 = 1 βˆ’ 𝑒 𝑄012 𝑒 + 𝑒 𝑄

123 𝑒

= 1 βˆ’ 𝑒

1 βˆ’ 𝑒 2𝑄0 + 2𝑒 1 βˆ’ 𝑒 𝑄

1 + 𝑒2𝑄2 + 𝑒

1 βˆ’ 𝑒 2𝑄

1 + 2𝑒 1 βˆ’ 𝑒 𝑄2 + 𝑒2𝑄 3

= 1 βˆ’ 𝑒 3𝑄0 + 3𝑒 1 βˆ’ 𝑒 2𝑄

1 + 3𝑒2 1 βˆ’ 𝑒 𝑄2 + 𝑒3𝑄3

Cubic Bezier curve

18

𝑄

123 𝑒

𝑄012 𝑒 𝑄0123 𝑒

𝑒 1 βˆ’ 𝑒

𝑄

1

𝑄3 𝑄0 𝑄2

Cubic Bezier curve

  • Quad. Bezier
  • Quad. Bezier
slide-19
SLIDE 19
  • Exact same idea applied to 4 points 𝑄0, 𝑄

1, 𝑄2 𝑄3:

  • As 𝑒 changes 0 β†’ 1, transition from 𝑄012 to 𝑄

123

  • 𝑄0123 𝑒 = 1 βˆ’ 𝑒 𝑄012 𝑒 + 𝑒 𝑄

123 𝑒

= 1 βˆ’ 𝑒

1 βˆ’ 𝑒 2𝑄0 + 2𝑒 1 βˆ’ 𝑒 𝑄

1 + 𝑒2𝑄2 + 𝑒

1 βˆ’ 𝑒 2𝑄

1 + 2𝑒 1 βˆ’ 𝑒 𝑄2 + 𝑒2𝑄 3

= 1 βˆ’ 𝑒 3𝑄0 + 3𝑒 1 βˆ’ 𝑒 2𝑄

1 + 3𝑒2 1 βˆ’ 𝑒 𝑄2 + 𝑒3𝑄3

  • Can easily control tangent at endpoints  ubiquitously used in CG

Cubic Bezier curve

19

𝑄

1

𝑄3 𝑄0 𝑄2 𝑄0123 𝑒

Cubic Bezier curve

slide-20
SLIDE 20

n-th order Bezier curve

  • Input: n+1 control points 𝑄0, β‹― , 𝑄

π‘œ

𝑄 𝑒 = ෍

𝑗=0 π‘œ π‘œC𝑗 𝑒𝑗 1 βˆ’ 𝑒 π‘œβˆ’π‘— 𝑄𝑗

20

𝑐𝑗

π‘œ(𝑒)

Bernstein basis function

1 βˆ’ 𝑒 4𝑄0 + 4𝑒 1 βˆ’ 𝑒 3𝑄

1

+ 6𝑒2 1 βˆ’ 𝑒 2𝑄2 + 4𝑒3 1 βˆ’ 𝑒 𝑄3 + 𝑒4𝑄

4

1 βˆ’ 𝑒 5𝑄0 + 5𝑒 1 βˆ’ 𝑒 4𝑄

1

+ 10𝑒2 1 βˆ’ 𝑒 3𝑄2 + 10𝑒3 1 βˆ’ 𝑒 2𝑄3 + 5𝑒4 1 βˆ’ 𝑒 𝑄

4

+ 𝑒5𝑄5

Quartic (4th) Quintic (5th)

slide-21
SLIDE 21

Cubic Bezier curves & cubic Hermite curves

  • Cubic Bezier curve & its derivative:
  • 𝑄 𝑒 = 1 βˆ’ 𝑒 3𝑄0 + 3𝑒 1 βˆ’ 𝑒 2𝑄

1 + 3𝑒2 1 βˆ’ 𝑒 𝑄2 + 𝑒3𝑄3

  • 𝑄′(𝑒) = βˆ’3 1 βˆ’ 𝑒 2𝑄0 + 3 1 βˆ’ 𝑒 2 βˆ’ 2𝑒(1 βˆ’ 𝑒) 𝑄

1 + 3 2𝑒 1 βˆ’ 𝑒 βˆ’ 𝑒2 𝑄2 + 3𝑒2𝑄3

  • Derivatives at endpoints:
  • 𝑄′ 0 = βˆ’3𝑄0 + 3𝑄

1

 𝑄

1 = 𝑄0 + 1 3 𝑄′ 0

  • 𝑄′ 1 = βˆ’3𝑄2 + 3𝑄3

 𝑄2 = 𝑄3 βˆ’

1 3 𝑄′ 1

  • Different ways of looking at cubic curves,

essentially the same

21

𝑄

1

𝑄3 𝑄0 𝑄2

𝑄′(0) 𝑄′(1)

slide-22
SLIDE 22

Evaluating Bezier curves

  • Method 1: Direct evaluation of polynomials
  • Simple & fast, could be numerically unstable
  • Method 2: de Casteljau’s algorithm
  • Directly after the recursive definition of Bezier curves
  • More computation steps, numerically stable
  • Also useful for splitting Bezier curves

22

slide-23
SLIDE 23

Drawing Bezier curves

  • In the end, everything is drawn as polyline
  • Main question: How to sample paramter t?
  • Method 1: Uniform sampling
  • Simple
  • Potentially insufficient sampling density
  • Method 2: Adaptive sampling
  • If control points deviate too much from straight

line, split by de Casteljau’s algorithm

23

slide-24
SLIDE 24

Further control: Rational Bezier curve

  • Another view on Bezier curve:

β€œWeighted average” of control points

  • 𝑄012 𝑒 = 1 βˆ’ 𝑒 2𝑄0 + 2𝑒 1 βˆ’ 𝑒 𝑄

1 + 𝑒2

𝑄

2

= πœ‡0 𝑒 𝑄

0 + πœ‡1 𝑒

𝑄

1+ πœ‡2 𝑒 𝑄2

  • Important property: partition of unity

πœ‡0 𝑒 + πœ‡1 𝑒 + πœ‡2 𝑒 = 1 βˆ€π‘’

  • Multiply each πœ‡π‘— 𝑒 by arbitrary coeff π‘₯𝑗:

πœŠπ‘— 𝑒 = π‘₯𝑗 πœ‡π‘—(𝑒)

  • Normalize to obtain new weights:

πœ‡π‘—

β€² 𝑒 = πœŠπ‘— 𝑒 Οƒπ‘˜ πœŠπ‘˜ 𝑒

24

w0 = w2 = 1

Non-polynomial curve  can represent arcs etc.

slide-25
SLIDE 25

Cubic splines

  • Series of connected cubic curves
  • Piecewise-polynomial
  • Share value & derivative at every transition
  • f intervals (C1 continuity)
  • Parameter range can be other than [0, 1]
  • Assumption: 𝑒𝑙 < 𝑒𝑙+1
  • Given values as only input,

we want to automatically set derivatives

25

t x t0 t1 t2 t3 t4 t5 x0(t) x1(t) x2(t) x3(t) x4(t) Curve tool in PowerPoint

slide-26
SLIDE 26

Cubic Catmull-Rom spline

  • Cubic function 𝑦𝑙(𝑒) for range 𝑒𝑙 ≀ 𝑒 ≀ 𝑒𝑙+1 is defined by

adjacent constrained values π‘¦π‘™βˆ’1, 𝑦𝑙, 𝑦𝑙+1, 𝑦𝑙+2

26

π‘’π‘™βˆ’1 𝑒𝑙 𝑒𝑙+1 𝑒𝑙+2 𝑒 𝑦 𝑦𝑙 π‘¦π‘™βˆ’1 𝑦𝑙+1 𝑦𝑙+2 𝑦𝑙(𝑒)

slide-27
SLIDE 27

Cubic Catmull-Rom spline: Step 1

  • As 𝑒𝑙 β†’ 𝑒𝑙+1, interpolate such that 𝑦𝑙 β†’ 𝑦𝑙+1  Line

π‘šπ‘™(𝑒) = 1 βˆ’ 𝑒 βˆ’ 𝑒𝑙 𝑒𝑙+1 βˆ’ 𝑒𝑙 𝑦𝑙 + 𝑒 βˆ’ 𝑒𝑙 𝑒𝑙+1 βˆ’ 𝑒𝑙 𝑦𝑙+1

27

π‘’π‘™βˆ’1 𝑒𝑙 𝑒𝑙+1 𝑒𝑙+2 𝑒 𝑦 π‘šπ‘™βˆ’1(𝑒) π‘šπ‘™(𝑒) π‘šπ‘™+1(𝑒)

slide-28
SLIDE 28

Cubic Catmull-Rom spline: Step 2

  • As π‘’π‘™βˆ’1 β†’ 𝑒𝑙+1, interpolate such that π‘šπ‘™βˆ’1 β†’ π‘šπ‘™  Quadratic curve

π‘Ÿπ‘™(𝑒) = 1 βˆ’ 𝑒 βˆ’ π‘’π‘™βˆ’1 𝑒𝑙+1 βˆ’ π‘’π‘™βˆ’1 π‘šπ‘™βˆ’1(𝑒) + 𝑒 βˆ’ π‘’π‘™βˆ’1 𝑒𝑙+1 βˆ’ π‘’π‘™βˆ’1 π‘šπ‘™(𝑒)

  • Passes through 3 points π‘’π‘™βˆ’1, π‘¦π‘™βˆ’1 , 𝑒𝑙, 𝑦𝑙 , 𝑒𝑙+1, 𝑦𝑙+1

28

π‘’π‘™βˆ’1 𝑒𝑙 𝑒𝑙+1 𝑒𝑙+2 𝑒 𝑦 π‘Ÿπ‘™(𝑒) π‘Ÿπ‘™+1(𝑒)

slide-29
SLIDE 29

Cubic Catmull-Rom spline: Step 3

  • As 𝑒𝑙 β†’ 𝑒𝑙+1, interpolate such that π‘Ÿπ‘™ β†’ π‘Ÿπ‘™+1  Cubic curve

𝑦𝑙 𝑒 = 1 βˆ’ 𝑒 βˆ’ 𝑒𝑙 𝑒𝑙+1 βˆ’ 𝑒𝑙 π‘Ÿπ‘™ 𝑒 + 𝑒 βˆ’ 𝑒𝑙 𝑒𝑙+1 βˆ’ 𝑒𝑙 π‘Ÿπ‘™+1(𝑒)

29

π‘’π‘™βˆ’1 𝑒𝑙 𝑒𝑙+1 𝑒𝑙+2 𝑒 𝑦 𝑦𝑙(𝑒)

Summary:

  • Derivative at each CP is defined by a quadratic

curve passing through its adjacent CPs

  • Each interval is a cubic curve satisfying

derivative constraints at both ends

slide-30
SLIDE 30

Evaluating cubic Catmull-Rom spline

30

A recursive evaluation algorithm for a class of Catmull-Rom splines [Barry,Colgman,SIGGRAPH88]

𝑄 𝑒0 = 𝑄0 𝑄 𝑒1 = 𝑄

1

𝑄 𝑒2 = 𝑄2 𝑄 𝑒3 = 𝑄3 𝑄 𝑒 𝑒1 ≀ 𝑒 ≀ 𝑒2

slide-31
SLIDE 31

Ways of setting parameter values 𝑒𝑙 (aka. knot sequence)

  • Assume: 𝑒0 = 0
  • Uniform

𝑒𝑙 = π‘’π‘™βˆ’1 + 1

  • Chordal

𝑒𝑙 = π‘’π‘™βˆ’1 + π‘„π‘™βˆ’1 βˆ’ 𝑄𝑙

  • Centripetal

𝑒𝑙 = π‘’π‘™βˆ’1 + π‘„π‘™βˆ’1 βˆ’ 𝑄𝑙

31

Parameterization of Catmull-Rom Curves [Yuksel,Schaefer,Keyser,CAD11]

slide-32
SLIDE 32

Application of cubic Catmull-Rom spline: Hair modeling

32

Parameterization of Catmull-Rom Curves [Yuksel,Schaefer,Keyser,CAD11]

slide-33
SLIDE 33

Recent exciting development: πœ†-Curves

  • Collaboration between

university & company (Adobe)

  • Features:
  • C2 continuous (smoother)
  • Curvature maxima always on control points

33

πœ†-Curves: Interpolation at Local Maximum Curvature [Yan, Schiller, Wilensky, Carr, Schaefer, SIGGRAPH 2017] Control points Catmull-Rom πœ†-Curves

https://www.youtube.com/watch?v=NvyYvj3q1AU

Curvature Tool in Illustrator

slide-34
SLIDE 34

Key ideas of πœ†-Curves

  • Cubic Bezier is difficult to control
  • Actually, quadratic Bezier is easier to use!
  • At most one curvature maximum can exist
  • User specifies curvature maxima

 reverse compute control points of quadratic Bezier

34

Curvature maxima

i-th quad Bezier (i+1)-th quad Bezier

Possible configurations with cubic Bezier

slide-35
SLIDE 35

35

Global/nonlinear formulation = iterative computation Change of one CP = change of entire shape ”Buckling” always occurs on CPs Curvature discontinuity at convex/concave boundary

slide-36
SLIDE 36

B-spline

  • Another way of defining polynomial spline
  • Represent curve as sum of basis functions
  • Cubic basis is the most commonly used
  • Deeply related to subdivision surfaces

 Next lecture

  • Non-Uniform Rational B-Spline
  • Non-Uniform = varying spacing of knots (𝑒𝑙)
  • Rational = arbitrary weights for CPs
  • (Complex stuff, not covered)
  • Cool Flash demo:

http://geometrie.foretnik.net/files/NURBS-en.swf

36

slide-37
SLIDE 37

Parametric surfaces

  • One parameter  Curve 𝑄(𝑒)
  • Two parameters  Surface 𝑄 𝑑, 𝑒
  • Cubic Bezier surface:
  • Input: 4Γ—4=16 control points π‘„π‘—π‘˜

𝑄 𝑑, 𝑒 = ෍

𝑗=0 3

෍

π‘˜=0 3

𝑐𝑗

3 𝑑 𝑐 π‘˜ 3 𝑒 π‘„π‘—π‘˜

37

Bernstein basis functions 𝑐0

3 𝑒 = 1 βˆ’ 𝑒 3

𝑐1

3 𝑒 = 3𝑒 1 βˆ’ 𝑒 2

𝑐2

3 𝑒 = 3𝑒2(1 βˆ’ 𝑒)

𝑐3

3 𝑒 = 𝑒3

slide-38
SLIDE 38

3D modeling using parametric surface patches

  • Pros
  • Can compactly represent smooth surfaces
  • Can accurately represent spheres, cones, etc
  • Cons
  • Hard to design nice layout of patches
  • Hard to maintain continuity across patches
  • Often used for designing man-made objects

consisting of simple parts

38

slide-39
SLIDE 39

Pointers

  • http://en.wikipedia.org/wiki/Bezier_curve
  • http://antigrain.com/research/adaptive_bezier/
  • https://groups.google.com/forum/#!topic/comp.graphics.algorithms/2

FypAv29dG4

  • http://en.wikipedia.org/wiki/Cubic_Hermite_spline
  • http://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_splin

e

39