Added theta multiplier feature in GUI
This commit is contained in:
parent
8c2cb258a9
commit
2a46543702
1 changed files with 19 additions and 1 deletions
|
@ -24,7 +24,7 @@ class spirographs:
|
|||
self.bigRadius = 12
|
||||
self.smallRadius = 5
|
||||
self.distance = 4
|
||||
self.rotations = 8
|
||||
self.rotations = 2
|
||||
self.highestTheta = (np.lcm(self.smallRadius, self.bigRadius)/self.bigRadius) * self.rotations * math.pi
|
||||
self.stepSize = self.highestTheta / 4096
|
||||
# update initial slider positions
|
||||
|
@ -107,6 +107,24 @@ class spirographs:
|
|||
return
|
||||
self.distanceAdjustment.set_value(self.distance)
|
||||
|
||||
def thetaMultiplier_changed_cb(self, widget):
|
||||
indexValue = widget.get_active()
|
||||
if indexValue == 0:
|
||||
self.rotations = 2
|
||||
elif indexValue == 1:
|
||||
self.rotations = 4
|
||||
elif indexValue == 2:
|
||||
self.rotations = 8
|
||||
elif indexValue == 3:
|
||||
self.rotations = 16
|
||||
elif indexValue == 4: # automatic not set up yet
|
||||
self.rotations = 2 # back to default
|
||||
self.highestTheta = (np.lcm(int(self.smallRadius + 0.5), int(self.bigRadius + 0.5))/self.bigRadius) * self.rotations * math.pi
|
||||
self.stepSize = self.highestTheta / 4096 # possibly multiply by number of rotations?
|
||||
self.recalcPoints()
|
||||
self.updatePlot()
|
||||
return
|
||||
|
||||
def recalcPoints(self):
|
||||
self.epiX = np.array([self.calcEpiX(i) for i in np.arange(0, self.highestTheta, self.stepSize)])
|
||||
self.epiY = np.array([self.calcEpiY(i) for i in np.arange(0, self.highestTheta, self.stepSize)])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue