Guest User

Untitled

a guest
May 3rd, 2018
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. #For answering question on Shoes mailing list dmonroe
  2. Shoes.app(:title => "Coplanar Points", :width => 550, :height => 400) do
  3.  
  4. def calculate
  5. @beex = (@betax.text.to_f-@alphax.text.to_f)
  6. @beey = (@betay.text.to_f-@alphay.text.to_f)
  7. @beez = (@betaz.text.to_f-@alphaz.text.to_f)
  8. @ceex = (@gammax.text.to_f-@alphax.text.to_f)
  9. @ceey = (@gammay.text.to_f-@alphay.text.to_f)
  10. @ceez = (@gammaz.text.to_f-@alphaz.text.to_f)
  11. @deex = (@deltax.text.to_f-@alphax.text.to_f)
  12. @deey = (@deltax.text.to_f-@alphay.text.to_f)
  13. @deez = (@deltax.text.to_f-@alphaz.text.to_f)
  14.  
  15.  
  16. ((@beex*((@ceey*@deez)-(@ceez*@deey)))-(@beey*((@ceex*@deez)-(@ceez*@deex)))+(@beez*((@ceex*@deey))-(@ceey*@deex)))
  17. end
  18. stack(:width => '100%', :margin => 20) do
  19. para('Calculate Coplanar Points')
  20. para(' x y z')
  21. end
  22.  
  23. flow(:width => '100%' ) do
  24. para('Point A: ')
  25. @alphax = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
  26. @alphay = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
  27. @alphaz = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
  28. end
  29. flow(:width => '100%' ) do
  30. para('Point B: ')
  31. @betax = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
  32. @betay = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
  33. @betaz = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
  34. end
  35. flow(:width => '100%' ) do
  36. para('Point C: ')
  37. @gammax = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
  38. @gammay = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
  39. @gammaz = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
  40. end
  41. flow(:width => '100%' ) do
  42. para('Point D: ')
  43. @deltax = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
  44. @deltay = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
  45. @deltaz = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
  46.  
  47. @button = button "Configure" do
  48. c = calculate==0
  49. case c
  50. when true
  51. alert("Points are coplanar, equation is")
  52. when false
  53. alert("Points are NOT coplanar")
  54.  
  55. end
  56. end
  57. end
  58. end
Add Comment
Please, Sign In to add comment