Up: Java Kali Home Page

Class DVector

Class DVector

java.lang.Object
   |
   +----DVector

class DVector
extends Object
A DVector represents a vector in R2; each coordinate is a double.

Constructor Index

 o DVector()
Create a new DVector with unspecified coordinates (actually I think the coords are initialized to 0, but don't count on this).
 o DVector(double, double)
Create a new DVector with given coordinates.

Method Index

 o array(double, double)
Construct an array of DVectors; the array method takes 2,4,6, or 8 doubles, and returns an array of 1,2,3, or 4 DVectors, respectively.
 o array(double, double, double, double)
 o array(double, double, double, double, double, double)
 o array(double, double, double, double, double, double, double, double)
 o aString(DVector[])
Convert an array of DVectors to a string.
 o copy()
Return a copy of this vector.
 o dot(DVector)
Return the dot product of this vector with another one.
 o length()
Return the length (magnitude) of this DVector (sqrt(x^2 + y^2))
 o negate()
Multiply this vector by -1.
 o scale(double)
Multiply this vector by the scalar s.
 o toString()
Convert a DVector to a String

Constructors

 o DVector
  public DVector(double x,
                 double y)
Create a new DVector with given coordinates.
 o DVector
  public DVector()
Create a new DVector with unspecified coordinates (actually I think the coords are initialized to 0, but don't count on this).

Methods

 o toString
  public String toString()
Convert a DVector to a String
Overrides:
toString in class Object
 o length
  public double length()
Return the length (magnitude) of this DVector (sqrt(x^2 + y^2))
 o negate
  public void negate()
Multiply this vector by -1.
 o scale
  public void scale(double s)
Multiply this vector by the scalar s.
 o dot
  public double dot(DVector v)
Return the dot product of this vector with another one.
 o copy
  public DVector copy()
Return a copy of this vector.
 o array
  public static DVector[] array(double x0,
                                double y0)
Construct an array of DVectors; the array method takes 2,4,6, or 8 doubles, and returns an array of 1,2,3, or 4 DVectors, respectively.
 o array
  public static DVector[] array(double x0,
                                double y0,
                                double x1,
                                double y1)
 o array
  public static DVector[] array(double x0,
                                double y0,
                                double x1,
                                double y1,
                                double x2,
                                double y2)
 o array
  public static DVector[] array(double x0,
                                double y0,
                                double x1,
                                double y1,
                                double x2,
                                double y2,
                                double x3,
                                double y3)
 o aString
  public static String aString(DVector v[])
Convert an array of DVectors to a string.


Up: Java Kali Home Page

[HOME] The Geometry Center Home Page

Author: Mark Phillips
Comments to: webmaster@geom.umn.edu
Created: Sep 16 1996 --- Last modified: Sep 18 1996