def generate_faces(mesh): dots, faces = mesh faces_ = [] for face in faces: faces_.append( bs.Face(*get_vectors_face(face, dots), ims.Color(0, 0, 0))) return faces_
def create_triangle_recorded(x1, y1, x2, y2, x3, y3, fillColor=ims.Color(0, 0, 0), lineColor=ims.Color(0, 0, 0), fill=False, line=True): if recordImages: ims.create_triangle(x1, y1, x2, y2, x3, y3, fillColor, lineColor, fill, line) if visualiseImage: if line: if fill: create_polygon(x1, y1, x2, y2, x3, y3, fill=fillColor.get_color_str(), outline=LINECOLOR.get_color_str()) else: create_line(x1, y1, x2, y2, x3, y3, x1, y1, fill=LINECOLOR.get_color_str()) elif fill: create_polygon(x1, y1, x2, y2, x3, y3, fill=fillColor.get_color_str())
RECORDED = False bs.visualiseImage = True bs.animatedImage = True fileName ="test" resoluion = 10 itemResolution = 2 bs.FILL = True bs.LINE = True nbImages = 10 MOVEMOUSE = False p.PROJECTIONSHERIQUE = True p.FOV = 2 light = v.Vector3D(10,-5,-3) light.normalize() lightColor = ims.Color(200, 200, 200, 0.8) waterColorMin = ims.Color(0, 0, 50) waterColorMax = ims.Color(0, 0, 50) wallColorMin = ims.Color(96, 80, 80) wallColorMax = ims.Color(96, 80, 80) itemColorMin = ims.Color(107, 103, 0) itemColorMax = ims.Color(110, 110, 10) waterMaterial = ims.Material(waterColorMin, waterColorMax, 1) wallMaterial = ims.Material(wallColorMin, wallColorMax, 1) itemMaterial = ims.Material(itemColorMin, itemColorMax, 1) solidWall = False
""" Created on Sat Mar 23 10:15:26 2019 @author: pierrehb """ import MyLibrairy.Vectors as v import MyLibrairy.imagesSavor as ims import MyLibrairy.basicScreen as bs light = v.Vector3D(0, 0, 0) position = v.Vector3D(0, 0, 0) direction = v.Vector3D(0, 0, 0) Dx = v.Vector3D(0, 0, 0) Dz = v.Vector3D(0, 0, 0) lightColor = ims.Color(0, 0, 0) screenX = 0 screenY = 0 screen = 0 PROJECTIONSHERIQUE = False FOV = 3 def get_virtual_screen(direction, screenX, screenY): if direction.getX() == 0: Dx = v.Vector3D(1, 0, 0) else: x = direction.getX() y = direction.getY() rap = (y / x)**2 + 1 yi = 1 / ((rap)**0.5)
def create_line_recorded(x1, y1, x2, y2, color=ims.Color(0, 0, 0)): if recordImages: ims.create_line(x1, y1, x2, y2, color) if visualiseImage: create_line(x1, y1, x2, y2, fill=color.get_color_str())
screenX = 550 screenY = 550 callBack = lambda: True canvas = Canvas refresh = True workWithEnvironnement = False environnements = None environnementLayers = 1 callBackEnv = lambda x: 1 projectionEnv = lambda x: 1 recordImages = False LINE = False FILL = True LINECOLOR = ims.Color(100, 100, 100) visualiseImage = True animatedImage = True LOOP = True def get_current_time(): #renvoit la date en ms time = datetime.now() time = [ time.year, time.month, time.day, time.hour, time.minute, time.second, time.microsecond ] microSeconds = 0 for i, m in enumerate([ 31536000000000, 2592000000000, 86400000000, 3600000000, 60000000, 1000000, 1