Skip to content

Instantly share code, notes, and snippets.

@atomicules
Created March 22, 2010 08:45
Show Gist options
  • Save atomicules/339896 to your computer and use it in GitHub Desktop.
Save atomicules/339896 to your computer and use it in GitHub Desktop.
#For answering question on Shoes mailing list dmonroe
Shoes.app(:title => "Coplanar Points", :width => 550, :height => 400) do
def calculate
@beex = (@[email protected]_f)
@beey = (@[email protected]_f)
@beez = (@[email protected]_f)
@ceex = (@[email protected]_f)
@ceey = (@[email protected]_f)
@ceez = (@[email protected]_f)
@deex = (@[email protected]_f)
@deey = (@[email protected]_f)
@deez = (@[email protected]_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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment