package ru.job4j.condition;
/**
 * Triangle.
 *
 * @author Dinar Khalfin (dinarhalfin@yahoo.com)
 * @version $Id$
 * @since 27.06.2017
 */
public class Triangle {
	/**
     * a.
	 */
	private Point a;
	/**
     * b.
	 */
	private Point b;
	/**
     * c.
	 */
	private Point c;
	/**
	 * Triangle.
     * @param a - a.
	 * @param b - b.
	 * @param c - c.
	 */
	public Triangle(Point a, Point b, Point c) {
		this.a = a;
		this.b = b;
		this.c = c;
	}
	/**
	 * Check for area of triangle.
	 * @return area.
	 */

	public double area() {
        double ab = Math.sqrt((a.getX() - b.getX()) * (a.getX() - b.getX()) + (a.getY() - b.getY()) * (a.getY() - b.getY()));
        double ac = Math.sqrt((a.getX() - c.getX()) * (a.getX() - c.getX()) + (a.getY() - c.getY()) * (a.getY() - c.getY()));
        double bc = Math.sqrt((b.getX() - c.getX()) * (b.getX() - c.getX()) + (b.getY() - c.getY()) * (b.getY() - c.getY()));
		boolean go = true;
		if (ab + ac <= bc || ab + ac <= bc || ab + ac <= bc) {
            go = false;
        } else {
		double p = (ab + bc + ac) / 2.0;
        return Math.sqrt(p * (p - ab) * (p - bc) * (p - ac));
	}


 }
}
@@ -485,42 +485,72 @@
 *%0D%0A%09
- 
 * 
-Check for area of triangle.%0D%0A%09 
+Distance from one point to another.%0D%0A%09* @param that - that.%0D%0A%09
 * @r
@@ -559,23 +559,24 @@
 urn 
-area
+distance
 .%0D%0A%09
- 
 */%0D%0A
-%0D%0A
 %09pub
@@ -590,423 +590,407 @@
 ble 
-area() %7B%0D%0A        
+distance(Point that) %7B%0D%0A%09%09
 double 
-ab = Math.sqrt((a.getX() - b.getX()) * (a.getX() - b.getX()) + (a.getY() - b.getY()) * (a.getY() - b.getY()));%0D%0A        double ac = Math.sqrt((a.getX() - c.getX()) * (a.getX() - c.getX()) + (a.getY() - c.getY()) * (a.getY() - c.getY()));%0D%0A        double bc = Math.sqrt((b.getX() - c.getX()) * (b.getX() - c.getX()) + (b.getY() - c.getY()) * (b.getY() - c.getY()));%0D%0A%09%09boolean go = true;
+sx = this.x - that.x;%0D%0A%09%09double sy = this.y - that.y;%0D%0A%09%09return Math.sqrt(sx*sx + sy*sy);%0D%0A%09%7D%0D%0A    /**%0D%0A%09* result.%09%0D%0A%09*/%0D%0A    private double result = -1;%0D%0A%09/**%0D%0A%09 * Check for area of triangle.%0D%0A%09 * @return area.%0D%0A%09 */%0D%0A%09public double area() %7B%0D%0A%09%09if (result == -1) %7B%0D%0A%09%09%09double ab = a.distance(b);%0D%0A%09%09%09double bc = b.distance(c);%0D%0A%09%09%09double ac = a.distance(c);%0D%0A
 %0D%0A%09%09
+/*
 if (
@@ -1007,38 +1007,38 @@
  bc %7C%7C ab + 
-a
+b
 c %3C= 
-b
+a
 c %7C%7C 
-a
 b
+c
  + ac %3C= bc)
@@ -1038,58 +1038,22 @@
  %3C= 
-bc) %7B%0D%0A            go = false;%0D%0A        %7D else %7B
+ab)*/    %0D%0A
 %0D%0A
+%09
 %09%09do
@@ -1088,22 +1088,26 @@
 0;%0D%0A
-        return
+%09%09%09double result =
  Mat
@@ -1155,14 +1155,35 @@
 );%0D%0A
-%09%7D%0D%0A%0D%0A
+        %7D%0D%0A%09%09return result;
 %0D%0A %7D

add Triangle task