draw thick circle as well
This commit is contained in:
parent
7fb5a06088
commit
03f3245721
@ -76,9 +76,9 @@ class SketchWidget:
|
|||||||
|
|
||||||
for shape in self.sketch:
|
for shape in self.sketch:
|
||||||
if isinstance(shape, Line):
|
if isinstance(shape, Line):
|
||||||
self.drawLine(shape)
|
self.drawLine(shape, 0.03)
|
||||||
elif isinstance(shape, Circle):
|
elif isinstance(shape, Circle):
|
||||||
self.drawCircle(shape)
|
self.drawCircle(shape, 0.03)
|
||||||
|
|
||||||
if gldrawable.is_double_buffered():
|
if gldrawable.is_double_buffered():
|
||||||
gldrawable.swap_buffers()
|
gldrawable.swap_buffers()
|
||||||
@ -89,18 +89,20 @@ class SketchWidget:
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def drawLine(self, shape):
|
def drawLine(self, shape, size):
|
||||||
self.drawFilledLine(shape.vars[0], shape.vars[1],
|
self.drawFilledLine(shape.vars[0], shape.vars[1],
|
||||||
shape.vars[2], shape.vars[3], 0.03)
|
shape.vars[2], shape.vars[3], size)
|
||||||
|
|
||||||
def drawCircle(self, shape):
|
def drawCircle(self, shape, size):
|
||||||
glBegin(GL_LINE_LOOP)
|
steps = 24
|
||||||
for i in range(24):
|
for i in range(steps + 1):
|
||||||
glVertex(shape.vars[0] +
|
angle = i * 2 * math.pi / steps
|
||||||
shape.vars[2] * math.sin(i * 2 * math.pi / 24.0),
|
next_angle = (i + 1) * 2 * math.pi / steps
|
||||||
shape.vars[1] +
|
self.drawFilledLine(shape.vars[0] + shape.vars[2] * math.cos(angle),
|
||||||
shape.vars[2] * math.cos(i * 2 * math.pi / 24.0))
|
shape.vars[1] + shape.vars[2] * math.sin(angle),
|
||||||
glEnd()
|
shape.vars[0] + shape.vars[2] * math.cos(next_angle),
|
||||||
|
shape.vars[1] + shape.vars[2] * math.sin(next_angle),
|
||||||
|
size)
|
||||||
|
|
||||||
def drawFilledLine(self, x0, y0, x1, y1, size):
|
def drawFilledLine(self, x0, y0, x1, y1, size):
|
||||||
glBegin(GL_QUADS)
|
glBegin(GL_QUADS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user