#!/bin/sh # the next line restarts using wish \ exec wish "$0" "$@" wm title . " Cuerpo Rigido" proc show_ayuda {} { catch {destroy .ayuda} set w .ayuda toplevel $w wm title $w "Ayuda" frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m button $w.buttons.ok -text OK -command "destroy $w" pack $w.buttons.ok -side left -expand 1 text $w.text -relief sunken -bd 2 -yscrollcommand "$w.scroll set" -setgrid 1 \ -height 30 -width 70 scrollbar $w.scroll -command "$w.text yview" pack $w.scroll -side right -fill y pack $w.text -expand yes -fill both $w.text insert 0.0 \ { Este programa presenta varias propiedades de la dinamica de un cuerpo rigido "libre" (sin fuerzas externas, moviendo bajo su propia inercia, con un punto fijo, digamos su centro de masa; el caso general de cuerpo rigido libre se reduce a este caso pasando al sistema inercial del centro de masa). Lo que observas en la ventana principal (titulada "Camera") es: - El elipsoide de inercia del cuerpo - El eje de velocidad angular (en blanco) - El eje de momento angular (en rojo) - El plano ortogonal al momento angular, tangente al elipsoide (el plano invariante de Poinsot). Para iniciar la simulacion picar el boton "integrar". Una vez que empieza la integracion el programa produce el trazo de la velocidad angular sobre el elipsoid de inercia (en verde) y sobre el plano invariante (en blanco). Nota que la curva verde es periodica (cerrada), como consecuencia de la leyes de conservacion de momento angular y energia, mientras la curva blanca es casi-periodica (llena densamente un anillo). Puedes cambiar la velocidad angular inicial (con respeto al cuerpo) y las longitudes de los ejes principales del elipsoid de inercia. Al acabar de meter los numeros tienes que dar "Enter". NOTA: el programa no esta protegido en contra de datos inapropiados (ejes con longitud negativa, datos no numericos ....etc), asi que tendras que "matar" el programa e iniciar de nuevo en caso que metiste datos malos. El despliegue grafico esta hecho mediante el programa "Geomview". Puedes manipular el objeto mediante el raton, rotandolo para observarlo desde distintos puntos de vista. Usando el "Tool Panel" puedes hacer otras cosas como "zoom in", translaciones, etc. En el "Main Panel" hay otros controles interesantes en "Appearance". } $w.text mark set insert 0.0 } set run 0 set y0 0.2 set y1 1.0 set y2 0.2 set L0 1.0 set L1 2.0 set L2 3.0 set v 5 set cf [open "/tmp/command_file" w] ################################################# frame .vel_ang pack .vel_ang -side top -fill x -pady 2m label .vel_ang.label -text "Velocidad Angular" pack .vel_ang.label -side top -fill x entry .vel_ang.entry0 -width 4 -relief sunken -textvariable y0 bind .vel_ang.entry0 { puts "y $y0 $y1 $y2";flush stdout} entry .vel_ang.entry1 -width 4 -relief sunken -textvariable y1 bind .vel_ang.entry1 { puts "y $y0 $y1 $y2";flush stdout} entry .vel_ang.entry2 -width 4 -relief sunken -textvariable y2 bind .vel_ang.entry2 { puts "y $y0 $y1 $y2";flush stdout} pack .vel_ang.entry0 .vel_ang.entry1 .vel_ang.entry2\ -side left -pady 10 -expand 1 ############################################################## frame .ellipsoid pack .ellipsoid -side top -fill x -pady 2m label .ellipsoid.label -text "Ejes del ellipsoid de inercia" pack .ellipsoid.label -side top -fill x entry .ellipsoid.entry0 -width 4 -relief sunken -textvariable L0 bind .ellipsoid.entry0 { puts "L $L0 $L1 $L2";flush stdout} entry .ellipsoid.entry1 -width 4 -relief sunken -textvariable L1 bind .ellipsoid.entry1 { puts "L $L0 $L1 $L2";flush stdout} entry .ellipsoid.entry2 -width 4 -relief sunken -textvariable L2 bind .ellipsoid.entry2 { puts "L $L0 $L1 $L2";flush stdout} pack .ellipsoid.entry0 .ellipsoid.entry1 .ellipsoid.entry2\ -side left -pady 10 -expand 1 ############################################################## scale .scale -orient horizontal -from 1 -to 9 \ -label " Velocidad de la integracion" -tickinterval 1 -length 200 \ -variable v -command velo -showvalue 0 -sliderlength 10 proc velo v {puts "v $v";flush stdout; upvar cf cf; seek $cf 0 puts $cf v; flush $cf;.parar invoke; .parar flash} pack .scale ############################################################## frame .buttons pack .buttons -side top -fill x frame .buttons.run pack .buttons.run -side left -fill y radiobutton .integrar -text "INTEGRAR" -variable run \ -value 1 -command { seek $cf 0 puts -nonewline $cf g; flush $cf puts -nonewline g; flush stdout} radiobutton .parar -text "PARAR"\ -variable run \ -value 0 -command { seek $cf 0 puts -nonewline $cf s; flush $cf } pack .integrar .parar -side top -in .buttons.run \ -pady 10 -padx 10 -anchor w frame .buttons.right pack .buttons.right -in .buttons -side left button .help -text Ayuda -command show_ayuda button .salir -text Salir -command { seek $cf 0;puts -nonewline $cf q close $cf puts q;flush stdout destroy .} pack .help .salir -in .buttons -side top -pady 10 -padx 10 ################# Cuerpo Rigido ############################################