Class pmr.euclid.Real2
All Packages Class Hierarchy This Package Previous Next Index
Class pmr.euclid.Real2
java.lang.Object
|
+----pmr.euclid.Status
|
+----pmr.euclid.Real2
- public class Real2
- extends Status
Real2 - a pair of FPt numbers - no other assumptions
Contains two doubles.
Can be used as-is, but there are some specialised derived classes
(e.g. Complex (a complex number), Point2 (x,y coords), etc),
The default value is 0.0, 0.0.
- Author:
- (C) P. Murray-Rust, 1996
-
Real2()
-
-
Real2(double, double)
-
-
Real2(Real2)
- copy constructor
-
clear()
- set to 0, 0
-
dotProduct(Real2)
- get dot product
-
elementAt(int)
- get either value; counts from ZERO
-
equals(Real2)
-
-
getAngle(Real2, Real2, Real2)
- get angle between 3 Real2s (the second is in the centre).
-
getLength()
- get length of Real2 if centered on origin
-
getMidPoint(Real2)
- point midway between 'this' and 'p'
-
getUnitVector()
- get unit vector
-
getX()
- get X value
-
getY()
- get Y value
-
multiplyBy(double)
- multiply a point by a scalar
-
negative()
- multiply both components by -1; MODIFIES 'this'
-
plus(Real2)
- add two points - vector sum;
-
setX(double)
-
-
setY(double)
-
-
sortAscending()
- sorts x and y so that x <= y
-
sortDescending()
- sorts x and y so that x >= y
-
subtract(Real2)
- subtract two points - vector difference;
-
swap()
- swaps the x and y values
-
toString()
-
-
transformBy(Transform2)
- transforms the point by a rot-trans matrix; MODIFIES 'this'
Real2
public Real2()
Real2
public Real2(double x,
double y)
Real2
public Real2(Real2 r)
- copy constructor
swap
public void swap()
- swaps the x and y values
sortAscending
public void sortAscending()
- sorts x and y so that x <= y
sortDescending
public void sortDescending()
- sorts x and y so that x >= y
clear
public void clear()
- set to 0, 0
setX
public void setX(double xx)
setY
public void setY(double yy)
equals
public boolean equals(Real2 r)
plus
public Real2 plus(Real2 r2)
- add two points - vector sum;
subtract
public Real2 subtract(Real2 r2)
- subtract two points - vector difference;
negative
public void negative()
- multiply both components by -1; MODIFIES 'this'
multiplyBy
public Real2 multiplyBy(double f)
- multiply a point by a scalar
getX
public double getX()
- get X value
getY
public double getY()
- get Y value
elementAt
public double elementAt(int elem) throws ArrayIndexOutOfBoundsException
- get either value; counts from ZERO
getLength
public double getLength()
- get length of Real2 if centered on origin
getMidPoint
public Real2 getMidPoint(Real2 p)
- point midway between 'this' and 'p'
getUnitVector
public Real2 getUnitVector() throws ZeroLengthVectorException
- get unit vector
- Throws: ZeroLengthVectorException
- this was of zero length
dotProduct
public double dotProduct(Real2 r)
- get dot product
getAngle
public static Angle getAngle(Real2 p1,
Real2 p2,
Real2 p3)
- get angle between 3 Real2s (the second is in the centre).
angle is CLOCKWISE from p1 to p3
transformBy
public void transformBy(Transform2 t)
- transforms the point by a rot-trans matrix; MODIFIES 'this'
toString
public String toString()
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index