|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--jumbo.euclid.Status
|
+--jumbo.euclid.Real2
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.
| Field Summary | |
double |
x
the first floating point value |
double |
y
the second floating point value |
| Constructor Summary | |
Real2()
|
|
Real2(double x,
double y)
|
|
Real2(Real2 r)
copy constructor |
|
| Method Summary | |
static Real2[] |
addPolygonOnLine(Real2 point1,
Real2 point2,
int nPoints,
int end,
Real2 repelPoint)
creates a polygon (returns points[]) from two points. |
void |
clear()
set to 0, 0 |
double |
dotProduct(Real2 r)
get dot product |
double |
elementAt(int elem)
get either value; counts from ZERO |
boolean |
equals(Real2 r)
|
double |
getAngle()
get angle between origin and this point (i.e polar coords) - uses atan2 (i.e. |
static Angle |
getAngle(Real2 p1,
Real2 p2,
Real2 p3)
get angle between 3 Real2s (the second is in the centre). |
double |
getLength()
get length of Real2 if centered on origin |
Real2 |
getMidPoint(Real2 p)
point midway between 'this' and 'p' |
Real2 |
getUnitVector()
get unit vector |
double |
getX()
get X value |
double |
getY()
get Y value |
Real2 |
makePoint(double rad,
double theta)
make a new point at (dist, theta) from this |
Real2 |
multiplyBy(double f)
multiply a point by a scalar |
void |
negative()
multiply both components by -1; MODIFIES 'this' |
Real2 |
plus(Real2 r2)
add two points - vector sum; |
void |
setX(double xx)
|
void |
setY(double yy)
|
void |
sortAscending()
sorts x and y so that x <= y |
void |
sortDescending()
sorts x and y so that x >= y |
Real2 |
subtract(Real2 r2)
subtract two points - vector difference; |
void |
swap()
swaps the x and y values |
java.lang.String |
toString()
|
void |
transformBy(Transform2 t)
transforms the point by a rot-trans matrix; MODIFIES 'this' |
| Methods inherited from class jumbo.euclid.Status |
NYI |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public double x
public double y
| Constructor Detail |
public Real2()
public Real2(double x,
double y)
public Real2(Real2 r)
| Method Detail |
public void swap()
public void sortAscending()
public void sortDescending()
public void clear()
public void setX(double xx)
public void setY(double yy)
public boolean equals(Real2 r)
public Real2 plus(Real2 r2)
public Real2 subtract(Real2 r2)
public void negative()
public Real2 multiplyBy(double f)
public double getX()
public double getY()
public double elementAt(int elem)
throws java.lang.ArrayIndexOutOfBoundsException
public double getLength()
public Real2 getMidPoint(Real2 p)
public Real2 getUnitVector()
throws ZeroVectorException
public double dotProduct(Real2 r)
public static Angle getAngle(Real2 p1,
Real2 p2,
Real2 p3)
public void transformBy(Transform2 t)
public static Real2[] addPolygonOnLine(Real2 point1,
Real2 point2,
int nPoints,
int end,
Real2 repelPoint)
public double getAngle()
public Real2 makePoint(double rad,
double theta)
double - rad the distance to new pointdouble - angle the angle to new point (anticlockwise from X axis),
i.e. theta=0 gives (rad, 0), theta=PI/2 gives (0, rad)public java.lang.String toString()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||