Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
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_BEZIER"><div style="background-color:yellow;font-family:courier new;"></a>CLASS <b>Bezier</b></div>
9
<i>(Defined in: jpgraph_regstat.php : 112)</i><table border=1><tr><td>&nbsp;<a href="Bezier.html" style="font-family:arial;font-weight:bold;color:darkblue;">Bezier</a>&nbsp;</td></tr><tr><td valign=top>&nbsp;<a href="Bezier.html#_BEZIER_BEZIER">Bezier()</a>&nbsp;<br>
10
&nbsp;<a href="Bezier.html#_BEZIER_GET">Get()</a>&nbsp;<br>
11
</td></tr></table>&nbsp;<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 a bezier interpolated curve.
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
In order to use this method the file jpgraph_regstat.php must be included.
20
<p>
21
Technical note: The control points for a bezier curve does not necessary lie on the curve. Using the alternative method of spline interpolation guarantees that the specified control point lie on the generated curve.
22
<p>
23
Technical note 2: An alternmative Bezier curve is also availabe in the Canvas tools (jpgraph_canvtools.php). The difference is that that method will not return any data points it will directly draw an interpolate bezier curve on the canvas.
24
 <p> &nbsp;
25
<div style="font-weight:bold;font-family:arial;font-size:85%;">See also related classes:</div><a href="Spline.html">Spline</a> and <a href="Shape.html">Shape</a> <p> &nbsp;<hr><span style="font-family:arial;font-size:120%;font-weight:bold;">Class Methods</span><hr><p>
26
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_BEZIER_BEZIER"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
27
function&nbsp;Bezier($datax,$datay,$attraction_factor,,)</font>
28
</b></div></a></span>
29
 
30
<span style='font-family:arial;font-size:90%;'><i>Create a new bezier object</i></span><p>
31
 
32
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
33
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
34
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
35
$datax</font>
36
 
37
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>X-coordinates for control points</td></tr>
38
 
39
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
40
$datay</font>
41
 
42
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Y-coordinates for control points</td></tr>
43
 
44
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
45
$attraction_factor</font>
46
 
47
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Attraction factor</td></tr>
48
 
49
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
50
</font>
51
 
52
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>No description available</td></tr>
53
 
54
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
55
</font>
56
 
57
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
58
1</font>
59
</td><td>No description available</td></tr>
60
</table>
61
 
62
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Creates a new Bezier interpoaltion object. The arguments specifies the X, and Y coordinate sof the control points to be used.
63
 
64
The attraction factor is an integer >1 and determines how much "gracity" each control point should have. A higher value makes the resulting curve bend much more sharper against the control points. The default value is 1.&nbsp;<br>
65
 
66
<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">
67
//&nbsp;Control&nbsp;points
<br />$xdata&nbsp;=&nbsp;array(1,3,12,15);
<br />$ydata&nbsp;=&nbsp;array(5,15,2,19);
<br />
<br />//&nbsp;Get&nbsp;the&nbsp;interpolated&nbsp;values&nbsp;by&nbsp;creating
<br />//&nbsp;a&nbsp;new&nbsp;bezier&nbsp;object.
<br />$bez&nbsp;=&nbsp;new&nbsp;Bezier($xdata,$ydata);
<br />
<br />//&nbsp;For&nbsp;the&nbsp;new&nbsp;data&nbsp;set&nbsp;we&nbsp;want&nbsp;50&nbsp;points&nbsp;to
<br />//&nbsp;get&nbsp;a&nbsp;smooth&nbsp;curve.
<br />list($newx,$newy)&nbsp;=&nbsp;$bez-&gt;Get(50);</font>
68
</span><br>
69
<p>
70
<p>&nbsp; <p> &nbsp; <span style='font-size:110%;'><a name="_BEZIER_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">
71
function&nbsp;Get($steps)</font>
72
</b></div></a></span>
73
74
<span style='font-family:arial;font-size:90%;'><i>Return two arrays of X and Y coordinates that represents the curve</i></span><p>
75
76
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
77
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
78
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
79
$steps</font>
80
81
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'>&nbsp;</td><td>Number of data points</td></tr>
82
</table>
83
 
84
<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.&nbsp;<br>
85
 
86
<div style="font-weight:bold;font-family:arial;font-size:85%;">Returns</div>array($datax,$datay)<br>
87
88
<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">
89
//&nbsp;Control&nbsp;points&nbsp;for&nbsp;bezier&nbsp;curve
<br />$xdata&nbsp;=&nbsp;array(1,3,12,15);
<br />$ydata&nbsp;=&nbsp;array(5,15,2,19);
<br />
<br />//&nbsp;Get&nbsp;the&nbsp;interpolated&nbsp;values&nbsp;by&nbsp;creating
<br />//&nbsp;a&nbsp;new&nbsp;Spline&nbsp;object.
<br />$bez&nbsp;=&nbsp;new&nbsp;Bezier($xdata,$ydata);
<br />
<br />//&nbsp;For&nbsp;the&nbsp;new&nbsp;data&nbsp;set&nbsp;we&nbsp;want&nbsp;50&nbsp;points&nbsp;to
<br />//&nbsp;get&nbsp;a&nbsp;smooth&nbsp;curve.
<br />list($newx,$newy)&nbsp;=&nbsp;$bez-&gt;Get(50);
<br /></font>
90
 
91
<p> <hr> <p>