com.ijchart.xychart.util
Class GeometryUtil

java.lang.Object
  extended by com.ijchart.xychart.util.GeometryUtil

public abstract class GeometryUtil
extends java.lang.Object

Title: IJChart

Description: a chart library for the Java(tm) platform.

Nice static helpers for geometry.

Copyright: Copyright (c) 2013

Company:

Version:
1.0
Author:
zhang feng min,shanghai china. Contract me by email.

Constructor Summary
GeometryUtil()
           
 
Method Summary
static double calculateArcEndPointAngle(java.awt.geom.Arc2D arc)
           Calculate the actual angle of arc end point.
static double distanceOfPoints(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
           Calculate the distance between two points.
static java.awt.geom.Point2D extentPoint(java.awt.geom.Point2D startPoint, java.awt.geom.Point2D endPoint, double disToStartPoint)
           Two points where the straight line,with direction from startPoint to endPoint as from the point startPoint distance disToStartPoint.
static java.awt.geom.Point2D findLineCrossPoint(java.awt.geom.Line2D line1, java.awt.geom.Line2D line2)
           Calculate the cross point of two line2,return null if not intersection.
static java.awt.geom.GeneralPath getArcPath(java.awt.geom.Arc2D arc)
           Calculate the path of arc.
static java.awt.geom.Point2D middlePoint(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
           Calculate the midpoint of two points.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeometryUtil

public GeometryUtil()
Method Detail

distanceOfPoints

public static double distanceOfPoints(java.awt.geom.Point2D p1,
                                      java.awt.geom.Point2D p2)
Calculate the distance between two points.

Parameters:
p1 - Point2D The point1 (null not permitted).
p2 - Point2D The point1 (null not permitted).
Returns:
double The distince.

middlePoint

public static java.awt.geom.Point2D middlePoint(java.awt.geom.Point2D p1,
                                                java.awt.geom.Point2D p2)
Calculate the midpoint of two points.

Parameters:
p1 - Point2D The point1 (null not permitted).
p2 - Point2D The point1 (null not permitted).
Returns:
Point2D The midpoint (never null).

extentPoint

public static java.awt.geom.Point2D extentPoint(java.awt.geom.Point2D startPoint,
                                                java.awt.geom.Point2D endPoint,
                                                double disToStartPoint)
Two points where the straight line,with direction from startPoint to endPoint as from the point startPoint distance disToStartPoint.

Parameters:
startPoint - Point2D The start point.
endPoint - Point2D The end point.
disToStartPoint - double The distince.
Returns:
Point2D The point.

calculateArcEndPointAngle

public static double calculateArcEndPointAngle(java.awt.geom.Arc2D arc)
Calculate the actual angle of arc end point.

Parameters:
arc - Arc2D The arc (null not permitted).
Returns:
double The angle.

findLineCrossPoint

public static java.awt.geom.Point2D findLineCrossPoint(java.awt.geom.Line2D line1,
                                                       java.awt.geom.Line2D line2)
Calculate the cross point of two line2,return null if not intersection.

Parameters:
line1 - Line2D The first line (null not permitted).
line2 - Line2D The second line (null not permitted).
Returns:
Point2D The cross point (maybe null).

getArcPath

public static java.awt.geom.GeneralPath getArcPath(java.awt.geom.Arc2D arc)
Calculate the path of arc.

Parameters:
arc - Arc2D The arc (null not permitted).
Returns:
GeneralPath