Exemple #1
0
def piedra(x, y):

    ref_color = gs.Color(0.372, 0.403, 0.360)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(201 + x, 330 + y)
    GL.glVertex2f(192 + x, 340 + y)
    GL.glVertex2f(211 + x, 343 + y)
    GL.glVertex2f(211 + x, 338 + y)
    GL.glEnd()

    ref_color = gs.Color(0.215, 0.219, 0.164)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(201 + x, 330 + y)
    GL.glVertex2f(192 + x, 340 + y)
    GL.glVertex2f(186 + x, 335 + y)
    GL.glVertex2f(196 + x, 325 + y)
    GL.glEnd()

    ref_color = gs.Color(0.564, 0.537, 0.474)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(196 + x, 325 + y)
    GL.glVertex2f(201 + x, 330 + y)
    GL.glVertex2f(211 + x, 338 + y)
    GL.glVertex2f(217 + x, 330 + y)
    GL.glVertex2f(206 + x, 320 + y)

    GL.glEnd()

    ref_color = gs.Color(0.215, 0.219, 0.164)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(211 + x, 343 + y)
    GL.glVertex2f(211 + x, 338 + y)
    GL.glVertex2f(217 + x, 338 + y)
    GL.glVertex2f(220 + x, 342 + y)
    GL.glEnd()

    ref_color = gs.Color(0.372, 0.403, 0.360)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(211 + x, 338 + y)
    GL.glVertex2f(217 + x, 338 + y)
    GL.glVertex2f(220 + x, 342 + y)
    GL.glVertex2f(222 + x, 340 + y)
    GL.glVertex2f(217 + x, 330 + y)
    GL.glEnd()
def ellipsoid(a, b, c, step=0.5, object_color=None):
    if object_color is None:
        object_color = gs.Color(0.0, 0.2, 0.5)
    else:
        pass

    u_step = step
    v_step = step

    ellipsoid = gs.GraphicalObject()
    ellipsoid.set_name("ellipsoid")

    u_top = 2 * math.pi
    u_down = 0

    v_top = math.pi
    v_down = 0

    #coordinates: x = a cos(u) sen(v) y = b sen(u) sen(v) z = c cos(v))

    first_edge = []
    v = v_down
    for u in quat.frange(u_down, u_top, u_step):
        x_value = a * math.cos(u) * math.sin(v)
        y_value = b * math.sin(u) * math.sin(v)
        first_edge.append(gs.Point(x_value, y_value, c))

    carry_ref = first_edge[0]
    for ref_point in first_edge:
        ellipsoid.push_edge(carry_ref, ref_point, object_color)

        carry_ref = ref_point

    last_edge = []
    last_edge = first_edge

    for v in quat.frange(v_down, v_top, v_step):
        carry_edge = []
        z_value = c * math.cos(v)
        for u in quat.frange(u_down, u_top, u_step):
            x_value = a * math.cos(u) * math.sin(v)
            y_value = b * math.sin(u) * math.sin(v)
            carry_edge.append(gs.Point(x_value, y_value, z_value))

        ##SE EMPIEZA A GENERAR LOS BORDES
        carry_ref = carry_edge[0]
        index = 0
        for ref_point in carry_edge:
            ##Generan Bordes Respecto a XY
            ellipsoid.push_edge(carry_ref, ref_point, object_color)

            ##Generan Bordes respecto a Z
            ellipsoid.push_edge(carry_ref, last_edge[index], object_color)

            carry_ref = ref_point
            index += 1

        last_edge = carry_edge

    return ellipsoid
Exemple #3
0
    def __init__(self, down_vertex, edge_length):
        self.ref_vertex = down_vertex
        self.length = edge_length
        self.list_of_points = []

        self.generate()

        self.cloud_of_points = []

        self.cube = gs.GraphicalObject()

        self.black = gs.Color()
        self.black.set_name("black")
        self.white = gs.Color(1.0, 1.0, 1.0)
        self.white.set_name("white")
        self.red = gs.Color(1.0, 0.0, 0.0)
        self.red.set_name("red")
        self.green = gs.Color(0.0, 1.0, 0.0)
        self.green.set_name("green")
        self.blue = gs.Color(0.0, 0.0, 1.0)
        self.blue.set_name("blue")
        self.orange = gs.Color(1.0, 0.27, 0.0)
        self.orange.set_name("orange")
        self.yellow = gs.Color(1.0, 1.0, 0.0)
        self.yellow.set_name("yellow")

        self.list_of_faces = []
        self.list_of_sub_faces = []
        self.matrix_of_cubes = [[[[], [], []], [[], [], []], [[], [], []]],
                                [[[], [], []], [[], [], []], [[], [], []]],
                                [[[], [], []], [[], [], []], [[], [], []]]]
        self.create_refs_vertex()
        self.generate_cloud()
Exemple #4
0
    def standard_cube(self):

        counter = 0
        for ref in self.list_of_points:
            if counter % 4 == 0:
                p0 = ref
            else:
                p1 = ref

                self.cube.push_edge(p0, p1, gs.Color(0, 0, 0))

                p0 = p1
            counter = counter + 1

        self.cube.show()
def main():
    GLUT.glutInit(sys.argv)
    GLUT.glutInitDisplayMode(GLUT.GLUT_SINGLE | GLUT.GLUT_RGBA
                             | GLUT.GLUT_DEPTH)
    GLUT.glutInitWindowSize(400, 400)
    GLUT.glutInitWindowPosition(200, 200)

    GLUT.glutCreateWindow("Grafica 2")

    GL.glDepthFunc(GL.GL_LEQUAL)
    GL.glEnable(GL.GL_DEPTH_TEST)
    GL.glClearDepth(1.0)
    GL.glClearColor(0.650, 0.780, 0.8, 0)
    GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
    GL.glMatrixMode(GL.GL_PROJECTION)
    GL.glLoadIdentity()
    GL.glMatrixMode(GL.GL_MODELVIEW)

    GLU.gluPerspective(100, 1.0, 1.0, 100.0)
    GL.glTranslatef(0.0, 0.0, 0.0)
    GLU.gluLookAt(10, 10, 10, 0, 0, 0, 0, 1, 0)

    grid = gr.grid_gen(100, gs.Color(0.5, 1, 1))

    while True:

        GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)

        grid.show()
        grid.plot()

        ########################################

        myTree.plotAge(5)

        ########################################

        GL.glFlush()
        GLUT.glutPostRedisplay()

    GLUT.glutMainLoop()
def hiperboloid_1h(a, b, c, dom, step=0.5, object_color=None):
    if object_color is None:
        object_color = gs.Color(0.0, 0.2, 0.5)
    else:
        pass

    u_step = step
    v_step = step

    hiperboloid_1h = gs.GraphicalObject()
    hiperboloid_1h.set_name("hiperboloid")

    u_top = 2 * math.pi
    u_down = 0

    v_top = dom
    v_down = -1 * dom

    #hiperboloide de una hojas  x = a cos(u) cosh(v)  y = b sen(u) cosh(v) z =  c senh(v)) u = 0,2pi , v = R

    first_edge = []
    v = v_down
    o = c * math.sinh(v)
    for u in quat.frange(u_down, u_top, u_step):
        x_value = a * math.cos(u) * math.cosh(v)
        y_value = b * math.sin(u) * math.cosh(v)
        first_edge.append(gs.Point(x_value, y_value, o))

    carry_ref = first_edge[0]
    for ref_point in first_edge:
        hiperboloid_1h.push_edge(carry_ref, ref_point, object_color)

        carry_ref = ref_point

    last_edge = []
    last_edge = first_edge

    for v in quat.frange(v_down, v_top, v_step):
        carry_edge = []
        z_value = c * math.sinh(v)
        for u in quat.frange(u_down, u_top, u_step):
            x_value = a * math.cos(u) * math.cosh(v)
            y_value = b * math.sin(u) * math.cosh(v)
            carry_edge.append(gs.Point(x_value, y_value, z_value))

        ##SE EMPIEZA A GENERAR LOS BORDES
        carry_ref = carry_edge[0]
        index = 0
        for ref_point in carry_edge:
            ##Generan Bordes Respecto a XY
            hiperboloid_1h.push_edge(carry_ref, ref_point, object_color)

            ##Generan Bordes respecto a Z
            hiperboloid_1h.push_edge(carry_ref, last_edge[index], object_color)

            carry_ref = ref_point
            index += 1

        last_edge = carry_edge

    return hiperboloid_1h
def parabolic_cylinder(a, dom, step=0.5, object_color=None):
    if object_color is None:
        object_color = gs.Color(0.0, 0.2, 0.5)
    else:
        pass

    u_step = step
    v_step = step

    parabolic_cylinder = gs.GraphicalObject()
    parabolic_cylinder.set_name("parabolic_cylinder")

    u_top = dom
    u_down = -dom

    v_top = dom
    v_down = -dom

    #cilindro parabolico T(u, v) = (u, a u², v)

    first_edge = []
    v = v_down
    o = v
    for u in quat.frange(u_down, u_top, u_step):
        x_value = u
        y_value = a * u**2
        first_edge.append(gs.Point(x_value, y_value, o))

    carry_ref = first_edge[0]
    for ref_point in first_edge:
        parabolic_cylinder.push_edge(carry_ref, ref_point, object_color)

        carry_ref = ref_point

    last_edge = []
    last_edge = first_edge

    for v in quat.frange(v_down, v_top, v_step):
        carry_edge = []
        z_value = v
        for u in quat.frange(u_down, u_top, u_step):
            x_value = u
            y_value = a * u**2
            carry_edge.append(gs.Point(x_value, y_value, z_value))

        ##SE EMPIEZA A GENERAR LOS BORDES
        carry_ref = carry_edge[0]
        index = 0
        for ref_point in carry_edge:
            ##Generan Bordes Respecto a XY
            parabolic_cylinder.push_edge(carry_ref, ref_point, object_color)

            ##Generan Bordes respecto a Z
            parabolic_cylinder.push_edge(carry_ref, last_edge[index],
                                         object_color)

            carry_ref = ref_point
            index += 1

        last_edge = carry_edge

    return parabolic_cylinder
def hyperbolic_cylinder(a, b, dom, step=0.5, object_color=None):
    if object_color is None:
        object_color = gs.Color(0.0, 0.2, 0.5)
    else:
        pass

    u_step = step
    v_step = step

    hyperbolic_cylinder = gs.GraphicalObject()
    hyperbolic_cylinder.set_name("hyperbolic_cylinder")

    u_top = 2 * math.pi
    u_down = 0

    v_top = dom
    v_down = -dom

    #cilindro hiperbolico (a sec(u), b tg(u), v)

    first_edge = []
    v = v_down
    o = v
    for u in quat.frange(u_down, u_top, u_step):
        x_value = a * (1 / math.cos(u))
        y_value = b * math.tan(u)
        first_edge.append(gs.Point(x_value, y_value, o))

    carry_ref = first_edge[0]
    for ref_point in first_edge:
        hyperbolic_cylinder.push_edge(carry_ref, ref_point, object_color)

        carry_ref = ref_point

    last_edge = []
    last_edge = first_edge

    for v in quat.frange(v_down, v_top, v_step):
        carry_edge = []
        z_value = v
        for u in quat.frange(u_down, u_top, u_step):
            x_value = a * (1 / math.cos(u))
            y_value = b * math.tan(u)
            carry_edge.append(gs.Point(x_value, y_value, z_value))

        ##SE EMPIEZA A GENERAR LOS BORDES
        carry_ref = carry_edge[0]
        index = 0
        for ref_point in carry_edge:
            ##Generan Bordes Respecto a XY
            hyperbolic_cylinder.push_edge(carry_ref, ref_point, object_color)

            ##Generan Bordes respecto a Z
            hyperbolic_cylinder.push_edge(carry_ref, last_edge[index],
                                          object_color)

            carry_ref = ref_point
            index += 1

        last_edge = carry_edge

    return hyperbolic_cylinder
def hyperbolic_parabolid(a, b, c, dom, step=0.5, object_color=None):
    if object_color is None:
        object_color = gs.Color(0.0, 0.2, 0.5)
    else:
        pass

    u_step = step
    v_step = step

    hyperbolic_parabolid = gs.GraphicalObject()
    hyperbolic_parabolid.set_name("hyperbolic_parabolid")

    u_top = dom
    u_down = -1 * dom

    v_top = dom
    v_down = -1 * dom

    #paraboloide hiperbolico  x = a (u+v) y =  b (u− v) z = 4c uv), con D = R²
    #a    u, b    v, c(u² − v²)

    first_edge = []
    v = v_down
    for u in quat.frange(u_down, u_top, u_step):
        x_value = a * u
        y_value = b * v
        z_value = c * (u**2 - v**2)
        first_edge.append(gs.Point(x_value, y_value, z_value))

    carry_ref = first_edge[0]
    for ref_point in first_edge:
        hyperbolic_parabolid.push_edge(carry_ref, ref_point, object_color)

        carry_ref = ref_point

    last_edge = []
    last_edge = first_edge

    for v in quat.frange(v_down, v_top, v_step):
        carry_edge = []
        for u in quat.frange(u_down, u_top, u_step):
            x_value = a * u
            y_value = b * v
            z_value = c * (u**2 - v**2)
            carry_edge.append(gs.Point(x_value, y_value, z_value))

        ##SE EMPIEZA A GENERAR LOS BORDES
        carry_ref = carry_edge[0]
        index = 0
        for ref_point in carry_edge:
            ##Generan Bordes Respecto a XY
            hyperbolic_parabolid.push_edge(carry_ref, ref_point, object_color)

            ##Generan Bordes respecto a Z
            hyperbolic_parabolid.push_edge(carry_ref, last_edge[index],
                                           object_color)

            carry_ref = ref_point
            index += 1

        last_edge = carry_edge

    return hyperbolic_parabolid
Exemple #10
0
def main(points):
    GLUT.glutInit(sys.argv)
    GLUT.glutInitDisplayMode(GLUT.GLUT_SINGLE | GLUT.GLUT_RGBA | GLUT.GLUT_DEPTH)
    GLUT.glutInitWindowSize(400, 400)
    GLUT.glutInitWindowPosition(200, 200)

    GLUT.glutCreateWindow("Grafica 2")

    GL.glDepthFunc(GL.GL_LEQUAL)
    GL.glEnable(GL.GL_DEPTH_TEST)
    GL.glClearDepth(1.0)
    GL.glClearColor(0.650, 0.780, 0.8, 0)
    GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
    GL.glMatrixMode(GL.GL_PROJECTION)
    GL.glLoadIdentity()
    GL.glMatrixMode(GL.GL_MODELVIEW)

    GLU.gluPerspective(100, 1.0, 1.0, 100.0)
    GL.glTranslatef(0.0, 0.0, 0.0)
    GLU.gluLookAt(15, 15, 15, 0, 0, 0, 0, 1, 0)

    first_time = True
    grid = gr.grid_gen(250, gs.Color(25 / 255, 150 / 250, 25 / 255))
    grid.show()

    do = True
    while do:
        GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
        grid.plot()

        ########################################

        if first_time:
            GL.glPointSize(2)
            GL.glColor3f(1.0, 0.0, 0.0)
            #GL.glBegin(GL.GL_LINES)
            GL.glBegin(GL.GL_POINTS)
            #carry_ref = points[0]
            for ref_point in points:
                #coordinates = ref_point
                #GL.glVertex3f(carry_ref[0], carry_ref[1], carry_ref[2])
                GL.glVertex3f(ref_point[0], ref_point[1], ref_point[2])
                #carry_ref = ref_point
            GL.glEnd()
            first_time = False

        """
        rubik.rotate_side("i1+")
        rubik.get_cube().plot()
        rubik.plot_sub_faces()
        """

        #final_rubik.rotate_side()
        final_rubik.plot()

        ########################################

        GL.glFlush()
        GLUT.glutPostRedisplay()

        do = False

    GLUT.glutMainLoop()
Exemple #11
0
def arbol(x, y):

    ref_color = gs.Color(0.203, 0.129, 0.101)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(244 + x, 320 + y)
    GL.glVertex2f(244 + x, 282 + y)
    GL.glVertex2f(247 + x, 282 + y)
    GL.glVertex2f(249 + x, 320 + y)
    GL.glEnd()

    ref_color = gs.Color(0.290, 0.180, 0.137)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(244 + x, 320 + y)
    GL.glVertex2f(244 + x, 282 + y)
    GL.glVertex2f(240 + x, 282 + y)
    GL.glVertex2f(240 + x, 318 + y)
    GL.glEnd()

    ref_color = gs.Color(0.129, 0.243, 0.121)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)
    GL.glVertex2f(255 + x, 284 + y)
    GL.glVertex2f(233 + x, 279 + y)
    GL.glVertex2f(230 + x, 282 + y)
    GL.glEnd()

    ref_color = gs.Color(0.105, 0.176, 0.082)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)
    GL.glVertex2f(255 + x, 284 + y)
    GL.glVertex2f(233 + x, 279 + y)
    GL.glVertex2f(250 + x, 260 + y)
    GL.glEnd()

    ref_color = gs.Color(0.156, 0.258, 0.105)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)
    GL.glVertex2f(233 + x, 255 + y)
    GL.glVertex2f(233 + x, 279 + y)
    GL.glVertex2f(250 + x, 260 + y)
    GL.glEnd()

    ref_color = gs.Color(0.129, 0.227, 0.113)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)
    GL.glVertex2f(255 + x, 284 + y)
    GL.glVertex2f(269 + x, 263 + y)
    GL.glVertex2f(250 + x, 260 + y)
    GL.glEnd()

    ref_color = gs.Color(0.121, 0.2, 0.101)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)
    GL.glVertex2f(254 + x, 239 + y)
    GL.glVertex2f(269 + x, 263 + y)
    GL.glVertex2f(250 + x, 260 + y)
    GL.glEnd()

    ref_color = gs.Color(0.219, 0.372, 0.164)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(233 + x, 255 + y)
    GL.glVertex2f(250 + x, 260 + y)
    GL.glVertex2f(254 + x, 239 + y)
    GL.glVertex2f(225 + x, 248 + y)
    GL.glEnd()

    ref_color = gs.Color(0.219, 0.372, 0.164)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(254 + x, 239 + y)
    GL.glVertex2f(225 + x, 248 + y)
    GL.glVertex2f(235 + x, 235 + y)
    GL.glEnd()

    ref_color = gs.Color(0.188, 0.321, 0.125)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(225 + x, 248 + y)
    GL.glVertex2f(220 + x, 266 + y)
    GL.glVertex2f(233 + x, 280 + y)
    GL.glVertex2f(233 + x, 255 + y)
    GL.glEnd()

    ref_color = gs.Color(0.105, 0.176, 0.082)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(220 + x, 266 + y)
    GL.glVertex2f(233 + x, 280 + y)
    GL.glVertex2f(230 + x, 281 + y)
    GL.glEnd()
Exemple #12
0
def nube(x, y):

    ref_color = gs.Color(0.984, 0.988, 0.996)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #1
    GL.glVertex2f(355 + x, 310 + y)
    GL.glVertex2f(414 + x, 330 + y)
    GL.glVertex2f(412 + x, 312 + y)
    GL.glEnd()

    ref_color = gs.Color(0.866, 0.878, 0.756)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #2
    GL.glVertex2f(355 + x, 310 + y)
    GL.glVertex2f(414 + x, 330 + y)
    GL.glVertex2f(390 + x, 340 + y)
    GL.glEnd()

    ref_color = gs.Color(0.843, 0.819, 0.772)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #3
    GL.glVertex2f(412 + x, 312 + y)
    GL.glVertex2f(414 + x, 330 + y)
    GL.glVertex2f(451 + x, 325 + y)
    GL.glVertex2f(433 + x, 309 + y)
    GL.glEnd()

    ref_color = gs.Color(0.956, 0.945, 0.886)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #4
    GL.glVertex2f(414 + x, 330 + y)
    GL.glVertex2f(451 + x, 325 + y)
    GL.glVertex2f(491 + x, 341 + y)
    GL.glEnd()

    ref_color = gs.Color(0.894, 0.862, 0.811)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #10
    GL.glVertex2f(414 + x, 330 + y)
    GL.glVertex2f(455 + x, 335 + y)
    GL.glVertex2f(459 + x, 350 + y)
    GL.glEnd()

    ref_color = gs.Color(0.835, 0.827, 0.768)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #5
    GL.glVertex2f(414 + x, 330 + y)
    GL.glVertex2f(390 + x, 340 + y)
    GL.glVertex2f(459 + x, 350 + y)
    GL.glEnd()

    ref_color = gs.Color(0.984, 0.980, 0.972)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #6
    GL.glVertex2f(451 + x, 325 + y)
    GL.glVertex2f(433 + x, 309 + y)
    GL.glVertex2f(484 + x, 297 + y)
    GL.glEnd()

    ref_color = gs.Color(0.886, 0.882, 0.803)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #7
    GL.glVertex2f(451 + x, 325 + y)
    GL.glVertex2f(484 + x, 297 + y)
    GL.glVertex2f(478 + x, 316 + y)
    GL.glEnd()

    ref_color = gs.Color(0.827, 0.823, 0.752)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #7.5
    GL.glVertex2f(451 + x, 325 + y)
    GL.glVertex2f(478 + x, 316 + y)
    GL.glVertex2f(491 + x, 341 + y)
    GL.glEnd()

    ref_color = gs.Color(0.960, 0.952, 0.901)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #9
    GL.glVertex2f(484 + x, 297 + y)
    GL.glVertex2f(478 + x, 316 + y)
    GL.glVertex2f(548 + x, 325 + y)
    GL.glEnd()
    ref_color = gs.Color(0.803, 0.792, 0.733)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #8
    GL.glVertex2f(548 + x, 325 + y)
    GL.glVertex2f(478 + x, 316 + y)
    GL.glVertex2f(491 + x, 341 + y)
    GL.glEnd()

    ref_color = gs.Color(0.796, 0.784, 0.709)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #11
    GL.glVertex2f(491 + x, 341 + y)
    GL.glVertex2f(455 + x, 335 + y)
    GL.glVertex2f(459 + x, 350 + y)
    GL.glEnd()
Exemple #13
0
def oso():

    ref_color = gs.Color(0.678, 0.603, 0.580)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(104, 296)
    GL.glVertex2f(111, 301)
    GL.glVertex2f(116, 299)  #
    GL.glEnd()

    ref_color = gs.Color(0.827, 0.650, 0.529)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(104, 296)
    GL.glVertex2f(110, 289)
    GL.glVertex2f(116, 299)  #
    GL.glEnd()

    ref_color = gs.Color(0.407, 0.278, 0.219)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(155, 314)
    GL.glVertex2f(155, 327)  #pes
    GL.glVertex2f(165, 334)  #pes
    GL.glVertex2f(169, 316)
    GL.glVertex2f(167, 307)
    GL.glEnd()

    ref_color = gs.Color(0.572, 0.458, 0.403)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #pseuñas
    GL.glVertex2f(155, 327)  #pes
    GL.glVertex2f(165, 334)  #pes
    GL.glVertex2f(149, 334)
    GL.glEnd()

    ref_color = gs.Color(0.454, 0.325, 0.250)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(128, 297)
    GL.glVertex2f(110, 289)
    GL.glVertex2f(116, 299)  #
    GL.glEnd()

    ref_color = gs.Color(0.694, 0.529, 0.443)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(126, 296)
    GL.glVertex2f(128, 294)
    GL.glVertex2f(127, 266)
    GL.glVertex2f(118, 270)  #
    GL.glVertex2f(108, 285)
    GL.glVertex2f(110, 289)
    GL.glEnd()

    ref_color = gs.Color(0, 0, 0)
    GL.glBegin
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(110, 289)
    GL.glVertex2f(113, 293)
    GL.glVertex2f(114, 290)
    GL.glEnd()

    ref_color = gs.Color(0.345, 0.196, 0.121)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(113, 274)
    GL.glVertex2f(115, 282)
    GL.glVertex2f(122, 281)
    GL.glVertex2f(119, 282)
    GL.glEnd()

    ref_color = gs.Color(0.454, 0.305, 0.121)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(113, 274)
    GL.glVertex2f(115, 282)
    GL.glVertex2f(122, 281)
    GL.glVertex2f(121, 278)
    GL.glEnd()

    ref_color = gs.Color(0.670, 0.470, 0.349)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(127, 266)
    GL.glVertex2f(126, 296)
    GL.glVertex2f(139, 300)  #*
    GL.glVertex2f(139, 261)  #*
    GL.glEnd()

    ref_color = gs.Color(0.545, 0.360, 0.282)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(139, 261)  #*
    GL.glVertex2f(139, 305)
    #glVertex2f(129,315)
    #glVertex2f(135,330)
    GL.glVertex2f(168, 308)
    GL.glVertex2f(156, 268)  #*
    GL.glVertex2f(139, 261)  #*
    GL.glEnd()

    ref_color = gs.Color(0.415, 0.313, 0.262)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #lomo triangulo
    GL.glVertex2f(152, 258)
    GL.glVertex2f(156, 268)  #*
    GL.glVertex2f(139, 261)  #*
    GL.glEnd()

    ref_color = gs.Color(0.666, 0.505, 0.419)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #lomo triangulo
    GL.glVertex2f(152, 258)
    GL.glVertex2f(156, 268)  #*
    GL.glVertex2f(165, 261)
    GL.glEnd()

    ref_color = gs.Color(0.545, 0.360, 0.282)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(139, 305)
    GL.glVertex2f(129, 315)
    GL.glVertex2f(135, 330)
    GL.glVertex2f(168, 308)
    GL.glVertex2f(156, 268)  #*
    GL.glEnd()

    ref_color = gs.Color(0.572, 0.458, 0.403)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #pseuñas
    GL.glVertex2f(129, 315)
    GL.glVertex2f(135, 330)
    GL.glVertex2f(127, 333)
    GL.glEnd()

    ref_color = gs.Color(0.803, 0.627, 0.537)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #
    GL.glVertex2f(156, 268)  #*
    GL.glVertex2f(165, 261)
    GL.glVertex2f(168, 308)
    GL.glEnd()

    ref_color = gs.Color(0.674, 0.478, 0.349)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_QUADS)  #barriga
    GL.glVertex2f(165, 261)
    GL.glVertex2f(168, 308)
    GL.glVertex2f(203, 301)
    GL.glVertex2f(207, 257)
    GL.glEnd()

    ref_color = gs.Color(0.407, 0.278, 0.219)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #barriga triangulo bajo
    GL.glVertex2f(168, 308)
    GL.glVertex2f(203, 301)
    GL.glVertex2f(203, 315)
    GL.glEnd()

    #atras

    ref_color = gs.Color(0.525, 0.364, 0.294)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #traser
    GL.glVertex2f(239, 325)  #pes
    GL.glVertex2f(245, 333)  #pes
    GL.glVertex2f(233, 333)
    GL.glEnd()

    ref_color = gs.Color(0.286, 0.196, 0.164)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #traser
    GL.glVertex2f(238, 286)
    GL.glVertex2f(225, 307)
    GL.glVertex2f(239, 325)  #pes
    GL.glVertex2f(245, 333)  #pes
    GL.glVertex2f(252, 321)
    GL.glVertex2f(238, 286)
    GL.glEnd()

    ref_color = gs.Color(0.529, 0.360, 0.298)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #cola
    GL.glVertex2f(240, 285)
    GL.glVertex2f(233, 295)
    GL.glVertex2f(245, 292)
    GL.glEnd()

    ref_color = gs.Color(0.407, 0.278, 0.219)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #traser
    GL.glVertex2f(234, 275)
    GL.glVertex2f(223, 307)
    GL.glVertex2f(227, 307)
    GL.glVertex2f(240, 285)
    GL.glEnd()

    ref_color = gs.Color(0.556, 0.372, 0.301)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #pata trasera
    GL.glVertex2f(207, 257)
    GL.glVertex2f(203, 301)
    GL.glVertex2f(203, 315)
    GL.glVertex2f(206, 326)  #pes
    GL.glVertex2f(209, 333)  #pes
    GL.glVertex2f(220, 334)
    GL.glVertex2f(234, 275)
    GL.glEnd()

    ref_color = gs.Color(0.572, 0.458, 0.403)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #pata trasera
    GL.glVertex2f(206, 326)  #pes
    GL.glVertex2f(209, 333)  #pes
    GL.glVertex2f(198, 333)
    GL.glEnd()
Exemple #14
0
def cerro():

    ref_color = gs.Color(0.462, 0.462, 0.462)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(316, 327)
    GL.glVertex2f(269, 298)
    GL.glVertex2f(321, 154)
    GL.glVertex2f(329, 182)
    GL.glEnd()

    ref_color = gs.Color(0.950, 0.954, 0.962)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)
    GL.glVertex2f(321, 154)
    GL.glVertex2f(329, 182)
    GL.glVertex2f(339, 101)  #punta
    GL.glEnd()

    ref_color = gs.Color(0.380, 0.380, 0.380)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(316, 327)
    GL.glVertex2f(329, 182)  #*
    GL.glVertex2f(347, 155)  #*
    GL.glVertex2f(378, 321)
    GL.glEnd()

    ref_color = gs.Color(0.850, 0.854, 0.862)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)
    GL.glVertex2f(329, 182)  #*
    GL.glVertex2f(347, 155)  #*
    GL.glVertex2f(339, 101)  #punta
    GL.glEnd()

    ref_color = gs.Color(0.282, 0.282, 0.274)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(347, 155)  #*
    GL.glVertex2f(378, 321)
    GL.glVertex2f(412, 295)
    GL.glVertex2f(368, 181)  #*
    GL.glEnd()

    ref_color = gs.Color(0.750, 0.754, 0.762)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)
    GL.glVertex2f(368, 181)  #*
    GL.glVertex2f(347, 155)  #*
    GL.glVertex2f(339, 101)  #punta
    GL.glEnd()
Exemple #15
0
def Base():

    ref_color = gs.Color(0.501, 0.349, 0.219)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #1
    GL.glVertex2f(102, 329)
    GL.glVertex2f(160, 422)
    GL.glVertex2f(191, 365)
    GL.glEnd()

    ref_color = gs.Color(0.411, 0.278, 0.172)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #2
    GL.glVertex2f(102, 329)
    GL.glVertex2f(178, 344)
    GL.glVertex2f(191, 365)
    GL.glEnd()

    ref_color = gs.Color(0.2, 0.149, 0.082)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #3
    GL.glVertex2f(160, 422)
    GL.glVertex2f(191, 365)
    GL.glVertex2f(205, 430)
    GL.glEnd()

    ref_color = gs.Color(0.337, 0.235, 0.098)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)  #4
    GL.glVertex2f(178, 344)
    GL.glVertex2f(191, 365)
    GL.glVertex2f(291, 385)
    GL.glVertex2f(312, 367)
    GL.glEnd()

    ref_color = gs.Color(0.301, 0.2, 0.133)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #5
    GL.glVertex2f(191, 365)
    GL.glVertex2f(205, 430)
    GL.glVertex2f(228, 463)
    GL.glEnd()

    ref_color = gs.Color(0.411, 0.278, 0.172)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #6
    GL.glVertex2f(191, 365)
    GL.glVertex2f(228, 463)
    GL.glVertex2f(291, 385)
    GL.glEnd()

    ref_color = gs.Color(0.309, 0.2, 0.145)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #7
    GL.glVertex2f(228, 463)
    GL.glVertex2f(291, 385)
    GL.glVertex2f(348, 495)

    GL.glEnd()

    ref_color = gs.Color(0.2, 0.149, 0.086)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #8
    GL.glVertex2f(228, 463)
    GL.glVertex2f(303, 508)
    GL.glVertex2f(348, 495)
    GL.glEnd()

    ref_color = gs.Color(0.250, 0.192, 0.109)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #9
    GL.glVertex2f(348, 495)
    GL.glVertex2f(291, 385)
    GL.glVertex2f(377, 440)

    GL.glEnd()

    ref_color = gs.Color(0.301, 0.211, 0.090)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #11
    GL.glVertex2f(413, 348)
    GL.glVertex2f(291, 385)
    GL.glVertex2f(377, 440)

    GL.glEnd()

    ref_color = gs.Color(0.250, 0.192, 0.117)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #10
    GL.glVertex2f(413, 348)
    GL.glVertex2f(291, 385)
    GL.glVertex2f(312, 367)
    GL.glEnd()

    ref_color = gs.Color(0.2, 0.149, 0.086)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #12
    GL.glVertex2f(348, 495)
    GL.glVertex2f(407, 459)
    GL.glVertex2f(377, 440)
    GL.glEnd()

    ref_color = gs.Color(0.250, 0.192, 0.109)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #13
    GL.glVertex2f(407, 459)
    GL.glVertex2f(377, 440)
    GL.glVertex2f(413, 348)
    GL.glEnd()

    ref_color = gs.Color(0.250, 0.192, 0.109)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #13*14
    GL.glVertex2f(407, 459)
    GL.glVertex2f(451, 402)
    GL.glVertex2f(413, 348)
    GL.glEnd()

    ref_color = gs.Color(0.2, 0.149, 0.082)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #14
    GL.glVertex2f(451, 402)
    GL.glVertex2f(377, 440)
    GL.glVertex2f(413, 348)
    GL.glEnd()

    ref_color = gs.Color(0.250, 0.192, 0.109)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #15
    GL.glVertex2f(451, 402)
    GL.glVertex2f(413, 348)
    GL.glVertex2f(476, 347)
    GL.glEnd()

    ref_color = gs.Color(0.333, 0.239, 0.105)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #16
    GL.glVertex2f(451, 402)
    GL.glVertex2f(476, 347)
    GL.glVertex2f(504, 367)
    GL.glEnd()

    ref_color = gs.Color(0.333, 0.239, 0.105)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_TRIANGLES)  #17
    GL.glVertex2f(476, 347)
    GL.glVertex2f(504, 367)
    GL.glVertex2f(512, 329)
    GL.glEnd()

    ref_color = gs.Color(0.278, 0.470, 0.121)
    ref_color.color_mode(scale_option)
    ref_color.set_entity_color()

    GL.glBegin(GL.GL_POLYGON)
    GL.glVertex2f(102, 329)
    GL.glVertex2f(178, 344)
    GL.glVertex2f(312, 367)
    GL.glVertex2f(413, 348)
    GL.glVertex2f(476, 347)
    GL.glVertex2f(512, 329)
    GL.glVertex2f(440, 295)
    GL.glVertex2f(387, 284)
    GL.glVertex2f(208, 282)
    GL.glVertex2f(102, 329)
    GL.glEnd()
Exemple #16
0
import os

import graph_data_struct as gs
"""
p1 = Point(5,5,5)

print("Angulo respecto a X - Rad: \t", p1.angle_x() , " - Angulo respecto a Z - Seg", to_seg(p1.angle_z()), "Norma:\t", p1.norm())

v1 = edge(Point(0,0,0), Point(5,5,5))

print ("Angulo respecto a X: \t", v1.angle_x(), " - Angulo respecto a Z - Seg", to_seg(v1.angle_z()), "Norma:\t", v1.norm())
"""

ref_value = 4.3

blanco = gs.Color(1.0, 1.0, 1.0)
rojo = gs.Color(1.0, 0.0, 0.0)
verde = gs.Color(0.0, 1.0, 0.0)
azul = gs.Color(0.0, 0.0, 1.0)

p1 = gs.Point(ref_value, ref_value, ref_value)
p2 = gs.Point(0.0, 0.0, 0.0)
p3 = gs.Point(0.0, ref_value, 0.0)
p4 = gs.Point(0.0, ref_value, ref_value)

tetaedro = gs.GraphicalObject()
tetaedro.set_name("tetraedro")

tetaedro.push_edge(p1, p2, rojo)
tetaedro.push_edge(p1, p3, rojo)
tetaedro.push_edge(p1, p4, rojo)