Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Draw2d
3.3

org.eclipse.draw2d.geometry
Class Ray

java.lang.Object
  extended by
org.eclipse.draw2d.geometry.Ray

public final class Ray
extends java.lang.Object

Represents a 2-dimensional directional 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 (java.lang.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.
 int hashCode ()
           
 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.
 java.lang.String toString ()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public int x
the X value


y

public int y
the Y value

Constructor Detail

Ray

public Ray()
Constructs a Ray <0, 0> with no direction and magnitude.

Since:
2.0

Ray

public Ray(int x,
           int y)
Constructs a Ray pointed in the specified direction.

Parameters:
x - X value.
y - Y value.
Since:
2.0

Ray

public Ray(
Point p)
Constructs a Ray pointed in the direction specified by a Point.

Parameters:
p - the Point
Since:
2.0

Ray

public Ray(
Point start,
           
Point end)
Constructs a Ray representing the direction and magnitude between to provided Points.

Parameters:
start - Strarting Point
end - End Point
Since:
2.0

Ray

public Ray(
Ray start,
           
Ray end)
Constructs a Ray representing the difference between two provided Rays.

Parameters:
start - The start Ray
end - The end Ray
Since:
2.0
Method Detail

assimilarity

public int assimilarity(
Ray r)
Calculates the magnitude of the cross product of this Ray with another. Represents the amount by which two Rays are directionally different. Parallel Rays return a value of 0.

Parameters:
r - Ray being compared
Returns:
The assimilarity
Since:
2.0
See Also:
similarity(Ray)

dotProduct

public int dotProduct(
Ray r)
Calculates the dot product of this Ray with another.

Parameters:
r - the Ray used to perform the dot product
Returns:
The dot product
Since:
2.0

equals

public boolean equals(java.lang.Object obj)
See Also:
Object.equals(Object)

getAdded

public 
Ray getAdded(
Ray r)
Creates a new Ray which is the sum of this Ray with another.

Parameters:
r - Ray to be added with this Ray
Returns:
a new Ray
Since:
2.0

getAveraged

public 
Ray getAveraged(
Ray r)
Creates a new Ray which represents the average of this Ray with another.

Parameters:
r - Ray to calculate the average.
Returns:
a new Ray
Since:
2.0

getScaled

public 
Ray getScaled(int s)
Creates a new Ray which represents this Ray scaled by the amount provided.

Parameters:
s - Value providing the amount to scale.
Returns:
a new Ray
Since:
2.0

hashCode

public int hashCode()
See Also:
Object.hashCode()

isHorizontal

public boolean isHorizontal()
Returns true if this Ray has a non-zero horizontal comonent.

Returns:
true if this Ray has a non-zero horizontal comonent
Since:
2.0

length

public double length()
Returns the length of this Ray.

Returns:
Length of this Ray
Since:
2.0

similarity

public int similarity(
Ray r)
Calculates the similarity of this Ray with another. Similarity is defined as the absolute value of the dotProduct()

Parameters:
r - Ray being tested for similarity
Returns:
the Similarity
Since:
2.0
See Also:
assimilarity(Ray)

toString

public java.lang.String toString()
Returns:
a String representation

Eclipse Draw2d
3.3

Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire