Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. public Angles findAnglesByAngleAndTwoEdges(double a, double angle, double b){
  2. double c = findEdgeByAngleAndTwoEdges(a, angle, b);
  3.  
  4. double alpha = Math.toDegrees(Math.acos((Math.pow(b, 2) + Math.pow(c, 2) - Math.pow(b, 2)) / (2 * b * c)));
  5. double gamma = angle;
  6. double beta = 180 - alpha - gamma;
  7.  
  8. System.out.printf("edges: - edge A: %.1f, edge B: %.1f, edge C: %.1f \n", a, b, c);
  9. System.out.printf("ang: - alpha: %.2f, beta: %.2f, gamma: %.2f\n\n", alpha, beta, gamma);
  10.  
  11. return new Angles(alpha, beta, gamma);
  12. }
  13.  
  14. public double findEdgeByAngleAndTwoEdges(double a, double angle, double b){
  15. double c = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b * Math.cos(angle));
  16. return c;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement