Presentación3d

31

description

python para todos los que queren aprender

Transcript of Presentación3d

Page 1: Presentación3d
Page 2: Presentación3d

TEMA: FI GURAS GEOMETRI CAS

INTEGRANTES: Lenin SUCASACA RAMIREZ Jesús Henrry COILA MAMANI

Page 3: Presentación3d

AGENDA

Descripción del proyecto Fundamento teórico Diagrama de flujo Codificación Demostración Conclusiones Recomendaciones Bibliografía

Page 4: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA INTRODUCCIÓN.- VPython es el lenguaje de

programación Python más un módulo de gráficos 3D Visual. VPython permite a los usuarios crear objetos, como conos y esferas en el espacio 3D y muestra estos objetos en una ventana. La simplicidad de VPython ha convertido en una herramienta para la simple ilustración de la física, especialmente en el ámbito educativo.

Page 5: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA

from visual import *from visual.text import *import time

en estas primeras lineas estamos exportando funciones de Visual Basic y también funciones de reloj.

Page 6: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA

Page 7: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA

En el anterior codigo mostrado a la represdentacion de un relog pequeño la cual funciona con el sistema de la computadora

Page 8: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA

# The floor, central post, and ball atop the postbox(pos=(0,-0.1,0),length=24,height=0.2,width=

24, color=(0,1,0))cylinder(pos=(0,0,0),axis=(0,h,0), radius=0.2,

color=(1,0,0))sphere(pos=(0,h,0), radius=0.5, color=(1,0,0)) Este presente codigo no’s permite crear la

base de la aplicacion.

Page 9: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA# Set up the gray slabs, including a portal

for i in range(Nslabs):

theta = i*2*pi/Nslabs

c = cos(theta)

s = sin(theta)

xc = R*c

zc = R*s

if i == 2: # Make a portal

box(pos=(-3.*w/8.,0.75*h/2.,R),

length=0.5*w/2,height=0.75*h,width=d, color=grey)

box(pos=(3.*w/8.0,0.75*h/2.,R),

length=-0.5*w/2,height=0.75*h,width=d, color=grey)

box(pos=(0,0.85*h,R),

length=w,height=0.3*h,width=d, color=grey)

else:

slab = box(pos=(R*c, h/2., R*s), axis=(c,0,s),

length=d, height=h, width=w, color=grey)

En este presente codigo nos permite crear los cuadrados alrededor de las figuras asi como tambien un portal .

Page 10: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA

# Decorate the front entrance slabtext(pos=(0, 0.77*h, R+d/2), string="LENIN",

color=color.black, depth=0.2, height=0.7, justify="center")

En codigo nos permite ingresar un pequeño texto al portal.

Page 11: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA

# Decorate back slab with a gold box and a clockbox(pos=(0,h/2.,-R+d/2+0.1),

length=w/2.,height=w/2.,width=0.2, color=(1,0.8,0))

clock = analog_clock(pos=(0,h/2.,-R+d/2+0.2+0.2*h/10.),

radius=0.20*w, axis=(0,0,1)) Este presente código nos permite darles

movimientos a algunos objetos de la aplicación o del ejemplo

Page 12: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA

# Draw guy wires from the top of the central post

Nwires = 32

for i in range(Nwires):

theta = i*2*pi/Nwires

cylinder(pos=(0,h,0), axis=(R*cos(theta),-h-0.1,R*sin(theta)),

radius=0.02, color=(1,0.7,0)) Este codigo nos permite crear como unas lineas con un

eje de un cilindro.

Page 13: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA

# Display extruded text

text( pos=(1.0,-0.3*sin(pi/10),-2), string='L', height=2.0, depth=0.3,

color=(0,0,1.0), up=(0,cos(pi/10),-sin(pi/10)) )

text( pos=(3.2,0,-2), string='S', height=2.0, depth=0.3,

color=(1.0,1.0,0), axis=(1,0,0.3))

text( pos=(5.0,-0.6*sin(pi/18),-1.4), string='R', height=2.0, depth=0.3,

color=(1.0,0,1.0), axis=(1,0,0.6), up=(0,cos(pi/18),sin(pi/18)) )

Este codigo nos permite crear unas letras como es la letra L, S, R.

Page 14: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA

# Display a pyramidpyramid(pos=(-4,0,-5), size=(2,2,2), axis=(0,3,0),

color=color.orange)

Este codigo nos permite crear una piramide de color naranja (orange).

Page 15: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA

# Display smoke rings rising out of a black tube

smoke = []

Nrings = 20

x0, y0, z0 = -5, 1.5, -2

r0 = 0.1

spacing = 0.2

thick = r0/4.

dr = 0.015

dthick = thick/Nrings

gray = 1.0

cylinder(pos=(x0,0,z0), axis=(0,y0+r0,0), radius=1.5*r0, color=color.black)

Este codigo nos permite crear los abjetos animados

Page 16: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA

# Create the smoke ringsfor i in range(Nrings): smoke.append(ring(pos=(x0,y0+spacing*i,z0),

axis=(0,1,0), radius=r0+dr*i, thickness=thick-

dthick*i, color=(gray,gray,gray)))y = 0dy = spacing/20top = Nrings-1

Page 17: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA# Roll a log back and forthrlog = 1.wide = 4.zpos = 2.zface = 5.tlogend = 0.2v0 = 1v = v0omega = -v0/rlogtheta = 0dt = 0.1tstop = 0.3log = frame(pos=(-wide,rlog,zpos),

axis=(0,0,1))

cylinder(frame=log, pos=(0,0,0), axis=(zface-zpos,0,0), color=(0.8,0.5,0))box(frame=log, pos=(zface-zpos+tlogend/2.,0,0), axis=(0,0,1), length=rlog, height=rlog, width=tlogend, color=color.yellow)

leftstop = box(pos=(-wide-rlog-tstop/2.,0.6*rlog,(zpos+zface)/2.), length=tstop, height=1.2*rlog, width=(zface-zpos), color=color.red)rightstop = box(pos=(wide+rlog+tstop/2.,0.6*rlog,(zpos+zface)/2.), length=tstop, height=1.2*rlog, width=(zface-zpos), color=color.red)

Page 18: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA

# Run a ball up and down the poley1 = 0.4y2 = 0.8*hvball0 = 2.5*v0vball = vball0ball = sphere(pos=(0,y1,0), radius=y1,

color=color.blue)rbaseball = 0.3vbaseball0 = 3*v0

Page 19: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA

# Display an ellipsoid

Rcloud = 0.8*R

omegacloud = v0/Rcloud

cloud = ellipsoid(pos=(0,0.7*h,-Rcloud), size=(5,2,2), color=(0.4,0.4,0.4))

rhairs = 0.025 # half-length of crosshairs

dhairs = 2. # how far away the crosshairs are

maxcosine = dhairs/sqrt(rhairs**2+dhairs**2) # if ray inside crosshairs, don't move

haircolor = color.black

roam = 0

Page 20: Presentación3d

DESCRI PCI ÓN DEL PROBLEMAwhile 1:

# Toggle roam option

if scene.mouse.events:

m = scene.mouse.getevent()

if m.drag or m.drop:

roam = not roam

# If in roaming mode, change center and forward according to mouse position

if roam:

ray = scene.mouse.ray

if abs(dot(ray,scene.forward)) < maxcosine: # do something only if outside crosshairs

newray = norm(vector(ray.x, 0, ray.z))

angle = arcsin(dot(cross(scene.forward,newray),scene.up))

newforward = rotate(scene.forward, axis=scene.up, angle=angle/10.)

scene.center = scene.mouse.camera+newforward*mag(scene.center-scene.mouse.camera)

scene.forward = newforward

scene.center = scene.center+scene.forward*ray.y/2.

# Roll the log

theta = theta + omega*dt

log.x = log.x+v*dt

log.rotate(angle=omega*dt) if log.x >= wide: v = -v0 omega = -v/rlog if rightstop.color == (1,0,0): rightstop.color = (0,0,1) else: rightstop.color = (1,0,0) if log.x <= -wide: v = +v0 omega = -v/rlog if leftstop.color == (1,0,0): leftstop.color = (0,0,1) else: leftstop.color = (1,0,0)

# Move the cloud cloud.rotate(angle=omegacloud*dt, origin=(0,0,0), axis=(0,1,0))

# Run the ball up and down ball.pos.y = ball.pos.y+vball*dt if ball.pos.y >= y2: vball = -vball0 if ball.pos.y <= y1: vball = +vball0

Page 21: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA# Move the smoke rings

for i in range(Nrings):

# Raise the smoke rings

smoke[i].pos = smoke[i].pos+vector(0,dy,0)

smoke[i].radius = smoke[i].radius+(dr/spacing)*dy

smoke[i].thickness = smoke[i].thickness-(dthick/spacing)*dy

y = y+dy

if y >= spacing:

# Move top ring to the bottom

y = 0

smoke[top].pos = (x0, y0, z0)

smoke[top].radius = r0

smoke[top].thickness = thick

top = top-1

if top < 0:

top = Nrings-1

# Update the analog clock on the back slab

clock.update()

rate(30)

Page 22: Presentación3d

DESCRI PCI ÓN DEL PROBLEMA

En todo este código nos permite configurar el poder mover con el mouse y con la sentencia while nos da un parámetro el cual se hace todos los procesos ya mencionados como los desplazamientos de los objetos y mas movimientos .

Page 23: Presentación3d

FUNDAMENTO TEÓRI CO

Este presente trabajo esta basado en la formación de la figuras geométricas y con la ayuda de la física para poder calcular los movimientos que podemos apreciar en el ejemplo (así también se utiliza las formulas de la dinámica para ser exactos con los movimientos que se presenta.

Page 24: Presentación3d

DI AGRAMA DE FLUJO

Page 25: Presentación3d

CODI FI CACI ÓN

Page 26: Presentación3d

DEMOSTRACI ÓN

Page 27: Presentación3d

CONCLUSI ONES

Este presente trabajo tiene por objeto el poder profundizar el tema de programación de celulares en forma mas profesional, nos permite ver la forma y la estructura las figuras geométricas formados en 3 dimensiones también los efectos o desplazamientos que se presenta en el siguiente proyecto.

Page 28: Presentación3d

RECOMENDACI ONES AL ALUMNO.- Poner todo su empeño para poder

aprender, investigar tanto en internet como en libros, por ultimo ponerse a practicar al menos 2 horas al día para poder al menos un nivel intermedio.

AL DOCENTE.- El docente deberá tener mucha paciencia pero mucha paciencia para poder explicarnos el tema ya que para muchos de nosotros se nos hace difícil entender el tema de programación.

A LA INSTITUCION.- La institución no nos brinda el tiempo suficiente para poder llevar a cabalidad el curso ya que 3 horas ala semana es algo incoherente para poder aprender un curso tan avanzado el de taller de móviles. Ser mas coherentes a la hora de programar las horas de los cursos según al peso y lo avanzado que se trate.

Page 29: Presentación3d

BI BLI OGRAFÍ A Buscadores en internet, google, altavista,

yahoo y otros. http://people.uncw.edu http://vpython.org/webdoc/visual

Page 30: Presentación3d
Page 31: Presentación3d