java.lang.Objectcomputational.geometry.Ray
public class Ray
| Field Summary | |
|---|---|
protected Point |
direction
|
protected java.lang.String |
label
|
protected Point |
origin
|
| Constructor Summary | |
|---|---|
Ray(Point origin,
Point direction)
|
|
Ray(java.lang.String label,
Point origin,
Point direction)
Creates a new instance of Ray, the Ray is identified with an origin and a direction (2 Points). |
|
| Method Summary | |
|---|---|
Rectangle |
boundingBox()
|
java.lang.Object |
clone()
Object Extension |
boolean |
contains(Point p)
Tells whether the shape encloses a given point. |
boolean |
cross(Segment s)
|
boolean |
crossLine(Segment s)
|
void |
draw(java.awt.Graphics gfx)
Draws the shape, using the current graphics context's color. |
void |
drawLabels(java.awt.Graphics gfx)
Draws the shape's associated labels, using the graphics context's color. |
void |
drawPoints(java.awt.Graphics gfx)
Draws the shape's defining points, using the graphics context's color. |
Point |
getDirection()
|
java.lang.String |
getLabel()
Returns the string label associated to this segment. |
Point |
getOrigin()
|
java.util.List |
getPoints()
Returns a list containing copies of the shape's defining points. |
void |
setDirection(Point newDirection)
|
void |
setLabel(java.lang.String label)
Sets the segment's label. |
java.lang.String |
toString()
Returns a string representation of this ray. |
void |
translate(int dx,
int dy)
Translates the shape by the given amount. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Point direction
protected java.lang.String label
protected Point origin
| Constructor Detail |
|---|
public Ray(Point origin,
Point direction)
public Ray(java.lang.String label,
Point origin,
Point direction)
| Method Detail |
|---|
public Rectangle boundingBox()
public java.lang.Object clone()
clone in class java.lang.Objectpublic boolean contains(Point p)
Shape
contains in interface Shapep - the point we test for encloseness.
public boolean cross(Segment s)
public boolean crossLine(Segment s)
public void draw(java.awt.Graphics gfx)
Shape
draw in interface Shapegfx - the graphics context where this shape has to be drawn.public void drawLabels(java.awt.Graphics gfx)
Shape
drawLabels in interface Shapegfx - the graphics context where this shape's labels have
to be drawn.public void drawPoints(java.awt.Graphics gfx)
Shape
drawPoints in interface Shapegfx - the graphics context where this shape's points have
to be drawn.public Point getDirection()
public java.lang.String getLabel()
null.
getLabel in interface Shapepublic Point getOrigin()
public java.util.List getPoints()
Shape
getPoints in interface Shapepublic void setDirection(Point newDirection)
public void setLabel(java.lang.String label)
setLabel in interface Shapethe - segment's new label.public java.lang.String toString()
toString in class java.lang.Object
public void translate(int dx,
int dy)
Shape
translate in interface Shapedx - the amount to translate along the X-axis