{*****************************************************************************} {************** Datei Anfang ***********************************************} {*****************************************************************************} {*** Fuer Ausdruck: &r &n &d &u Seite &s **} {*** Fuer Ausdruck: &r Seite &s **} {*** Fuer Ausdruck: Fixsys 5Pt **} {Datei: :/hc_me10/hc_schnittpunkt_setzen_v3.txt} {09:29 16.01.2013} define hc_schnittpunkt_setzen {Haupt-Prgm} local p1 {Punkt1 } local w1 {Winkel1 } local p2 {Punkt2 } local w2 {Winkel2 } local Z0 {Zaehler0; Anzahl der Elemente} local Z1 {Zaehler1} local Z2 {Zaehler2} LOCAL I LOCAL name_ltab inq_selected_elem c_lines all let z0 (inq 14) {Anzahl Elemente} let z1 0 let z2 1 {Zaehler z2 auf 1; Reduktion der Punkt-Berechnungen} if (z0 > 1) {Berechnung nur sinnvoll, wenn min. 2 Elemente} {logische Tabelle aufsetzen} LET name_ltab 'cat_werte_liste_ltab' CREATE_LTAB z0 2 name_ltab {Create logical table; n rows; 2 columns; Name der logical table} LET I 0 {Elemente in Tabelle schreiben} loop exit_if ((inq 14) = 0) LET I (I+1) let P1 (inq 101) { Mittelpunkt der Linie} write_ltab name_ltab I 1 (STR P1) let W1 (inq 3) { Winkel zur X-Achse der Linie} write_ltab name_ltab I 2 (STR W1) inq_next_elem end_loop {Werte auslesen und Punkte berechnen} loop {1. Element} let z1 (z1 + 1) LET p1 (VAL (READ_LTAB name_ltab z1 1)) let w1 (VAL (READ_LTAB name_ltab z1 2)) loop {2. Element} let z2 (z2 + 1) LET p2 (VAL (READ_LTAB name_ltab z2 1)) let w2 (VAL (READ_LTAB name_ltab z2 2)) if (w1 <> w2) {parallele Linien ausschließen} hc_schnittpunkt_ber p1 w1 p2 w2 end_if exit_if (z2 >= z0) end_loop let z2 z1 exit_if (z1 = z0) end_loop else display ('Nur ' + str z0 + ' Linie(n) gefunden. Programm Ende.') end_if window_fit end_define define hc_schnittpunkt_ber {Schnittpunktsberechnung} parameter p1 parameter w1 parameter p2 parameter w2 local x1 local y1 local x2 local y2 local s1 local s2 local a1 local a2 local xs local ys local pntxy let x1 (x_of p1) let y1 (y_of p1) let x2 (x_of p2) let y2 (y_of p2) if ((abs w1 <> 90) and (abs w2 <> 90)) {Allgemeinfall} let s1 (tan w1) let s2 (tan w2) let a1 (y1 - (s1 * x1)) let a2 (y2 - (s2 * x2)) let xs ((a2 - a1)/(s1 - s2)) let ys (((s1 * a2) - (s2 * a1))/(s1 - s2)) else_if ((abs w1 = 90) and (abs w2 <> 90)) {1. Element senkrecht} let s2 (tan w2) let xs x1 let ys (y2 + (s2 * (x1 - x2))) else_if ((abs w1 <> 90) and (abs w2 = 90)) {2. Element senkrecht} let s1 (tan w1) let xs x2 let ys (y1 + (s1 * (x2 - x1))) end_if let Pntxy (pnt_xy xs ys) {Punkt setzen} inq_elem pntxy if (inq 403 <> point) point pntxy end end_if end_define