Added theta multiplier feature in GUI

This commit is contained in:
A.M. Rowsell 2024-11-19 06:47:00 -05:00
commit 2a46543702
Signed by: amr
GPG key ID: 0B6E2D8375CF79A9

View file

@ -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)])