Up: Java Kali Source Code and Documentation
Class DVector
Class DVector
java.lang.Object
|
+----DVector
- class DVector
- extends Object
A DVector represents a vector in R2; each coordinate
is a double.
-
DVector()
- Create a new DVector with unspecified coordinates (actually I
think the coords are initialized to 0, but don't count on this).
-
DVector(double, double)
- Create a new DVector with given coordinates.
-
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.
-
array(double, double, double, double)
-
array(double, double, double, double, double, double)
-
array(double, double, double, double, double, double, double, double)
-
aString(DVector[])
- Convert an array of DVectors to a string.
-
copy()
- Return a copy of this vector.
-
dot(DVector)
- Return the dot product of this vector with another one.
-
length()
- Return the length (magnitude) of this DVector (sqrt(x^2 + y^2))
-
negate()
- Multiply this vector by -1.
-
scale(double)
- Multiply this vector by the scalar s.
-
toString()
- Convert a DVector to a String
DVector
public DVector(double x,
double y)
- Create a new DVector with given coordinates.
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).
toString
public String toString()
- Convert a DVector to a String
- Overrides:
- toString in class Object
length
public double length()
- Return the length (magnitude) of this DVector (sqrt(x^2 + y^2))
negate
public void negate()
- Multiply this vector by -1.
scale
public void scale(double s)
- Multiply this vector by the scalar s.
dot
public double dot(DVector v)
- Return the dot product of this vector with another one.
copy
public DVector copy()
- Return a copy of this vector.
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.
array
public static DVector[] array(double x0,
double y0,
double x1,
double y1)
array
public static DVector[] array(double x0,
double y0,
double x1,
double y1,
double x2,
double y2)
array
public static DVector[] array(double x0,
double y0,
double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
aString
public static String aString(DVector v[])
- Convert an array of DVectors to a string.
Up: Java Kali Source Code and Documentation
The Geometry Center Home Page
Author: Mark Phillips
Comments to:
webmaster@geom.umn.edu
Created: Sep 16 1996 ---
Last modified: Sep 18 1996