Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #For answering question on Shoes mailing list dmonroe
- Shoes.app(:title => "Coplanar Points", :width => 550, :height => 400) do
- def calculate
- @beex = (@betax.text.to_f-@alphax.text.to_f)
- @beey = (@betay.text.to_f-@alphay.text.to_f)
- @beez = (@betaz.text.to_f-@alphaz.text.to_f)
- @ceex = (@gammax.text.to_f-@alphax.text.to_f)
- @ceey = (@gammay.text.to_f-@alphay.text.to_f)
- @ceez = (@gammaz.text.to_f-@alphaz.text.to_f)
- @deex = (@deltax.text.to_f-@alphax.text.to_f)
- @deey = (@deltax.text.to_f-@alphay.text.to_f)
- @deez = (@deltax.text.to_f-@alphaz.text.to_f)
- ((@beex*((@ceey*@deez)-(@ceez*@deey)))-(@beey*((@ceex*@deez)-(@ceez*@deex)))+(@beez*((@ceex*@deey))-(@ceey*@deex)))
- end
- stack(:width => '100%', :margin => 20) do
- para('Calculate Coplanar Points')
- para(' x y z')
- end
- flow(:width => '100%' ) do
- para('Point A: ')
- @alphax = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
- @alphay = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
- @alphaz = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
- end
- flow(:width => '100%' ) do
- para('Point B: ')
- @betax = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
- @betay = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
- @betaz = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
- end
- flow(:width => '100%' ) do
- para('Point C: ')
- @gammax = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
- @gammay = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
- @gammaz = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
- end
- flow(:width => '100%' ) do
- para('Point D: ')
- @deltax = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
- @deltay = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
- @deltaz = edit_line(:width => 100, height => 35) {@coplanar.text = calculate}
- @button = button "Configure" do
- c = calculate==0
- case c
- when true
- alert("Points are coplanar, equation is")
- when false
- alert("Points are NOT coplanar")
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment