- new
Vector (sim, xVariable, yVariable): VectorGraphGraph #### Parameters

##### sim: ODESim

the simulation whose differential equations will be shown as a direction field

##### xVariable: number

index of X variable in VarsList of

`sim`

##### yVariable: number

index of Y variable in VarsList of

`sim`

#### Returns VectorGraph

dotStyle : string = 'red'

The color to use for drawing dots, a CSS3 color value.

gridPoints : number = 10

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.

lineStyle : string = 'blue'

The color to use for drawing lines, a CSS3 color value.

`Private`

needneedRedraw_ : boolean = true

set when the entire graph needs to be redrawn.

`Private`

offoffScreen_ : null | HTMLCanvasElement = null

The offscreen buffer to draw the graph into

`Private`

xxVariable_ : number

index of x variable in VarsList

`Private`

yyVariable_ : number

index of y variable in VarsList

- contains(_p_world): boolean
Whether the DisplayObject contains the given world coordinates point.

#### Parameters

##### _p_world: Vector

the point in world coordinates

#### Returns boolean

`true`

if this DisplayObject contains the given point

- draw(context, map): void
Draws this DisplayObject using the given CoordMap.

#### Parameters

##### context: CanvasRenderingContext2D

the canvas's context to draw this object into

##### map: CoordMap

the mapping to use for translating between simulation and screen coordinates

#### Returns void

`Private`

full- full
Draw (context, coordMap): void Draws the entire graph into the given Graphics context.

#### Parameters

##### context: CanvasRenderingContext2D

the canvas's context to draw into

##### coordMap: CoordMap

the CoordMap specifying sim to screen conversion

#### Returns void

- get
Mass (): MassObject[]Objects Returns the set of MassObjects that this DisplayObject represents. Returns an empty list if this DisplayObject doesn't represent a MassObject.

#### Returns MassObject[]

the set of MassObjects that this DisplayObject represents

- get
Screen (): ScreenRectRect Returns the screen rectangle that this VectorGraph is occupying within the SimView, in screen coordinates.

#### Returns ScreenRect

the screen rectangle of this VectorGraph in screen coordinates

- observe(event): void
Notifies this Observer that a change has occurred in the Subject.

#### Parameters

##### event: SubjectEvent

contains information about what has changed in the Subject: typically either a one-time GenericEvent, or a change to the value of a Parameter

#### Returns void

- set
Position (_position): void 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.

#### Parameters

##### _position: GenericVector

this DisplayObject's position, in simulation coordinates.

#### Returns void

- set
Screen (screenRect): voidRect Sets the screen rectangle that this VectorGraph should occupy within the SimView, in screen coordinates.

#### Parameters

##### screenRect: ScreenRect

the screen coordinates of the area this VectorGraph should occupy.

#### Returns void

- to
String (): stringShort 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'}}`

#### Returns string

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 DOOptionally, make length of the vector be proportional to the speed of the trajectory at that point.