import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.println("enter x1 y1 x2 y2 x3 y3");
double x1=input.nextDouble();
double y1=input.nextDouble();
double x2=input.nextDouble();
double y2=input.nextDouble();
double x3=input.nextDouble();
double y3=input.nextDouble();
double a=Math.sqrt((x3-x2)*(x3-x2)+(y2-y3)*(y2-y3));
double b=Math.sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
double c=Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
double A=Math.toDegrees(Math.acos((a*a-b*b-c*c)/(-2*b*c)));
double B=Math.toDegrees(Math.acos((b*b-a*a-c*c)/(-2*a*c)));
double C=Math.toDegrees(Math.acos((c*c-b*b-a*a)/(-2*a*b)));
System.out.println("A的角度为 "+(int)(A*100)/100.0+" B的角度为 "+(int)(B*100)/100.0+" C的角度为 "+(int)(C*100)/100.0);
}
}
计算三角形的角度
最新推荐文章于 2023-10-18 20:02:28 发布