The document discusses using the LaTeX typesetting system and the GD graphics library in PHP to generate geometric diagrams and images computationally. It covers initializing image objects in PHP-GD, drawing lines and curves, scaling drawings, and generating circles by dividing them into line segments. Examples are provided of drawing a line, email as an icon, and a circle to demonstrate these techniques.
PDF.js is a JavaScript library for rendering PDF files in the browser without using native code plugins. It works by parsing PDF files and converting the drawing commands into an intermediate representation, then executing those commands on a canvas to display the PDF content. One challenge is that PDF processing can freeze the UI, so it uses web workers to do processing in a background thread.
The document provides an overview of 3D geometric primitives and meshes in Three.js. It discusses various geometry types like BoxGeometry, SphereGeometry, CylinderGeometry, and their constructors. It also covers coordinate systems and basic 3D components like points, lines, and triangles. The document is from a lecture on Three.js meshes, geometries, and primitives, with code examples for creating different geometric shapes.
Workflows for developing next gen 3D browser gamesMichael Plank
The document discusses workflows for developing 3D browser games. It covers 3D basics like terminology, shading, and texturing. It then discusses moving from 2D to 3D by comparing display lists and 3D scene graphs. The document outlines the workflow from concept art to importing 3D in-game assets. It also covers advanced 3D topics like post-processing, animation, and particles. Finally, it compares the pros and cons of different 3D web technologies.
Iccv2011 learning spatiotemporal graphs of human activities zukun
The document presents a new approach for learning spatiotemporal graphs of human activities from weakly supervised video data. The approach uses 2D+t tubes as mid-level features to represent activities as segmentation graphs, with nodes describing tubes and edges describing various relations. A probabilistic graph mixture model is used to model activities, and learning estimates the model parameters and permutation matrices using a structural EM algorithm. The learned models allow recognizing and segmenting activities in new videos through robust least squares inference. Evaluation on benchmark datasets demonstrates the ability to learn characteristic parts of activities and recognize them under weak supervision.
Evolutionary Problems In Aspect Oriented Software Developmentkim.mens
This document discusses evolutionary problems in aspect-oriented software development. It identifies three main categories of challenges: aspect exploration, which involves discovering potential aspects in a system; aspect extraction, which involves migrating code to an aspect-oriented solution; and aspect evolution, which involves maintaining and evolving an aspect-oriented system over time. Each category presents open research problems regarding how to effectively discover, extract, and manage crosscutting concerns through the use of aspects. The document argues that addressing these problems will be important for achieving widespread adoption of aspect-oriented software development.
The Ring programming language version 1.5.3 book - Part 48 of 184Mahmoud Samir Fayed
This document provides documentation on creating a 2D game engine in Ring. It discusses organizing the project into layers, including the games layer, game engine classes layer, and interface to graphics library layer. It then describes the key classes in the game engine - Game, GameObject, Sprite, Text, Animate, Sound, and Map. It provides details on the attributes and methods for each class. It also provides an example of how to load the game engine library, create a Game object, and start drawing text to the screen. The document is intended to teach how to structure a 2D game engine project using different programming paradigms in Ring.
This book is intended for education and fun. Python is an amazing, text-based coding language, perfectly suited for children older than the age of 10. The Standard Python library has a module called Turtle which is a popular way to introduce programming to kids. This library enables children to create pictures and shapes by providing them with a virtual canvas. With the Python Turtle library, you can create nice animation projects using images that are taken from the internet, scaled-down stored as a gif-files download to the projects. The book includes 19 basic lessons with examples that introduce to the Python codes through Turtle library which is convenient to the school students of 10+years old. The book has also a lot of projects that show how to make different animations with Turtle graphics: games, applications to math, physics, and science.
PDF.js is a JavaScript library for rendering PDF files in the browser without using native code plugins. It works by parsing PDF files and converting the drawing commands into an intermediate representation, then executing those commands on a canvas to display the PDF content. One challenge is that PDF processing can freeze the UI, so it uses web workers to do processing in a background thread.
The document provides an overview of 3D geometric primitives and meshes in Three.js. It discusses various geometry types like BoxGeometry, SphereGeometry, CylinderGeometry, and their constructors. It also covers coordinate systems and basic 3D components like points, lines, and triangles. The document is from a lecture on Three.js meshes, geometries, and primitives, with code examples for creating different geometric shapes.
Workflows for developing next gen 3D browser gamesMichael Plank
The document discusses workflows for developing 3D browser games. It covers 3D basics like terminology, shading, and texturing. It then discusses moving from 2D to 3D by comparing display lists and 3D scene graphs. The document outlines the workflow from concept art to importing 3D in-game assets. It also covers advanced 3D topics like post-processing, animation, and particles. Finally, it compares the pros and cons of different 3D web technologies.
Iccv2011 learning spatiotemporal graphs of human activities zukun
The document presents a new approach for learning spatiotemporal graphs of human activities from weakly supervised video data. The approach uses 2D+t tubes as mid-level features to represent activities as segmentation graphs, with nodes describing tubes and edges describing various relations. A probabilistic graph mixture model is used to model activities, and learning estimates the model parameters and permutation matrices using a structural EM algorithm. The learned models allow recognizing and segmenting activities in new videos through robust least squares inference. Evaluation on benchmark datasets demonstrates the ability to learn characteristic parts of activities and recognize them under weak supervision.
Evolutionary Problems In Aspect Oriented Software Developmentkim.mens
This document discusses evolutionary problems in aspect-oriented software development. It identifies three main categories of challenges: aspect exploration, which involves discovering potential aspects in a system; aspect extraction, which involves migrating code to an aspect-oriented solution; and aspect evolution, which involves maintaining and evolving an aspect-oriented system over time. Each category presents open research problems regarding how to effectively discover, extract, and manage crosscutting concerns through the use of aspects. The document argues that addressing these problems will be important for achieving widespread adoption of aspect-oriented software development.
The Ring programming language version 1.5.3 book - Part 48 of 184Mahmoud Samir Fayed
This document provides documentation on creating a 2D game engine in Ring. It discusses organizing the project into layers, including the games layer, game engine classes layer, and interface to graphics library layer. It then describes the key classes in the game engine - Game, GameObject, Sprite, Text, Animate, Sound, and Map. It provides details on the attributes and methods for each class. It also provides an example of how to load the game engine library, create a Game object, and start drawing text to the screen. The document is intended to teach how to structure a 2D game engine project using different programming paradigms in Ring.
This book is intended for education and fun. Python is an amazing, text-based coding language, perfectly suited for children older than the age of 10. The Standard Python library has a module called Turtle which is a popular way to introduce programming to kids. This library enables children to create pictures and shapes by providing them with a virtual canvas. With the Python Turtle library, you can create nice animation projects using images that are taken from the internet, scaled-down stored as a gif-files download to the projects. The book includes 19 basic lessons with examples that introduce to the Python codes through Turtle library which is convenient to the school students of 10+years old. The book has also a lot of projects that show how to make different animations with Turtle graphics: games, applications to math, physics, and science.
The document discusses interfaces between web applications and databases. It covers topics like object-oriented programming principles, using HTTP headers, connecting to databases, defining database tables and fields, and performing CRUD operations. Code examples are provided for functions related to HTTP headers, connecting to databases, and working with database tables and objects.
Este documento resume as formas quadráticas e autovalores/autovetores. Discute curvas e superfícies quadráticas como parábolas, elipses, hipérboles e suas representações matriciais. Também aborda sistemas lineares quadráticos, aplicações lineares, polinômios característicos e espaços próprios.
The document discusses LaTeX, an open-source document preparation system. It introduces LaTeX and some of its basic features, such as formatting text, creating lists, inserting tables, and structuring documents into sections and chapters. It also demonstrates how to write mathematical formulas in LaTeX.
The document discusses the benefits of exercise for mental health. Regular physical activity can help reduce anxiety and depression and improve mood and cognitive functioning. Exercise causes chemical changes in the brain that may help protect against developing mental illness and improve symptoms for those who already have a condition.
This document discusses using LaTeX to generate documents from web applications. It provides an overview of LaTeX and HTML markup languages and their structure. It also describes how to set up LaTeX documents and templates within a web-based object-oriented interface on databases, and includes functions for generating, running, and printing LaTeX documents from items within a database.
O documento apresenta uma prova de Álgebra Linear com questões sobre matrizes. Em 3 frases ou menos:
A prova contém questões sobre determinantes, matrizes adjuntas, inversos e produtos de matrizes. As respostas mostram os cálculos para encontrar esses itens e verificar propriedades algébricas. Também resolve um sistema linear homogêneo e não homogêneo, encontrando as soluções completas.
1. O documento apresenta uma prova de Álgebra Linear com três questões. A primeira questão pede para resolver operações matriciais como determinantes, inversas e produtos. A segunda questão pede para resolver sistemas lineares. A terceira questão pede para resolver determinantes e postos de matrizes.
2. O documento é uma prova de Álgebra Linear com três questões. A primeira questão pede para resolver operações matriciais. A segunda questão pede para resolver sistemas lineares. A terceira questão pede para resolver determinantes e postos de matrizes.
3.
O documento discute autovetores, autovalores e formas quadráticas. Ele define permutações e aplicações lineares, e mostra como autovetores e autovalores estão relacionados a sistemas lineares homogêneos e ao polinômio caraterístico de uma matriz. Exemplos são fornecidos para casos de dimensão 2 e 3.
1. O documento apresenta notas de aula sobre álgebra linear e matrizes.
2. São definidas operações básicas com matrizes como soma, multiplicação por escalar, matriz oposta.
3. Também são apresentados conceitos como produto de matrizes, transposta, vetores coluna e linha, e matrizes notáveis como diagonal, nula e identidade.
O documento apresenta um compêndio de álgebra linear com seções sobre vetores, matrizes e determinantes. Aborda conceitos como produto escalar, comprimento de vetores, produto de matrizes, propriedades de determinantes e expansões de Laplace.
O documento discute considerações sobre interfaces web em sistemas de informação. Ele aborda tópicos como metodologia de desenvolvimento web usando ferramentas livres como PHP e MySQL, modelagem de dados em tabelas relacionais, e implementação de funcionalidades básicas como listagem, edição e pesquisa de registros. O autor também apresenta seu currículo e experiência com programação e desenvolvimento de aplicativos web.
O documento introduz o tema da liberdade no contexto da ciência e do pensamento livre. Aborda conceitos como ciência, filosofia, sociedade, indivíduo e informática, discutindo a natureza questionável do conhecimento e a importância da liberdade individual e social.
O documento discute temas relacionados à ciência, filosofia, sociedade e liberdade individual. Aborda conceitos como objetividade científica, métodos dedutivos e estatísticos, axiomas questionáveis, ciências exatas versus humanas, história, religião, liberdade, governo, ética versus moral e informática.
O documento apresenta as ideias de Ole Peter Smith sobre ciência, filosofia, história, informática e software livre. Ele discute conceitos como liberdade de pensamento, democracia e direitos livres. Smith defende que o conhecimento deve ser compartilhado e a educação é essencial para libertar a humanidade.
O documento apresenta breves biografias e citações de figuras históricas como Gandhi, Sartre e Einstein. Também discute conceitos como liberdade, tradição e oportunidade de fazer a diferença. É assinado por Ole Peter Smith e feito em LaTeX.
The document discusses interfaces between web applications and databases. It covers topics like object-oriented programming principles, using HTTP headers, connecting to databases, defining database tables and fields, and performing CRUD operations. Code examples are provided for functions related to HTTP headers, connecting to databases, and working with database tables and objects.
Este documento resume as formas quadráticas e autovalores/autovetores. Discute curvas e superfícies quadráticas como parábolas, elipses, hipérboles e suas representações matriciais. Também aborda sistemas lineares quadráticos, aplicações lineares, polinômios característicos e espaços próprios.
The document discusses LaTeX, an open-source document preparation system. It introduces LaTeX and some of its basic features, such as formatting text, creating lists, inserting tables, and structuring documents into sections and chapters. It also demonstrates how to write mathematical formulas in LaTeX.
The document discusses the benefits of exercise for mental health. Regular physical activity can help reduce anxiety and depression and improve mood and cognitive functioning. Exercise causes chemical changes in the brain that may help protect against developing mental illness and improve symptoms for those who already have a condition.
This document discusses using LaTeX to generate documents from web applications. It provides an overview of LaTeX and HTML markup languages and their structure. It also describes how to set up LaTeX documents and templates within a web-based object-oriented interface on databases, and includes functions for generating, running, and printing LaTeX documents from items within a database.
O documento apresenta uma prova de Álgebra Linear com questões sobre matrizes. Em 3 frases ou menos:
A prova contém questões sobre determinantes, matrizes adjuntas, inversos e produtos de matrizes. As respostas mostram os cálculos para encontrar esses itens e verificar propriedades algébricas. Também resolve um sistema linear homogêneo e não homogêneo, encontrando as soluções completas.
1. O documento apresenta uma prova de Álgebra Linear com três questões. A primeira questão pede para resolver operações matriciais como determinantes, inversas e produtos. A segunda questão pede para resolver sistemas lineares. A terceira questão pede para resolver determinantes e postos de matrizes.
2. O documento é uma prova de Álgebra Linear com três questões. A primeira questão pede para resolver operações matriciais. A segunda questão pede para resolver sistemas lineares. A terceira questão pede para resolver determinantes e postos de matrizes.
3.
O documento discute autovetores, autovalores e formas quadráticas. Ele define permutações e aplicações lineares, e mostra como autovetores e autovalores estão relacionados a sistemas lineares homogêneos e ao polinômio caraterístico de uma matriz. Exemplos são fornecidos para casos de dimensão 2 e 3.
1. O documento apresenta notas de aula sobre álgebra linear e matrizes.
2. São definidas operações básicas com matrizes como soma, multiplicação por escalar, matriz oposta.
3. Também são apresentados conceitos como produto de matrizes, transposta, vetores coluna e linha, e matrizes notáveis como diagonal, nula e identidade.
O documento apresenta um compêndio de álgebra linear com seções sobre vetores, matrizes e determinantes. Aborda conceitos como produto escalar, comprimento de vetores, produto de matrizes, propriedades de determinantes e expansões de Laplace.
O documento discute considerações sobre interfaces web em sistemas de informação. Ele aborda tópicos como metodologia de desenvolvimento web usando ferramentas livres como PHP e MySQL, modelagem de dados em tabelas relacionais, e implementação de funcionalidades básicas como listagem, edição e pesquisa de registros. O autor também apresenta seu currículo e experiência com programação e desenvolvimento de aplicativos web.
O documento introduz o tema da liberdade no contexto da ciência e do pensamento livre. Aborda conceitos como ciência, filosofia, sociedade, indivíduo e informática, discutindo a natureza questionável do conhecimento e a importância da liberdade individual e social.
O documento discute temas relacionados à ciência, filosofia, sociedade e liberdade individual. Aborda conceitos como objetividade científica, métodos dedutivos e estatísticos, axiomas questionáveis, ciências exatas versus humanas, história, religião, liberdade, governo, ética versus moral e informática.
O documento apresenta as ideias de Ole Peter Smith sobre ciência, filosofia, história, informática e software livre. Ele discute conceitos como liberdade de pensamento, democracia e direitos livres. Smith defende que o conhecimento deve ser compartilhado e a educação é essencial para libertar a humanidade.
O documento apresenta breves biografias e citações de figuras históricas como Gandhi, Sartre e Einstein. Também discute conceitos como liberdade, tradição e oportunidade de fazer a diferença. É assinado por Ole Peter Smith e feito em LaTeX.
O documento apresenta breves biografias e citações de diversos pensadores como Lou Reed, Mahatma Gandhi, Albert Einstein, Martin Luther King Jr. e Jean-Paul Sartre, discutindo temas como liberdade individual e social, democracia, educação e prosperidade.
O documento apresenta uma prova de Álgebra Linear com questões sobre matrizes. Em 3 frases ou menos:
A prova contém questões sobre determinantes, matrizes adjuntas, inversos e produtos de matrizes. As respostas mostram os cálculos para encontrar esses itens e verificar propriedades algébricas. Também resolve um sistema linear homogêneo e não homogêneo, encontrando as soluções completas.
1. O documento apresenta uma prova de Álgebra Linear com três questões.
2. A primeira questão pede para resolver exercícios envolvendo matrizes e sistemas lineares.
3. A segunda questão pede para analisar vetores e sistemas lineares.
4. A terceira questão pede para analisar determinantes e postos de matrizes.
O documento apresenta as ideias de Ole Peter Smith sobre software livre e sociedade. Ele discute como o software livre promove a liberdade de pensamento ao permitir que as pessoas executem, leiam, modifiquem e redistribuam software. Smith também defende que a liberdade requer responsabilidade social e respeito pelos direitos dos outros.
1. A
L TEX
Geometria Computacional
Primeiros GDs
Escalonamento
Curvas
Inventing the Wheel
Show Off: Os Oids...
Geometria Computacional
Ole Peter Smith, IME, UFG, ole@mat.ufg.br
Dia Debian
UEG, UnU Laranjeiras
17/08/2012
Life sure is a Mystery to be Lived
Not a Problem to be Solved...
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
2. A
L TEX
Geometria Computacional
Primeiros GDs
Escalonamento
Curvas
Inventing the Wheel
Show Off: Os Oids...
Beautiful Scientific Documents
Classical Free Software
Markup Language
Thesis, automatic:
· Bibliography
· Contents
· List of Tables, Figures
· Index, References
SL!
Slideshows: Beamer
MikTex, LyX, TexMaker, Kyle
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
3. A
L TEX
Geometria Computacional
Primeiros GDs
Geometria Computacional
Escalonamento
GD
Curvas
Inventing the Wheel
Show Off: Os Oids...
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, ole@mat.ufg.br Geometria Computacional
4. A
L TEX
Geometria Computacional
Primeiros GDs
Geometria Computacional
Escalonamento
GD
Curvas
Inventing the Wheel
Show Off: Os Oids...
Estrutura:
$image=CreateImageObject;
$image− >DrawSomething;
...
$image− >WriteImage;
$image− >Close;
Pixels...
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
5. A
L TEX
Geometria Computacional Init Image Object
Primeiros GDs Email as Icon
Escalonamento Draw Line I
Curvas Problem
Inventing the Wheel Draw Line II
Show Off: Os Oids...
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 Image
header("Content-type: image/png");
Draw a Line
imageline($image,10,20,100,200,$text_color);
Close and Write
imagepng ($image);
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
6. A
L TEX
Geometria Computacional Init Image Object
Primeiros GDs Email as Icon
Escalonamento Draw Line I
Curvas Problem
Inventing the Wheel Draw Line II
Show Off: Os Oids...
Never Publish Emails on www
$id=$_GET["ID"];
$person=Mysql_SelectUniqueHash("People","ID=’".$id."’");
$email=$person[ "Email" ];
header("Content-type: image/png");
$hgt=imagefontheight(3);
$wdt=imagefontwidth(3*strlen($email);
$image = ImageCreate ($wdt+10, $hgt+10)
or die ("Cannot Create image");
$bg_color = imagecolorallocate ($image,255, 255, 255);
$text_color = imagecolorallocate ($image,34,139,34);
imagecolortransparent($image,$bg_color);
imagestring ($image,$fontsize, 5, 5, $email, $text_color);
imagepng ($image);
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
7. A
L TEX
Geometria Computacional Init Image Object
Primeiros GDs Email as Icon
Escalonamento Draw Line I
Curvas Problem
Inventing the Wheel Draw Line II
Show Off: Os Oids...
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, ole@mat.ufg.br Geometria Computacional
8. A
L TEX
Geometria Computacional Init Image Object
Primeiros GDs Email as Icon
Escalonamento Draw Line I
Curvas Problem
Inventing the Wheel Draw Line II
Show Off: Os Oids...
Draw Line I - Result
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
9. A
L TEX
Geometria Computacional Init Image Object
Primeiros GDs Email as Icon
Escalonamento Draw Line I
Curvas Problem
Inventing the Wheel Draw Line II
Show Off: Os Oids...
Draw Line I - Problem
Escalonamento!
Flipped: Cima por baixo...
Draw Point: filledarc
void imagearc($im,
int $cx, int $cy, #center
int $a, $int b, #semi-eixos
int $ang1, int $ang2, #angle (degrees)
int $color);
void imagefilledarc($im,
int $cx, int $cy,
int $a, int $b,
int $ang1, int $ang2,
int $color,int $style);
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
10. A
L TEX
Geometria Computacional Init Image Object
Primeiros GDs Email as Icon
Escalonamento Draw Line I
Curvas Problem
Inventing the Wheel Draw Line II
Show Off: Os Oids...
Draw Line II
$im=imagecreate (400,400);
$bgcol = imagecolorallocate ($im,255, 255, 255);
$txtcol = imagecolorallocate ($im,0,0,0);
header("Content-type: image/png");
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)
imagepng($im);
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
11. A
L TEX
Geometria Computacional Init Image Object
Primeiros GDs Email as Icon
Escalonamento Draw Line I
Curvas Problem
Inventing the Wheel Draw Line II
Show Off: Os Oids...
Draw Line II - Result
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
12. A
L TEX
Scaling
Geometria Computacional
Programmed
Primeiros GDs
Initialization
Escalonamento
Convertion
Curvas
Now Draw
Inventing the Wheel
Convertions
Show Off: Os Oids...
Scaling
Rx , Ry ∈ N: Ex. 400,400
Minx , Miny ∈ R: 0.0,0.0
Maxx , Maxy ∈ R: 6.0,6.0
Affin Application:
X ax x + bx
=
Y ay y + by
Conditions:
0 ax Minx + bx Rx ax Maxx + bx
= , =
Ry ay Miny + by 0 ay Maxy + by
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
13. A
L TEX
Scaling
Geometria Computacional
Programmed
Primeiros GDs
Initialization
Escalonamento
Convertion
Curvas
Now Draw
Inventing the Wheel
Convertions
Show Off: Os Oids...
Scaling
ax (Maxx − Minx ) = Rx − 0 ∧ ay (Maxy − Miny ) = 0 − Ry ⇔
Rx Ry
ax = ∧ ay = −
Maxx − Minx Maxy − Miny
bx = −ax Minx
by = −ay Maxy
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
14. A
L TEX
Scaling
Geometria Computacional
Programmed
Primeiros GDs
Initialization
Escalonamento
Convertion
Curvas
Now Draw
Inventing the Wheel
Convertions
Show Off: Os Oids...
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, ole@mat.ufg.br Geometria Computacional
15. A
L TEX
Scaling
Geometria Computacional
Programmed
Primeiros GDs
Initialization
Escalonamento
Convertion
Curvas
Now Draw
Inventing the Wheel
Convertions
Show Off: Os Oids...
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, ole@mat.ufg.br Geometria Computacional
16. A
L TEX
Scaling
Geometria Computacional
Programmed
Primeiros GDs
Initialization
Escalonamento
Convertion
Curvas
Now Draw
Inventing the Wheel
Convertions
Show Off: Os Oids...
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, ole@mat.ufg.br Geometria Computacional
17. A
L TEX
Scaling
Geometria Computacional
Programmed
Primeiros GDs
Initialization
Escalonamento
Convertion
Curvas
Now Draw
Inventing the Wheel
Convertions
Show Off: Os Oids...
Draw Line I - Result
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
18. A
L TEX
Scaling
Geometria Computacional
Programmed
Primeiros GDs
Initialization
Escalonamento
Convertion
Curvas
Now Draw
Inventing the Wheel
Convertions
Show Off: Os Oids...
Serial Convertion
Maligma: C´digo Repetido
o
function ScalePoints($ps)
{
$pps=array();
for ($n=0;$n<count($ps);$n++)
{
$pps[$n]=ScalePoint($ps[$n]);
}
return $pps;
}
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
19. A
L TEX
Geometria Computacional Drawing a Circle
Primeiros GDs Generate
Escalonamento Line Segments
Curvas Code
Inventing the Wheel Results
Show Off: Os Oids...
Drawing a Circle
Equation:
(x − xc )2 + (y − yc )2 = r 2
Parametrization:
x(t) xc + r cos t
=
y (t) yc + r sin t
t ∈ [−π, π]
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
20. A
L TEX
Geometria Computacional Drawing a Circle
Primeiros GDs Generate
Escalonamento Line Segments
Curvas Code
Inventing the Wheel Results
Show Off: Os Oids...
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, ole@mat.ufg.br Geometria Computacional
21. A
L TEX
Geometria Computacional Drawing a Circle
Primeiros GDs Generate
Escalonamento Line Segments
Curvas Code
Inventing the Wheel Results
Show Off: Os Oids...
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, ole@mat.ufg.br Geometria Computacional
22. A
L TEX
Geometria Computacional Drawing a Circle
Primeiros GDs Generate
Escalonamento Line Segments
Curvas Code
Inventing the Wheel Results
Show Off: Os Oids...
Drawing Circle
$n=6;
$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, ole@mat.ufg.br Geometria Computacional
23. A
L TEX
Geometria Computacional Drawing a Circle
Primeiros GDs Generate
Escalonamento Line Segments
Curvas Code
Inventing the Wheel Results
Show Off: Os Oids...
Draw Circle - Result n = 6
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
24. A
L TEX
Geometria Computacional Drawing a Circle
Primeiros GDs Generate
Escalonamento Line Segments
Curvas Code
Inventing the Wheel Results
Show Off: Os Oids...
Draw Circle - Result n = 20
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
25. A
L TEX
Geometria Computacional Drawing a Circle
Primeiros GDs Generate
Escalonamento Line Segments
Curvas Code
Inventing the Wheel Results
Show Off: Os Oids...
Draw Circle - Result n = 500
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
26. A
L TEX
Geometria Computacional
Primeiros GDs Drawing a Wheel
Escalonamento Animate...
Curvas Solution
Inventing the Wheel
Show Off: Os Oids...
Drawing a Wheel
function DrawWheel($im,$n,$dn,$pc,$r1,$r2,$color,$ang=0.0)
{
$p1s=Circle($n,$pc,$r1,$ang);
DrawCurve($im,$p1s,$color);
$p2s=Circle($n,$pc,$r2,$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, ole@mat.ufg.br Geometria Computacional
27. A
L TEX
Geometria Computacional
Primeiros GDs Drawing a Wheel
Escalonamento Animate...
Curvas Solution
Inventing the Wheel
Show Off: Os Oids...
Drawing a Wheel
$n=200;
$dn=5;
$center=array(2.0,1.0);
DrawWheel($im,$n,$dn,$center,$color,3.0,0.2);
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
28. A
L TEX
Geometria Computacional
Primeiros GDs Drawing a Wheel
Escalonamento Animate...
Curvas Solution
Inventing the Wheel
Show Off: Os Oids...
Wheel - Result
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
29. A
L TEX
Geometria Computacional
Primeiros GDs Drawing a Wheel
Escalonamento Animate...
Curvas Solution
Inventing the Wheel
Show Off: Os Oids...
Animate Wheel
$nimages=79;
$dt=2.0*3.1415927/$nimages;
system("/bin/rm Wheel*.gif");
for ($t=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,$t);
imagegif($image,"Wheel.$i.gif");
$t+=$dt;
}
//Merda! PHP nao tem suporte para GIF animado...
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
30. A
L TEX
Geometria Computacional
Primeiros GDs Drawing a Wheel
Escalonamento Animate...
Curvas Solution
Inventing the Wheel
Show Off: Os Oids...
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";
uruacu/Wheel.gif
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
31. A
L TEX
Geometria Computacional
Primeiros GDs
Escalonamento
Curvas
Inventing the Wheel
Show Off: Os Oids...
Cycloid
Icons/Cycloid.gif
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
32. A
L TEX
Geometria Computacional
Primeiros GDs
Escalonamento
Curvas
Inventing the Wheel
Show Off: Os Oids...
Trochoid
Icons/Trochoid_1.gif
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
33. A
L TEX
Geometria Computacional
Primeiros GDs
Escalonamento
Curvas
Inventing the Wheel
Show Off: Os Oids...
Trochoid
Icons/Trochoid_2.gif
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
34. A
L TEX
Geometria Computacional
Primeiros GDs
Escalonamento
Curvas
Inventing the Wheel
Show Off: Os Oids...
Epicycloid
Icons/Epicycloid_1.gif
Icons/Epicycloid_2.gif
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
35. A
L TEX
Geometria Computacional
Primeiros GDs
Escalonamento
Curvas
Inventing the Wheel
Show Off: Os Oids...
Hypocycloid
Icons/Hypocycloid_1.gif
Icons/Hypocycloid_2.gif
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional
36. A
L TEX
Geometria Computacional
Primeiros GDs
Escalonamento
Curvas
Inventing the Wheel
Show Off: Os Oids...
Oloid
Icons/Oloid.gif
Please Always Enjoy... Animations - Made in C++
Ole Peter Smith, IME, UFG, ole@mat.ufg.br Geometria Computacional