|
Eclipse Draw2d 2.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.draw2d.geometry.Ray
Represents a 2-dimensional directionl Vector, or Ray. Vector
is
commonly imported, so the name Ray was chosen.
Field Summary | |
int |
x
the X value |
int |
y
the Y value |
Constructor Summary | |
Ray()
Constructs a Ray <0, 0> with no direction and magnitude. |
|
Ray(int x,
int y)
Constructs a Ray pointed in the specified direction. |
|
Ray(Point p)
Constructs a Ray pointed in the direction specified by a Point. |
|
Ray(Point start,
Point end)
Constructs a Ray representing the direction and magnitude between to provided Points. |
|
Ray(Ray start,
Ray end)
Constructs a Ray representing the difference between two provided Rays. |
Method Summary | |
int |
assimilarity(Ray r)
Calculates the magnitude of the cross product of this Ray with another. |
int |
dotProduct(Ray r)
Calculates the dot product of this Ray with another. |
boolean |
equals(Object obj)
|
Ray |
getAdded(Ray r)
Creates a new Ray which is the sum of this Ray with another. |
Ray |
getAveraged(Ray r)
Creates a new Ray which represents the average of this Ray with another. |
Ray |
getScaled(int s)
Creates a new Ray which represents this Ray scaled by the amount provided. |
boolean |
isHorizontal()
Returns true if this Ray has a non-zero horizontal comonent. |
double |
length()
Returns the length of this Ray. |
int |
similarity(Ray r)
Calculates the similarity of this Ray with another. |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public int x
public int y
Constructor Detail |
public Ray()
public Ray(int x, int y)
x
- X value.y
- Y value.public Ray(Point p)
p
- the Pointpublic Ray(Point start, Point end)
start
- Strarting Pointend
- End Pointpublic Ray(Ray start, Ray end)
start
- The start Rayend
- The end RayMethod Detail |
public int assimilarity(Ray r)
r
- Ray being compared
similarity(Ray)
public int dotProduct(Ray r)
r
- the Ray used to perform the dot product
public boolean equals(Object obj)
equals
in class Object
Object.equals(Object)
public Ray getAdded(Ray r)
r
- Ray to be added with this Ray
public Ray getAveraged(Ray r)
r
- Ray to calculate the average.
public Ray getScaled(int s)
s
- Value providing the amount to scale.
public boolean isHorizontal()
public double length()
public int similarity(Ray r)
r
- Ray being tested for similarity
assimilarity(Ray)
public String toString()
toString
in class Object
|
Eclipse Draw2d 2.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |