1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
import java.io.*; import java.util.*; public class Main { static Point[] pt=new Point[5]; static PrintWriter out=new PrintWriter(System.out); static boolean check1(){ return !Point.isPointInRect(pt[0], pt[1], pt[2], pt[3], pt[4])&& !Point.isPointInRect(pt[1], pt[2], pt[3], pt[4], pt[0])&& !Point.isPointInRect(pt[2], pt[3], pt[4], pt[0], pt[1])&& !Point.isPointInRect(pt[3], pt[4], pt[0], pt[1], pt[2])&& !Point.isPointInRect(pt[4], pt[0], pt[1], pt[2], pt[3]); } static boolean check0(Point p,Point a,Point b,Point c,Point d){ double v1=Math.acos(-1.0)/5.0,v2=v1*2.0,v3=v1*3.0; double angle=Vector.angle2(p, a, b)+Vector.angle2(p, b, c)+Vector.angle2(p, c, d); angle=Math.abs(angle);
return Point.dcmp(angle-v1)==0||Point.dcmp(angle-v2)==0||Point.dcmp(angle-v3)==0; } static boolean check2(){ return check0(pt[0], pt[1], pt[2], pt[3], pt[4])&& check0(pt[1], pt[2], pt[3], pt[4], pt[0])&& check0(pt[2], pt[3], pt[4], pt[0], pt[1])&& check0(pt[3], pt[4], pt[0], pt[1], pt[2])&& check0(pt[4], pt[0], pt[1], pt[2], pt[3]); } public static void main(String[] args) throws IOException{ InputReader in=new InputReader(System.in); int T=in.nextInt(); while(T-->0){ for(int i=0;i<5;i++) pt[i]=new Point(in.nextDouble(), in.nextDouble()); if (pt[0].equals(pt[1])&&pt[1].equals(pt[2])&&pt[2].equals(pt[3])&&pt[3].equals(pt[4])&&pt[4].equals(pt[0])){ out.println("Yes");continue; } out.println(check2()?"Yes":"No"); } out.flush(); out.close(); } }
|