Source for file Coordinates.php
Documentation is available at Coordinates.php
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Jesus M. Castagnetto <jmcastagnetto@php.net> |
// +----------------------------------------------------------------------+
* Utility class for defining 3D coordinates and
* its associated distance() method
* @author Jesus M. Castagnetto <jmcastagnetto@php.net>
* @package Science_Chemistry
* Array of tridimensional coordinates: (x, y, z)
* Constructor for the class, returns null if parameter is
* not an array with 3 entries
* @param array $coords array of three floats (x, y, z)
* @return object Science_Chemistry_Coordinates
* Cartesian distance calculation method
* @param object Science_Chemistry_Coordinates $coord
$xyz2 = $coord->getCoordinates ();
for ($i=0; $i< count($xyz2); $i++ ) {
$sum2 += pow(($xyz2[$i] - $this->coords[$i]),2 );
* Checks if the object is an instance of Science_Chemistry_Coordinates
* @param object Science_Chemistry_Coordinates $obj
* Returns the array of coordinates
* @return array array (x, y, z)
if (is_array($this->coords) && !empty ($this->coords))
* Returns a string representation of the coordinates: x y z
for ($i=0; $i< count($this->coords); $i++ )
$tmp[$i] = sprintf("%10.4f",$this->coords[$i]);
* Returns a CML representation of the coordinates
$out = "<coordinate3 builtin=\"xyz3\">";
for ($i=0; $i < count($this->coords); $i++ )
$out .= implode(" ",$tmp). "</coordinate3>\n";
} // end of class Science_Chemistry_Coordinates
// vim: expandtab: ts=4: sw=4
Documentation generated on Mon, 11 Mar 2019 15:48:16 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|