SketchWidget: add drawFilledLine()
This commit is contained in:
parent
87348d3605
commit
1203478a33
@ -90,10 +90,8 @@ class SketchWidget:
|
||||
return True
|
||||
|
||||
def drawLine(self, shape):
|
||||
glBegin(GL_LINES)
|
||||
glVertex(shape.vars[0], shape.vars[1])
|
||||
glVertex(shape.vars[2], shape.vars[3])
|
||||
glEnd()
|
||||
self.drawFilledLine(shape.vars[0], shape.vars[1],
|
||||
shape.vars[2], shape.vars[3], 0.03)
|
||||
|
||||
def drawCircle(self, shape):
|
||||
glBegin(GL_LINE_LOOP)
|
||||
@ -103,3 +101,20 @@ class SketchWidget:
|
||||
shape.vars[1] +
|
||||
shape.vars[2] * math.cos(i * 2 * math.pi / 24.0))
|
||||
glEnd()
|
||||
|
||||
def drawFilledLine(self, x0, y0, x1, y1, size):
|
||||
glBegin(GL_QUADS)
|
||||
angle = math.atan2(y1 - y0, x1 - x0)
|
||||
ninety = math.pi / 2
|
||||
glVertex(x0 + size * math.cos(angle + ninety),
|
||||
y0 + size * math.sin(angle + ninety))
|
||||
glVertex(x0 + size * math.cos(angle - ninety),
|
||||
y0 + size * math.sin(angle - ninety))
|
||||
glVertex(x1 + size * math.cos(angle - ninety),
|
||||
y1 + size * math.sin(angle - ninety))
|
||||
glVertex(x1 + size * math.cos(angle + ninety),
|
||||
y1 + size * math.sin(angle + ninety))
|
||||
glEnd()
|
||||
|
||||
def drawFilledCircle(self, x, y, radius, steps):
|
||||
pass
|
||||
|
Loading…
x
Reference in New Issue
Block a user