Example usage for java.awt.geom Point2D.Double Point2D.Double

List of usage examples for java.awt.geom Point2D.Double Point2D.Double

Introduction

In this page you can find the example usage for java.awt.geom Point2D.Double Point2D.Double.

Prototype

Point2D.Double

Source Link

Usage

From source file:com.controlj.addon.gwttree.server.OpaqueBarRenderer3D.java

private Point2D.Double getTargetPoint(Point2D.Double darkTarget, Point2D.Double lightTarget, double slope) {
    Point2D.Double normalizedStart = new Point2D.Double();
    normalizedStart.setLocation(lightTarget.getX() - darkTarget.getX(), lightTarget.getY() - darkTarget.getY());

    Point2D.Double normalizedResult = new Point2D.Double();
    double normX = (Math.pow(slope, 2.0) * normalizedStart.getX() - (normalizedStart.getY() * slope))
            / (Math.pow(slope, 2.0) - 1.0);
    normalizedResult.setLocation(normX, normX / slope);
    Point2D.Double result = new Point2D.Double();

    result.setLocation(normalizedResult.getX() + darkTarget.getX(),
            normalizedResult.getY() + darkTarget.getY());
    return result;
}