Beispiel #1
0
    def draw_arrow(self, color):

        # Set material
        glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color)
        #glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color)
        #glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, [1, 1, 1, 0.0])
        #glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 20)

        # Draw cylinder
        quad = gluNewQuadric()
        gluQuadricDrawStyle(quad, GLU_FILL)
        gluQuadricTexture(quad, True)
        gluQuadricNormals(quad, GLU_SMOOTH)
        gluCylinder(quad, self.size / 30, self.size / 30,
                    self.size * 0.8, 20, 20)

        # Move to the arrowhead position
        glTranslatef(0, 0, self.size * 0.8)

        # Draw arrowhead
        gluQuadricDrawStyle(quad, GLU_FILL)
        gluQuadricTexture(quad, True)
        gluQuadricNormals(quad, GLU_SMOOTH)
        gluCylinder(quad, self.size / 15, 0,
                    self.size * 0.2, 20, 20)

        # Revert to the original position
        glTranslatef(0, 0, -self.size * 0.8)
Beispiel #2
0
    def draw(self, from_fixed_frame: bool = True):
        self.opgl_move_to_pose(from_fixed_frame)
        self.apply_material()

        # draw sphere
        quad = gluNewQuadric()
        gluQuadricDrawStyle(quad, GLU_FILL)
        gluQuadricTexture(quad, True)
        gluQuadricNormals(quad, GLU_SMOOTH)
        gluSphere(quad, self.radius, 20, 20)
Beispiel #3
0
def draw_sphere(coords, radius, color_s=BLUE):
    quad: gluNewQuadric = gluNewQuadric()
    gluQuadricDrawStyle(quad, GLU_LINE)
    glColor3f(color_s[0], color_s[1], color_s[2])

    glPushMatrix()
    glTranslatef(coords[0], coords[1], coords[2])

    gluSphere(quad, radius, 12, 12)
    glPopMatrix()
Beispiel #4
0
    def draw(self, from_fixed_frame: bool = True):
        self.opgl_move_to_pose(from_fixed_frame)
        self.apply_material()

        # draw sphere
        quad = gluNewQuadric()
        gluQuadricDrawStyle(quad, GLU_FILL)
        gluQuadricTexture(quad, True)
        gluQuadricNormals(quad, GLU_SMOOTH)
        gluSphere(quad, self.radius, 20, 20)
Beispiel #5
0
    def draw(self, from_fixed_frame: bool = True):
        self.opgl_move_to_pose(from_fixed_frame)
        self.apply_material()

        # draw parallelepiped
        quad = gluNewQuadric()
        gluQuadricDrawStyle(quad, GLU_FILL)
        gluQuadricTexture(quad, True)
        gluQuadricNormals(quad, GLU_SMOOTH)
        glScalef(self.length, self.width, self.height)
        glutSolidCube(1)
Beispiel #6
0
    def draw(self, from_fixed_frame: bool = True):
        self.opgl_move_to_pose(from_fixed_frame)
        self.apply_material()

        # draw parallelepiped
        quad = gluNewQuadric()
        gluQuadricDrawStyle(quad, GLU_FILL)
        gluQuadricTexture(quad, True)
        gluQuadricNormals(quad, GLU_SMOOTH)
        glScalef(self.length, self.width, self.height)
        glutSolidCube(1)
Beispiel #7
0
 def paintCylinder(self, diameter, height):
     r = diameter / 70.
     height = 2 * height / 70.
     glColor3f(0., 0., 0.)
     glPushMatrix()
     glTranslatef(*self.offsets)  # move down
     glRotatef(-90., 1., 0., 0.)
     quadric = gluNewQuadric()
     gluQuadricDrawStyle(quadric, GLU_LINE)
     slices = max(int(round(r * 32)), 15)
     gluCylinder(quadric, r, r, height, slices, 1)
     glPopMatrix()
Beispiel #8
0
    def __init__(self, parent) -> None:
        """Initializes _Axes with constructors."""
        self.parent = parent

        self._vao_axes = None
        self._vao_arrows = None

        build_dimensions = self.parent.build_dimensions
        dist = 0.5 * (build_dimensions[1] +
                      max(build_dimensions[0], build_dimensions[2]))
        self._arrow_base_radius = dist / 75.0
        self._arrow_length = 2.5 * self._arrow_base_radius
        self._quadric = gluNewQuadric()
        gluQuadricDrawStyle(self._quadric, GLU_FILL)
Beispiel #9
0
def _set_draw_style(style):
   global _Quadric
   if style == 'wireframe':
      gluQuadricDrawStyle(_Quadric, GLU_LINE)
   elif style == 'solid':
      gluQuadricDrawStyle(_Quadric, GLU_FILL)