#!/usr/bin/wish -f set entry_x1 1 set entry_y1 0 set entry_z1 0 set entry_x2 0 set entry_y2 1 set entry_z2 0 set entry_x3 0 set entry_y3 0 set entry_z3 1 set alpha 0 set beta 0 set gamma 0 proc Alpha {entry_z1 entry_z2} { set PI 3.141592654 set result_alpha [ expr {asin($entry_z2/(cos(-asin($entry_z1))))*180/$PI}] set result_alpha [ format "%.3f" $result_alpha] return $result_alpha } proc Beta {entry_z1} { set PI 3.141592654 set result_beta [ expr {-asin($entry_z1)*180/$PI}] set result_beta [ format "%.3f" $result_beta] return $result_beta } proc Gamma {entry_z1 entry_y1} { set PI 3.141562654 set result_gamma [ expr {asin($entry_y1/(cos(-asin($entry_z1))))*180/$PI}] set result_gamma [ format "%.3f" $result_gamma] return $result_gamma } wm geometry . 840x400 label .x1 -text x1 entry .entry_x1 -background white -textvariable entry_x1 label .x2 -text x2 entry .entry_x2 -background white -textvariable entry_x2 label .x3 -cursor fleur -text x3 entry .entry_x3 -background white -cursor fleur -textvariable entry_x3 label .result_alpha -textvariable result_alpha label .y1 -text y1 entry .entry_y1 -background white -textvariable entry_y1 label .y2 -text y2 entry .entry_y2 -background white -textvariable entry_y2 label .y3 -cursor fleur -text y3 entry .entry_y3 -background white -cursor fleur -textvariable entry_y3 label .result_beta -textvariable result_beta label .z1 -text z1 entry .entry_z1 -background white -textvariable entry_z1 label .z2 -text z2 entry .entry_z2 -background white -textvariable entry_z2 label .z3 -cursor fleur -text z3 entry .entry_z3 -background white -cursor fleur -textvariable entry_z3 label .result_gamma -textvariable result_gamma label .alpha -text Alpha label .beta -text Beta label .gamma -text Gamma ################### # SETTING GEOMETRY ################### place .x1 -in . -x 35 -y 45 -anchor nw -bordermode ignore place .entry_x1 -in . -x 70 -y 45 -anchor nw -bordermode ignore place .x2 -in . -x 240 -y 45 -anchor nw -bordermode ignore place .entry_x2 -in . -x 275 -y 45 -anchor nw -bordermode ignore place .x3 -in . -x 450 -y 45 -anchor nw -bordermode ignore place .entry_x3 -in . -x 475 -y 45 -anchor nw -bordermode ignore place .result_alpha -in . -x 700 -y 45 -anchor nw -bordermode ignore place .y1 -in . -x 35 -y 65 -anchor nw -bordermode ignore place .entry_y1 -in . -x 70 -y 65 -anchor nw -bordermode ignore place .y2 -in . -x 240 -y 65 -anchor nw -bordermode ignore place .entry_y2 -in . -x 275 -y 65 -anchor nw -bordermode ignore place .y3 -in . -x 450 -y 65 -anchor nw -bordermode ignore place .entry_y3 -in . -x 475 -y 65 -anchor nw -bordermode ignore place .result_beta -in . -x 700 -y 65 -anchor nw -bordermode ignore place .z1 -in . -x 35 -y 85 -anchor nw -bordermode ignore place .entry_z1 -in . -x 70 -y 85 -anchor nw -bordermode ignore place .z2 -in . -x 240 -y 85 -anchor nw -bordermode ignore place .entry_z2 -in . -x 275 -y 85 -anchor nw -bordermode ignore place .z3 -in . -x 450 -y 85 -anchor nw -bordermode ignore place .entry_z3 -in . -x 475 -y 85 -anchor nw -bordermode ignore place .result_gamma -in . -x 700 -y 85 -anchor nw -bordermode ignore place .alpha -in . -x 640 -y 45 -anchor nw -bordermode ignore place .beta -in . -x 640 -y 65 -anchor nw -bordermode ignore place .gamma -in . -x 640 -y 85 -anchor nw -bordermode ignore bind .entry_z1 {set result_alpha [Alpha $entry_z1 $entry_z2] set result_beta [Beta $entry_z1] set result_gamma [Gamma $entry_z1 $entry_y1] } bind .entry_z2 {set result_alpha [Alpha $entry_z1 $entry_z2]} bind .entry_y1 {set result_gamma [Gamma $entry_z1 $entry_y1]}