This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
phptsmadmin/includes/jpgraph/docs/classref/Bezier.html

99 lines
12 KiB
HTML
Raw Normal View History

2011-05-28 09:51:52 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><style type="text/css">
<!--
A:link {font-family: helvetica, arial, geneva, sans-serif; font-size: small; text-decoration: none; color: #000000}
A:visited {font-family: helvetica, arial, geneva, sans-serif; font-size: small; text-decoration: none; color: #000000}
A:hover {font-family: helvetica, arial, geneva, sans-serif; font-size: small; text-decoration: underline; color: #FF0000}
A.no:link {font-family:inherit; font-size: inhreit;text-decoration: none; color: #000000}
A.no:visited {font-family:inherit; font-size: inherit;text-decoration: none; color: #000000}
A.no:hover {font-family:inherit; font-size: inherit;text-decoration: none; color: #000000}
th {font-family: helvetica, arial; color : black; font-size:90%; background : #b7c8b7; border-right:black solid 1pt; border-bottom:black solid 1pt;}
td {font-family: helvetica, arial; color : black; font-size:90%; background : white; border-right:black solid 1pt; border-bottom:black solid 1pt;}
//-->
</style></HEAD><hr><div style="padding-left:4px;border-left:solid black 1px;border-top:solid black 1px;border-bottom:solid black 2px;border-right:solid black 2px;background-color:#deaa87;font-family:courier new;font-size:16pt;">Class <a class="no" name="_C_BEZIER"><b>Bezier</b></a></div>
<i>(Defined in: jpgraph_regstat.php : 112)</i><br>&nbsp;<br><table cellspaceing=0 cellpadding=4 style="border:solid #303030 1px;"><tr><td align="center" style="background:lightgray;" >&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_GET">Get()</a>&nbsp;<br>
&nbsp;<a href="Bezier.html#_BEZIER___CONSTRUCT">__construct()</a>&nbsp;<br>
</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.
<p>
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.
<p>
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.
<p>
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.
<p>
In order to use this method the file jpgraph_regstat.php must be included.
<p>
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.
<p>
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.
<p> &nbsp;
<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>
<p> &nbsp; <div style='font-family: helvetica, arial, geneva, sans-serif;margin-bottom:4px;border-left:solid black 1px;border-top:solid black 1px;border-bottom:solid black 2px;border-right:solid black 2px;font-size:120%;background:#dde9af;padding:4px;'><a class="no" name="_BEZIER_GET"><span style="color:#555555;">Bezier ::</span><br><b>Get</b>($steps)</a></div>
<span style='font-family:arial;font-size:95%;'><i>Return two arrays of X and Y coordinates that represents the curve</i></span><p>
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
<span style="color: #0000BB">$steps</span>
</span>
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'>&nbsp;</td><td>Number of data points</td></tr>
</table>
<div style="font-weight:bold;font-family:arial;font-size:90%;">Description:</div>Return a data set representing the interpolated smooth curve passing through all the specified control points.&nbsp;<br>
<div style="font-weight:bold;font-family:arial;font-size:90%;"><p>Example:</div><div style="padding:5px;border:dashed gray 1px;background-color:#f3f3f3;font-family:courier new;font-size:90%;font-weight:bold;"><b><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #FF8000">//&nbsp;Control&nbsp;points&nbsp;for&nbsp;bezier&nbsp;curve <br /></span><span style="color: #0000BB">$xdata&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">3</span><span style="color: #007700">,</span><span style="color: #0000BB">12</span><span style="color: #007700">,</span><span style="color: #0000BB">15</span><span style="color: #007700">); <br /></span><span style="color: #0000BB">$ydata&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #0000BB">5</span><span style="color: #007700">,</span><span style="color: #0000BB">15</span><span style="color: #007700">,</span><span style="color: #0000BB">2</span><span style="color: #007700">,</span><span style="color: #0000BB">19</span><span style="color: #007700">); <br /> <br /></span><span style="color: #FF8000">//&nbsp;Get&nbsp;the&nbsp;interpolated&nbsp;values&nbsp;by&nbsp;creating <br />//&nbsp;a&nbsp;new&nbsp;Spline&nbsp;object. <br /></span><span style="color: #0000BB">$bez&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Bezier</span><span style="color: #007700">(</span><span style="color: #0000BB">$xdata</span><span style="color: #007700">,</span><span style="color: #0000BB">$ydata</span><span style="color: #007700">); <br /> <br /></span><span style="color: #FF8000">//&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 /></span><span style="color: #007700">list(</span><span style="color: #0000BB">$newx</span><span style="color: #007700">,</span><span style="color: #0000BB">$newy</span><span style="color: #007700">)&nbsp;=&nbsp;</span><span style="color: #0000BB">$bez</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Get</span><span style="color: #007700">(</span><span style="color: #0000BB">50</span><span style="color: #007700">); <br /></span><span style="color: #0000BB"></span>
</span>
</b></div><br>
<p>
<p> &nbsp; <div style='font-family: helvetica, arial, geneva, sans-serif;margin-bottom:4px;border-left:solid black 1px;border-top:solid black 1px;border-bottom:solid black 2px;border-right:solid black 2px;font-size:120%;background:#dde9af;padding:4px;'><a class="no" name="_BEZIER___CONSTRUCT"><span style="color:#555555;">Bezier ::</span><br><b>__construct</b>($datax, $datay, $attraction_factor, , )</a></div>
<span style='font-family:arial;font-size:95%;'><i>Create a new bezier object</i></span><p>
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
<span style="color: #0000BB">$datax</span>
</span>
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'>&nbsp;</td><td>X-coordinates for control points</td></tr>
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
<span style="color: #0000BB">$datay</span>
</span>
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'>&nbsp;</td><td>Y-coordinates for control points</td></tr>
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
<span style="color: #0000BB">$attraction_factor</span>
</span>
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'>&nbsp;</td><td>Attraction factor</td></tr>
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
<span style="color: #0000BB"></span>
</span>
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'>&nbsp;</td><td>No description available</td></tr>
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
<span style="color: #0000BB"></span>
</span>
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
<span style="color: #0000BB">1</span>
</span>
</td><td>No description available</td></tr>
</table>
<div style="font-weight:bold;font-family:arial;font-size:90%;">Description:</div>Creates a new Bezier interpoaltion object. The arguments specifies the X, and Y coordinate sof the control points to be used.
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>
<div style="font-weight:bold;font-family:arial;font-size:90%;"><p>Example:</div><div style="padding:5px;border:dashed gray 1px;background-color:#f3f3f3;font-family:courier new;font-size:90%;font-weight:bold;"><b><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #FF8000">//&nbsp;Control&nbsp;points <br /></span><span style="color: #0000BB">$xdata&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">3</span><span style="color: #007700">,</span><span style="color: #0000BB">12</span><span style="color: #007700">,</span><span style="color: #0000BB">15</span><span style="color: #007700">); <br /></span><span style="color: #0000BB">$ydata&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #0000BB">5</span><span style="color: #007700">,</span><span style="color: #0000BB">15</span><span style="color: #007700">,</span><span style="color: #0000BB">2</span><span style="color: #007700">,</span><span style="color: #0000BB">19</span><span style="color: #007700">); <br /> <br /></span><span style="color: #FF8000">//&nbsp;Get&nbsp;the&nbsp;interpolated&nbsp;values&nbsp;by&nbsp;creating <br />//&nbsp;a&nbsp;new&nbsp;bezier&nbsp;object. <br /></span><span style="color: #0000BB">$bez&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Bezier</span><span style="color: #007700">(</span><span style="color: #0000BB">$xdata</span><span style="color: #007700">,</span><span style="color: #0000BB">$ydata</span><span style="color: #007700">); <br /> <br /></span><span style="color: #FF8000">//&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 /></span><span style="color: #007700">list(</span><span style="color: #0000BB">$newx</span><span style="color: #007700">,</span><span style="color: #0000BB">$newy</span><span style="color: #007700">)&nbsp;=&nbsp;</span><span style="color: #0000BB">$bez</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Get</span><span style="color: #007700">(</span><span style="color: #0000BB">50</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</b></div><br>
<p> <hr> <p></html>