File:PuroRotolamentoCirc.gif
PuroRotolamentoCirc.gif (240 × 240 pixels, file size: 149 KB, MIME type: image/gif, looped, 159 frames, 1.6 s)
Captions
Captions
Summary
editDescriptionPuroRotolamentoCirc.gif |
Italiano: Moto di puro rotolamento di un disco su una circonferenza |
Date | |
Source | Own work |
Author | Cielo Francesco |
Immagine fatta con processing
Ecco il codice, i parametri sono tutti commentati in modo da renderne facile la modifica per chi volesse. Le impostazioni iniziali sono nella funzione setup.
/* * Moto di puro rotolamento di un disco su una circonferenza * */ int sz; // intero che moltiplicato per 16 da la dimensione in // pixel dell'immagine int R; // raggio della circonferenza int r; // raggio del disco float nu; // frequenza (giri al sec) di rotazione del disco attorno // alla circonferenza float phi; // angolo tra il centro del disco e l'asse orizzontale float theta; // angolo tra il punto che si vuole osservare sul disco e // l'asse che collega i due centri int nDent; // numero di dentini da disegnare sul disco //variabili per poter calcolare la velocità float x, y; float dx, dy, dt; void setup() { sz = 15; size(16*sz, 16*sz); frameRate(20); R = width/4; r = width/16; phi = -PI; theta = 0; nu = 1.0/8; nDent = 3; } void draw() { background(255); dt = 1.0/frameRate; // così la velocità esce in pixel al secondo =P phi = phi + TWO_PI*nu/frameRate; theta = PI + (phi*R)/r; disegnaCirconferenza(); disegnaDisco(); if((phi >= -HALF_PI) && (phi <= -HALF_PI+TWO_PI)) saveFrame("img/pr-####.png"); } void disegnaCirconferenza() { noFill(); ellipse(width/2, height/2, 2*R, 2*R); //circonferenza fill(0); ellipse(width/2, height/2, 4, 4); //centro // disegno dei dentini for(int i = 0; i< nDent*R/r; i++) { float a = i*TWO_PI/(nDent*R/r); float px = 0.98*R*cos(a) + width/2; float py = 0.98*R*sin(a) + height/2; float dentX = 0.9*R*cos(a) + width/2; float dentY = 0.9*R*sin(a) + height/2; line(dentX, dentY, px, py); } } void disegnaDisco() { float px, py, tmp; float cx, cy; float dentX, dentY; cx = (R + r)*cos(phi); cy = (R + r)*sin(phi); tmp = r*cos(theta) + (R + r); py = r*sin(theta); px = cos(phi)*tmp - sin(phi)*py; py = sin(phi)*tmp + cos(phi)*py; // calcolo del vettore velocità (divisa per due per farcela stare // nell'immagine anche quando è abbastanza grande) dx = (px - x)/dt/2; dy = (py - y)/dt/2; x = px; y = py; cx = width/2 + cx; cy = height/2 + cy; px = width/2 + px; py = height/2 + py; // disco fill(230); ellipse(cx, cy, 2*r, 2*r); fill(0); ellipse(cx, cy, 4, 4); // punto di contatto fill(0, 0, 255); ellipse(R*cos(phi) + width/2, R*sin(phi) + height/2, 4, 4); // punto da osservare fill(255, 0, 0); ellipse(px, py, 4, 4); line(cx, cy, px, py); //velocità stroke(255, 0, 0); line(px, py, px+dx, py+dy); stroke(0); // disegno dei dentini for(int i = 0; i<nDent; i++) { float a = i*TWO_PI/nDent + theta; tmp = 0.9*r*cos(a) + (R + r); py = 0.9*r*sin(a); px = cos(phi)*tmp - sin(phi)*py; py = sin(phi)*tmp + cos(phi)*py; tmp = 0.8*r*cos(a) + (R + r); dentY = 0.8*r*sin(a); dentX = cos(phi)*tmp - sin(phi)*dentY; dentY = sin(phi)*tmp + cos(phi)*dentY; line(dentX + width/2, dentY + height/2, px + width/2, py + height/2); } }
Licensing
edit![]() |
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue |
![]() ![]() ![]() |
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license. | |
| ||
This licensing tag was added to this file as part of the GFDL licensing update.http://creativecommons.org/licenses/by-sa/3.0/CC BY-SA 3.0Creative Commons Attribution-Share Alike 3.0truetrue |
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 21:07, 27 November 2008 | ![]() | 240 × 240 (149 KB) | Skyhc (talk | contribs) | {{Informazioni file |Descrizione = Moto di puro rotolamento di un disco su una circonferenza |Autore = Cielo Francesco }} |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
File usage on other wikis
The following other wikis use this file:
- Usage on it.wikipedia.org
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
GIF file comment | whirlgif 3.04 (c) dino@danbbs.dk 159 images |
---|