package com.srbenoit.math.grapher;

/**
 * An interface for functions that can be graphed.
 */
public interface Graphable {

    /**
     * Gets the number of dimensions of the graph (2 for a function of a single value).
     *
     * @return  the number of dimensions of the graph
     */
    int graphDimensions();

    /**
     * Gets a default domain over which the graph will show the main features of the function. This
     * domain should be computed based on known attributes of the function.
     *
     * @return  a two-double array containing the left and right endpoints of the default domain
     */
    double[] defaultDomain();

    /**
     * Gets a default range over which the graph will show the main features of the function. This
     * range should be computed based on known attributes of the function.
     *
     * @return  a two-double array containing the lower and upper limits of the default range
     */
    double[] defaultRange();

    /**
     * Computes the graph values at a coordinate or coordinates. The number of coordinates needed is
     * one less than the dimension.
     *
     * @param   coordinates  the list of coordinates
     * @return  the graph values at that location
     */
    double valueAt(double... coordinates);
}
