Here you can find the source of cap(java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2, double radius)
public static java.awt.geom.Point2D.Double cap(java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2, double radius)
//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*/ }