Commit b6004b89 authored by ronan's avatar ronan
Browse files

Semble fonctionner ? A vérifier

parent 2391029f
......@@ -82,19 +82,22 @@ class Fortune:
# AJout des breakpoints
#Cas spécial
if p1 is p3:
if p1 is p3 and p1 is not None:
print("A")
min = findMinCircle(p1, p, site)
results = computeBreakPoint(p1, p, min.point.getY())
#Regarder plus proche suivant X du quel, Pas Y???
d1 = abs(results[0].getX() - site.point.getX())
d2 = abs(results[0].getX() - site.point.getX())
if d1 < d2:
self.addEvent(min)
elif d1 > d2:
#Echanger sites...
self.addEvent(min)
elif d1 == d2:
#Ajout 2 event
if self.isValidVertex(min) and min.point.getY() >= site.point.getY():
results = computeBreakPoint(p1, p, min.point.getY())
#Regarder plus proche suivant X du quel, Pas Y???
d1 = (results[0] - min.center).getMagnitude()
d2 = (results[1] - min.center).getMagnitude()
vertexVerif(min)
if d1 < d2:
self.addEvent(min)
elif d1 > d2:
min.sites[0], min.sites[2] = min.sites[2], min.sites[0]
self.addEvent(min)
assert(d1 != d2), "What?"
else:
if p1 is not None:
......@@ -215,8 +218,7 @@ class Fortune:
while i > -1 and vSite.point.getY() >= self.sites[i].point.getY():
if self.sites[i] not in vSite.sites:
vec = vSite.center - self.sites[i].point
if vec.getMagnitude() < radius:
if vec.getMagnitude() < radius and self.sites[i] not in vSite.sites:
return False
i -= 1
return True
......@@ -181,8 +181,8 @@ class Node:
self.site = None
# Set values
self.value = p.point.getY()
self.right.value = p.point.getY()
self.value = p.point.getX()
self.right.value = p.point.getX()
def eraseNode(self, p0, piN, pkN, edges):
# On ajoute le point centre au root edge et au second root node
......@@ -248,7 +248,7 @@ class Node:
elif self.root is None:
v = self.deep() - 1
leafs = math.pow(2, v)
sizeA = sizeD*math.pow(1.04, v)
sizeA = sizeD*math.pow(0.96, v) # <- to reduce size of tree
size = sizeA*leafs/2
if self.left is not None:
......
......@@ -134,12 +134,12 @@ def mouse(event):
""
fortune.init(vec, False)
"""
print(a)
vec.append(a)
fortune.init(vec, False)
fortune.beachLine.update(float(fortune.rEvents[len(fortune.rEvents) - 1].point.getY() + 100)/fac.getY())
print(a)
full(event)
start[0] = True
......@@ -181,7 +181,11 @@ if __name__ == "__main__":
vec.append(Vector3D(2.96666667, 1.01666667))
vec.append(Vector3D(4, 1))
vec.append(Vector3D(10.2, 1.58333333))
vec.append(Vector3D(11.78333333, 1.25))
#[ 10.08333333 4.06666667 0. 1. ]
#[ 11.78333333 1.25 0. 1. ]
#vec.append(Vector3D(9.5, 2.06666667))
......@@ -202,10 +206,10 @@ if __name__ == "__main__":
start = [True]
for i in vec:
i.setY(i.getY() + 0)
i.setY(i.getY() +40)
i.setX(i.getX() + 0)
fac = Vector3D(60, 60)
fac = Vector3D(15, 15)
ly = [0]
mousePos = Vector3D(-1, -1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment