def showModeConstruction(self): """Show the graphical components of the mode construction.""" if len(self.graph_drawing) > 1: t1 = Trajectory.createFromTuples(self.graph_drawing, segment_color=mycolors.GREEN) t2 = Trajectory.createFromTuples(self.graph_construction, segment_color=mycolors.BLUE) t3 = Trajectory.createFromTuples(self.graph_display, segment_color=mycolors.RED) t1.show(self.context) t2.show(self.context) t3.show(self.context) #self.showVectors([(0,0)]+self.graph_construction,self.vectors,mycolors.RED) self.context.text.append("time: " + str(self.time))
def drawSample(self, index, color): """Draw the points that were sampled for the fourier transform.""" t = Trajectory.createFromTuples(self.graphs[index]) l = t.sampleSegments(self.sample_number, include=self.include) for e in l: p = Point(*e, radius=5, conversion=False) p.show(self.context)
def setConstructionMode(self): """Set the attributes before starting the construction mode.""" self.step = 0 self.display = [] t = Trajectory.createFromTuples(self.drawing) l = t.sample(self.sample_number) self.coefficients = Fourier.transform(l, self.coefficients_number)
def showModeDrawing(self): """Show the graphical components of the mode drawing.""" if len(self.graph_drawing) > 1: t = Trajectory.createFromTuples(self.graph_drawing, segment_color=mycolors.GREEN) p = PolynomialInterpolation(self.graph_drawing, color=mycolors.RED) t.show(self.context) p.show(self.context, 200)
def interpolate(path, n=200): """Interpolate n points from the path.""" return Trajectory.createFromTuples(path).sample(n)
def trajectory(self): """Return the trajectory of the pendulum.""" return Trajectory.createFromTuples(self.points)
def updateSample(self): """Update the sample.""" t = Trajectory.createFromTuples(self.drawing) self.sample = t.sampleSegments(self.sample_number, include=self.include)
def getTrajectory(self): """Return the trajectory associated with the points of the interpolation.""" return Trajectory.createFromTuples(self.points)
def showTrajectory(self, context, color=None): """Show the trajectory defined by the points of the interpolation.""" if not color: color = self.trajectory_color Trajectory.createFromTuples(self.points).show(context, color=color)
def showModeDisplay(self): """Show the graphical components of the mode display.""" t3 = Trajectory.createFromTuples(self.graph_display, segment_color=mycolors.RED) t3.show(self.context)