ome.util.math.geom2D
Class Segment

java.lang.Object
  extended by ome.util.math.geom2D.Segment

public class Segment
extends Object

A segment in the Euclidean space R2.

Since:
OME2.2
Version:
2.2 (Internal version: $Revision: 1582 $ $Date: 2005/06/09 15:01:32 $)
Author:
Jean-Marie Burel      j.burel@dundee.ac.uk,
Andrea Falconi      a.falconi@dundee.ac.uk

Field Summary
 double directionX1
          The end point of the segment's first element.
 double directionX2
          The end point of the segment's second element.
 double originX1
          The origin of the segment's first element.
 double originX2
          The origin of the segment's first element.
 
Constructor Summary
Segment(double originX1, double originX2, double endX1, double endX2)
          Creates a new instance.
 
Method Summary
 boolean equals(double k, double x1, double x2)
          Performs an equality test based on a point on this line defined by k as in getPoint() and another given point.
 boolean equals(Object o)
          Overridden to reflect equality of abstract values (data object) as opposite to object identity.
 PlanePoint getPoint(double k)
          Returns the point of this line defined by k.
 int hashCode()
          Overridden to reflect equality of abstract values (data object) as opposite to object identity.
 boolean lies(double x1, double x2)
          Tells whether a specified point lies on this line.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

originX1

public final double originX1
The origin of the segment's first element.


originX2

public final double originX2
The origin of the segment's first element.


directionX1

public final double directionX1
The end point of the segment's first element.


directionX2

public final double directionX2
The end point of the segment's second element.

Constructor Detail

Segment

public Segment(double originX1,
               double originX2,
               double endX1,
               double endX2)
Creates a new instance.

Parameters:
originX1 - The origin of the segment's first element.
originX2 - The origin of the segment's first element.
o - The origin point of the segment.
endX1 - The end point's first element.
endX2 - The end point's second element.
Method Detail

getPoint

public PlanePoint getPoint(double k)
Returns the point of this line defined by k. More precisely, this method returns the #origin+k#direction point.

Parameters:
k - The coefficient to select the point. Must be in the range [0, 1].
Returns:
See above.

lies

public boolean lies(double x1,
                    double x2)
Tells whether a specified point lies on this line.

Parameters:
p - The point to test. Mustn't be null.
Returns:
true if p lies on this line, false otherwise.

equals

public boolean equals(double k,
                      double x1,
                      double x2)
Performs an equality test based on a point on this line defined by k as in getPoint() and another given point.

Parameters:
k - The coefficient to select the point. Must be in the range [0, 1].
x1 - The point to test's first element.
x2 - The point to test's second element.
Returns:
true if the points are geometrically equal, false otherwise.

equals

public boolean equals(Object o)
Overridden to reflect equality of abstract values (data object) as opposite to object identity.

Overrides:
equals in class Object
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Overridden to reflect equality of abstract values (data object) as opposite to object identity.

Overrides:
hashCode in class Object
See Also:
Object.hashCode()


OmeroJava Api

Version: Beta-4.1.1-r5927-b91

Copyright © 2009 The University of Dundee. All Rights Reserved.