| 1 |
lars |
1 |
<style type="text/css">
|
|
|
2 |
<!--
|
|
|
3 |
A:link {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: none; color: #0000ff}
|
|
|
4 |
A:visited {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: none; color: #0000ff}
|
|
|
5 |
A:hover {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: underline; color: #FF0000}
|
|
|
6 |
th {font-family: helvetica, arial; color : blue; font-size:85%; background : lightgrey; border-right:black solid 1pt; border-bottom:black solid 1pt;}
|
|
|
7 |
//-->
|
|
|
8 |
</style><hr><a name="_C_SPLINE"><div style="background-color:yellow;font-family:courier new;"></a>CLASS <b>Spline</b></div>
|
|
|
9 |
<i>(Defined in: jpgraph_regstat.php : 17)</i><table border=1><tr><td> <a href="Spline.html" style="font-family:arial;font-weight:bold;color:darkblue;">Spline</a> </td></tr><tr><td valign=top> <a href="Spline.html#_SPLINE_GET">Get()</a> <br>
|
|
|
10 |
<a href="Spline.html#_SPLINE_SPLINE">Spline()</a> <br>
|
|
|
11 |
</td></tr></table> <p><div style="font-weight:bold;font-family:arial;font-size:100%;">Class usage and Overview</div>Utility class to help construct an interpolated data points given an arbitrary number of data points.
|
|
|
12 |
<p>
|
|
|
13 |
This class doesn't draw any graphs by itself it is only used to generate a new set of data points representing the smooth line from the input which are the control lines for the cubic spline.
|
|
|
14 |
<p>
|
|
|
15 |
The principle of using this class is that you first create an instance of this class and giving it the X,Y values for your control points.
|
|
|
16 |
<p>
|
|
|
17 |
You can then get back an interpolated smooth dataset by calling the Get() method. This method takeas as argument how many data points you want the interpolated graph to have.
|
|
|
18 |
<p>
|
|
|
19 |
Technical note: The spline is constructed with natural 2:nd derivates at the start and end points of the line.
|
|
|
20 |
<p>
|
|
|
21 |
<hr><span style="font-family:arial;font-size:120%;font-weight:bold;">Class Methods</span><hr><p>
|
|
|
22 |
<p> <p> <span style='font-size:110%;'><a name="_SPLINE_GET"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
|
|
|
23 |
function Get($num)</font>
|
|
|
24 |
</b></div></a></span>
|
|
|
25 |
|
|
|
26 |
<span style='font-family:arial;font-size:90%;'><i>Return the two new data vectors</i></span><p>
|
|
|
27 |
|
|
|
28 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
29 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
30 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
31 |
$num</font>
|
|
|
32 |
|
|
|
33 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
34 |
50</font>
|
|
|
35 |
</td><td>Number of data points</td></tr>
|
|
|
36 |
</table>
|
|
|
37 |
|
|
|
38 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Return a data set representing the interpolated smooth curve passing through all the specified control points. <br>
|
|
|
39 |
|
|
|
40 |
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
|
|
|
41 |
$spline = new Spline($xcontrol_points, $ycontrol_points);
<br />list ($xdata, $ydata) = $spline->Get(100);
<br />$lp = new LinePlot($ydata, $xdata);
<br /></font>
|
|
|
42 |
</span><br>
|
|
|
43 |
<p>
|
|
|
44 |
<p> <p> <span style='font-size:110%;'><a name="_SPLINE_SPLINE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
|
|
|
45 |
function Spline($xdata,$ydata)</font>
|
|
|
46 |
</b></div></a></span>
|
|
|
47 |
|
|
|
48 |
<span style='font-family:arial;font-size:90%;'><i>Constructor. Create a new Spline object</i></span><p>
|
|
|
49 |
|
|
|
50 |
|
|
|
51 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
52 |
|
|
|
53 |
$xdata</font>
|
|
|
54 |
|
|
|
55 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Control points. X-coordinates</td></tr>
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
$ydata</font>
|
|
|
59 |
|
|
|
60 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Control points. Y-coordinates</td></tr>
|
|
|
61 |
</table>
|
|
|
62 |
|
|
|
63 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Constructor. Create a new Spline object. The spline is determined by it's control points which are given with it's X and Y coordinates as arguments.
|
|
|
64 |
<p>
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
|
|
|
68 |
$spline = new Spline($xcontrol_points, $ycontrol_points);
<br />list ($xdata, $ydata) = $spline->Get(100);
<br />$lp = new LinePlot($ydata, $xdata);
<br /></font>
|
|
|
69 |
|
|
|
70 |
<p> <hr> <p>
|