SciLib.Math
Class rPoint

java.lang.Object
  extended by SciLib.Math.rPoint

public class rPoint
extends java.lang.Object

This class describes a 3D point (x, y, z). A rPoint in 3D can be understood as a 3D vector


Field Summary
 double x
          public members
 double y
          public members
 double z
          public members
 
Constructor Summary
rPoint()
          make a rPoint object at origin
rPoint(double x, double y, double z)
          make a rPoint (x, y, z) object
rPoint(rPoint p)
          make a rPoint from another rPoint
 
Method Summary
static rPoint crossProduct(rPoint a, rPoint b)
          Compute the cross product of the two vector in 3D space
 double distance(rPoint p)
          compute the distance from this point to a point a
static double dotProduct(rPoint a, rPoint b)
          Compute the dot product of the two vector in 3D space
static rPoint minus(rPoint a, rPoint b)
          minus 2 3D vectors
 double norm()
          compute the norm of a 3D vector
static rPoint plus(rPoint a, rPoint b)
          add 2 3D vectors
 void print()
          print this rPoint on the screen
 void scale(double s)
          multiplication of a 3D vector with a scalar
 void setPoint(double x, double y, double z)
          set rPoint
 double squareDistance(rPoint p)
          compute the square distance from this point to a point a
 java.lang.String toString()
          make a String from this rPoint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x
public members


y

public double y
public members


z

public double z
public members

Constructor Detail

rPoint

public rPoint()
make a rPoint object at origin


rPoint

public rPoint(double x,
              double y,
              double z)
make a rPoint (x, y, z) object

Parameters:
x - the first coordinate
y - the second coordinate
z - the third coordinate

rPoint

public rPoint(rPoint p)
make a rPoint from another rPoint

Parameters:
p - A rPoint
Method Detail

setPoint

public void setPoint(double x,
                     double y,
                     double z)
set rPoint

Parameters:
x - the first coordinate
y - the second coordinate
z - the third coordinate

squareDistance

public double squareDistance(rPoint p)
compute the square distance from this point to a point a

Parameters:
p - a rPoint
Returns:
A double value

distance

public double distance(rPoint p)
compute the distance from this point to a point a

Parameters:
p - a rPoint
Returns:
A double value

crossProduct

public static rPoint crossProduct(rPoint a,
                                  rPoint b)
Compute the cross product of the two vector in 3D space

Parameters:
a - a rPoint
b - a rPoint
Returns:
a rPoint

dotProduct

public static double dotProduct(rPoint a,
                                rPoint b)
Compute the dot product of the two vector in 3D space

Parameters:
a - a rPoint
b - a rPoint
Returns:
a double value

norm

public double norm()
compute the norm of a 3D vector


plus

public static rPoint plus(rPoint a,
                          rPoint b)
add 2 3D vectors

Parameters:
a - a rPoint
b - a rPoint
Returns:
a rPoint

minus

public static rPoint minus(rPoint a,
                           rPoint b)
minus 2 3D vectors

Parameters:
a - a rPoint
b - a rPoint
Returns:
a rPoint

scale

public void scale(double s)
multiplication of a 3D vector with a scalar

Parameters:
s - A double value

toString

public java.lang.String toString()
make a String from this rPoint

Overrides:
toString in class java.lang.Object
Returns:
a String

print

public void print()
print this rPoint on the screen