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

Class: Image_Graph_Tool

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

Class Overview


This class contains a set of tool-functions.


Author(s):

Version:

  • Release: 0.8.0

Copyright:

  • 2003-2009 The PHP Group

Methods


Inherited Variables

Inherited Methods


Class Details

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

These functions are all to be called statically



[ Top ]


Method Detail

bezier   [line 117]

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

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 177]

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')

Parameters:

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

[ Top ]

calculateLinearRegression   [line 268]

array calculateLinearRegression( array &$data)

Calculate linear regression on a dataset
  • Return: The slope and intersection of the "best-fit" line

Parameters:

array   &$data   —  The data to calculate regression upon

[ Top ]

close2zero   [line 158]

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

Parameters:

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

[ Top ]

controlPoint   [line 91]

double controlPoint( double $p1, double $p2, double $factor, [double $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

Parameters:

double   $p1   —  1st point
double   $p2   —  2nd point
double   $factor   —  Mirror factor, 0 returns P2, 1 returns a pure mirror, i.e. P1 on the exact other side of P2
double   $smoothFactor   —  How much to smooth the curve (0..1)

[ Top ]

mid   [line 57]

double mid( double $p1, double $p2)

Return the average of 2 points
  • Return: The average of P1 and P2

Parameters:

double   $p1   —  1st point
double   $p2   —  2nd point

[ Top ]

mirror   [line 73]

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

Mirrors P1 in P2 by a amount of Factor
  • Return: mirrored in $p2 by Factor

Parameters:

double   $p1   —  1st point, point to mirror
double   $p2   —  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 138]

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

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, 11 Mar 2019 15:39:38 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.