Entradas

Mostrando las entradas de mayo, 2018

Figura 3D

Imagen
import sys, math, pygame from operator import itemgetter class Point3D: def __init__ ( self , x= 0 , y= 0 , z= 0 ): self .x, self .y, self .z = float (x), float (y), float (z) def rotateX( self , angle): """ Rotates the point around the X axis by the given angle in degrees. """ rad = angle * math.pi / 180 cosa = math.cos(rad) sina = math.sin(rad) y = self .y * cosa - self .z * sina z = self .y * sina + self .z * cosa return Point3D( self .x, y, z) def rotateY( self , angle): """ Rotates the point around the Y axis by the given angle in degrees. """ rad = angle * math.pi / 180 cosa = math.cos(rad) sina = math.sin(rad) z = self .z * cosa - self .x * sina x = self .z * sina + self .x * cosa return Point3D(x, self .y, z) def rotateZ( self , angle): """ Rotates the point...

Trabajos en 2-D

Dibujo from Tkinter import * import math canvas = Canvas( width = 700 , height = 550 , bg = 'white' ) canvas.pack( expand =YES, fill =BOTH) canvas.create_oval( 150 , 150 , 400 , 400 , fill = "cornsilk" , outline = "black" , dash =( 5 , 10 )) canvas.create_rectangle( 210 , 219 , 248 , 256 , fill = "white" , outline = "blue" , dash =( 5 , 10 )) canvas.create_rectangle( 310 , 219 , 348 , 256 , fill = "white" , outline = "blue" , dash =( 5 , 10 )) canvas.create_arc( 290 , 270 , 250 , 310 , fill = "white" , outline = "black" , dash =( 5 , 10 )) canvas.create_arc( 450 , 220 ,- 20 , 120 , fill = "pink" , outline = "black" , dash =( 5 , 10 )) coord= 330 , 250 , 225 , 375 canvas.create_arc(coord, star = 0 , extent =- 180 , ...