com.bbn.openmap.omGraphics.awt
Class LineUtil

java.lang.Object
  extended by com.bbn.openmap.omGraphics.awt.LineUtil

public class LineUtil
extends java.lang.Object

Various computations about plane geometry.

Version:
11 aot 2002
Author:
Eric LEPICIER from Pascal HAURIE 1997

Constructor Summary
LineUtil()
           
 
Method Summary
static java.awt.geom.Point2D interpolatedPoint(java.awt.geom.Point2D A, java.awt.geom.Point2D B, double d)
          Interpolates a point on a segment.
static double norm(java.awt.geom.Point2D A, java.awt.geom.Point2D B)
          Computes the segment length
static double norm2(java.awt.geom.Point2D A, java.awt.geom.Point2D B)
          Computes the segment square length
protected static boolean retrievePoints(float length, java.util.LinkedList<java.awt.geom.Point2D> points, java.util.LinkedList<java.awt.geom.Point2D> polysegment)
          Extract a length on a polyline.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineUtil

public LineUtil()
Method Detail

norm2

public static double norm2(java.awt.geom.Point2D A,
                           java.awt.geom.Point2D B)
Computes the segment square length

Parameters:
A - the begin point
B - the end point
Returns:
double the square distance between A and B

norm

public static double norm(java.awt.geom.Point2D A,
                          java.awt.geom.Point2D B)
Computes the segment length

Parameters:
A - the begin point
B - the end point
Returns:
double the distance between A and B

interpolatedPoint

public static java.awt.geom.Point2D interpolatedPoint(java.awt.geom.Point2D A,
                                                      java.awt.geom.Point2D B,
                                                      double d)
Interpolates a point on a segment.

Parameters:
A - the begin point
B - the end point
d - the distance from A to the wanted point
Returns:
Point2D the point at distance d from A on the segment AB, the point B if d>AB

retrievePoints

protected static boolean retrievePoints(float length,
                                        java.util.LinkedList<java.awt.geom.Point2D> points,
                                        java.util.LinkedList<java.awt.geom.Point2D> polysegment)
Extract a length on a polyline.

Parameters:
length - the curve length to extract from points
points - the original points
polysegment - the returned points
Returns:
true if we got the desired length, false otherwise


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details