/** * Construct a contour plotting algorithm. The end result of the algorithm is a sequence of * line segments for each isobar given as two vertices. * * @param $aDataMatrix The Z-data to be used * @param $aIsobar A mixed variable, if it is an integer then this specified the number of isobars to use. * The values of the isobars are automatically detrmined to be equ-spaced between the min/max value of the * data. If it is an array then it explicetely gives the isobar values * @param $aInvert By default the matrice with row index 0 corresponds to Y-value 0, i.e. in the bottom of * the plot. If this argument is true then the row with the highest index in the matrice corresponds to * Y-value 0. In affect flipping the matrice around an imaginary horizontal axis. * @param $aHighContrast Use high contrast colors (blue/red:ish) * @param $aHighContrastBW Use only black colors for contours * @return an instance of the contour plot algorithm */ public function __construct($aDataMatrix, $aIsobar = 10, $aFactor = 1, $aInvert = false, $aIsobarColors = array()) { $this->dataMatrix = $aDataMatrix; $this->flipData = $aInvert; $this->isobar = $aIsobar; $this->interpFactor = $aFactor; if ($this->interpFactor > 1) { if ($this->interpFactor > 5) { Util\JpGraphError::RaiseL(28007); // ContourPlot interpolation factor is too large (>5) } $ip = new MeshInterpolate(); $this->dataMatrix = $ip->Linear($this->dataMatrix, $this->interpFactor); } $this->contour = new Contour($this->dataMatrix, $this->isobar, $aIsobarColors); if (is_array($aIsobar)) { $this->nbrContours = count($aIsobar); } else { $this->nbrContours = $aIsobar; } }
/** * Utility function to do linear mesh interpolation * @param $aDat Matrix to interpolate * @param $aFactor Interpolation factor */ function doMeshInterpolate(&$aData, $aFactor) { $m = new MeshInterpolate(); $aData = $m->Linear($aData, $aFactor); }