Polar Coordinate Systems
Fletcher Dunn
Valve Software
Ian Parberry
University of North Texas
3D Math Primer for Graphics & Game Development
What You’ll See in This Chapter
This chapter describes the polar coordinate system. It is divided into our sections. • Section 7.! describes "D polar coordinates. • Section 7." #ives some e$amples %here polar coordinates are pre erable to Cartesian coordinates. • Section 7.& sho%s ho% polar space %or's in &D and introduces cylindrical and spherical coordinates. • Section 7.( ma'es it clear that polar space can be used to describe vectors as %ell as positions.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
"
Word Cloud
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
&
Section 7.!-
"D Polar Coordinates
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
(
Polar Coordinate Space
• .ecall that "D Cartesian coordinate space has an ori#in and t%o a$es that pass throu#h the ori#in. • / "D polar coordinate space also has an ori#in 0'no%n as the pole12 %hich has the same basic purpose- it de ines the center o the coordinate space. • / polar coordinate space only has one a$is2 sometimes called the polar axis2 %hich is usually depicted as a ray rom the ori#in. • It is customary in math literature or the polar a$is to point to the ri#ht in dia#rams2 and thus it corresponds to the 3x a$is in a Cartesian system. • It4s o ten convenient to use di erent conventions than this2 as %e4ll discuss later in this lecture. 5ntil then2 %e’ll use the traditional conventions o the math literature.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
6
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
7
Polar Coordinates
• In Cartesian coordinates %e described a "D point usin# the usin# t%o si#ned distances2 x and y. • Polar coordinates use a distance and an an#le. • 8y convention2 the distance is usually called r 0%hich is short or radi s1 and the an#le is usually called 9. The polar coordinate pair 0r2 91 species a point in "D space as ollo%s!. Start at the ori#in2 acin# in the direction o the polar a$is2 and rotate by an#le 9. Positive values o 9 are usually interpreted to mean countercloc'%ise rotation2 %ith ne#ative values indicatin# cloc'%ise rotation. ". )o% move or%ard rom the ori#in a distance o r units.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
7
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
:
;$amples
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
<
Polar Dia#rams
• The #rid circles sho% lines o constant r. • The strai#ht #rid lines that pass throu#h the ori#in sho% lines o constant 92 consistin# o points that are the same direction rom the ori#in.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
!=
/n#ular *easurement
• It really doesn4t matter %hether you use de#rees or radians 0or #rads2 mils2 minutes2 si#ns2 se$tants2 or Furmans1 to measure an#les2 so lon# as you 'eep it strai#ht. • In the te$t o our boo' %e almost al%ays #ive speci ic an#ular measurements in de#rees and use the > symbol a ter the number. • We do this because %e are human bein#s2 and most humans %ho are not math pro essors ind it easier to deal %ith %hole numbers rather than ractions o ?. • Indeed2 the choice o the number &7= %as speci ically desi#ned to ma'e ractions avoidable in many common cases. • @o%ever2 computers pre er to %or' %ith an#les e$pressed usin# radians2 and so the code snippets in our boo' use radians rather than de#rees.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
!!
Some Ponderable Auestions
!. Can the radial distance r ever be ne#ativeB ". Can 9 ever #o outside o C!:=>D 9 D !:=>B &. The value o the an#le directly %est o the ori#in 0i.e. or points %here x E = and y F = usin# Cartesian coordinates1 is ambi#uous. Is 9 eGual to 3!:=> or C!:=> or these pointsB (. The polar coordinates or the ori#in itsel are also ambi#uous. Clearly r F =2 but %hat value o 9 should %e useB Wouldn4t any value %or'B
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
!"
/liasin#
• The ans%er to all o these Guestions is HyesI. • In act2 or any #iven point2 there are in initely many polar coordinate pairs that can be used to describe that point. • This phenomenon is 'no%n as aliasin!. • T%o coordinate pairs are said to be aliases o each other i they have di erent numeric values but re er to the same point in space. • )otice that aliasin# doesn4t happen in Cartesian space. ;ach point in space is assi#ned e$actly one 0x2 y1 coordinate pair. • / #iven point in polar space corresponds to many coordinate pairs2 but a coordinate pair unambi#uously desi#nates e$actly one point.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
!&
Creatin# /liases
• Jne %ay to create an alias or a point 0 r2 91 is to add a multiple o &7=> to 9. Thus 0r2 91 and 0r2 9 3 "&7=>1 describe the same point2 %here " is an inte#er. • We can also #enerate an alias by addin# !:=> to 9 and ne#atin# rK %hich means %e ace the other direction2 but %e displace by the opposite amount. • In #eneral2 or any point 0r2 91 other than the ori#in2 all o the polar coordinates that are aliases or 0r2 91 be e$pressed as-
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
!(
Canonical Polar Coordinates
/ polar coordinate pair 0r2 91 is in canonical orm i all o the ollo%in# are true-
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
!6
/l#orithm to *a'e 0r2 91 Canonical
!. I r F =2 then assi#n 9 F =. ". I r E =2 then ne#ate r2 and add !:=> to 9. &. I 9 D !:=>2 then add &7=> until 9 L C!:=> (. I 9 L !:=>2 then subtract &7=> until 9 D !:=>.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
!7
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
!7
/ )itMPic'y Jbservation
• Pic'y readers may notice that %hile this code ensures that 9 is in ran#e C? D 9 D ? radians2 it does not e$plicitly avoid the case %here 9 F C?. • The value ? cannot be represented e$actly in loatin# point. In act2 because ? is irrational2 it can never be represented e$actly %ith any inite number o di#its in any baseN • The value o the constant PI in our code is not e$actly eGual to ?2 it4s the closest number to ? that can be represented by a float. • While double precision arithmetic is closer2 it’s not e$act. • So2 you can thin' o this unction as returnin# a value rom C? to ?2 excl sive.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
!:
Convertin# rom Polar to Cartesian Coordinates in "D
Convertin# polar coordinates 0r2 91 to the correspondin# Cartesian coordinates 0x2 y1 ollo%s rom the de inition o sin and cos. x F r cos 9 y F r sin 9
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
!<
Convertin# rom Cartesian to Polar Coordinates in "D
• Computin# polar coordinates 0r2 91 rom Cartesian coordinates 0x2 y1 is sli#htly tric'y. • Due to aliasin#2 there isn4t only one ri#ht ans%erK there are in initely many 0r2 91 pairs that describe the point 0x2 y1. • 5sually2 %e %ant canonical coordinates. • We can easily compute r usin# Pytha#oras4s theorem
Chapter 7 )otes &D *ath Primer or +raphics , +ame Dev "=
Solve or 9
Computin# r %as pretty easy. )o% solve or 9-
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
"!
Pause or Thou#ht
• There are t%o problems %ith this approach. • The irst is that i x F =2 then the division is unde ined. • The second is that arctan has a ran#e rom C<=> to 3<=>. • The basic problem is that the division yOx e ectively discards some use ul in ormation %hen x F y. 8oth x and y can either be positive or ne#ative2 resultin# in our di erent possibilities2 correspondin# to the our di erent Guadrants that may contain the point. 8ut the division yOx results in a sin#le value. • I %e ne#ate both x and y2 %e move to a di erent Guadrant in the plane2 but the ratio xOy doesn4t chan#e. • 8ecause o these problems2 the complete eGuation or conversion rom Cartesian to polar coordinates reGuires some if statements to handle each Guadrant2 and is a bit o a mess or math people.
Chapter 7 )otes &D *ath Primer or +raphics , +ame Dev ""
atan"
• Puc'ily2 pro#rammers have the atan2 unction2 %hich properly computes the an#le or all x and y e$cept or the pes'y case at the ori#in. • 8orro%in# this notation2 let4s de ine an atan" unction %e can use in these notes in our math notation.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
"&
atan"
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
"(
T%o Qey Jbservations
T%o 'ey observations about this de inition. !. First2 ollo%in# the convention o the atan2 unction as ound in the standard libraries o most computer lan#ua#es2 the ar#uments are in reverse order- y2 x. You can either Rust remember that it4s reversed2 or you mi#ht ind it handy to remember that atan"0y2 x1 is similar to arctan0yOx1. Jr remember that tan 9 F sin 9 O cos 92 and 9 F atan"0sin 92 cos 91. ". Second2 in many so t%are libraries2 the atan2 unction is unde ined at the ori#in2 %hen x F y F =. The atan" unction %e are de inin# or use in our eGuations in these notes is de ined such that atan"0=2 =1 F =. In our code snippets %e4ll use atan2 and e$plicitly handle the ori#in as a special case2 but in our eGuations2 %e4ll use atan" %hich is de ined at the ori#in. 0)ote the di erence in type ace.1
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
"6
Computin# 9
• 8ac' to the tas' at hand- computin# the polar an#le 9 rom a set o "D Cartesian coordinates. • /rmed %ith the atan" unction2 %e can easily convert "D Cartesian coordinates to polar orm.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
"7
Code Snippet
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
"7
Section 7."-
Why 5se Polar CoordinatesB
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
":
Why 5se Polar CoordinatesB
• They’re better or humans 0e#. HI live "" miles )); o Dallas2 TSI1 • They’re use ul in video #ames 0 or cameras and turrets and assassin’s arms2 oh my1. • Sometimes %e even use &D spherical coordinates or locatin# thin#s on the #lobe C latitude and lon#itude. *ore comin# upT
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
"<
Section 7.&-
&D Polar Space
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
&=
&D Polar Space
There are t%o 'inds in common use!. Cylindrical coordinates
– ! an#le and " distances
". Spherical coordinates
– " an#les and ! distance
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
&!
&D Cylindrical Space
To locate the point described by cylindrical coordinates 0r2 92 #12 start by processin# r and 9 Rust li'e %e %ould or "D polar coordinates2 and then move up or do%n the # a$is by #.
Chapter 7 )otes &D *ath Primer or +raphics , +ame Dev &"
&D Spherical Coordinates
• /s %ith "D polar coordinates2 &D spherical coordinates also %or' by de inin# a direction and distance. • The only di erence is that in &D it ta'es two an!les to de ine a direction. • There are t%o polar a$es in &D spherical space.
!. The irst a$is is horiUontal and corresponds to the polar a$is in "D polar coordinates or 3x in our &D Cartesian conventions. ". The other a$is is vertical2 correspondin# to 3y in our &D Cartesian conventions.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
&&
)otational Con usion
• Di erent people use di erent conventions and notation or spherical coordinates2 but most Hmath peopleI have a#reed that the t%o an#les are named 9 and V. • *ath people also are in #eneral a#reement about ho% these t%o an#les are to be interpreted to de ine a direction. • You can ima#ine it li'e thisChapter 7 )otes &D *ath Primer or +raphics , +ame Dev &(
Findin# the Point 0r2 92 V1
!. 8e#in by standin# at the ori#in2 acin# the direction o the horiUontal polar a$is. The vertical a$is points rom your eet to your head. ". .otate countercloc'%ise by the an#le 9 0the same %ay that %e did or "D polar coordinates1. &. Point your arm strai#ht up2 in the direction o the vertical polar a$is. (. .otate your arm do%n%ard by the an#le V. Your arm no% points in the direction speci ied by the polar an#les 92 V. 6. Displace rom the ori#in alon# this direction by the distance r2 and %e4ve arrived at the point described by the spherical coordinates 0 r2 92 V1.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
&6
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
&7
/Uimuth2 Wenith2 Pat2 and Pon#
• The horiUontal an#le 9 is 'no%n as the a#im th2 and V is the #enith. • Jther terms that you4ve probably heard are lon!it de and latit de. • $on!it de is basically 92 and latit de is the an#le o inclination2 <=> C V. • So you see2 the latitudeOlon#itude system or describin# locations on planet ;arth is actually a type o spherical coordinate system. • We4re o ten only interested in describin# points on the planet4s sur ace2 and so the radial distance r2 %hich %ould measure the distance to the center o the ;arth2 isn4t necessary.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
&7
XisualiUin# Polar Coordinates
• The spherical coordinate system described in the previous section is the traditional ri#ht handed system used by Hmath people.I • We4ll soon see that the ormulas or convertin# bet%een Cartesian and spherical coordinates are rather ele#ant under these assumptions. • @o%ever2 i you are li'e most people in the video #ame industry2 you probably spend more time visualiUin# #eometry than manipulatin# eGuations2 and or our purposes these conventions carry a e% irritatin# disadvanta#es-
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
&:
Irritatin# Disadvanta#e !
The de ault horiUontal direction at 9 F = points in the direction o 3x. • This is un ortunate2 since or us2 3x points Hto the ri#htI or Heast2I neither o %hich are the de ault directions in most people4s mind. • Similar to the %ay that numbers on a cloc' start at the top2 it %ould be nicer or us i the horiUontal polar a$is pointed to%ards 3#2 %hich is H or%ardI or Hnorth.I
Chapter 7 )otes &D *ath Primer or +raphics , +ame Dev &<
Irritatin# Disadvanta#e "
The conventions or the an#le V are un ortunate in several respects. • It %ould be nicer i the "D polar coordinates 0r2 91 %ere e$tended into &D simply by addin# a third coordinate o Uero2 li'e %e e$tend the Cartesian system rom "D to &D. • 8ut the spherical coordinates 0r2 92 =1 don4t correspond to the "D polar coordinates 0r2 91 as %e4d li'e. • In act2 assi#nin# V F = puts us in the a%'%ard situation o Gim%al loc"2 a sin#ularity %e4ll describe later. • Instead2 the points in the "D plane are represented as 0r2 92 <=>1. • It mi#ht have been more intuitive to measure latitude2 rather than Uenith. *ost people thin' o the de ault as HhoriUontalI and HupI as the e$treme case.
Chapter 7 )otes &D *ath Primer or +raphics , +ame Dev (=
Irritatin# Disadvanta#e &
• )o o ense to the +ree's2 but 9 and V ta'e a little %hile to #et used to. • The symbol r isn4t so bad because at least it stands or somethin# meanin# ul- Hradial distanceI or Hradius.I • Wouldn4t it be #reat i the symbols %e used to denote the an#les %ere similarly short or ;n#lish %ords2 rather than completely arbitrary +ree' symbolsB
Chapter 7 )otes &D *ath Primer or +raphics , +ame Dev (!
Irritatin# Disadvanta#es ( and 6
(. It %ould be nice i the t%o an#les or spherical coordinates %ere the same as the irst t%o an#les %e use or & ler an!les2 %hich are used to describe orientation in &D. 0We4re not #oin# to discuss ;uler an#les until Chapter :.1 6. It4s a ri#htMhanded system2 and %e use a le tMhanded system.
Chapter 7 )otes &D *ath Primer or +raphics , +ame Dev ("
Spherical Coordinates or +amers
• The horiUontal an#le 9 %e %ill rename to h2 %hich is short or headin! and is similar to a compass headin#. / headin# o Uero indicates a direction o H or%ardI or Hto the northI2 dependin# on the conte$t. This matches the standard aviation conventions. • I %e assume our &D cartesian conventions described in Chapter !2 then a headin# o Uero 0and thus our primary polar a$is1 corresponds to 3#. • /lso2 since %e pre er a le tMhanded coordinate system2 positive rotation %ill rotate cloc'%ise %hen vie%ed rom above.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
(&
Spherical Coordinates or +amers
• The vertical an#le V is renamed to p2 %hich is short or pitch and measures ho% much %e are loo'in# up or do%n. The de ault pitch value o Uero indicates a horiUontal direction2 %hich is %hat most o us intuitively e$pect. • Perhaps notMsoMintuitively2 positive pitch rotates do%n%ard2 %hich means that pitch actually measures the an!le of declination. • This mi#ht seem to be a bad choice2 but it is consistent %ith the le tMhand rule. • Pater %e4ll see ho% consistency %ith the le tMhand rule bears ruit %orth su erin# this small measure o counterMintuitiveness.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
((
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
(6
/liasin# in &D Spherical Coordinates
• The irst sureM ire %ay to #enerate an alias is to add a multiple o &7=> to either an#le. This is really the most trivial orm o aliasin# and is caused by the cyclic nature o an#ular measurements. • The other t%o orms o aliasin# are a bit more interestin#2 because they are caused by the interdependence o the coordinates. In other %ords2 the meanin# o one coordinate r depends on the values o the other coordinate0s1 C the an#les1 This dependency created a orm o aliasin# and a sin#ularity-
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
(7
The /liasin# and the Sin#ularity
• The aliasin# in "D polar space could be tri##ered by ne#atin# the radial distance r and adRustin# the an#le so that the opposite direction is indicated. We can do the same %ith spherical coordinates. 5sin# our headin# and pitch conventions2 all %e need to do is lip the headin# by addin# an odd multiple o !:=>2 and then ne#ate the pitch. • The sin#ularity in "D polar space occurred at the ori#in2 since the an#ular coordinate is irrelevant %hen r F =. With spherical coordinates2 %oth an#les are irrelevant at the ori#in.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
(7
That’s )ot /ll2 Fol's
• So spherical coordinates e$hibit similar aliasin# behavior because the meanin# o r chan#es dependin# on the values o the an#les. • @o%ever2 spherical coordinates also su er additional orms o aliasin# because the pitch an#le rotates about an a$is that varies dependin# on the headin# an#le. • This creates an additional orm o aliasin# and an additional sin#ularity2 analo#ous to those caused by the dependence o r on the direction.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
(:
*ore /liasin# and Sin#ularities
• Di erent headin# and pitch values can result in the same direction2 even e$cludin# trivial aliasin# o each individual an#le.
– /n alias o 0h2 p1 can be #enerated by 0hY!:=>2 !:=> C p1. – For e$ample2 instead o turnin# ri#ht <=>0 acin# east1 and pitchin# do%n (6>2 %e could turn le t <=>0 acin# %est1 and then pitch do%n !&6>. – /lthou#h %e %ould be upside do%n2 %e %ould still be loo'in# in the same direction.
• / sin#ularity occurs %hen the pitch an#le is set to <=> 0or any alias o these values1.
– In this situation2 'no%n as +imbal loc'2 the direction indicated is purely vertical 0strai#ht up or strai#ht do%n12 and the headin# an#le is irrelevant. – We4ll have a #reat deal more to say about +imbal loc' %hen %e discuss ;uler an#les in Chapter :.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
(<
Canonical Spherical Coordinates
• Zust as %e did in "D2 %e can de ine a set o canonical spherical coordinates such that any #iven point in &D space maps unambi#uously to e$actly one coordinate triple %ithin the canonical set. • We place similar restrictions on r and h as %e did or polar coordinates. • T%o additional constraints are added related to the pitch an#le.
!. Pitch is restricted to be in the ran#e C<=> to <=>. ". Since the headin# value is irrelevant %hen pitch reaches the e$treme values o +imbal loc'2 %e orce h F = in that case.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
6=
Conditions or Canonical Spherical Coordinates
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
6!
/l#orithm to *a'e 0r2 p2 h1 Canonical
!. I r F =2 then assi#n h F p F = ". I r E =2 then ne#ate r2 add !:=> to h2 and ne#ate p &. I p E C<=>2 then add &7=> to p until p [ C<=> (. I p L "7=>2 then subtract &7=> rom p until p D "7=> 6. I p L <=>2 add !:=> to h and set p F !:=> Cp 7. I h D C!:=>2 then add &7=> to h until h L C!:=> 7. I h L !:=>2 then subtract &7=> rom h until h D !:=>
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
6"
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
6&
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
6(
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
66
Convertin# Spherical Coordinates to &D Cartesian Coordinates.
• Pet4s see i %e can convert spherical coordinates to &D Cartesian coordinates. • For no%2 our discussion %ill use the traditional ri#htM handed conventions or both Cartesian and spherical spaces. • Pater %e4ll sho% conversions applicable to our le tM handed conventions. • ;$amine the i#ure on the ne$t slide2 %hich sho%s both spherical and Cartesian coordinates.
Chapter 7 )otes &D *ath Primer or +raphics , +ame Dev 67
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
67
What is dB
)otice that %e4ve introduced a ne% variable d2 the horiUontal distance bet%een the point and the vertical a$is.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
6:
Computin# #
From the ri#ht trian#le %ith hypotenuse r and le#s d and #2 %e see that #Or F cos V2 that is2 # F r cos V.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
6<
Computin# x and y
• Consider that i V F <=>2 %e basically have "D polar coordinates. • Pet x' and y' stand or the x and y coordinates that %ould result i V F <=>. • /s in "D2 x' F r cos 92 y' F r sin 9. • )otice that %hen V F <=>2 d F r. /s V decreases2 d decreases2 and by similar trian#les xOx' F yOy' F dOr. Poo'in# at trian#le d#r a#ain2 %e observe that dOr F sin V.
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
7=
Puttin# it /ll To#ether
Puttin# all this to#ether2 %e havex F r sin V cos 9 y F r sin V sin 9 # F r cos 9 5sin# our #amer conventionsx F r cos p sin h y F Cr sin p # F r cos p cos h
Chapter 7 )otes &D *ath Primer or +raphics , +ame Dev 7!
Continuin#
• r is easy• /s be ore2 the sin#ularity at the ori#in %hen r F = is handled as a special case. • The headin# an#le is surprisin#ly simple to compute usin# our atan" unction2 h F atan"0x2 #1. • This tric' %or's because atan" only uses the ratio o its ar#uments and their si#ns. ;$amine the eGuations x F r cos p sin h( y F Cr sin p( and # F r cos p cos h and notice that the scale actor o r cos p is common to both x and #. • Furthermore2 by usin# canonical coordinates %e are assumin# r L = and C <=> D p D <=>2 thus cos p [ = and the common scale actor is al%ays nonne#ative.
Chapter 7 )otes &D *ath Primer or +raphics , +ame Dev 7"
Finally
• Finally2 once %e 'no% r2 %e can solve or p rom y. y F Cr sin p CyOr F sin p p F arcsin0CyOr1 • The arcsin unction has a ran#e o C<=> to <=>2 %hich ortunately coincides %ith the ran#e or p %ithin the canonical set.
Chapter 7 )otes &D *ath Primer or +raphics , +ame Dev 7&
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
7(
Section 7.(-
5sin# Polar Coordinates to Speci y Xectors
Chapter 7 )otes
&D *ath Primer or +raphics , +ame Dev
76
5sin# Polar Coords to Speci y Xectors
• We4ve seen ho% to describe a point usin# polar coordinates2 and ho% to describe a vector usin# cartesian coordinates. It4s also possible to use polar orm to describe vectors. • Polar coordinates directly describe the t%o 'ey properties o a vector2 its direction and len#th. • /s or the details o ho% polar vectors %or'2 %e4ve actually already covered them.