Here you can find the source of clacGradient(Point2D p1, Point2D p2, Point2D p3)
private static double clacGradient(Point2D p1, Point2D p2, Point2D p3)
//package com.java2s; //License from project: Open Source License import java.awt.geom.Point2D; public class Main { private static double clacGradient(Point2D p1, Point2D p2, Point2D p3) { double p1x = p1.getX(); double p1y = p1.getY(); double p2x = p2.getX(); double p2y = p2.getY(); double p3x = p3.getX(); double p3y = p3.getY(); return p1x * (p2y - p3y) + p2x * (p3y - p1y) + p3x * (p1y - p2y); }/* www .j a v a 2 s . c o m*/ }