the simulation whose differential equations will be shown as a direction field
index of X variable in VarsList of sim
index of Y variable in VarsList of sim
The color to use for drawing dots, a CSS3 color value.
Number of grid points to have in each direction, horizontally and vertically.
Private
lastto detect when redraw needed; when the coordmap changes, we need to redraw.
The color to use for drawing lines, a CSS3 color value.
Private
needset when the entire graph needs to be redrawn.
Private
offThe offscreen buffer to draw the graph into
Private
xindex of x variable in VarsList
Private
yindex of y variable in VarsList
Whether the DisplayObject contains the given world coordinates point.
the point in world coordinates
true
if this DisplayObject contains the given point
Draws this DisplayObject using the given CoordMap.
the canvas's context to draw this object into
the mapping to use for translating between simulation and screen coordinates
Private
fullDraws the entire graph into the given Graphics context.
the canvas's context to draw into
the CoordMap specifying sim to screen conversion
Returns the set of MassObjects that this DisplayObject represents. Returns an empty list if this DisplayObject doesn't represent a MassObject.
the set of MassObjects that this DisplayObject represents
Returns the screen rectangle that this VectorGraph is occupying within the SimView, in screen coordinates.
the screen rectangle of this VectorGraph in screen coordinates
Notifies this Observer that a change has occurred in the Subject.
contains information about what has changed in the Subject: typically either a one-time GenericEvent, or a change to the value of a Parameter
Sets this DisplayObject's position in simulation coordinates of the containing SimView. Each type of DisplayObject has a different policy regarding whether this will have an effect. Generally the policies are:
If the DisplayObject does not represent a SimObject, then the position can be set. Examples are DisplayClock, EnergyBarGraph.
If the SimObject's position is dependent on other objects, then the position cannot be set. Examples are DisplayConnector, DisplayRope, DisplaySpring.
If the SimObject can be moved independently and isDragable
is true
, then the position of the SimObject is modified. Example: DisplayShape.
this DisplayObject's position, in simulation coordinates.
Sets the screen rectangle that this VectorGraph should occupy within the SimView, in screen coordinates.
the screen coordinates of the area this VectorGraph should occupy.
Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.
For an object whose main purpose is to represent another Printable object, it is
recommended to include the result of calling toStringShort
on that other object.
For example, calling toStringShort()
on a DisplayShape might return something like
this:
DisplayShape{polygon:Polygon{'chain3'}}
a minimal string representation of this object.
Generated using TypeDoc
Draws vectors showing the direction field of the differential equation. In a graph of Y vs. X, shows the value of the derivative dy/dx at various points on a grid, as a short line with that slope.
This is a static display that is typically layered over a DisplayGraph. The DisplayGraph will be drawing the actual graph lines.
This is generally only useful for differential equations of 2 variables. Otherwise, the phase space is 3D, 4D, etc. and cannot be adequately represented by these direction field vectors.
The screen rectangle that the VectorGraph should occupy within the SimView must be set with setScreenRect before drawing can be done.
Redraws when a parameter changes in the subject, because a parameter change modifies the direction field.
TO DO Optionally, make length of the vector be proportional to the speed of the trajectory at that point.