[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Image/Graph/ -> Tool.php (sommaire)

Image_Graph - Main class for the graph creation. PHP versions 4 and 5

Author: Jesper Veggerby <pear.nosey@veggerby.dk>
Copyright: Copyright (C) 2003, 2004 Jesper Veggerby Hansen
License: http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
Version: CVS: $Id: Tool.php,v 1.4 2005/09/14 20:27:24 nosey Exp $
Poids: 291 lignes (10 kb)
Inclus ou requis: 3 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

Image_Graph_Tool:: (8 méthodes):
  mid()
  mirror()
  controlPoint()
  bezier()
  rotate()
  close2zero()
  calculateArcDimensionAndCenter()
  calculateLinearRegression()


Classe: Image_Graph_Tool  - X-Ref

This class contains a set of tool-functions.

These functions are all to be called statically

mid($p1, $p2)   X-Ref
Return the average of 2 points

param: double P1 1st point
param: double P2 2nd point
return: double The average of P1 and P2

mirror($p1, $p2, $factor = 1)   X-Ref
Mirrors P1 in P2 by a amount of Factor

param: double $p1 1st point, point to mirror
param: double $o2 2nd point, mirror point
param: double $factor Mirror factor, 0 returns $p2, 1 returns a pure
return: double $p1 mirrored in $p2 by Factor

controlPoint($p1, $p2, $factor, $smoothFactor = 0.75)   X-Ref
Calculates a Bezier control point, this function must be called for BOTH
X and Y coordinates (will it work for 3D coordinates!?)

param: double $p1 1st point
param: double $p2 Point to
param: double $factor Mirror factor, 0 returns P2, 1 returns a pure
return: double P1 mirrored in P2 by Factor

bezier($t, $p1, $p2, $p3, $p4)   X-Ref
Calculates a Bezier point, this function must be called for BOTH X and Y
coordinates (will it work for 3D coordinates!?)

param: double $t A position between $p2 and $p3, value between 0 and 1
param: double $p1 Point to use for calculating control points
param: double $p2 Point 1 to calculate bezier curve between
param: double $p3 Point 2 to calculate bezier curve between
param: double $p4 Point to use for calculating control points
return: double The bezier value of the point t between $p2 and $p3 using

rotate($x, $y, $xc, $yc, $angle)   X-Ref
For a given point (x,y) return a point rotated by a given angle aroung the center (xy,yc)

param: int $x x coordinate of the point to rotate
param: int $y y coordinate of the point to rotate
param: int $xc x coordinate of the center of the rotation
param: int $yc y coordinate of the center of the rotation
param: int $angle angle of the rotation
return: array the coordinate of the new point

close2zero($value, $decimal)   X-Ref
If a number is close 0 zero (i.e. 0 within $decimal decimals) it is rounded down to zero

param: double $value The value to round
param: int $decimal The number of decimals
return: double The value or zero if "close enough" to zero

calculateArcDimensionAndCenter($v1, $v2)   X-Ref
Calculate the dimensions and center point (of gravity) for an arc

param: int $v1 The angle at which the arc starts
param: int $v2 The angle at which the arc ends
return: array An array with the dimensions in a fraction of a circle width radius 1 'rx', 'ry' and the

calculateLinearRegression(&$data)   X-Ref
Calculate linear regression on a dataset

param: array $data The data to calculate regression upon
return: array The slope and intersection of the "best-fit" line



Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7