more layout; now 8 points in ninepoint.gcs instead of 7
This commit is contained in:
parent
c858529ddc
commit
94d65af760
|
@ -102,7 +102,7 @@ class DecompositionView(QtGui.QDialog):
|
||||||
for k in range(0,len(layer)):
|
for k in range(0,len(layer)):
|
||||||
c = layer[k]
|
c = layer[k]
|
||||||
y = n * 50.0
|
y = n * 50.0
|
||||||
x = (k - len(layer)/2.0) * 30.0 * n
|
x = (k - len(layer)/2.0) * 50.0 * n
|
||||||
cvcluster = CVCluster(self, c, x,y)
|
cvcluster = CVCluster(self, c, x,y)
|
||||||
self.ui.graphicsScene.addItem(cvcluster)
|
self.ui.graphicsScene.addItem(cvcluster)
|
||||||
self.map[c] = cvcluster
|
self.map[c] = cvcluster
|
||||||
|
@ -112,7 +112,7 @@ class DecompositionView(QtGui.QDialog):
|
||||||
for child in c.subs:
|
for child in c.subs:
|
||||||
self.ui.graphicsScene.addItem(CVConnection(self, self.map[c], self.map[child]))
|
self.ui.graphicsScene.addItem(CVConnection(self, self.map[c], self.map[child]))
|
||||||
# iteratively improve graph layout
|
# iteratively improve graph layout
|
||||||
self.optimiseGraphLayout()
|
# self.optimiseGraphLayout()
|
||||||
|
|
||||||
def optimiseGraphLayout(self):
|
def optimiseGraphLayout(self):
|
||||||
|
|
||||||
|
@ -156,9 +156,9 @@ class DecompositionView(QtGui.QDialog):
|
||||||
norm = numpy.linalg.norm(direction)
|
norm = numpy.linalg.norm(direction)
|
||||||
if norm != 0:
|
if norm != 0:
|
||||||
direction = direction / numpy.linalg.norm(direction)
|
direction = direction / numpy.linalg.norm(direction)
|
||||||
direction[1] = 0.0
|
#direction[1] = 0.0
|
||||||
c1.force += force*direction;
|
c1.force += -force*direction / 10.0;
|
||||||
c2.force += -force*direction;
|
c2.force += force*direction / 10.0;
|
||||||
#print "force 1", c1.force
|
#print "force 1", c1.force
|
||||||
#print "force 2", c2.force
|
#print "force 2", c2.force
|
||||||
|
|
||||||
|
@ -173,17 +173,16 @@ class DecompositionView(QtGui.QDialog):
|
||||||
norm = numpy.linalg.norm(direction)
|
norm = numpy.linalg.norm(direction)
|
||||||
if norm != 0:
|
if norm != 0:
|
||||||
direction = direction / numpy.linalg.norm(direction)
|
direction = direction / numpy.linalg.norm(direction)
|
||||||
#goal = box1.height() + box2.height() + box1.width() + box2.width()
|
goal = box1.height() + box2.height() + box1.width() + box2.width()
|
||||||
#goal = 0
|
force = (norm - goal) / 20.0
|
||||||
force = (norm - goal) / 1.0
|
#direction[1] = 0.0
|
||||||
direction[1] = 0.0
|
c1.force += +force*direction;
|
||||||
c1.force += force*direction;
|
|
||||||
c2.force += -force*direction;
|
c2.force += -force*direction;
|
||||||
#print "force ", force
|
#print "force ", force
|
||||||
|
|
||||||
# apply forces
|
# apply forces
|
||||||
for c in l:
|
for c in l:
|
||||||
move = QtCore.QPointF(c.force[0],c.force[1])/2
|
move = QtCore.QPointF(c.force[0],c.force[1])
|
||||||
c.position += move
|
c.position += move
|
||||||
c.translate(move.x(), move.y())
|
c.translate(move.x(), move.y())
|
||||||
# done iterating
|
# done iterating
|
||||||
|
|
|
@ -1,26 +1,30 @@
|
||||||
<!DOCTYPE Geometric Constraints>
|
<!DOCTYPE Geometric Constraints>
|
||||||
<Objects>
|
<Objects>
|
||||||
<Point posX="-85.5578" posY="0.0" key="p1" posZ="-65.3951" name="p1" />
|
<Point posX="-85.557800293" posY="0.0" key="p1" posZ="-65.3951" name="p1"/>
|
||||||
<Point posX="-148.0809" posY="0.0" key="p4" posZ="21.5276" name="p4" />
|
<Point posX="-148.0809021" posY="0.0" key="p4" posZ="21.5275993347" name="p4"/>
|
||||||
<DistanceConstraint pBeginKey="p1" key="d5" distance="107.073310441" pEndKey="p4" name="d5" fixed="False" />
|
<DistanceConstraint pBeginKey="p1" key="d5" distance="107.073310956" pEndKey="p4" name="d5" fixed="False"/>
|
||||||
<Point posX="-37.0202217432" posY="0.0" key="p8" posZ="27.2141" name="p8" />
|
<Point posX="-37.0202217102" posY="0.0" key="p8" posZ="27.2141" name="p8"/>
|
||||||
<DistanceConstraint pBeginKey="p4" key="d9" distance="111.206162316" pEndKey="p8" name="d9" fixed="False" />
|
<DistanceConstraint pBeginKey="p4" key="d9" distance="111.20616448" pEndKey="p8" name="d9" fixed="False"/>
|
||||||
<DistanceConstraint pBeginKey="p8" key="d12" distance="104.557928574" pEndKey="p1" name="d12" fixed="False" />
|
<DistanceConstraint pBeginKey="p8" key="d12" distance="104.557928725" pEndKey="p1" name="d12" fixed="False"/>
|
||||||
<Point posX="43.6015929367" posY="0.0" key="p17" posZ="-84.8918" name="p17" />
|
<Point posX="43.6015930176" posY="0.0" key="p17" posZ="-84.8918" name="p17"/>
|
||||||
<DistanceConstraint pBeginKey="p1" key="d18" distance="130.622624743" pEndKey="p17" name="d18" fixed="False" />
|
<DistanceConstraint pBeginKey="p1" key="d18" distance="130.622625112" pEndKey="p17" name="d18" fixed="False"/>
|
||||||
<Point posX="37.8428925571" posY="0.0" key="p21" posZ="-26.4018" name="p21" />
|
<Point posX="37.8428916931" posY="0.0" key="p21" posZ="-26.4018" name="p21"/>
|
||||||
<DistanceConstraint pBeginKey="p17" key="d22" distance="58.7728060421" pEndKey="p21" name="d22" fixed="False" />
|
<DistanceConstraint pBeginKey="p17" key="d22" distance="58.7728061347" pEndKey="p21" name="d22" fixed="False"/>
|
||||||
<DistanceConstraint pBeginKey="p21" key="d25" distance="129.414869194" pEndKey="p1" name="d25" fixed="False" />
|
<DistanceConstraint pBeginKey="p21" key="d25" distance="129.414868649" pEndKey="p1" name="d25" fixed="False"/>
|
||||||
<DistanceConstraint pBeginKey="p8" key="d30" distance="92.0823034874" pEndKey="p21" name="d30" fixed="False" />
|
<DistanceConstraint pBeginKey="p8" key="d30" distance="92.0823027582" pEndKey="p21" name="d30" fixed="False"/>
|
||||||
<Point posX="63.3457111997" posY="0.0" key="p33" posZ="59.7086" name="p33" />
|
<Point posX="63.3457107544" posY="0.0" key="p33" posZ="59.7086" name="p33"/>
|
||||||
<DistanceConstraint pBeginKey="p21" key="d34" distance="89.8075428173" pEndKey="p33" name="d34" fixed="False" />
|
<DistanceConstraint pBeginKey="p21" key="d34" distance="89.8075429362" pEndKey="p33" name="d34" fixed="False"/>
|
||||||
<DistanceConstraint pBeginKey="p33" key="d37" distance="105.495085316" pEndKey="p8" name="d37" fixed="False" />
|
<DistanceConstraint pBeginKey="p33" key="d37" distance="105.495084861" pEndKey="p8" name="d37" fixed="False"/>
|
||||||
<Point posX="-31.2615213636" posY="71.6617" key="p40" posZ="-17.4658" name="p40" />
|
<Point posX="-31.2615222931" posY="71.6616973877" key="p40" posZ="-17.4657993317" name="p40"/>
|
||||||
<DistanceConstraint pBeginKey="p40" key="d43" distance="123.637173235" pEndKey="p17" name="d43" fixed="False" />
|
<DistanceConstraint pBeginKey="p40" key="d43" distance="123.637172697" pEndKey="p17" name="d43" fixed="False"/>
|
||||||
<DistanceConstraint pBeginKey="p33" key="d48" distance="141.569119922" pEndKey="p40" name="d48" fixed="False" />
|
<DistanceConstraint pBeginKey="p33" key="d48" distance="141.569118559" pEndKey="p40" name="d48" fixed="False"/>
|
||||||
<DistanceConstraint pBeginKey="p4" key="d53" distance="142.487373881" pEndKey="p40" name="d53" fixed="False" />
|
<DistanceConstraint pBeginKey="p4" key="d53" distance="142.487373161" pEndKey="p40" name="d53" fixed="False"/>
|
||||||
<DistanceConstraint pBeginKey="p40" key="d68" distance="84.64546852" pEndKey="p8" name="d68" fixed="False" />
|
<DistanceConstraint pBeginKey="p40" key="d68" distance="84.6454658901" pEndKey="p8" name="d68" fixed="False"/>
|
||||||
<DistanceConstraint pBeginKey="p40" key="d73" distance="99.953345948" pEndKey="p21" name="d73" fixed="False" />
|
<DistanceConstraint pBeginKey="p40" key="d73" distance="99.9533441802" pEndKey="p21" name="d73" fixed="False"/>
|
||||||
<DistanceConstraint pBeginKey="p40" key="d78" distance="101.88573462" pEndKey="p1" name="d78" fixed="False" />
|
<DistanceConstraint pBeginKey="p40" key="d78" distance="101.885732758" pEndKey="p1" name="d78" fixed="False"/>
|
||||||
<Prototypes numberOfImports="0" number="81" />
|
<Point posX="0.0" posY="-66.2397" key="p81" posZ="-12.397" name="p81"/>
|
||||||
|
<DistanceConstraint pBeginKey="p81" key="d84" distance="77.5623409318" pEndKey="p21" name="d84" fixed="False"/>
|
||||||
|
<DistanceConstraint pBeginKey="p8" key="d89" distance="85.5992635177" pEndKey="p81" name="d89" fixed="False"/>
|
||||||
|
<DistanceConstraint pBeginKey="p1" key="d94" distance="120.484993467" pEndKey="p81" name="d94" fixed="False"/>
|
||||||
|
<Prototypes numberOfImports="0" number="97"/>
|
||||||
</Objects>
|
</Objects>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user