Documentation Build v9.18

Contour extends stdClass
in package

This class encapsulates the core contour plot algorithm. It will find the path of the specified isobars in the data matrix specified. It is assumed that the data matrix models an equspaced X-Y mesh of datavalues corresponding to the Z values.

Table of Contents

Methods

__construct()  : an
Create a new contour level "algorithm machine".
adjustDataPointValues()  : mixed
In order to avoid all kinds of unpleasent extra checks and complex boundary controls for the degenerated case where the contour levels exactly crosses one of the vertices we add a very small delta (0.1%) to the data point value.
CalculateColors()  : mixed
Calculate suitable colors for each defined isobar
determineIsobarEdgeCrossings()  : mixed
Determine all edges, horizontal and vertical that the specified isobar crosses. The crossings are recorded in the two edge matrices.
getCrossingCoord()  : unknown_type
Return the normalized coordinates for the crossing of the specified edge with the specified isobar- The crossing is simpy detrmined with a linear interpolation between the two vertices on each side of the edge and the value of the isobar
getIsobars()  : mixed
This is where the main work is done. For each isobar the crossing of the edges are determined and then each cell is analyzed to find the 0, 2 or 4 crossings. Then the normalized coordinate for the crossings are determined and pushed on to the isobar stack. When the method is finished the $isobarCoord will hold one arrayfor each isobar where all the line segments that makes up the contour plot are stored.
getMinMaxVal()  : mixed
Find the min and max values in the data matrice
isobarHCrossing()  : true
Determine if the specified isobar crosses the horizontal edge specified by its row and column
isobarVCrossing()  : true
Determine if the specified isobar crosses the vertical edge specified by its row and column
resetEdgeMatrices()  : mixed
Reset the two matrices that keeps track on where the isobars crosses the horizontal and vertical edges
SetInvert()  : mixed
Flip the plot around the Y-coordinate. This has the same affect as flipping the input data matrice
UseHighContrastColor()  : unknown_type

Methods

__construct()

Create a new contour level "algorithm machine".

public __construct(mixed $aMatrix[, mixed $aIsobars = 10 ][, mixed $aColors = null ]) : an
Parameters
$aMatrix : mixed

The values to find the contour from

$aIsobars : mixed = 10

Mixed. If integer it determines the number of isobars to be used. The levels are determined automatically as equdistance between the min and max value of the matrice. If $aIsobars is an array then this is interpretated as an array of values to be used as isobars in the contour plot.

$aColors : mixed = null
Return values
an —

instance of the contour algorithm

adjustDataPointValues()

In order to avoid all kinds of unpleasent extra checks and complex boundary controls for the degenerated case where the contour levels exactly crosses one of the vertices we add a very small delta (0.1%) to the data point value.

public adjustDataPointValues() : mixed

This has no visible affect but it makes the code sooooo much cleaner.

CalculateColors()

Calculate suitable colors for each defined isobar

public CalculateColors() : mixed

determineIsobarEdgeCrossings()

Determine all edges, horizontal and vertical that the specified isobar crosses. The crossings are recorded in the two edge matrices.

public determineIsobarEdgeCrossings(mixed $aIsobar) : mixed
Parameters
$aIsobar : mixed

The value of the isobar to be checked

getCrossingCoord()

Return the normalized coordinates for the crossing of the specified edge with the specified isobar- The crossing is simpy detrmined with a linear interpolation between the two vertices on each side of the edge and the value of the isobar

public getCrossingCoord(mixed $aRow, mixed $aCol, mixed $aEdgeDir, mixed $aIsobarVal) : unknown_type
Parameters
$aRow : mixed

Row of edge

$aCol : mixed

Column of edge

$aEdgeDir : mixed

Determine if this is a horizontal or vertical edge

$aIsobarVal : mixed
Return values
unknown_type

getIsobars()

This is where the main work is done. For each isobar the crossing of the edges are determined and then each cell is analyzed to find the 0, 2 or 4 crossings. Then the normalized coordinate for the crossings are determined and pushed on to the isobar stack. When the method is finished the $isobarCoord will hold one arrayfor each isobar where all the line segments that makes up the contour plot are stored.

public getIsobars() : mixed
Tags
@return

array( $isobarCoord, $isobarValues, $isobarColors )

getMinMaxVal()

Find the min and max values in the data matrice

public getMinMaxVal() : mixed
Tags
@return

array(min_value,max_value)

isobarHCrossing()

Determine if the specified isobar crosses the horizontal edge specified by its row and column

public isobarHCrossing(mixed $aRow, mixed $aCol, mixed $aIsobar) : true
Parameters
$aRow : mixed

Row index of edge to be checked

$aCol : mixed

Col index of edge to be checked

$aIsobar : mixed

Isobar value

Return values
true —

if the isobar is crossing this edge

isobarVCrossing()

Determine if the specified isobar crosses the vertical edge specified by its row and column

public isobarVCrossing(mixed $aRow, mixed $aCol, mixed $aIsobar) : true
Parameters
$aRow : mixed

Row index of edge to be checked

$aCol : mixed

Col index of edge to be checked

$aIsobar : mixed

Isobar value

Return values
true —

if the isobar is crossing this edge

resetEdgeMatrices()

Reset the two matrices that keeps track on where the isobars crosses the horizontal and vertical edges

public resetEdgeMatrices() : mixed

SetInvert()

Flip the plot around the Y-coordinate. This has the same affect as flipping the input data matrice

public SetInvert([mixed $aFlg = true ]) : mixed
Parameters
$aFlg : mixed = true

If true the the vertice in input data matrice position (0,0) corresponds to the top left corner of teh plot otherwise it will correspond to the bottom left corner (a horizontal flip)

UseHighContrastColor()

public UseHighContrastColor([mixed $aFlg = true ][, mixed $aBW = false ]) : unknown_type
Parameters
$aFlg : mixed = true
$aBW : mixed = false
Return values
unknown_type
On this page

Search results