update strings and removed intersectingEdges
This commit is contained in:
parent
9bebf84986
commit
500367c550
@ -120,7 +120,7 @@ class Canvas(QWidget):
|
||||
currentHeight = abs(self.current[0].y() - pos.y())
|
||||
self.parent().window().labelCoordinates.setText(
|
||||
'Width: %d, Height: %d / X: %d; Y: %d' % (currentWidth, currentHeight, pos.x(), pos.y()))
|
||||
|
||||
|
||||
color = self.drawingLineColor
|
||||
if self.outOfPixmap(pos):
|
||||
# Don't allow the user to draw outside the pixmap.
|
||||
@ -535,32 +535,6 @@ class Canvas(QWidget):
|
||||
# print "d %.2f, m %d, %.2f" % (d, m, d - m)
|
||||
return distance(p1 - p2) < self.epsilon
|
||||
|
||||
def intersectingEdges(self, x1y1, x2y2, points):
|
||||
"""For each edge formed by `points', yield the intersection
|
||||
with the line segment `(x1,y1) - (x2,y2)`, if it exists.
|
||||
Also return the distance of `(x2,y2)' to the middle of the
|
||||
edge along with its index, so that the one closest can be chosen."""
|
||||
x1, y1 = x1y1
|
||||
x2, y2 = x2y2
|
||||
for i in range(4):
|
||||
x3, y3 = points[i]
|
||||
x4, y4 = points[(i + 1) % 4]
|
||||
denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1)
|
||||
nua = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)
|
||||
nub = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)
|
||||
if denom == 0:
|
||||
# This covers two cases:
|
||||
# nua == nub == 0: Coincident
|
||||
# otherwise: Parallel
|
||||
continue
|
||||
ua, ub = nua / denom, nub / denom
|
||||
if 0 <= ua <= 1 and 0 <= ub <= 1:
|
||||
x = x1 + ua * (x2 - x1)
|
||||
y = y1 + ua * (y2 - y1)
|
||||
m = QPointF((x3 + x4) / 2, (y3 + y4) / 2)
|
||||
d = distance(m - QPointF(x2, y2))
|
||||
yield d, i, (x, y)
|
||||
|
||||
# These two, along with a call to adjustSize are required for the
|
||||
# scroll area.
|
||||
def sizeHint(self):
|
||||
|
||||
@ -24,11 +24,11 @@ resetAll=Reset All
|
||||
resetAllDetail=Reset All
|
||||
boxLineColor=Box Line Color
|
||||
boxLineColorDetail=Choose Box line color
|
||||
crtBox=Create\nRectBox
|
||||
crtBox=Create RectBox
|
||||
crtBoxDetail=Draw a new box
|
||||
delBox=Delete\nRectBox
|
||||
delBox=Delete RectBox
|
||||
delBoxDetail=Remove the box
|
||||
dupBox=Duplicate\nRectBox
|
||||
dupBox=Duplicate RectBox
|
||||
dupBoxDetail=Create a duplicate of the selected box
|
||||
tutorial=Tutorial
|
||||
tutorialDetail=Show demo
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user