예제 #1
0
 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))
예제 #2
0
 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)
예제 #3
0
 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)
예제 #4
0
 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)
예제 #5
0
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)
예제 #7
0
 def updateSample(self):
     """Update the sample."""
     t = Trajectory.createFromTuples(self.drawing)
     self.sample = t.sampleSegments(self.sample_number,
                                    include=self.include)
예제 #8
0
 def getTrajectory(self):
     """Return the trajectory associated with the points of the interpolation."""
     return Trajectory.createFromTuples(self.points)
예제 #9
0
 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)
예제 #10
0
 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)