three dimensional curve
Transcript of three dimensional curve
7/29/2019 three dimensional curve
http://slidepdf.com/reader/full/three-dimensional-curve 1/12
Comp uter- Aided Design & Appli cati ons, 9(5), 2012, 679- 690
© 2012 CAD Solut ions, LLC, ht tp :/ / www.cadanda.com
679
Computing Rotation Minimizing Frames using Quaternions
David Yoon1, Mark Narduzz i2 and Jie Shen3
1Universit y of Michigan - Dearborn, [email protected] 2Universit y of Michigan - Dearborn, mnarduz [email protected]
3Universit y of Michigan - Dearbor n, [email protected]
ABSTRACT
Frenet Frames have been employed as local frames along a trajectory. However, they
behave poorly around inflection points of the path. To remedy this, we propose to
comput e rotation m inimiz ing f rames (RMF) using quaternion s.
Keywords: 3D curves, Frenet fr ames, rot ation m inim izi ng fr ames.
DOI: 10.3722/ cadaps.2012.679- 690
1 INTRODUCTION
Three dimensional motion enjoys a wide spectrum of applications including robotics, NC machining,and 3D animation, ju st t o name a few. It t ypicall y depicts an object moving along a path. The positi on
and orientation of the object are represented in terms of a moving frame at a particular point on the
trajectory. It is very important to select the appropriate moving frame at a particular point on the
trajectory. Traditionally, the Frenet Frame has been employed as moving frames. However, over the
years the drawbacks of the frame have been identified and a number of different approaches to
remedy these problems have emerged. Since the trajectory and the Frenet frame form the basis for 3D
mot ions, they are briefly in tr oduced in t he next secti on.
2 TRAJECTORY AND FRENET FRAME
Let P(u) R3 be a C2 curve, where u U. Then the posit ion and orientation of an object is specified in
term s of a parti cular point on t he trajector y and t he moving frames as fol low:
PO(u) = [P(u), F(u)]
7/29/2019 three dimensional curve
http://slidepdf.com/reader/full/three-dimensional-curve 2/12
Comp uter- Aided Design & Appli cati ons, 9(5), 2012, 679- 690
© 2012 CAD Solut ions, LLC, ht tp :/ / www.cadanda.com
680
where P( ) is the trajectory and the movin g fr ame F(u) = [r (u), s(u), t(u)] and r (), u(), and t () represent 3D
orthonomal vectors [6]. Oftentimes the Frenet Frame has been employed as the moving frame as
follows:
t(u) ='( )
| '( ) |
P u
P u
, s(u) ='( ) "( )
| '( ) ''( ) |
P u xP u
P u xP u
, and r (u) = r (u) x s(u).
The Frenet Frame serves as the moving frame very well as long as there is no inflection point along the
t rajectory , i.e. P (u) = 0. However, when th ere is an inf lecti on poin t , the sign of s() changes and thi s
ind uces undesirable consequences. To remedy th is, there are a number of solutions p ubli shed. In th is
section, some of t he well- known approaches are reviewed and we wil l p resent our approach i n t he
next section. The papers summar iz ed below may be character ized as an eff or t to pr oduce a fr ame in
which the binormal vector does not change the sign around the inflection point. This type of a frame
is known as a Rotation Mini mi zi ng Frame (RMF).
Silt anen/ Woodward [10] summari ze the behavior of t he prin ciple normal vector around an
inf lection point and propose th e proj ection normal method. In this approach, th ey compu te th e
tangent vector (in our notation t()), the normal vector (in our notation r()) and the binormal vector (in
our notation s()) at each knot point . The norm al vector r i at knot point u i is computed as follows:
ri= r
i- 1(r
i- 1· t
i) t
i- 1
where · represents dot product and ri,s
i, and t
iare normalized. This approach is intuitive and easy to
implement.
Klok [3] considers moving frames in the context of sweeping. When there is no inflection point
along the trajectory, the Frenet frames function as the moving frames. However, when there is an
inflection point, a Rotation Minimizing Frame (RMF) has to be computed. A moving frame that does
not exhibit discontinuous rotation about the tangent is called a rotation minimizing frame. Due to the
RMF's smooth r otation as th e moving fr ame crosses an inf lecti on point , the RMF is pr eferr ed over th e
Frenet frame in many applications of computer graphics including sweep surface modeling [9],
generalized cylinders [12], motion design and control [6]. He formulates the problem as differential
equations on nor mal vector and binormal vector. The interested reader is referred t o his paper.
Guggenheimer [1] formulates the rotation minizing problem as an integration problem rather than
a dif ferential equati on problem and claims that hi s approach is compu tationally f aster. Shani/ Ball ard s
[8] approach is in a way simil ar to Guggenheimer s in that th ey view rotation mi nim izi ng problem as
an integration problem.
Wang/ Jutt ler [11] intr oduce the double reflection method to come up wit h r otation mi nimiz ing
frames. As one can easily see, the authors deviate from previously mentioned researchers and
formulate the problem in terms of the basic transformation reflection.
Rossignac/ Kim [7] split a motion i nto t he translati onal and r otational components and consider
th e rotat ional comp onent i n terms of a screw moti on. They compu te the parameters of a mot ion fr om
two motion fr ames. It appears that the rotation between the two mot ion fr ames is minim ized byexplicitl y comp uti ng the angle between them r ather than relying on th e two pr incipl e norm al vectors.
In both refs [7,11], the authors both implicitly and explicitly compute the axis of rotation and the
angle of rotation and obtain the rotation minimization frame. Generalizing these approaches, we will
compute RMFs using quaternions.
7/29/2019 three dimensional curve
http://slidepdf.com/reader/full/three-dimensional-curve 3/12
Comp uter- Aided Design & Appli cati ons, 9(5), 2012, 679- 690
© 2012 CAD Solut ions, LLC, ht tp :/ / www.cadanda.com
681
2. 1 Quaternions
An i ntuit ive view of a quaternion is t hat it represents an axis of r otation in R3 along with the rotation
angle. Following Hanson [2], one can consider the axis of rotation n = [ n
1, n
2,n
3]
as
a unit vector with
an angle of rot ati on q in th e polar coord inate system. Then t he quaternion q may be r epresented as a
4- dim ensional vector ( )q w ix jy kz = + + + = (w,vv
) and its component may be expressed as follows:
Fig. 1: The Axis of Rotati on on S2 [2].
w = cos (q / 2)
x = n1sin(q / 2)
y = n2sin(q / 2)
z = n3sin(q / 2)
Quaternions, represented by q, are a part of a subset of th e hypercomp lex numbers, with t he form :
w + x i + y j + zk
where
i 2 = j 2 = k2 = i j k = - 1
i j = k , j i = - k
j k = i , kj = - i
k i = j i k = - j
Any vector of vr
∈R3 can be mapped int o a quaternion space:
0
v
é ù
ê úë ûr
This t ype of a quaternion is known as a pure quaternion.
7/29/2019 three dimensional curve
http://slidepdf.com/reader/full/three-dimensional-curve 4/12
Comp uter- Aided Design & Appli cati ons, 9(5), 2012, 679- 690
© 2012 CAD Solut ions, LLC, ht tp :/ / www.cadanda.com
682
2.2. Quaternion Reflections
Quaternions can be used to compute reflections wi th respect to a plane. Let v = x, y, z [ ]T be a unit
vector norm al to th e plane of r eflecti on and ( )0,r q v= . To comp ute the refl ecti on of p , compute [9]:
q2 = qr ´ p ´ qr To und erstand refl ection, consider r eflecti on wi th respect t o th e x- y pl ane. The basis vector k is
norm al to t he plane of r efl ection. From the relationship between i , j , and k , we have:
kik = i
kjk = j
kkk = -k
Thus only the z comp onent of a vector i s invert ed, the x and y compon ent s are unchanged.
Reflection differs from rotation in two ways. First, the reflection quaternion must be a pure
quaternion. Second, mul ti pli cati on on t he right is by the same quatern ion as on the left . For r otations,multiplication on the right is by the conjugate.
In general, it's not possible to compose an arbitrary number of reflections like rotations. It is,
however, possible to combine two reflections into one rotation. Consider two pure, unit quaternions,
q r1
and q r2 . Each r epr esent s a vector norm al to a plane of refl ection. To r eflect a point p through each
plane, compute:
q1 = qr 1 ´ p ´ qr 1
This r epresents t he reflecti on of p with respect t o plane 1.
p2 = qr 2 ´ q1 ´ qr 2
p 2
represents t he reflection wi th respect t o p lane 2. Combining t hese two equati ons:
p2
= qr 2´ qr 1
´ p ´ qr 1( )´ qr 2= qr 2
´ qr 1( )´ p ´ qr 1´ qr 2( )
Both q r1
and q r2
are pure quaternions and t herefor e -qr 1 = conj qr 1( ) and -qr 2 = conj qr 2( ).
qr 1 ´ qr 2 = -qr 1( )´ -qr 2( )= qr 1
* ´ qr 2
* = qr 2 ´ qr 1( )*
Finally, for two r eflecti ons:
qr = qr 2 ´ qr 1
p2 = qr ´ p ´ qr *
Therefore, two reflections are equivalent to one rotation. However, the product qr 2 ´ qr 1 is not
necessarily a pure quaternion so we cannot compose a third reflection into a single rotation. However,
7/29/2019 three dimensional curve
http://slidepdf.com/reader/full/three-dimensional-curve 5/12
Comp uter- Aided Design & Appli cati ons, 9(5), 2012, 679- 690
© 2012 CAD Solut ions, LLC, ht tp :/ / www.cadanda.com
683
it can be shown that the composition of an even number of reflections can be written as a single
rotation.
2. 3 Transforming the Double Reflection Method to a Single Quaternion Rotation
We now have the tools to transform the double reflection method into a set of quaternion equations.
The name "double reflection" suggests the approach we take. Each reflection is represented by a
quaternion and t he two r eflecti on quaternions are composed t o pr oduce one rot ation quaternion . Thus
Ri undergoes a single rotati on t o pr oduce R
i+1.
The first plane of reflection in the double reflection method is the bisecting plane between P i and
P i+1
. Expressed as a pure quaternion, 1 1i iq p p+= - . However, t o pr oduce a reflection with out scali ng,
q 1
must also be a unit quaternion. Define a function unit(q) that maps a non- zero quaternion t o the
unit hyper- sphere, S3:
unit q( ) =q
q=
q
N q( )
Thus the proper equation for the first reflection quaternion is:( )1 1i iq unit P P += -
To compute the quaternion representing the second plane of reflection, we need the unit
quaternion for T i+1
reflection of T i in plane 1 :
q2
= unit T i+1
- q1
´ T i´ q
1( )
The first reflection of Ri is computed the same as for T
i :
Ri
L = q1 ´ Ri ´ qi
The second reflection of Ri is comp uted by refl ecti ng Ri
Lusing q
2 :
Ri+1 = q2 ´ Ri
L ´ q2
By substituting Ri
L = q1 ´ Ri ´ qiinto Ri+1 = q2 ´ Ri
L ´ q2, we can comput e R
i+1dir ectly fr om R
i with a
single rotation:
Ri+1= q2
´ Ri
L ´ q2= q2
´ q1´ Ri ´ q1( )´ q2
= q2´ q1( )´ Ri ´ q1
´ q2( )= q2´ q1( )´ Ri ´ q2
´ q1( )*
Or more simply:
qr = q2 ´ q1
Ri+1= qr ´ Ri ´ qr
*
Here we arrive at our goal: the double reflection method can be expressed by the following set of
quaternion equations:
7/29/2019 three dimensional curve
http://slidepdf.com/reader/full/three-dimensional-curve 6/12
Comp uter- Aided Design & Appli cati ons, 9(5), 2012, 679- 690
© 2012 CAD Solut ions, LLC, ht tp :/ / www.cadanda.com
684
( )
( )
( ) ( )
1 1
2 1 1 1
1 2 1 2 1
1 1 1
*
i i
i i
i i
i i i
q unit P P
q unit T q T q
R q q R q q
S T R
+
+
+
+ + +
= -
= - ´ ́
= ´ ´ ´ ´
= ´
2.4 RMF by Quaternion Rotation Implementation [5]
A pseudo code implementation of double reflection by quaternion rotation is shown in the algorithm
below. All points and vectors are used as pure quaternions.
Algorithm - RMF by quaternion rotation
Input:
Points Pi, and unit tangent vectors, T i, for i = 0 n, and an ini ti al reference vector R0.Output:
Ui= ( R
i, S
i, T
i), for i = 1 n, as an approxim ate RMF
for i = 0 to n- 1
q1 = unit (P[i+ 1] - P[i]) ; fi rst refl ecti on quaterni on
q2 = unit (T[i+ 1] - q1*T[i]*q1) ; second refl ection quatern ion
q = q2 * q1 ; rot ation quaternion
R[i+ 1] = q*R[i]*conj (q) ; rot ate reference vector
S[i+ 1] = T[i+ 1] x R[i+ 1] ; 3D vector cross prod uct
U[i+ 1] = ( R[i+ 1], S[i+ 1], T[i+ 1] )
End
3 AN ILLUSTRATION
The system developed as part of our approach allows a user to specify a parametric curve, display the
curve, the Frenet frames, and rotation minimizing frames computed using both the double reflection
method and quaterni on rotati on. Furt her, this system demonstrates double refl ection step- by- step,
and perfor ms a timi ng compari son between quaternion r otation and double refl ection.
3.1 Command line options
The application, rmf, has several command line options as shown below:
~/misc/masters$rmf -?
usage: rmf -c (-q | -d | -f) -r -s -t -p filename –h -F -?
-c draw parametric curve
7/29/2019 three dimensional curve
http://slidepdf.com/reader/full/three-dimensional-curve 7/12
Comp uter- Aided Design & Appli cati ons, 9(5), 2012, 679- 690
© 2012 CAD Solut ions, LLC, ht tp :/ / www.cadanda.com
685
-q draw quaternion RMF
-d draw double-reflection RMF
-f draw frenet frame
-p filename load parametric equations from filename
-r draw normal/reference vector
-s draw s vector
-t draw tangent vector
-h home view (no rotation)
-F draw each component of the parametric curve
-? this help text
These opti ons start th e appli cati on and immediately draw t he specif ied it ems.
The default curve is:
( )( ) ( ) ( )
( ) ( )
( ) ( ) ( )
1 134 4
2
3
3 2
0.25 0.0156254
1( ) 2 0.25 0.25 2
4
3 2( ) 3 0.5 0.5 3 3
2
t t t x t t t
t t y t t t
t t t z t t t t
- += = -
-= - = - + -
- += - = - + + -
This set of polynomials was chosen to clearly demonstrate the difference between Frenet frames and
RMFs.
3.2 Screen captures
Fig. 2: Init ial view wit h parametri c curve.
7/29/2019 three dimensional curve
http://slidepdf.com/reader/full/three-dimensional-curve 8/12
Comp uter- Aided Design & Appli cati ons, 9(5), 2012, 679- 690
© 2012 CAD Solut ions, LLC, ht tp :/ / www.cadanda.com
686
Fig. 3: Frenet frames with reference vector displayed.
Fig. 4: Rotation m inimiz ing f rames using doubl e refl ection.
7/29/2019 three dimensional curve
http://slidepdf.com/reader/full/three-dimensional-curve 9/12
Comp uter- Aided Design & Appli cati ons, 9(5), 2012, 679- 690
© 2012 CAD Solut ions, LLC, ht tp :/ / www.cadanda.com
687
Fig. 5: Rotation m inimiz ing fr ames using quaternion r otation .
Fig. 6: Frenet fr ames (dif ferent perspective).
7/29/2019 three dimensional curve
http://slidepdf.com/reader/full/three-dimensional-curve 10/12
Comp uter- Aided Design & Appli cati ons, 9(5), 2012, 679- 690
© 2012 CAD Solut ions, LLC, ht tp :/ / www.cadanda.com
688
Fig. 7: Rotation mi nim izi ng fr ames using quaternions (dif ferent perspecti ve).
4 CONCLUSION
One advantage the quaternion rotation method has over double reflection [11] is that intermediate
reference vectors need not be computed. Indeed, it is possible to compute RN
directly from the initial
reference vector R0
by composing all the rotations computed at each step. Instead of producing a
series of RMFs along a curve, it is possible to generate a series of rotation quaternions and compute
the RMF at a point only if required (i.e. not hidden). If the initial reference vector requires further
rot ation, simpl y compose th e same rotation w it h t he seri es of r otation quaternions as needed.
REFERENCES
[1] Guggenheim er , H.: Comput ing Frames Along a Traj ector y, Comp uter- Aided Geometri c Design 6,
1989, 77- 78.
[2] Hanson,A. J.: Visuali zi ng Quaternions, Morgan Kaufman, 2006
[3] Klok , F., Two Moving Coordinate Frames for Sweeping Along a 3D Trajector y, Comp ut er - Aid ed
Geometr ic Design , 3, 1986, 217- 229.
[4] Math s Transformati ons using Quaternion s:
htt p:// www.euclideanspace.com/ maths/ algebra/ realNormedAlgebra/ quaternions/ tr ansform s/
index.htm [5] Nard uzzi , M, Rotation Minimizi ng Frames by Quarternion Rotations, MS Proj ect r eport , CIS
Departm ent , Universit y of Michigan Dearbor n, 2011
[6] Pobegailo, A.P.: Design of m oti on along parameter ized curves using B- slpi nes, Comput er- Aided
Design, 35, 2003, 1041- 1046.
7/29/2019 three dimensional curve
http://slidepdf.com/reader/full/three-dimensional-curve 11/12
Comp uter- Aided Design & Appli cati ons, 9(5), 2012, 679- 690
© 2012 CAD Solut ions, LLC, ht tp :/ / www.cadanda.com
689
[7] Rossignac, J.R.; Kim , J.J.: Comput ing and Visualiz ing Pose- Interpolating 3D Moti ons, Comp ut er -
Aided Design 33, 2001, 279- 291.
[8] Shani,U, Ballard, D.H.: Splines as Embeddings for Generalized Cylinders, Computer Vision,
graphi cs, and Image Processing, 27, 1984, 129- 156.
[9] Shoemake, K.:Quaternions, ht tp :/ / www.cs.calt ech.edu/ cour ses/ cs171/ quatut.pdf
[10] Siltanen, P.; Woodward, C.: Normal Orientation Methods for 3D Offset Curves, Sweep Surfaces
and Skinn in g. EUROGRAPHICS 92[11] Wang, W.; Juttler, B.; Zheng, D.; Liu, Y.: Computation of Rotation Minimizing Frames, ACM
Transaction s on Graphics, 27(1), Art icle 2, Publi cati on date: March 2008
[12] Yoon, D, Shen, J, Ohou, E. Generali zed Cyli nders in Reverse Engin eer ing, Proc of t he 2010 Int .
Conf. on Compu ter Graphi cs & Vir tual Realit y, 83- 87, Jul y 12- 15, 2010, Las Vegas, Nevada
APPENDIX: QUATERNION ALGEBRA [4]
Let q and q’ be quaterni ons. Then the followi ng holds:
ADDITION
q + q = q + q =
' '
' '
' '
' '
w w w w x x x x
y y y y
z z z z
+é ù é ù é ùê ú ê ú ê ú+ê ú ê ú ê ú+ =ê ú ê ú ê ú+ê ú ê ú ê ú
+ë û ë û ë û
MULTIPLICATION
qq' =' '
' '
ww v v
v v wv w v
é ù- ·ê ú
´ + +ê úë û
r ur
r r r r
MULTIPLICATION FACTS
(pq)p’ = p(qp’)
1q = q1 =
1
0
0
0
w
y
z
é ù é ùê ú ê úê ú ê úê ú ê úê ú ê úë û ë û
w q = qw = w
w
y
z
é ù
ê úê úê úê úë û
=
'
'
'
'
w w
w x
w y
w z
é ù
ê úê úê úê úë û
7/29/2019 three dimensional curve
http://slidepdf.com/reader/full/three-dimensional-curve 12/12
Comp uter- Aided Design & Appli cati ons, 9(5), 2012, 679- 690
© 2012 CAD Solut ions, LLC, ht tp :/ / www.cadanda.com
690
CONJUNCTIVE
q* =
*w
y
z
é ùê ú
ê úê úê úë û
=
w
y
z
é ùê ú-ê úê ú-
ê ú-ë û
CONJUNCTIVE FACTS
(q*)* = q
(pq)* = q*p*
(p+ q)* = p*+q*
NORM : N(Q) = X2 + Y2 + Z2 + W2
NORM FACTS
N(qq ) = N(q)N(q )
INVERSE
q - 1 = q* / N(q)
UNIT QUATERNION
q = q / N(q)
N(qq ) = 1
q- 1
= q*
PURE QUATERNION
q =
0
x
y
z
ë
êêêê
û
úúúú
-q = q*
QUATERNION ROTATIONAL FACTS
Quaternion rot ation is well docum ent ed, and does not need to be repeated here. The equati on torot ate a point v around a quaterni on q is below:
w = qvq*