コード例 #1
0
ファイル: draw.py プロジェクト: gavine199/pymt
def drawSemiCircle(pos=(0, 0),
                   inner_radius=100,
                   outer_radius=120,
                   slices=32,
                   loops=1,
                   start_angle=0,
                   sweep_angle=360):
    '''Draw a semi-circle. You can choose the start angle,
    and the ending angle (from 0 to 360), and the inner/outer radius !

    :Parameters:
        `pos`: tuple, default to (0, 0)
            Center position of the circle
        `inner_radius`: int, default to 100
            Radius of the inner circle
        `outer_radius`: int, default to 120
            Radius of the outer circle
        `slices`: int, default to 32
            Precision of circle drawing
        `start_angle`: int, default to 0
            Angle to start drawing
        `sweep_angle`: int, default to 360
            Angle to finish drawing
    '''
    with gx_matrix:
        glTranslatef(pos[0], pos[1], 0)
        gluPartialDisk(gluNewQuadric(), inner_radius, outer_radius, slices,
                       loops, start_angle, sweep_angle)
コード例 #2
0
ファイル: draw.py プロジェクト: gavine199/pymt
def drawStippledCircle(
        pos=(0, 0), inner_radius=200, outer_radius=400, segments=10):
    '''
    Draw a stippled circle. A stippled circle consists of several equally-sized
    segments, with a gap between every two segments. The gap is the size of a
    segment. The circle's position and thickness can be specified.

    :Parameters:
        `pos`: tuple, default to (0, 0)
            Center position of the circle
        `inner_radius`: int, default to 100
            Radius of the inner circle
        `outer_radius`: int, default to 120
            Radius of the outer circle
        `segments`: int, defaults to 10
            Number of visible segments
    '''
    angle_delta = (360 / segments) / 2
    current_angle = 0
    quadric = gluNewQuadric()
    with gx_matrix:
        glTranslatef(pos[0], pos[1], 0)
        for i in range(segments):
            next_angle = current_angle + angle_delta
            gluPartialDisk(quadric, inner_radius, outer_radius, 32, 1,
                           current_angle, angle_delta)
            # For the stipple effect, leave a part of the Disk out
            current_angle = next_angle + angle_delta
コード例 #3
0
ファイル: draw.py プロジェクト: imc/pymt
def drawStippledCircle(pos=(0,0), inner_radius=200, outer_radius=400, segments=10):
    '''
    Draw a stippled circle. A stippled circle consists of several equally-sized
    segments, with a gap between every two segments. The gap is the size of a
    segment. The circle's position and thickness can be specified.

    :Parameters:
        `pos` : tuple, default to (0, 0)
            Center position of the circle
        `inner_radius` : int, default to 100
            Radius of the inner circle
        `outer_radius` : int, default to 120
            Radius of the outer circle
        `segments` : int, defaults to 10
            Number of visible segments
    '''
    angle_delta = (360/segments)/2
    current_angle = 0
    quadric = gluNewQuadric()
    with gx_matrix:
        glTranslatef(pos[0], pos[1], 0)
        for i in range(segments):
            next_angle = current_angle + angle_delta
            gluPartialDisk(quadric, inner_radius, outer_radius, 32, 1, current_angle, angle_delta)
            # For the stipple effect, leave a part of the Disk out
            current_angle = next_angle + angle_delta
コード例 #4
0
ファイル: draw.py プロジェクト: imc/pymt
def drawSemiCircle(pos=(0,0), inner_radius=100, outer_radius=120, slices=32, loops=1, start_angle=0, sweep_angle=360):
    '''Draw a semi-circle. You can choose the start angle,
    and the ending angle (from 0 to 360), and the inner/outer radius !

    :Parameters:
        `pos` : tuple, default to (0, 0)
            Center position of the circle
        `inner_radius` : int, default to 100
            Radius of the inner circle
        `outer_radius` : int, default to 120
            Radius of the outer circle
        `slices` : int, default to 32
            Precision of circle drawing
        `start_angle` : int, default to 0
            Angle to start drawing
        `sweep_angle` : int, default to 360
            Angle to finish drawing
    '''
    with gx_matrix:
        glTranslatef(pos[0], pos[1], 0)
        gluPartialDisk(gluNewQuadric(), inner_radius, outer_radius, slices, loops, start_angle, sweep_angle)
コード例 #5
0
ファイル: object3D.py プロジェクト: softtrainee/arlab
    def _fan_(self):
        '''
        '''
        i_r = 0
        o_r = 1
        glPushMatrix()

        glRotatef(90, 1, 0, 0)
        # blades=[-15,-15+45,-15+90]

        sweep = 30
        nblades = 8
        for start in [-15] * nblades:
            glRotatef(-360.0 / nblades, 0, 0, 1)
            glPushMatrix()
            glRotatef(25, 0 + math.cos(start), 1, 0)
            # glRotatef(5,math.sin(start),math.cos(start),0)

            gluPartialDisk(gluNewQuadric(), i_r, o_r, xseg, yseg,
                           start, sweep
                           )
            glPopMatrix()
        glPopMatrix()
コード例 #6
0
ファイル: Rect.py プロジェクト: elfion/nanoengineer
 def draw(self):
     gluPartialDisk(self.quadric,0.5,1.5,32,32,0,300) #e stub - should use named options
     return
コード例 #7
0
ファイル: Rect.py プロジェクト: elfion/nanoengineer
 def draw(self):
     gluPartialDisk(self.quadric, 0.5, 1.5, 32, 32, 0,
                    300)  #e stub - should use named options
     return