http://acm.hdu.edu.cn/showproblem.php?pid=1071
/*
2011-9-9
author:BearFly1990
*/
package acm.hdu.tests;
import java.io.BufferedInputStream;
import java.util.Scanner;
public class HDU_1071 {
public static void main(String[] args) {
Scanner in = new Scanner(new BufferedInputStream(System.in));
double p1x, p2x, p3x, p1y, p2y, p3y;
double a, b, c, k, m, result, x;
int t;
t = in.nextInt();
while (t-- > 0) {
p1x = in.nextDouble();
p1y = in.nextDouble();
p2x = in.nextDouble();
p2y = in.nextDouble();
p3x = in.nextDouble();
p3y = in.nextDouble();
a = (p2y - p1y) / ((p2x - p1x) * (p2x - p1x));
b = -2 * p1x * (p2y - p1y) / ((p2x - p1x) * (p2x - p1x));
c = p1y - p1x * p1x * (p2y - p1y) / ((p2x - p1x) * (p2x - p1x)) + 2
* p1x * p1x * (p2y - p1y) / ((p2x - p1x) * (p2x - p1x));
k = (p3y - p2y) / (p3x - p2x);
m = p3y - p3x * (p3y - p2y) / (p3x - p2x);
x = p3x - p2x;
result = a * p3x * p3x * p3x / 3 + 0.5 * (b - k) * p3x * p3x
+ (c - m) * p3x - a * p2x * p2x * p2x / 3 - 0.5 * (b - k)
* p2x * p2x - (c - m) * p2x;
System.out.printf("%.2f\r\n", result);
}
}
}