Diferencia entre revisiones de «Arbol recursivividad»
De Casiopea
(Página creada con '{{Proyecto |Título=Arbol recursividad |Tipo de Proyecto=Proyecto de Taller |Palabras Clave=recursividad, processing, prueba, dibujo |Año de Inicio=2011 |Año de Término=2011...') |
Sin resumen de edición |
||
(No se muestran 4 ediciones intermedias del mismo usuario) | |||
Línea 1: | Línea 1: | ||
{{Proyecto | {{Proyecto | ||
|Título= | |Título=Árbol recursividad | ||
|Tipo de Proyecto=Proyecto de Taller | |Tipo de Proyecto=Proyecto de Taller | ||
|Palabras Clave=recursividad, processing, prueba, dibujo | |Palabras Clave=recursividad, processing, prueba, dibujo | ||
Línea 6: | Línea 6: | ||
|Año de Término=2011 | |Año de Término=2011 | ||
|Carreras Relacionadas=Arquitectura | |Carreras Relacionadas=Arquitectura | ||
|Asignaturas Relacionadas=Imagen Escrita, | |Asignaturas Relacionadas=Imagen Escrita, | ||
|Cursos Relacionados=Imagen Escrita, | |Cursos Relacionados=Imagen Escrita, | ||
|Profesor=Herbert Spencer, | |Profesor=Herbert Spencer, | ||
|Alumnos=Trajan Pirkovic, | |Alumnos=Trajan Pirkovic, | ||
|Imagen=Arbol221111.JPG | |Imagen=Arbol221111.JPG | ||
}} | }} | ||
<pre> | |||
void setup() { | |||
size(400, 600); | |||
smooth(); | |||
background(#022F6C); | |||
fill(#2C1001); | |||
rect(0, 400, 400, 300); | |||
noStroke(); | |||
} | |||
void drawTree(float x, float y, float big, int levels) { | |||
pushMatrix(); | |||
{ | |||
translate(x, y); | |||
line(0, -big/2, -big/2, -big); // brazo izquierdo | |||
line(0, -big/2, 0, -big); // brazo central | |||
line(0, -big/2, big/2, -big); // brazo derecho | |||
line(0, 0, 0, -big/2); // tronco | |||
if (levels > 0) { | |||
stroke(255); //color hojas | |||
drawTree(-big/2, -big, big*(random(.5, 1)), levels - 1); // Y izquierda | |||
drawTree(big/2, -big, big*(random(.5, 1)), levels - 1); // Y derecha | |||
stroke(93, random(50, 93), 0); // color ramas | |||
drawTree(0, -big*(random(.5, 1)), big*0.8, levels - 1 ); // rama central | |||
} | |||
} | |||
popMatrix(); | |||
} | |||
void drawTronco(float x, float y, float x1, float y2) { // Linea para el tronco | |||
strokeWeight(2); | |||
{ | |||
stroke(#645600); | |||
line(x, y, x1, y2); | |||
} | |||
} | |||
void draw() { | |||
} | |||
void mouseReleased() { | |||
drawTree(mouseX, mouseY, 35, round(9)); //hace la recursiva | |||
drawTronco(mouseX, mouseY, mouseX, mouseY-90); // Dibuja la linea del tronco | |||
} | |||
</pre> |
Revisión actual - 00:41 22 nov 2011
Título | Árbol recursividad |
---|---|
Tipo de Proyecto | Proyecto de Taller |
Palabras Clave | recursividad, processing, prueba, dibujo |
Período | 2011-2011 |
Asignatura | Imagen Escrita, |
Del Curso | Imagen Escrita, |
Carreras | Arquitectura |
Alumno(s) | Trajan Pirkovic |
Profesor | Herbert Spencer |
void setup() { size(400, 600); smooth(); background(#022F6C); fill(#2C1001); rect(0, 400, 400, 300); noStroke(); } void drawTree(float x, float y, float big, int levels) { pushMatrix(); { translate(x, y); line(0, -big/2, -big/2, -big); // brazo izquierdo line(0, -big/2, 0, -big); // brazo central line(0, -big/2, big/2, -big); // brazo derecho line(0, 0, 0, -big/2); // tronco if (levels > 0) { stroke(255); //color hojas drawTree(-big/2, -big, big*(random(.5, 1)), levels - 1); // Y izquierda drawTree(big/2, -big, big*(random(.5, 1)), levels - 1); // Y derecha stroke(93, random(50, 93), 0); // color ramas drawTree(0, -big*(random(.5, 1)), big*0.8, levels - 1 ); // rama central } } popMatrix(); } void drawTronco(float x, float y, float x1, float y2) { // Linea para el tronco strokeWeight(2); { stroke(#645600); line(x, y, x1, y2); } } void draw() { } void mouseReleased() { drawTree(mouseX, mouseY, 35, round(9)); //hace la recursiva drawTronco(mouseX, mouseY, mouseX, mouseY-90); // Dibuja la linea del tronco }