Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit...

50
Announcements First tutorial is going to be today 11am-12pm in BV462 C++ and OpenGL as preparation for programming portion of assignment 1 (continuation next week) Blackboard/Portal should now be available Lecture Notes and Slides for last week are on the course webpage: http://www.cs.toronto.edu/~ls/teaching.html Assignment 1 will go out on Wednesday

Transcript of Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit...

Page 1: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Announcements

First tutorial is going to be today 11am-12pm in BV462

C++ and OpenGL as preparation for programming portion of assignment 1 (continuation next week)

Blackboard/Portal should now be available

Lecture Notes and Slides for last week are on the course webpage:

http://www.cs.toronto.edu/~ls/teaching.html

Assignment 1 will go out on Wednesday

Page 2: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Last week’s review

What is computer graphicsDefinition of raster displaysLine drawing

Simple line drawing Efficient line drawing using Bresenham’s algorithm

Polygon fillingwith active edge lists

ClippingVery briefly, we’ll rev-visit it later

Page 3: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Parametric Curvesand Polygons

Computer Graphics, CSCD18Fall 2008Instructor: Leonid Sigal

Page 4: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

2D Geometric Objects

2D objects are simpler, so we’ll start with these before jumping to 3D

Most of the concepts we will be talking about in 2D can (and will) be extended to 3D

We will consider 2 key object classesParametric curves (we already started looking at lines which is a special case)Polygons

Page 5: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Parametric Curves in 2DGoal: model geometry using mathematic representation

There are many ways of representing curves in 2DExplicit

Implicit

Parametric

)(xfy =

( ))(),()( λλλ yxp =

0),( =yxf

given x, find y

Function from R -> R2

(we already saw this for Bresenham’s alg)

Page 6: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Explicit Equation of a Line

Explicit equation form:

Explicit equation for the line:

)(xfy =

bmxy +=

Problem: this representation doesn’t work for vertical lines. Why?

Page 7: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Implicit Equation of a LineImplicit equation form:

Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1):

Intuition

0),( =yxf

0))(())(( 010010 =−−−−− xxyyyyxx

0)( =xf vector form

Page 8: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Implicit Equation of a LineImplicit equation form:

Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1):

IntuitionDirection of the line is vector:So any vector for from the starting point to any point on the line must be parallel to Alternatively, must be perpendicular to the normal

We can check this by taking a dot product of the normal with the , thereby deriving the implicit equation for the line

0),( =yxf0)( =xf

01 ppd −=r

)( 0pp −

),( 1001 xxyyn −−=r

)( 0pp −

)( 0pp −

01 ppd −=r

),( 1001 xxyyn −−=r

0p)( 0pp −

1p

0))(())(( 010010 =−−−−− xxyyyyxx

Page 9: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Implicit Equation of a Line0),( =yxf

0)( =xf01 ppd −=

r

),( 1001 xxyyn −−=r

0p)( 0pp −

1p

0))(())(( 010010 =−−−−− xxyyyyxx

Page 10: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Parametric Equation of a Line

( ))(),()( λλλ yxp =Parametric equation form:

Parametric equation for the line through p0 and p1:

whereFor parametric equation bounds for must be specified

Line segment from p0 to p1: Ray from p0 in the direction of p1: Line passing though p0 and p1:

dppr

λλ += 0)(

10 ≤≤ λ∞<≤ λ0∞<<∞− λ

λ01 ppd −=

r

Page 11: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Explicit Equation of a Circle

Explicit equation form:

Explicit equation for the line:

)(xfy =

Does no exist !!!

y is multi-function of x (for every x there are 2 y’s)

Page 12: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Implicit Equation of a CircleImplicit equation form:

Implicit equation for the circle:

or in vector form

0),( =yxf

0)()( 222 =−−+− ryyxx cc

0)( =xf vector form

022 =−− rpp c

Page 13: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Parametric Equation of a Circle

( ))(),()( λλλ yxp =Parametric equation form:

Parametric equation for circle:

( ))2sin(),2cos()( πλπλλ rrp =

Note: this is the polar coordinate representation of the circle.

Note: There are an infinite number of parametric representations for most curves

Page 14: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Ellipses

Special case where ellipse is centered at origin (0,0)and major axis is aligned with y-axis

Implicit form:

Parametric form:

a

b)2sin()()2cos()(

πλλπλλ

byax

==

012

2

2

2

=−+by

ax

Page 15: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

SuperellipsesDerived from ellipse to allow a “squarness” parameter

Parametric form:

where

a

b

( )( ) η

η

πλπλλ

πλπλλ/2

/2

)2sin()2sin()(

)2cos()2cos()(

signby

signax

=

=

η

000

01

1)(

=<>

⎪⎩

⎪⎨

⎧−=

xxx

ififif

xsign

Page 16: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

SuperellipsesDerived from ellipse to allow a “squarness” parameter

Parametric form: ( )( ) η

η

πλπλλ

πλπλλ/2

/2

)2sin()2sin()(

)2cos()2cos()(

signby

signax

=

=

η

Images from Paul Bourke on-line reference[http://local.wasp.uwa.edu.au/~pbourke/surfaces_curves/superellipse/]

Page 17: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Further extensions …

From Wolfram MathWorld[http://mathworld.wolfram.com/Superellipse.html]

Page 18: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Tangents and NormalsTangent to a curve at a point is the instantaneous direction of that curve

Line containing the tangent intersects curve at the pointIs given by the

Normal to a curve is a perpendicular to the tangent direction )(λτr

)(λp

)(λnr

⎟⎠⎞

⎜⎝⎛==

λλ

λλ

λλ

λτd

dyd

dxdpd )(,)()()(r

Page 19: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Tangents and NormalsTangent to a curve at a point is the instantaneous direction of that curveNormal to a curve is a perpendicular to the tangent direction

Can be derived from the implicit form for point p on curve f(x,y)

)(λτr

)(λp

)(λnr

⎟⎟⎠

⎞⎜⎜⎝

⎛∂

∂∂

∂=∇=

yyxf

xyxfpfn p

),(,),(|)()(λr

Page 20: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Proof

On board and in Lecture Notes

Page 21: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

PolygonsPolygon is a continuous, piecewise linear, closed planar curve

Simple polygon is non self-intersectingRegular polygon is simple, equilateral and equiangularN-gon regular polygon with N sides

Where do we get themApproximations to simple parametric curvesMake them up

Polygon Simple Polygon Regular Polygon N(8)-gon

Page 22: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Example: Building N-gon from a CircleIdea: to find vertices of an N-gram, find N equidistant points on a circle

In polar coordinates

where

What if we don’t want N-gon with the center at (0,0)To translate – add (xc, yc) to each pointTo scale – change rTo rotate – add (delta) to each

Niiπ

θ2

=

)sin,(cos),( iiii ryx θθ=

10 −≤≤ Ni

Page 23: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

2D Transformations

Computer Graphics, CSCD18Fall 2008Instructor: Leonid Sigal

Page 24: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Use of 2D Transformations

Goal: given point cloud, polygon, or sampled parametric curve

Change coordinate frames Compose objects made of simple parts

By defining position/scale/orientation of parts with respect to other parts (hierarchical models)

Deform the shape to create new more interesting shapesUseful for animation

Page 25: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Transformation Types

Rigid transformationsExamples: Translations, RotationsProperties: preserve distance and angles

Conformal transformationsExamples: translations, rotations, uniform scaleProperties: preserves angles (not distance)

Affine transformationsExamples: translations, rotations, general scaling, reflectionsProperties: preserves parallelism, preserves linearity (lines remain lines

Page 26: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Elementary Transformations

Translation

Rotation

01 cossinsincos

xx ⎟⎟⎠

⎞⎜⎜⎝

⎛ −=

θθθθ

txx += 01

1x

0x

t

θ

CCW

1x

0x

Page 27: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Elementary Transformations

Uniform Scaling

Non-uniform Scaling

01 00

xb

ax ⎟⎟

⎞⎜⎜⎝

⎛=

01 00

xa

ax ⎟⎟

⎞⎜⎜⎝

⎛=

1x0x

1x0x

Page 28: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Elementary Transformations

Shear

Reflection

01 1001

xx ⎟⎟⎠

⎞⎜⎜⎝

⎛−=

01 101

xh

x ⎟⎟⎠

⎞⎜⎜⎝

⎛=

1x0x

1x

0x

Page 29: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Affine Transformation

Any linear transformation A (can be rotation, scaling, reflection, etc.) followed by a translation tThereby translation, rotation, scaling, sheer are all special cases of affine transformation

Propertiesinverse of affine transformation is also affinelines are preservedgiven closed region (polygon) area under the affine transformation is scaled by det(A)compositions of affine transformations is still affine transformation

txAx += 01

Page 30: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Announcements

Assignment 1 is out

Writing portion4 questionWhen we ask for “prove” something, we mean proof in a mathematical senseElectronic submissions are preferred

ProgrammingStart earlyStarter code available for Linux and VC++

Page 31: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Last class review

dppr

λλ += 0)(

0)( 0 =− nxxr

bmxy +=

⎥⎦

⎤⎢⎣

⎡=

)2sin()2cos(

)(πλπλ

λba

p

012

2

2

2

=−+by

ax

022 =−− rpp c

⎥⎦

⎤⎢⎣

⎡=

)2sin()2cos(

)(πλπλ

λrr

p

Explicit:

Implicit:

Parametric:

Line Circle Ellipse

N/A N/A

Page 32: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Tangents and Normals

⎟⎠⎞

⎜⎝⎛=

λλ

λλ

λτd

dyd

dx )(,)()(r

)(λτr

)(λp

)(λnr

Tangent from parametric form:

Normal from implicit form:⎟⎟⎠

⎞⎜⎜⎝

⎛∂

∂∂

∂=

yyxf

xyxfn ),(,),()(λ

r

derivative

gradient

Page 33: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Transformations

Rigid transformationsExamples: Translations, RotationsProperties: preserve distance and angles

Conformal transformationsExamples: translations, rotations, uniform scaleProperties: preserves angles (not distance)

Affine transformationsExamples: translations, rotations, general scaling, reflectionsProperties: preserves parallelism, preserves linearity (lines remain lines

Page 34: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Affine Transformation

Any linear transformation A (can be rotation, scaling, reflection, etc.) followed by a translation tThereby translation, rotation, scaling, sheer are all special cases of affine transformation

Propertiesinverse of affine transformation is also affinelines are preservedgiven closed region (polygon) area under the affine transformation is scaled by det(A)compositions of affine transformations is still affine transformation

tpAq +=

Page 35: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Proof: Inverse of Affine Transformation is also an Affine Transformation

tpAq +=

pAtq =−

ptqA =−− )(1

ptAqA =− −− 11

vqBp +=

where

tAv 1−=1−= AB

assime A-1 exists

Page 36: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Proof: compositions of affine transformations is still affine transformation

222

111

)()(

tpApFtpApF+=

+=

( ) ( ) 211212 )( ttpAApFF ++=

21212 ttApAA ++=

tpA +=

where

212 ttAt +=12AAA =

Page 37: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Why composing transformations useful?Rotations as we have seen It in the last class rotate the object about the origin in CCW, what if we want to rotate about some other point c?

θ

CCW

q

p

Solution:Translate by -c (so that c is the new origin)Rotate Translate back by c

ctIAFtRAFctIAF

==

==

−==

333

222

111

:0)(:

( )( ))(123 pFFFq =

c

Page 38: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Additional Affine Transformation Properties Proofs

In the Lecture Notes

Page 39: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Changing Coordinate Frames

1x

0x

Affine transformation (rotation + translation)

Can be interpreted as the transformation from object coordinate frame (red) to world coordinate frame (blue)

worldTobject

Page 40: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Hierarchical Models

uparmTlowarm

torsoTuparm

globalTtorso

pglobal = globalTtorso x torsoTuparm x uparmTlowarm x plowarm

Page 41: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Homogeneous Coordinates

Computer Graphics, CSCD18Fall 2008Instructor: Leonid Sigal

Page 42: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Homogeneous CoordinatesProblem: affine transformations often become complex and unwieldy to keep track of

Homogeneous coordinates allow all the transformations to be specified by a single matrix multiply (OpenGL)

How do we express a Cartesian point in homogeneous coordinates?

⎥⎦

⎤⎢⎣

⎡yx

Cartesian point Homogeneous point

01

≠⎥⎥⎥

⎢⎢⎢

⎡=

⎥⎥⎥

⎢⎢⎢

⎡α

ααα

α yx

yx

Page 43: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Homogeneous Coordinates

⎥⎦

⎤⎢⎣

⎡21 ⎥

⎥⎥

⎢⎢⎢

121

⎥⎥⎥

⎢⎢⎢

5105

⎥⎦

⎤⎢⎣

⎡yx

01

≠⎥⎥⎥

⎢⎢⎢

⎡=

⎥⎥⎥

⎢⎢⎢

⎡α

ααα

α yx

yx

Cartesian point Homogeneous point

Example:

⎥⎥⎥

⎢⎢⎢

242

Page 44: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Converting from Homogeneous Coordinates

Note: two homogeneous points are not equal if they are not scalar multiples of one another

⎥⎦

⎤⎢⎣

⎡αα

//

yx

01//

≠⎥⎥⎥

⎢⎢⎢

⎡=

⎥⎥⎥

⎢⎢⎢

⎡αα

α

αyx

yx

Cartesian pointHomogeneous point

Page 45: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Homogeneous TransformationsTurns out that many transformations become linear in homogeneous coordinates (mainly affine)

But it’s easier to always keep track of homogeneous representation, so

tpAq +=

⎥⎦

⎤⎢⎣

⎡+⎥

⎤⎢⎣

⎡⎥⎦

⎤⎢⎣

⎡=⎥

⎤⎢⎣

y

x

y

x

y

x

tt

pp

dcba

qq

[ ] ptA

q ˆ100

ˆ ⎥⎦

⎤⎢⎣

⎡=

⎥⎥⎥

⎢⎢⎢

⎥⎦

⎤⎢⎣

⎡=⎥

⎤⎢⎣

1y

x

y

x

y

x pp

tdctba

qq

Affine in Cartesian Coordinates Affine in Homogeneous Coordinates

[ ]ptAq ˆ=

This is linear and easy to keep track of

Page 46: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Properties of Affine Transformation (cont.)

With homogeneous representation for affine transformation, several additional properties of affine transformations become apparent

affine transformations are associative

Affine transformations are not in general commutative(proof of this is a homework question)

( ) ( )123123 FFFFFF =

2112 FFFF ≠

Page 47: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Vectors in Homogeneous Coordinates

⎥⎥⎥

⎢⎢⎢

⎡=

0

ˆy

x

vv

vr

Homogeneous vector(third component 0!)

⎥⎥⎥

⎢⎢⎢

0y

x

vv

Homogeneous vector

⎥⎥⎥

⎢⎢⎢

⎡++

1yy

xx

vpvp

⎥⎥⎥

⎢⎢⎢

1y

x

pp

+ =

Homogeneous point Homogeneous point

Example:

Page 48: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

What else can we do with Homogeneous Coordinates?

The equation of the line

In homogeneous coordinates

cbyaxdmxy++=

+=0

[ ] 0ˆ1

==⎥⎥⎥

⎢⎢⎢

⎡plp

pcba T

y

x

bdcbma

−=−=

Vector holding homogeneous coordinate of a point

Vector holding lineparameters

Page 49: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Finding Line Passing Through 2 Points

Equation of the line in homogeneous coordinates:

If two homogeneous points p1 and p2 are on the line then

(vector l must perpendicular to two 3D vectors)

[ ] 0ˆ1

==⎥⎥⎥

⎢⎢⎢

⎡plp

pcba T

y

x

0ˆ1 =plT 0ˆ 2 =plT

21 ˆˆ ppl ×=

Page 50: Announcements - cs.ubc.calsigal/teaching08/LS03_Curves.pdf · Implicit Equation of a Line Implicit equation form: Implicit equation for the line from p0=(x0,y0) to p1=(x1,y1): Intuition

Finding Intersection of Two Lines

If two homogeneous points p0 and p1 are on the line then

(point p must perpendicular to two 3D vectors holding the line parameters)

0ˆ1 =pl T 0ˆ2 =pl T

21ˆ llp ×=

2l

1lp̂