Geometria Computacional
Ole Peter Smith, IME, UFG, [email protected]
24/05/2010
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 Computacional 24/05/2010 1 / 69
Beautiful Scienti�c Documents
Classical Free Software
Markup Language
Thesis, automatic:· Bibliography· Contents· List of Tables, Figures· Index, ReferencesSlideshows: Beamer
MikTex, LyX, TexMaker, Kyle ^SL!
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 2 / 69
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.php
Formats: GIF - PNG - JPG
^ Animated GIF's_ GIF's: poucas cores
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 3 / 69
Apache/CGI
Apache: webserverDocumentos EstáticosDocumentos Dinâmicos
PHPLinguagem para gerar páginas dinâmics
Perl, C, Java
Minha maquina: 127.0.0.1
Windows: Windows Apache Mysql Php (WAMP)
Localizar 'ServerRoot'
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 4 / 69
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 Computacional 24/05/2010 5 / 69
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 Computacional 24/05/2010 6 / 69
Never Publish Emails on www
$id=$_GET["ID"];
$person=Mysql_SelectHash("People","ID='".$id."'");
$email=$person[ "Email" ];
$hgt=imagefontheight(3);
$wdt=imagefontwidth(3*strlen($email);
imagecolortransparent($image,$bg_color);
imagestring ($image,$fontsize,5,5, $email,$text_color);
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 7 / 69
Line and Point
void imageline($image,
int $x1, int $y1, #first point
int $x2, $int x2, #last point
int $color);
void imagearc($image,
int $cx, int $cy, #center
int $a, $int b, #semi-eixos
int $ang1, int $ang2, #angle (degrees)
int $color);
void imagefilledarc(...);
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 8 / 69
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 Computacional 24/05/2010 9 / 69
Draw Line I - Result
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 10 / 69
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 Computacional 24/05/2010 11 / 69
Draw Line II - Result
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 12 / 69
Scaling
Rx ,Ry ∈ N: Ex. 400,400
Minx ,Miny ∈ R: 0.0,0.0
Maxx ,Maxy ∈ R: 6.0,6.0
A�n Application: (X
Y
)=
(axx + bxayy + by
)Conditions:(
0Ry
)=
(axMinx + bxayMiny + by
),
(Rx
0
)=
(axMaxx + bxayMaxy + by
)
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 13 / 69
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 Computacional 24/05/2010 14 / 69
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 Computacional 24/05/2010 15 / 69
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 Computacional 24/05/2010 16 / 69
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 Computacional 24/05/2010 17 / 69
Draw Line I - Result
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 18 / 69
Serial Convertion
Maligma: Código Repetido
function 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 Computacional 24/05/2010 19 / 69
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 Computacional 24/05/2010 20 / 69
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 Computacional 24/05/2010 21 / 69
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 Computacional 24/05/2010 22 / 69
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 Computacional 24/05/2010 23 / 69
Draw Circle - Result n = 6
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 24 / 69
Draw Circle - Result n = 20
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 25 / 69
Draw Circle - Result n = 500
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 26 / 69
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 Computacional 24/05/2010 27 / 69
Drawing a Wheel
$n=200;
$dn=5;
$center=array(2.0,1.0);
DrawWheel($im,$n,$dn,$center,$color,3.0,0.2);
Modelo radial
Melhorar: Modelo tangencial
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 28 / 69
Wheel - Result
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 29 / 69
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 Computacional 24/05/2010 30 / 69
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 Computacional 24/05/2010 31 / 69
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";
http://127.0.0.1/uruacu/6.php
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 32 / 69
Funções Trigonométricas
Nada de triângulos...
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 33 / 69
Rotação
Rotação, ângulo θ:(x ′
y ′
)= D(θ)
(x
y
)=
(cos θ − sin θsin θ cos θ
)(x
y
)=
(x cos θ − y sin θx sin θ + y cos θ
)R ortogonal : RTR = I⇔ R−1 = RT
R(θ)−1 = R(−θ)R(θ)n = R(nθ), ∀n ∈ Z
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 34 / 69
Rotação
^ Pontos �xos: (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 Computacional 24/05/2010 35 / 69
Aplicação Linear: Rn 7→ Rn
f (x) = Ax − A = (a1...an)
Composição: f1 ◦ f2 = A1A2
Bijeção ⇔ detA 6= 0
Núcleo, Ax = 0: dim= n − ρAImagen, 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 Computacional 24/05/2010 36 / 69
Escalonamento
Dilatação pelo eixo y :
E x =
(λ 00 1
)(x
y
)=
(λxy
)λ > 1: Dilatação
λ = 1: Identidade
0 < λ < 1: Contração
λ = 0: Projeção no eixo y
λ = −1: Re�exão no eixo y
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 37 / 69
Escalonamento
Dilatação pelo eixo e = (cos θ, sin θ):1: Rotação ângulo θ: i 7→ e e j 7→ f = e
2: Dilatação pelo eixo f
3: 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 θ
)Linear
Eθe E similares
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 38 / 69
Escalonamento e Re�exão
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 39 / 69
Projeção
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 40 / 69
Re�exã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 ângulos
Não rígida
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 41 / 69
Projeção em e = (cos θ, sin θ)
P =
(sin2 θ sin θ cos θ
sin θ cos θ cos2 θ
)Nilpotente: Pn = P, n ≥ 1
Singular: detP = 0
ker f = tf, t ∈ R
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 42 / 69
Translação, t = (t1, t2)
f (x) = x + t = I x + t
_: não linear...
A�m: f (x) = A x + b
⇒ Geometria Projetiva
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 43 / 69
Projective Geometry
(x
y
)→
x
y
1
. E:
x
y
z
→ (x/zy/z
), z 6= 0
Translation:
1 0 t10 1 t20 0 1
x
y
1
=
x + t1y + t2
1
^: Translation is Linear!
Rotation:
cos θ − sin θ 0sin θ cos θ 00 0 1
x
y
1
=
x cos θ − y sin θx sin θ + y cos θ
1
Scaling:
λ1 0 00 λ2 00 0 1
x
y
1
=
λ1xλ2y1
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 44 / 69
Projective Geometry
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 45 / 69
Curvature
Curve 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 Computacional 24/05/2010 46 / 69
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 Computacional 24/05/2010 47 / 69
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 48 / 69
Evolute
Center 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 Computacional 24/05/2010 49 / 69
Calculate & Draw Evolute
double dt=(t2-t1)/(1.0*(n-1));
//First point
Vector 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 Computacional 24/05/2010 50 / 69
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 ta sin t
)r′′(t) =
(a sin ta cos t
)κ =
a2(cos t − 1)
(2a2(1− cos t))3/2=
−12√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 Computacional 24/05/2010 51 / 69
De�ne 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 Computacional 24/05/2010 52 / 69
Trochoid
Mark Point distance b from Center of Circle, radius a, and Let it Roll
a = b: Cycloid
r(t) =
(at − b sin ta − b cos t
)r′(t) =
(a − b cos tb sin t
)r′′(t) =
(a sin t−b cos t
)κ =
ab cos t − b2
(a2 + b2 − 2ab cos t)3/2
rc = 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 Computacional 24/05/2010 53 / 69
De�ne 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 Computacional 24/05/2010 54 / 69
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/2010 55 / 69
Epicycloid I
Circle, Radius r , Rolls outside Circle, Radius R
r(t) = ((R + r) cos t − r cos
(R+rr
t)
(R + r) sin t − r sin(R+rr
t) ) =
r [η e(t)− e (ηt)]
Dimensionlesses: η =R + r
r> 1 e µ =
R
r= η − 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 Computacional 24/05/2010 56 / 69
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 Computacional 24/05/2010 57 / 69
Epicycloid III
κ = +∞ para µt = 2pπ, p ∈ Zκn = κ
|r(t)| r′(t) =
(rη)2(1 + η) [1− cosµt]
(2(rη)2 [1− cosµt])2rη [−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 Computacional 24/05/2010 58 / 69
De�ne 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 Computacional 24/05/2010 59 / 69
Hipocycloid I
Circle, Radius r , Rolls inside Circle, Radius R
r(t) = ((R − r) cos t + r cos
(r−Rr
t)
(R − r) sin t + r sin(r−Rr
t) ) =
r [−η e(t) + e (ηt)]
Dimensionlesses: η =r − R
r≤ 0 e µ =
R
r= 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 Computacional 24/05/2010 60 / 69
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 Computacional 24/05/2010 61 / 69
Hipocycloid III
κ = +∞ para µt = π2
+ 2pπ, p ∈ Zκn =
(rη)2(1 + η) [1− cosµt]
(2(rη)2 [1− cosµt])2rη {−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 Computacional 24/05/2010 62 / 69
De�ne 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 Computacional 24/05/2010 63 / 69
Epicycloid & Hipocycloid
κHypo =
(1 + r−Rr
)
2√2r r−R
r
[1− cos (
R
rt)
]−1/2=
2r − R
2√2r(r − R)
[1− cos (
R
rt)
]−1/2κEpi =
(1 + R+rr
)
2√2r R+r
r
[1− cos (
R
rt)
]−1/2=
2r + R
2√2r(r + R)
[1− cos (
R
rt)
]−1/2
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 64 / 69
Hypotrochoid & Epitrochoid
Hypotrochoid: r(t) =((R − r) cos t + d cos
(r−Rr
t)
(R − r) sin t + d sin(r−Rr
t) )
Hypotrochoids...
Epitrochoid: r(t) =((R + r) cos t − d cos
(R+rr
t)
(R + r) sin t − d sin(R+rr
t) )
Epitrochoids...
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 65 / 69
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 Computacional 24/05/2010 66 / 69
De�ning 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 Computacional 24/05/2010 67 / 69
De�ning 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 length
for (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 Computacional 24/05/2010 68 / 69
De�ning 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 Computacional 24/05/2010 69 / 69
Thanks!
Ole Peter Smith, IME, UFG, [email protected] () Geometria Computacional 24/05/2010 70 / 69
Top Related