API Docs for: 1.0.0
Show:

MathFunction Class

Base class for all functions rendered by MathCanvas.

Derived classes must implement toString() and evaluate(). To override the default rendering which displays the output from toString(), implement prepareToRender() and render().

Constructor

MathFunction

()

Methods

evaluate

(
  • var_list
)

Must be implemented by derived classes.

Parameters:

  • var_list Object

    map of variable names to values or MathFunctions

Returns:

the value of the function

getParent

() MathFunction

Returns:

MathFunction: parent function or null

parenthesizeForPrint

(
  • f
)
Boolean protected

Parameters:

Returns:

Boolean: true if f needs to parenthesize us

parenthesizeForRender

(
  • f
)
Boolean protected

Parameters:

Returns:

Boolean: true if f needs to parenthesize us

prepareToRender

(
  • canvas
  • top_left
  • font_size
  • rect_list
)
Int

Add the layout information for this object and its descendants to rect_list.

Parameters:

  • canvas MathCanvas

    the drawing canvas

  • top_left Point

    x,y coordinates of the top left of the bounding box

  • font_size Float

    percentage of the base font size

  • rect_list RectList

    layout information

Returns:

Int: index of this items info in rect_list

render

(
  • canvas
  • rect_list
)

Draw this object and its descendants.

Parameters:

  • canvas MathCanvas

    the drawing canvas

  • rect_list RectList

    layout information

toString

()

Must be implemented by derived classes.

Returns:

text representation of the function