01: /*************************************************************************
02: * *
03: * 1) This source code file, in unmodified form, and compiled classes *
04: * derived from it can be used and distributed without restriction, *
05: * including for commercial use. (Attribution is not required *
06: * but is appreciated.) *
07: * *
08: * 2) Modified versions of this file can be made and distributed *
09: * provided: the modified versions are put into a Java package *
10: * different from the original package, edu.hws; modified *
11: * versions are distributed under the same terms as the original; *
12: * and the modifications are documented in comments. (Modification *
13: * here does not include simply making subclasses that belong to *
14: * a package other than edu.hws, which can be done without any *
15: * restriction.) *
16: * *
17: * David J. Eck *
18: * Department of Mathematics and Computer Science *
19: * Hobart and William Smith Colleges *
20: * Geneva, New York 14456, USA *
21: * Email: eck@hws.edu WWW: http://math.hws.edu/eck/ *
22: * *
23: *************************************************************************/package edu.hws.jcm.draw;
24:
25: import edu.hws.jcm.data.*;
26:
27: /**
28: * A Tangent line is a line that is tangent to the graph of a specified function of one argument
29: * at a specified value of its argument. If added to a CoordinateRect, it will appear
30: * as a line.
31: * A TangentLine is a Computable object, so should be added to a Controller to be
32: * recomputed when the Value or Function changes.
33: *
34: */
35:
36: public class TangentLine extends DrawGeometric {
37:
38: /**
39: * Create a tangent line to the graph of a function.
40: *
41: * @param x The x-coordinate where the tangent is drawn.
42: * @param f The line is tangent to the graph of this function. This should be a function of one variable.
43: */
44: public TangentLine(Value x, Function f) {
45: super (INFINITE_LINE_RELATIVE, x, new ValueMath(f, x),
46: new Constant(1), new ValueMath(f.derivative(1), x));
47: }
48:
49: }
|