org.geotools.geometry.iso.util.algorithmND
Class AlgoPointND

java.lang.Object
  extended by org.geotools.geometry.iso.util.algorithmND.AlgoPointND

public class AlgoPointND
extends java.lang.Object

This class offers methods to process basic operations on double arrays in n-dimensional space. In majority, these algorithms are non-robust in sense that floating-point rounding errors may occur.

Author:
Jackson Roehrig and Sanjay Jena

Constructor Summary
AlgoPointND()
           
 
Method Summary
static double[] add(double[] p0, double[] p1)
          Adds a coordinate to another coordinate
static double[] evaluate(double[] c0, double[] c1, double r)
          Interpolation of a straigt line given by two coordinates c0 and c1.
static double getDistance(double[] p0, double[] p1)
          Returns the distance between two points
static double getDistanceSquare(double[] p0, double[] p1)
          Returns the square of the distance between two points
static double getDistanceToOrigin(double[] p0)
          Returns the distance from the coordinate represented by p0 to the origin of the coordinate system.
static double[] normalize(double[] p)
          Normalizes a vector which begins at the origin and ends at p to length 1 Note: This method is NON-ROBUST due to floating-point rounding errors.
static double[] scale(double[] p0, double factor)
           
static double[][] split(double[] c0, double[] c1, double maxSpacingSquare)
           
static double[] subtract(double[] p0, double[] p1)
          Substracts a coordinate p0 from a coordinate p1.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlgoPointND

public AlgoPointND()
Method Detail

getDistanceSquare

public static double getDistanceSquare(double[] p0,
                                       double[] p1)
Returns the square of the distance between two points

Parameters:
p0 -
p1 -
Returns:
double

getDistance

public static double getDistance(double[] p0,
                                 double[] p1)
Returns the distance between two points

Parameters:
p0 -
p1 -
Returns:
double

getDistanceToOrigin

public static double getDistanceToOrigin(double[] p0)
Returns the distance from the coordinate represented by p0 to the origin of the coordinate system. Note: This method is NON-ROBUST due to floating-point rounding errors. Inexact results according to floating-point rounding errors may be caused.

Parameters:
p0 -
Returns:
double

subtract

public static double[] subtract(double[] p0,
                                double[] p1)
Substracts a coordinate p0 from a coordinate p1. Note: This method is NON-ROBUST due to floating-point rounding errors. Inexact results according to floating-point rounding errors may be caused.

Parameters:
p0 -
p1 -
Returns:
p1 - p0 : double[]

add

public static double[] add(double[] p0,
                           double[] p1)
Adds a coordinate to another coordinate

Parameters:
p0 -
p1 -
Returns:
double[]

scale

public static double[] scale(double[] p0,
                             double factor)
Parameters:
p0 -
factor -
Returns:
double[]

split

public static double[][] split(double[] c0,
                               double[] c1,
                               double maxSpacingSquare)
Parameters:
c0 -
c1 -
maxSpacingSquare - is the square of the max. allowed spacing
Returns:
only the intermediate coordinates

evaluate

public static double[] evaluate(double[] c0,
                                double[] c1,
                                double r)
Interpolation of a straigt line given by two coordinates c0 and c1. The method will return a double array which describes the coordinate at distance r on this straight line, whith a parametrisation of 0.0 at c0 and 1.0 at c1. Note: This method is NON-ROBUST due to floating-point rounding errors. Inexact results according to floating-point rounding errors may be caused.

Parameters:
c0 -
c1 -
r -
Returns:
double[]

normalize

public static double[] normalize(double[] p)
Normalizes a vector which begins at the origin and ends at p to length 1 Note: This method is NON-ROBUST due to floating-point rounding errors. Inexact results according to floating-point rounding errors may be caused.

Parameters:
p - the end point of the vector
Returns:
double[] End point of the normalized vector


Copyright © 1996-2010 Geotools. All Rights Reserved.