Image_Graph
[ class tree: Image_Graph ] [ index: Image_Graph ] [ all elements ]

Class: Image_Graph_Tool

Source Location: /Image_Graph-0.7.2/Graph/Tool.php

Class Overview


This class contains a set of tool-functions.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • Copyright (C) 2003, 2004 Jesper Veggerby Hansen

Methods


Inherited Variables

Inherited Methods


Class Details

[line 43]
This class contains a set of tool-functions.

These functions are all to be called statically



[ Top ]


Method Detail

bezier   [line 110]

double bezier( double $t, double $p1, double $p2, double $p3, double $p4)

Calculates a Bezier point, this function must be called for BOTH X and Y coordinates (will it work for 3D coordinates!?)
  • Return: The bezier value of the point t between $p2 and $p3 using $p1 and $p4 to calculate control points
  • Static: This method can be called statically

Parameters:

double   $t     A position between $p2 and $p3, value between 0 and 1
double   $p1     Point to use for calculating control points
double   $p2     Point 1 to calculate bezier curve between
double   $p3     Point 2 to calculate bezier curve between
double   $p4     Point to use for calculating control points

[ Top ]

calculateArcDimensionAndCenter   [line 168]

array calculateArcDimensionAndCenter( int $v1, int $v2)

Calculate the dimensions and center point (of gravity) for an arc
  • Return: An array with the dimensions in a fraction of a circle width radius 1 'rx', 'ry' and the center point of gravity ('cx', 'cy')
  • Static: This method can be called statically

Parameters:

int   $v1     The angle at which the arc starts
int   $v2     The angle at which the arc ends

[ Top ]

calculateLinearRegression   [line 263]

array calculateLinearRegression( array &$data)

Calculate linear regression on a dataset
  • Return: The slope and intersection of the "best-fit" line
  • Static: This method can be called statically

Parameters:

array   $data     The data to calculate regression upon

[ Top ]

close2zero   [line 149]

double close2zero( double $value, int $decimal)

If a number is close 0 zero (i.e. 0 within $decimal decimals) it is rounded down to zero
  • Return: The value or zero if "close enough" to zero
  • Static: This method can be called statically

Parameters:

double   $value     The value to round
int   $decimal     The number of decimals

[ Top ]

controlPoint   [line 85]

double controlPoint( double $p1, double $p2, double $factor, [mixed $smoothFactor = 0.75])

Calculates a Bezier control point, this function must be called for BOTH X and Y coordinates (will it work for 3D coordinates!?)
  • Return: P1 mirrored in P2 by Factor
  • Static: This method can be called statically

Parameters:

double   $p1     1st point
double   $p2     Point to
double   $factor     Mirror factor, 0 returns P2, 1 returns a pure mirror, i.e. P1 on the exact other side of P2

[ Top ]

mid   [line 54]

double mid( double $p1, double $p2)

Return the average of 2 points
  • Return: The average of P1 and P2
  • Static: This method can be called statically

Parameters:

double   $p1     P1 1st point
double   $p2     P2 2nd point

[ Top ]

mirror   [line 69]

double mirror( double $p1, mixed $p2, [double $factor = 1], double $o2)

Mirrors P1 in P2 by a amount of Factor
  • Return: mirrored in $p2 by Factor
  • Static: This method can be called statically

Parameters:

double   $p1     1st point, point to mirror
double   $o2     2nd point, mirror point
double   $factor     Mirror factor, 0 returns $p2, 1 returns a pure mirror, ie $p1 on the exact other side of $p2

[ Top ]

rotate   [line 130]

array rotate( int $x, int $y, int $xc, int $yc, int $angle)

For a given point (x,y) return a point rotated by a given angle aroung the center (xy,yc)
  • Return: the coordinate of the new point
  • Static: This method can be called statically

Parameters:

int   $x     x coordinate of the point to rotate
int   $y     y coordinate of the point to rotate
int   $xc     x coordinate of the center of the rotation
int   $yc     y coordinate of the center of the rotation
int   $angle     angle of the rotation

[ Top ]


Documentation generated on Mon, 13 Mar 2006 03:44:00 -0500 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.