/** * Converts the string argument to a DoubleDouble number. * * @param str a string containing a representation of a numeric value * @return the extended precision version of the value * @throws NumberFormatException if <tt>s</tt> is not a valid representation of a number */ public static DD valueOf(String str) throws NumberFormatException { return parse(str); }
/** * Creates a new vector from an existing one. * * @param v the vector to copy * @return a new vector */ public static Vector2D create(Vector2D v) { return new Vector2D(v); }
/** * Returns a new DoubleDouble whose value is <tt>(this * y)</tt>. * * @param y the multiplicand * @return <tt>(this * y)</tt> */ public final DD multiply(DD y) { if (y.isNaN()) return createNaN(); return copy(this).selfMultiply(y); }
public static DD triAreaDDFast( Coordinate a, Coordinate b, Coordinate c) { DD t1 = DD.valueOf(b.x).selfSubtract(a.x) .selfMultiply( DD.valueOf(c.y).selfSubtract(a.y)); DD t2 = DD.valueOf(b.y).selfSubtract(a.y) .selfMultiply( DD.valueOf(c.x).selfSubtract(a.x)); return t1.selfSubtract(t2); }
/** * Creates a vector from a {@link Coordinate}. * * @param coord * the Coordinate to copy * @return a new vector */ public static Vector3D create(Coordinate coord) { return new Vector3D(coord); }
/** * Divides the vector by a scalar value. * * @param d the value to divide by * @return a new vector with the value v / d */ public Vector2D divide(double d) { return create(x / d, y / d); }
/** * Creates a new DoubleDouble with value 0.0. */ public DD() { init(0.0); }
/** * Creates a new DoubleDouble with the value of the argument. * * @param dd the DoubleDouble value to copy * @return a copy of the input value */ public static DD copy(DD dd) { return new DD(dd); }
/** * Creates a vector from a {@link Coordinate}. * * @param coord the Coordinate to copy * @return a new vector */ public static Vector2D create(Coordinate coord) { return new Vector2D(coord); }
/** * Creates a new DoubleDouble with value equal to the argument. * * @param dd the value to initialize */ public DD(DD dd) { init(dd); }
/** * Creates a vector with the direction and magnitude * of the difference between the * <tt>to</tt> and <tt>from</tt> {@link Coordinate}s. * * @param from the origin Coordinate * @param to the destination Coordinate * @return a new vector */ public static Vector2D create(Coordinate from, Coordinate to) { return new Vector2D(from, to); }
/** * Creates a new DoubleDouble with value x. * * @param x the value to initialize */ public DD(double x) { init(x); }
/** * Creates a new vector with given X and Y components. * * @param x the x component * @param y the y component * @return a new vector */ public static Vector2D create(double x, double y) { return new Vector2D(x, y); }
/** * Creates a new DoubleDouble with value (hi, lo). * * @param hi the high-order component * @param lo the high-order component */ public DD(double hi, double lo) { init(hi, lo); }
/** * Creates a copy of this vector * * @return a copy of this vector */ public Object clone() { return new Vector2D(this); }