Java Geometry Algorithm cap(java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2, double radius)

Here you can find the source of cap(java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2, double radius)

Description

cap

License

Open Source License

Declaration

public static java.awt.geom.Point2D.Double cap(java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2,
            double radius) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static java.awt.geom.Point2D.Double cap(java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2,
            double radius) {
        double angle = 1.5707963267948966D - Math.atan2(p2.x - p1.x, p2.y - p1.y);
        java.awt.geom.Point2D.Double p3 = new java.awt.geom.Point2D.Double(p2.x + radius * Math.cos(angle),
                p2.y + radius * Math.sin(angle));
        return p3;
    }/*from   w  w w .jav  a 2s  . com*/
}

Related

  1. botRect(Point2D.Double botLocation)
  2. botSides( Point2D.Double botLocation)
  3. bound(Point... points)
  4. boundingBox(Vector points)
  5. boundsOf(Collection points)
  6. centroid(Vector points)
  7. checkPoint(Point p)
  8. checkPoint(Point point, String name)
  9. checkWinPossibility(int[][] board, Point p1, Point p2, int playerID)