Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. a_x = 1
  2. b_x = (-2 * point[0]) # point[0] = x-coordinate of point
  3. c_x = point[0]**2 + point[1]**2 - C**2 # point[1] = y-coordinate of point
  4. d_x = (b_x**2) - (4 * a_x * c_x)
  5. sqr_d_x = cmath.sqrt(d_x) # Takes the square root of d_x
  6.  
  7. x_1 = (-b_x - sqr_d_x)/(2 * a_x) #Sol 1,x-coordinate of base vertice
  8. x_2 = (-b_x + sqr_d_x)/(2 * a_x) #Sol 2,x-coordinate of base vertice
  9.  
  10. Pw_x = min(x_1,x_2) # Since isosceles triangle is slanted on 2D space
  11. Pz_x = max(x_1,x_2)
  12.  
  13. a_y = 1
  14. b_y = (-2 * point[1])
  15. c_y = point[0]**2 + point[1]**2 - C**2
  16. d_y = (b_y**2) - (4 * a_y * c_y)
  17. sqr_d_y = cmath.sqrt(d_y)
  18.  
  19. y_1 = (-b_y - sqr_d_y)/(2 * a_y)
  20. y_2 = (-b_y + sqr_d_y)/(2 * a_y)
  21.  
  22. Pw_y = max(y_1,y_2)
  23. Pz_y = min(y_1,y_2)
  24.  
  25. Pw = (Pw_x,Pw_y) # left base vertice
  26. Pz = (Pz_x,Pz_y) # right base vertice
  27.  
  28. print(cmath.sqrt((point[0] - Pw_x)**2 + (point[1] - Pw_y)**2))
  29. print(cmath.sqrt((point[0] - Pz_x)**2 + (point[1] - Pz_y)**2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement