Constructors
Fields
Properties
Arguments
#Gets all the arguments associated with this function. Arguments can be either of type Vector (i.e. 2D grips) or Scalar (i.e. 1D sliders) or referents (i.e. 1D functions).
AssumeContinuous
#Override this property and return false if the underlying function is expected to contain discontinuities.
LatestGraphSegments
#The polyline segments the graph was most recently drawn with, in graph (content) coordinates. Empty when the function hasn't been drawn yet. Populated by DrawGraph(FunctionGraphics) from whatever GraphSegments(FunctionGraphics) yields, so subclasses that override GraphSegments (LinearFunction, ThresholdFunction, etc.) contribute here too. Hit-testing uses these so the click tolerance matches the rendered pixels exactly.
Rank
#Gets or sets the stature of this function. The stature controls the visual style of the function, as well as its inclusion in any outputted collection.
Tint
#Gets or sets the Open-Color family used to tint this function. A concrete shade is resolved at draw time based on the current background so the function stays legible under any theme. Use TintFor(Color) when a concrete Color is needed.
Methods
AfterDrawGraphSegments
#Draw any decoration that should appear on top of the graph polyline. Called from DrawGraph(FunctionGraphics) after the polyline has been rendered.
Parameters:
| graphics (FunctionGraphics) | Graphics object to draw with. |
BeforeDrawGraphSegments
#Draw any decoration that should appear behind the graph polyline. Called from DrawGraph(FunctionGraphics) after GraphSegments(FunctionGraphics) has run, so LatestGraphSegments is populated and available.
Parameters:
| graphics (FunctionGraphics) | Graphics object to draw with. |
CanInsertVector
#Test whether a grip can be inserted at or near a coordinate.
CanRemoveVector
#Override this method to specifically okay removal off a specific grip.
Parameters:
| vector (VectorArgument) |
DrawGraph
#Draw this function graph into a graphics context. Non-virtual: subclasses customise the rendering via GraphSegments(FunctionGraphics) (the polyline itself) and the BeforeDrawGraphSegments(FunctionGraphics) / AfterDrawGraphSegments(FunctionGraphics) hooks (any decorations before or after the curve). This keeps pen setup, rank thickness rules, obscure dashing, and segment capture in one place.
Parameters:
| graphics (FunctionGraphics) | Graphics object to draw with. |
DrawGripFlourishes
#Draw all grip flourishes associated with this function.
Parameters:
| graphics (FunctionGraphics) | Graphics object to draw with. |
DrawGripShapes
#Draw all grips associated with this function.
Parameters:
| graphics (FunctionGraphics) | Graphics object to draw with. |
DrawHints
#Draw the visual hints such as asymptotes, limits and markers associated with this function.
Parameters:
| graphics (FunctionGraphics) | Graphics object to draw with. |
DrawScalarShapes
#Draw all scalars associated with this function.
Parameters:
| graphics (FunctionGraphics) | Graphics object to draw with. |
EstimateDistance
#Compute an estimate of the distance from the function to the given point. This estimate is done by sampling the function at small intervals around the point. Note: implementors may choose to override this method and provide analytic distance measurements.
EstimateProjection
#Compute an estimate of the point on the function closest to a search point. This estimate is done by sampling the function at small intervals around the point.
GraphSegments
#Override this method if you think you can provide a more performant way to generate a graphics path representing the graph curve.
Parameters:
| graphics (FunctionGraphics) | Drawing properties. |
SetupDrawing
#Must be called prior to any draw method. This will ensure the colours and layout are correct.
Parameters:
| graphics (FunctionGraphics) | |
| animate (bool = true) |
TintFor
#public Color TintFor(Color background)
Resolve Tint into a concrete colour that stands out against the supplied background.
Parameters:
| background (Color) | Background the tint must contrast with. |
TryInsertVector
#Try and insert a grip at a coordinate.
Parameters:
| location (Point2d) | Grip location. |
Returns: True if grip was inserted.
TryRemoveVectors
#Try and remove a set of grips.
Parameters:
| vectors (VectorArgument[]) | Vectors whose removal is indicated. |
Returns: True if the function changed state.
Events
FunctionChanged
#Raised when the shape of the function changes due to non-grip/scalar events, for example when the function is modified via a custom menu item.