public class R2
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
double |
x1
first coordinate
|
double |
x2
second coordinate
|
Constructor and Description |
---|
R2()
Creates a new instance of R2, the zero element.
|
R2(double x1,
double x2)
Creates a new instance of R2 initialized to arguments.
|
R2(R2 vecPt)
Creates a new instance of R2 initialized to argument.
|
Modifier and Type | Method and Description |
---|---|
R2 |
cartesian2Polar()
Apply coordinate transform from cartesian to polar coordinates.
|
R2 |
copy()
Performs a deep copy operation.
|
double |
get1()
Return first coordinate value.
|
double |
get2()
Return second coordinate value.
|
double |
getx()
Return first coordinate value.
|
double |
gety()
Return second coordinate value.
|
R2 |
minus(R2 r)
Vector subtraction.
|
double |
norm2()
Compute the l2 norm of the vector in R2.
|
R2 |
plus(R2 r)
Vector addition.
|
R2 |
polar2Cartesian()
Apply coordinate transform from polar to cartesian coordinates
|
void |
print(java.io.PrintWriter os)
Print out centents on an output stream.
|
void |
println(java.io.PrintWriter os)
Print out centents on an output stream, terminate with new line character.
|
void |
set(double s)
Set all coordinates to value
|
void |
set1(double x1)
Set first coordinate value.
|
void |
set2(double x2)
Set second coordinate value.
|
void |
setx(double x)
Set first coordinate value.
|
void |
sety(double y)
Set second coordinate value.
|
R2 |
times(double s)
Scalar multiplication.
|
R2 |
times(R2 r)
Vector multiplication, i.e.
|
java.lang.String |
toString()
Convert to a string representation
|
public R2()
public R2(double x1, double x2)
x1
- first coordinate valuex2
- first coordinate valuepublic R2(R2 vecPt)
vecPt
- deep copies this valuepublic R2 copy()
public void set1(double x1)
public void set2(double x2)
public void setx(double x)
public void sety(double y)
public void set(double s)
public double get1()
public double get2()
public double getx()
public double gety()
public R2 cartesian2Polar()
public R2 polar2Cartesian()
public R2 times(double s)
s
- scalar to multiply this vectorpublic R2 plus(R2 r)
r
- vector displacementpublic R2 minus(R2 r)
r
- vector displacementpublic R2 times(R2 r)
r
- second (right) operand in cross-product (this is first operand)public double norm2()
public java.lang.String toString()
toString
in class java.lang.Object
public void print(java.io.PrintWriter os)
os
- output stream receive content dumppublic void println(java.io.PrintWriter os)
os
- output stream receive content dump