geometriacomputacional - files.cercomp.ufg.br · beautifulscientificdocuments...
TRANSCRIPT
Geometria Computacional
Ole Peter Smith, IME, UFG, [email protected]
24/05/2010www.ime.ufg.br/docentes/olepeter
Life sure is a Mystery to be LivedNot a Problem to be Solved...
These slides were made in LATEX/Beamer
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 1
/ 71
Beautiful Scientific DocumentsClassical Free SoftwareMarkup LanguageThesis, automatic:· Bibliography· Contents· List of Tables, Figures· Index, ReferencesSlideshows: BeamerMikTex, LyX, TexMaker, Kyle ^SL!
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 2
/ 71
Quero Desenhar µατεµατικα...
Usando SL...Graphical Library· GD· Unices - Ruindows· PHP - C - Perl - ...· http://www.libgd.org/Documentation· http://www.php.net/manual/pt_BR/book.image.phpFormats: GIF - PNG - JPG^ Animated GIF’s_ GIF’s: poucas cores
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 3
/ 71
Apache/CGI
Apache: webserverDocumentos EstáticosDocumentos Dinâmicos
PHPLinguagem para gerar páginas dinâmics
Perl, C, JavaMinha maquina: 127.0.0.1Windows: Windows Apache Mysql Php (WAMP)Localizar ’ServerRoot’
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 4
/ 71
Estrutura de uma Programa
$image=CreateImageObject;$image− >Initialize;$image− >DrawSomething;$image− >DrawSomethingMore;...$image− >WriteImage;$image− >Close;Pixels... _
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 5
/ 71
Init Image Object (PHP)
ImageCreate:
$image = imagecreate (400,400)or die ("Cannot Create image");#Black on White - Background first!$bg_color = imagecolorallocate ($image,255, 255, 255);$text_color = imagecolorallocate ($image,0,0,0);
Tell Apache to Expect an Imageheader("Content-type: image/png");
Draw a Lineimageline($image,10,20,100,200,$text_color);
Close and Writeimagepng ($image);
Save in ServerRoot
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 6
/ 71
Line and Point
void imageline($image,int $x1, int $y1, #first pointint $x2, $int x2, #last pointint $color);
void imagearc($image,int $cx, int $cy, #centerint $a, $int b, #semi-eixosint $ang1, int $ang2, #angle (degrees)int $color);
void imagefilledarc(...);
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 7
/ 71
Draw Line
Draw Line: y = x + 1, x ∈ [0, 5]$image = imagecreate (400,400)
or die ("Cannot Create image");#Black on White - Background first!$bg_color = imagecolorallocate ($image,255, 255, 255);$text_color = imagecolorallocate ($image,0,0,0);
header("Content-type: image/png");imageline($image,0,1,5,6,$text_color);imagepng ($image);
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 8
/ 71
Draw Line I - Result
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 9
/ 71
Draw Line I - Problems
Escalonamento!Flipped: Cima por baixo...
$im=imagecreate (400,400)...imagestring($im,5,15+8,15-5,"1",$txtcol);imagefilledarc($im,15,15,10,10,0,360,$txtcol,IMG_ARC_PIE);imagefilledarc($im,200,200,50,100,0,90,$txtcol,IMG_ARC_PIE);imagestring($im,5,385+8,385-5,"2",$txtcol);imagefilledarc($im,385,385,10,10,0,360,$txtcol,IMG_ARC_PIE);
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 10
/ 71
Draw Line II - Result
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 11
/ 71
Scaling
Rx ,Ry ∈ N: Ex. 400,400Minx ,Miny ∈ R: 0.0,0.0Maxx ,Maxy ∈ R: 6.0,6.0Affin Application: (
XY
)=
(axx + bxayy + by
)Conditions:(
0Ry
)=
(axMinx + bxayMiny + by
),
(Rx0
)=
(axMaxx + bxayMaxy + by
)
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 12
/ 71
Scaling
ax(Maxx −Minx) = Rx − 0 ∧ ay (Maxy −Miny ) = 0− Ry ⇔
ax =Rx
Maxx −Minx∧ ay = − Ry
Maxy −Miny
bx = −axMinx
by = −ayMaxy
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 13
/ 71
Scaling - Init
function InitCanvas($R,$Min,$Max){
global $a,$b;$a=array();$b=array();
$a[0]=$R[0]/($Max[0]-$Min[0]);$a[1]=-$R[1]/($Max[1]-$Min[1]);
$b[0]=-$a[0]*$Min[0];$b[1]=$a[1]*$Max[1];
}
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 14
/ 71
Scaling - Convertion
function ScalePoint($p){
global $a,$b;
$pp=array();for ($i=0;$i<2;$i++){
$pp[$i]=((int) ($a[$i]*$p[$i]+$b[$i]));}
return $pp;}
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 15
/ 71
Now Draw the Line....
$Res=array(400,400);$Min=array(0.0,0.0);$Max=array(6.0,6.0);InitCanvas($R,$Min,$Max);$p1=array(0.0,1.0);$p2=array(5.0,6.0);$pp1=ScalePoint($p1);$pp2=ScalePoint($p2);imageline($pp1[0],$pp1[1],$pp2[0],$pp2[1],$color);
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 16
/ 71
Draw Line I - Result
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 17
/ 71
Serial Convertion
Maligma: Código Repetidofunction ScalePoints($ps){
$pps=array();for ($n=0;$n<count($ps);$n++){
$pps[$n]=ScalePoint($ps[$n]);}
return $pps;}
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 18
/ 71
Funções Trigonométricas
Nada de triângulos...
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 19
/ 71
Drawing a Circle
Equation:
(x − xc)2 + (y − yc)
2 = r2
Parametrization: (x(t)y(t)
)=
(xc + r cos tyc + r sin t
)t ∈ [−π, π]
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 20
/ 71
Generating a Circle
function Circle($n,$pc,$r,$ang=0.0){
$dt=2*3.1415927/(1.0*($n-1));$ps=array();for ($i=0,$t=$ang;$i<$n;$i++,$t+=$dt){
$p=array( $pc[0]+$r*cos($t),$pc[1]+$r*sin($t) );array_push($ps,$p);
}return $ps;
}
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 21
/ 71
Curve as Line Segments
function DrawCurve($im,$ps,$color){
$pps=ScalePoints($ps);for ($n=0;$n<count($pps)-1;$n++){
imageline($im,$pps[$n][0],$pps[$n][1],$pps[$n+1][0],$pps[$n+1][1],$color);
}}
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 22
/ 71
Drawing Circle
$n=6;$Res=array(400,400);$Min=array(0.0,0.0);$Max=array(6.0,6.0);InitCanvas($Res,$Min,$Max);$center=array(2.0,1.0);$ps=Circle($n,$center,2);DrawCurve($im,$ps,$color);imagestring($im,3,5,5,"n=$n",$color);
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 23
/ 71
Draw Circle - Result n = 6
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 24
/ 71
Draw Circle - Result n = 20
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 25
/ 71
Draw Circle - Result n = 500
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 26
/ 71
Drawing a Wheel
function DrawWheel($im,$n,$dn,$pc,$r,$R,$color,$ang=0.0){
$p1s=Circle($n,$pc,$r,$ang);DrawCurve($im,$p1s,$color);$p2s=Circle($n,$pc,$R,$ang);DrawCurve($im,$p2s,$color);for ($i=0;$i<$n;$i+=$dn){
$p1=ScalePoint($p1s[$i]);$p2=ScalePoint($p2s[$i]);imageline($im,$p1[0],$p1[1],$p2[0],$p2[1],$color);
}}
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 27
/ 71
Drawing a Wheel
$n=200;$dn=5;$center=array(2.0,1.0);DrawWheel($im,$n,$dn,$center,$color,3.0,0.2);
Modelo radialMelhorar: Modelo tangencial
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 28
/ 71
Wheel - Result
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 29
/ 71
Better Model
Point 1:
r1 =
(r cos θr sin θ
)Tangente ou normal unitário(versor):
n =
(− sin θcos θ
)Ponto 2:
r2 = r1 + ln =
(r cos θ − l sin θr sin θ + l cos θ
)|r2|2 = R2 ⇔ l = ±
√R2 − r2
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 30
/ 71
Animate Wheel
$nimages=79;$dang=2.0*3.1415927/$nimages;system("/bin/rm Wheel*.gif");for ($ang=0.0,$i=0;$i<$nimages;$i++){
$image = ImageCreate...$center=array(3.0,3.0);DrawWheel($image,200,5,$center,0.2,2.0,$color,$ang);imagegif($image,"Wheel.$i.gif");$ang+=$dang;
}Merda! PHP não tem suporte para GIF animado...
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 31
/ 71
Animate Wheel
ImageMagick...Continued...system("/usr/bin/convert -delay 2 -loop 0 ".
"Wheel.*.gif Wheel.gif");header("Content-type: text/html");print "<IMG SRC=’Wheel.gif’>\n";
Animate...
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 32
/ 71
Rotação
Rotação, ângulo θ:(x ′
y ′
)= R(θ)
(xy
)=
(cos θ − sin θsin θ cos θ
)(xy
)=
(x cos θ − y sin θx sin θ + y cos θ
)R(θ1)R(θ2) = R(θ1 + θ2)
⇒ R ortogonal : RTR = I⇔ R−1 = RT
⇒ R(θ)−1 = R(−θ)⇒ R(θ)n = R(nθ), ∀n ∈ Z
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 33
/ 71
Rotação
^ Pontos fixos: (0.0)^ Retas em retas^ Círcumferências em
Círcumferências^ Elipses em elipses^ Hipérboles em Hipérboles
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 34
/ 71
Aplicação Linear: Rn 7→ Rn
f (x) = Ax − A = (a1...an)
Composição: f1 ◦ f2 = A1A2Bijeção ⇔ detA 6= 0Núcleo, Ax = 0: dim= n − ρA
Imagen, ger(a1a2): dim Im(f ) = ρA
Inversa seeeeee: A regular, f −1: A−1
Imagem inversa: Se Ax0 = y:
f −1(y) = {x0 + ker f }
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 35
/ 71
Escalonamento
Dilatação pelo eixo y :
E x =
(λ 00 1
)(xy
)=
(λxy
)λ > 1: Dilataçãoλ = 1: Identidade0 < λ < 1: Contraçãoλ = 0: Projeção no eixo yλ = −1: Reflexão no eixo y
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 36
/ 71
Escalonamento
Dilatação pelo eixo e = (cos θ, sin θ):1: Rotação ângulo θ: i 7→ e e j 7→ f = e2: Dilatação pelo eixo f3: Rotação ângulo −θEθ
= R−1ER =(cos θ sin θ− sin θ cos θ
)(λ 00 1
)(cos θ − sin θsin θ cos θ
)=
(λ cos2 θ + sin2 θ (1− λ) cos θ sin θ
(1− λ) cos θ sin θ λ sin2 θ + cos2 θ
)LinearEθe E similares
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 37
/ 71
Escalonamento
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 38
/ 71
Reflexão
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 39
/ 71
Projeção
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 40
/ 71
Reflexão em e = (cos θ, sin θ
R =
(− cos 2θ sin 2θ
sin 2θ cos 2θ
)R2 = I
R−1 = R
Ortogonal: R−1 = R
Ímpar: detR = −1Isometria: x′ · x′ = x · xPreserva comprimentosReverte ângulosNão rígida
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 41
/ 71
Projeção em e = (cos θ, sin θ)
P =
(sin2 θ sin θ cos θ
sin θ cos θ cos2 θ
)Nilpotente: Pn = P, n ≥ 1Singular: detP = 0ker f = tf, t ∈ R
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 42
/ 71
Translação, t = (t1, t2)
f (x) = x + t = I x + t_: não linear...Afim: f (x) = A x + b⇒ Geometria Projetiva
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 43
/ 71
Projective Geometry(
xy
)→
xy1
. E:
xyz
→ (x/zy/z
), z 6= 0
Translation:
1 0 t10 1 t20 0 1
xy1
=
x + t1y + t2
1
^: Translation is Linear!
Rotation:
cos θ − sin θ 0sin θ cos θ 00 0 1
xy1
=
x cos θ − y sin θx sin θ + y cos θ
1
Scaling:
λ1 0 00 λ2 00 0 1
xy1
=
λ1xλ2y1
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional
24/05/2010www.ime.ufg.br/docentes/olepeter 44/ 71
Projective Geometry
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 45
/ 71
CurvatureCurve in R2:
r(t) =
(x(t)y(t)
)− r′(t) =
(x ′(t)y ′(t)
)− r′′(t) =
(x ′′(t)y ′′(t)
)Accompanying Coordenate System:
t(t) =r′(t)|r′(t)|
− n(t) = t(t)
Oscillating Circle, radius ρ - Curvature κ:
1ρ
=r′(t) · r′′(t)|r′(t)|3
=
∣∣∣∣ x ′ x ′′
y ′ y ′′
∣∣∣∣(x ′2 + y ′2)3/2
Curvature Vector κn =
r′(t) · r′′(t)|r′(t)|4
r′(t)
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 46
/ 71
Calculate Curvature & Center
Vector tan=this->Tangent(t);Vector acc=this->Acceleration(t);
double len=tan.Norm2();double kappa=Determinant2(tan,acc)/(len*len*len);
tan.Normalize();Vector n=tan.Normal2();
n*=kappa;p+=n;
return p;
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 47
/ 71
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 48
/ 71
EvoluteCenter of Curvature:
rC (t) = r(t) + κn(t)
Center of Curvature:
rC (t) = r(t) +
∣∣∣∣ x ′ x ′′
y ′ y ′′
∣∣∣∣(x ′2 + y ′2)2
(−y ′
x ′
)Evolute: Curve of Centers of Curvature
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 49
/ 71
Calculate & Draw Evolutedouble dt=(t2-t1)/(1.0*(n-1));//First pointVector rant=this->CalcPoint(t1);Vector revant=this->CenterOfCurvature2(t1);double t=t1+dt;for (int i=1;i<n;i++){
Vector rnext=this->CalcPoint(t);Vector revnext=this->CenterOfCurvature2(t);graph->DrawLine(rant,rnext,color);graph->DrawLine(revant,revnext,colorev);rant=rnext;revant=revnext;t+=dt;
}graph->DrawPoint(rant,color);graph->DrawPoint(revant,colorev);
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 50
/ 71
Cycloid
Mark Point on Circle, radius a, and Let it Roll
r(t) =
(at − a sin ta − a cos t
)r′(t) =
(a − a cos t
a sin t
)r′′(t) =
(a sin ta cos t
)κ =
a2(cos t − 1)(2a2(1− cos t))3/2
=−1
2√2a(1− cos t)1/2
rc = r + κn =
(at − a sin ta − a cos t
)− 1
4a2(1− cos t)
(−a sin t
a − a cos t
)Cycloids!!!
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 51
/ 71
Define Cycloid
double a;double X(double t) { return a*(t-sin(t)); }double Y(double t) { return a*(1-cos(t)); }double Kappa(double t){
double div=2*sqrt(2)*a*sqrt(1-cos(t));return -1.0/div;
}...Curve *curve=new Curve(2,n);curve->SetR(0,X);curve->SetR(1,Y);curve->SetCurvature(Kappa);curve->DrawWithEvolute(graph,n,0.0,theta);
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 52
/ 71
Trochoid
Mark Point distance b from Center of Circle, radius a, and Let it Rolla = b: Cycloid
r(t) =
(at − b sin ta − b cos t
)r′(t) =
(a − b cos t
b sin t
)r′′(t) =
(a sin t−b cos t
)κ =
ab cos t − b2
(a2 + b2 − 2ab cos t)3/2rc = r + κn =(
at − b sin ta − b cos t
)+
ab cos t − b2
(a2 + b2 − 2ab cos t)2
(−b sin t
a − b cos t
)Trochoids!!!
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 53
/ 71
Define Trochoid
double a,b;double X(double t) { return a*t-b*sin(t); }double Y(double t) { return a*1-b*cos(t); }double Kappa(double t){
double denom=a*a+b*b-2.0*a*b*cos(t);denom=sqrt(denom)*denom;
return (a*b*cos(t)-b*b)/denom;}...Curve *curve=new Curve(2,n);curve->SetR(0,X);curve->SetR(1,Y);curve->SetCurvature(Kappa);curve->DrawWithEvolute(graph,n,0.0,theta);
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 54
/ 71
Unit Vectors
e(t) =
(cos tsin t
)f(t) =
(− sin tcos t
)Derivatives:
e′(t) = e(t) = f(t)
f ′(t) = f(t) = −e(t)
Dotproducts:
e(t1) · e(t2) = f(t1) · f(t2) = cos (t1 − t2)
e(t1) · f(t2) = −f(t1) · e(t2) = sin (t1 − t2)
Note:e(ηt) = cos (µt)e(t) + sin (µt)f(t)
f(ηt) = − sin (µt)e(t) + cos (µt)f(t)
With: µ = η − 1.Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional
24/05/2010www.ime.ufg.br/docentes/olepeter 55/ 71
Epicycloid I
Circle, Radius r , Rolls outside Circle, Radius Rr(t) = (
(R + r) cos t − r cos(R+r
r t)
(R + r) sin t − r sin(R+r
r t) ) =
r [η e(t)− e (ηt)]
Dimensionlesses: η =R + r
r> 1 e µ =
Rr
= η − 1 > 0.
r′(t) =rη [f(t)− f (ηt)]
r′′(t) =rη [−e(t) + ηe (ηt)]
r′(t) =rη [−e(t) + e (ηt)]
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 56
/ 71
Epicycloid II
r′(t) · r′′(t) =
(rη)2 [1 + η − (1 + η) cos (η − 1)t] =
(rη)2(1 + η) [1− cosµt]
r′(t) · r′(t) =(rη)2 [1 + 1− 2 cos (η − 1)t] =
2(rη)2 [1− cosµt] =
κ =(rη)2(1 + η) [1− cosµt]
(2(rη)2 [1− cosµt])3/2=
(1 + η)
2√2rη
[1− cosµt]−1/2
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 57
/ 71
Epicycloid III
κ = +∞ para µt = 2pπ, p ∈ Zκn = κ
|r(t)| r′(t) =
(rη)2(1 + η) [1− cosµt](2(rη)2 [1− cosµt])2
rη [−e(t) + e (ηt)]
(1 + η)
4rη[1− cosµt]−1 {−e(t) + e (ηt)}
Evolute:
rC (t) = r(t) + κn =
r [η e(t)− e (ηt)] +(1 + η)
4rη[1− cosµt]−1 {−e(t) + e (ηt)}
Epicycloids!!!
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 58
/ 71
Define Epicycloid
double a,b;double X(double t) { return (a+b)*cos(t)-r*cos( (a+b)/r*t ); }double Y(double t) { return (a+b)*sin(t)-r*sin( (a+b)/r*t ); }double Kappa(double t){
double denom=2.0*sqrt(2.0)*b*(b+a)*sqrt(1-cos(a/r*t));double val=(2.0*b+a)/denom;
return val;}...Curve *curve=new Curve(2,n);curve->SetR(0,X);curve->SetR(1,Y);curve->SetCurvature(Kappa);curve->DrawWithEvolute(graph,n,0.0,theta);
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 59
/ 71
Hipocycloid I
Circle, Radius r , Rolls inside Circle, Radius Rr(t) = (
(R − r) cos t + r cos( r−R
r t)
(R − r) sin t + r sin( r−R
r t) ) =
r [−η e(t) + e (ηt)]
Dimensionlesses: η =r − R
r≤ 0 e µ =
Rr
= 1− η ≥ 1.
r′(t) =rη [−f(t) + f (ηt)]
r′′(t) =rη [e(t)− η e (ηt)]
r′(t) =rη [e(t)− e (ηt)]
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 60
/ 71
Hipocycloid II
r′(t) · r′′(t) =
(rη)2 [1 + η − (1 + η) cos (η − 1)t] =
(rη)2(1 + η) [1− cosµt]
r′(t) · r′(t) =(rη)2 [1 + 1− 2 cos (η − 1)t] =
2(rη)2 [1− cosµt] =
κ =(rη)2(1 + η) [1− cosµt]
(2(rη)2 [1− cosµt])3/2=
(1 + η)
2√2rη
[1− cosµt]−1/2
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 61
/ 71
Hipocycloid III
κ = +∞ para µt = π2 + 2pπ, p ∈ Z
κn =(rη)2(1 + η) [1− cosµt](2(rη)2 [1− cosµt])2
rη {−e(t) + e (ηt)} =
(1 + η)
4rη[1− cosµt]−1 {−e(t) + e (ηt)}
Evolute:
rC (t) = r(t) + κn =
r [−η e(t) + e (ηt)] +(1 + η)
4(rη)2[1− cosµt]−1 {−e(t) + e (ηt)}
Hypocycloids!!!
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 62
/ 71
Define Hypocycloid
double a,b;double X(double t) { return (a-b)*cos(t)+b*cos( (a-b)/r*t ); }double Y(double t) { return (a-b)*sin(t)-b*sin( (a-b)/r*t ); }double Kappa(double t){
double denom=2.0*sqrt(2.0)*b*(b-a)*sqrt(1-cos(a/b*t));double val=(2.0*b-a)/denom;
return val;}...Curve *curve=new Curve(2,n);curve->SetR(0,X);curve->SetR(1,Y);curve->SetCurvature(Kappa);curve->DrawWithEvolute(graph,n,0.0,theta);
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 63
/ 71
Epicycloid & Hipocycloid
κHypo =
(1 + r−Rr )
2√2r r−R
r
[1− cos (
Rr
t)]−1/2
=
2r − R2√2r(r − R)
[1− cos (
Rr
t)]−1/2
κEpi =
(1 + R+rr )
2√2r R+r
r
[1− cos (
Rr
t)]−1/2
=
2r + R2√2r(r + R)
[1− cos (
Rr
t)]−1/2
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 64
/ 71
Hypotrochoid & Epitrochoid
Hypotrochoid: r(t) =((R − r) cos t + d cos
( r−Rr t)
(R − r) sin t + d sin( r−R
r t) )
Hypotrochoids...Epitrochoid: r(t) =(
(R + r) cos t − d cos(R+r
r t)
(R + r) sin t − d sin(R+r
r t) )
Epitrochoids...
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 65
/ 71
Rolling
Circle, Radius R , Rolls on Curve:
r(t) =
(x(t)y(t)
)
rR(t) =
(x(t)y(t)
)+
R
(x ′(t)2 + y ′(t)2)1/2
(−y ′(t)x(t)
)Oloids...
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 66
/ 71
Defining Rolling
Vector Curve::CalcRollingCenter(double t,double a,Vector &rant,int inside){
Vector tan=this->UnitTangent(t);Vector n=tan.Normal2();n*=a;Vector rc;if (inside==1) { rc=rant-n; }else { rc=rant+n; }return rc;
}Vector Curve::CalcRollingPoint(double s,double a,Vector &rc){
Vector *p=Vector2(a*cos(s/a-PI),a*sin(s/a-PI));(*p)+=rc;return *p;
}
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 67
/ 71
Defining Rolling
double dt=(t2-t1)/(1.0*(n-1));Vector rant=this->CalcPoint(t1);Vector rcant=this->CalcRollingCenter(t1,a,rant,inside);Vector rpant=this->CalcRollingPoint(0.0,a,rcant);double t=t1+dt, s=0.0; //parameter & arc lengthfor (int i=1;i<n;i++){
Vector rnext=this->CalcPoint(t);Vector rcnext=this->CalcRollingCenter(t,a,rnext,inside);Vector rpnext=this->CalcRollingPoint(s,a,rcnext);graph->DrawLine(rpant,rpnext,color);s+=Distance(rant,rnext);rant=rnext;rcant=rcnext;rpant=rpnext;
}
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 68
/ 71
Defining Rolling
double r;
double RX(double t){
return t;}
double RY(double t){
return r*sin(t);}
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 69
/ 71
Optimization: Projected Gradients
minx∈GF (x)Forma simplificado:yk+1 = xk − βk∇F (xk)
xk+1 = PG (yk+1)
Iteração externoIteração interno
Visualização
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 70
/ 71
Thanks!
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional24/05/2010www.ime.ufg.br/docentes/olepeter 71
/ 71