Interferenzhyperbeln

Motivation

Im Physik Oberstufenkurs wird im ersten Semester das Thema Schwingungen und Wellen bearbeitet. Dort treten dann natürlich auch Interferenzhyperbeln auf. Nachdem ich dies nun schon mehrfach unterrichtet habe, habe ich mich privat mit der zugehörigen Mathematik beschäftigt. Hierzu gibt es einen netten Artikel bei der Wikipedia.

Herausgekommen ist ein kleines Perl-Skript, mitdem ich Kreise und Hyperbeln mithilfe von Pstricks erzeuge.

Die Theorie

Hat man zwei Erregerzentren von Wellen, so ergeben sich für die Interferenzmuster Hyperbelfunktionen.

Eine Hyperbel ist definiert als die Menge aller Punkte der Zeichenebene, für die die Differenz der Abstände zu den Brennpunkten(erregerzentren) F1 und F2 konstant gleich 2a ist, wobei a die große Halbachse der Hyperbel ist.

Den halben Abstand der Brennpunkte voneinander bezeichnet man üblicherweise mit e. Die Gleichung der Hyperbel erhält eine besonders einfache Form, wenn sie in „1.Hauptlage“ liegt, das heißt, dass die beiden Brennpunkte auf der x-Achse symmetrisch zum Ursprung liegen. Also in den Punkten (-e|0) und (e|0).

Es gilt dann für die Hyperbel

wobei gilt:

Hat man zwei Erreger mit der gleichen Wellenlänge, so liegen die Interferenzmaxima genau an den Stellen mit einem Gangunterschied von Δs = nλ, wobei λ die Wellenlänge ist und n N.

D. h man sucht einen Punkt P auf der Interferenzhyperbel, der d+ Δs vom linken Erreger und d vom rechten Erreger entfernt ist, für die rechte Verstärkung.

Wobei oBdA d = e ist. Es gilt dann:

(I)
(x+ e)2 + y2
=
(d+ s)2
(II)
(x-e)2 + y2
=
d2

Daraus ergibt sich: x = 2ds+s2
4e und y = Hieraus bestimmt man für die gesuchte Hyperbel a:

Setzt man dies nun in Gleichung (2.2) ein und löst dies nach y auf, so hat man die Funktion für die Hyperbel.

Mit einer geeigneten Parametrisierung erhält man:

für 0 < t < 2π.

Programmeingabe

Wie erhält man nun die gewünschten Ergebnisse? Hierzu übergibt man an mein Skript eine Datei mit dem folgenden Eingabeformat:

abstand 3  
wellenlaenge 1,2  
gegen  
boegen  
hyperbel  
anzahlkreise 1

Zur Erklärung: abstand n gibt an, wie weit die Erregerzentren auf der x- Achse entfernt sind. wellenlaenge l1,l2 gibt die Wellenlängen der zwei Erreger an. Setzt man gegen, so wird startet der zweite Erreger gegenphasig zum ersten Erreger. Wird boegen gesetzt, so werden weitere Kreisbögen gezeichnet. anzahlkreise n gibt an, wie viele Kreise gezeichnet werden. Ist dies nicht gesetzt, so werden 4 Kreise gemalt.

Beispiele

Als Beispiel hier ein paar Eingaben für mein Programm und deren Ausgaben:

  1. Die Eingabe:
    abstand 3  
    wellenlaenge 1,1  
    boegen  
    hyperbel
    Das Bild:
  2. Die Eingabe:
    abstand 3  
    wellenlaenge 1,2  
    gegen  
    boegen  
    hyperbel
    Das Bild

Der Programmcode

 interferenz.pl 
1 #!/usr/bin/perl -w 2 ################################################################## 3 ## Programm zur Erstellung von Interferenzmustern mit Pstricks 4 ## Letzte Aenderung: 26.11.2009 5 ## Autor: Xenia Rendtel 6 ################################################################## 7 use POSIX qw /floor ceil/; 8 use Math::Trig; 9 use strict; 10 use lib '/home/xenia/Schule/Informatik-Eigen/Interferenz'; 11 use hilfsfunktionen; 12 my ( 13 $e, $s, 14 $d, $l1, 15 $l2, $weiter, 16 $kreise, $diff, 17 $i, $ymax, 18 $ymin, $xmin, 19 $xmax, @ausgabedatei, 20 @ausgabedateizeilen, $kopf, 21 $kommandodatei, $texdatei, 22 $leer, $eingabedateizeilen, 23 @eingabedatei, $kommandodateinummer, 24 $datei, $zeile, 25 $ausrichtung, $bezeichnung, 26 $func, $variable, 27 $j, $schritt, 28 $spalten, $nachkommastellen, 29 $spaltenausrichtung, $liste, 30 $endeerreicht, $hilfszeile, 31 $anzahlzeilen 32 ); 33 my $boegen = 0; 34 my $hyperbel = 0; 35 $xmin = $xmax = $ymin = $ymax = 0; 36 $kopf = 1; 37 $diff = 0; 38 ### Das Array wird eingelesen 39 @ausgabedateizeilen = (); 40 41 for ( $i = 0 ; $i <= 150 ; $i++ ) { 42 $ausgabedateizeilen[$i] = 0; 43 } 44 45 # In ein array wird geschrieben 46 sub schreibeinarray { 47 my ( $layer, $zeile ) = @_; 48 $ausgabedatei[$layer][ $ausgabedateizeilen[$layer] ] = 49 $zeile; 50 $ausgabedateizeilen[$layer]++; 51 } 52 53 # Der Kopf der Latex-Datei wird geschrieben 54 sub kopfdatei { 55 if ( $kopf == 1 ) { 56 kommentar( 1, "Interferenzhyperbeln" ); 57 kommentar( 1, "Autor: X. Rendtel" ); 58 kommentar( 1, "Letzte Aenderung: 2009" ); 59 latex( 2, 60 "\\documentclass[10pt, a4paper]{article}" ); 61 usepackage( "utf8", "inputenc" ); 62 usepackage( 63 "", 64 "pstricks,pst-pdf,pst-node,xcolor, " 65 . "pst-circ,pst-func,pst-math,pst-eucl, " 66 . "pstricks-add,multido" 67 ); 68 latex( 3, 69 "\\pagestyle{empty} \n\\begin{document} " ); 70 } 71 beginpicture(4); 72 } 73 74 sub fussdatei { 75 endpicture(11); 76 if ( $kopf == 1 ) { latex( 11, "\\end{document}" ); } 77 } 78 #### Pictureumgebung 79 sub beginpicture { 80 my ($layer) = @_; 81 schreibeinarray( 82 $layer, 83 sprintf( 84 "\\begin{pspicture}(%g,%g)(%g,%g)\n", 85 getminmax( "x", "min" ), 86 getminmax( "y", "min" ), 87 getminmax( "x", "max" ), 88 getminmax( "y", "max" ) 89 ) 90 ); 91 } 92 93 sub endpicture { 94 my ($layer) = @_; 95 latex( $layer, "\\end{pspicture}" ); 96 } 97 98 # Die Eingabedatei wird gelesen 99 sub leseeingabedatei { 100 my $dateiname = shift(@_); 101 my $zeile; 102 open( my $EINGABEDATEI, $dateiname ) 103 || die $dateiname . ": $!"; 104 while ( $zeile = <$EINGABEDATEI> ) { 105 106 # Zeilenenden beseitigen, Kommentare und Leerzeilen ignorieren 107 $zeile =~ s/[\r\n]//g; 108 $zeile =~ s/ +/ /g; 109 $zeile =~ s/ +$//g; 110 $zeile =~ s/^ +//g; 111 next if ( $zeile =~ /^\#/ ); 112 next if ( $zeile =~ /^$/ ); 113 if ( $zeile =~ /^lesedatei (.*)$/i ) { 114 leseeingabedatei($1); 115 } else { 116 $eingabedatei[$eingabedateizeilen] = $zeile; 117 $eingabedateizeilen++; 118 } 119 } 120 close($EINGABEDATEI); 121 } 122 ### Minimum und Maximum setzen 123 sub setminmax { 124 my ( $min, $xodery, $minmax ) = @_; 125 if ( $xodery eq "x" ) { 126 if ( $minmax eq "min" ) { $xmin = $min; } 127 else { $xmax = $min; } 128 } 129 if ( $xodery eq "y" ) { 130 if ( $minmax eq "min" ) { $ymin = $min; } 131 else { $ymax = $min; } 132 } 133 } 134 135 sub getminmax { 136 my ( $xodery, $minmax ) = @_; 137 if ( $xodery eq "x" ) { 138 if ( $minmax eq "min" ) { return $xmin; } 139 else { return $xmax; } 140 } 141 if ( $xodery eq "y" ) { 142 if ( $minmax eq "min" ) { return $ymin; } 143 else { return $ymax; } 144 } 145 } 146 ## Minimum und Maximum bestimmen 147 sub minmax { 148 my ( $xminlokal, $xmaxlokal, $yminlokal, $ymaxlokal ) = 149 @_; 150 if ( $xminlokal < getminmax( "x", "min" ) ) { 151 setminmax( $xminlokal, "x", "min" ); 152 } 153 if ( $xmaxlokal > getminmax( "x", "max" ) ) { 154 setminmax( $xmaxlokal, "x", "max" ); 155 } 156 if ( $yminlokal < getminmax( "y", "min" ) ) { 157 setminmax( $yminlokal, "y", "min" ); 158 } 159 if ( $ymaxlokal > getminmax( "y", "max" ) ) { 160 setminmax( $ymaxlokal, "y", "max" ); 161 } 162 } 163 164 sub degtorad { 165 my ($wert) = @_; 166 return $wert * pi() / 180; 167 } 168 169 sub radtodeg { 170 my ($wert) = @_; 171 return $wert * 180 / pi(); 172 } 173 my $abstand = 0; 174 175 sub setabstand { 176 my ($wert) = @_; 177 $abstand = $wert; 178 } 179 180 sub getabstand { 181 return $abstand; 182 } 183 my ( $wellenlaenge1, $wellenlaenge2 ); 184 $wellenlaenge1 = $wellenlaenge2 = 1; 185 186 sub setwelleeins { 187 my ($wert) = @_; 188 $wellenlaenge1 = $wert; 189 } 190 191 sub setwellezwei { 192 my ($wert) = @_; 193 $wellenlaenge2 = $wert; 194 } 195 196 sub getwelleeins { 197 return $wellenlaenge1; 198 } 199 200 sub getwellezwei { 201 return $wellenlaenge2; 202 } 203 my $anzahl = 4; 204 205 sub setkreisanzahl { 206 my ($wert) = @_; 207 $anzahl = $wert; 208 } 209 210 sub getkreisanzahl { 211 return $anzahl; 212 } 213 my $liniendicke = 1; 214 215 sub setliniendicke { 216 my ($wert) = @_; 217 $liniendicke = $wert; 218 } 219 220 sub getliniendicke { 221 return $liniendicke; 222 } 223 224 sub seterreger { 225 my ( $abstand, $wellenlaenge1, $wellenlaenge2, $anzahl, 226 $liniendicke ) 227 = @_; 228 $e = $abstand / 2; 229 kommentar( 2, "Abstand Erreger: " . $abstand ); 230 kommentar( 2, 231 "Wellenlaenge Erreger 1: " . $wellenlaenge1 ); 232 kommentar( 2, 233 "Wellenlaenge Erreger 2: " . $wellenlaenge2 ); 234 kommentar( 2, "Anzahl Kreise: " . $anzahl ); 235 ausgabe( 236 "\\psset{linecolor=black, fillcolor=black!20, " 237 . "linestyle=solid, linewidth= " 238 . $liniendicke 239 . "pt, dotstyle = *, plotpoints = 1000, dotsize = 3pt," 240 . " arrowsize = 3pt 2, arrowinset = 0.25, xunit = 1cm, " 241 . "yunit = 1cm, algebraic =true} 242 " 243 ); 244 } 245 sub setboegen { my $wert = @_; $boegen = $wert; } 246 sub getboegen { return $boegen; } 247 ## Die Kreise werden gezeichnet 248 sub erzeugekreise { 249 my ( $x, $lambda, $start, $anzahlkreise ) = @_; 250 minmax( 251 $x - $lambda * ($anzahlkreise), 252 $x + $lambda * ($anzahlkreise), 253 -$lambda * ($anzahlkreise), 254 $lambda * ($anzahlkreise) 255 ); 256 if ( getboegen() == 1 ) { 257 $anzahlkreise = 5 * $anzahlkreise; 258 } else { 259 $anzahlkreise = $anzahlkreise; 260 } 261 if ( $start == 0 ) { 262 schreibeinarray( 263 10, 264 sprintf( 265 "\\multido{\\nx=0+%f}{%i}{", 266 $lambda, $anzahlkreise 267 ) 268 ); 269 schreibeinarray( 270 10, 271 sprintf( 272 "\\pscircle[linewidth=1pt](%f,0){\\nx}}\n", 273 $x ) 274 ); 275 schreibeinarray( 276 10, 277 sprintf( 278 "\\multido{\\nx=%f+%f}{%i}{", 279 $lambda / 2, 280 $lambda, $anzahlkreise 281 ) 282 ); 283 schreibeinarray( 284 10, 285 sprintf( 286 "\\pscircle[linestyle=dashed, linewidth=1pt](%f,0){\\nx}}\n", 287 $x ) 288 ); 289 } else { 290 schreibeinarray( 291 10, 292 sprintf( 293 "\\multido{\\nx=0+%f}{%i}{", 294 $lambda, $anzahlkreise 295 ) 296 ); 297 schreibeinarray( 298 10, 299 sprintf( 300 "\\pscircle[linestyle=dashed, linewidth=1pt](%f,0){\\nx}}\n", 301 $x ) 302 ); 303 schreibeinarray( 304 10, 305 sprintf( 306 "\\multido{\\nx=%f+%f}{%i}{", 307 $lambda / 2, 308 $lambda, $anzahlkreise 309 ) 310 ); 311 schreibeinarray( 312 10, 313 sprintf( 314 "\\pscircle[linewidth=1pt](%f,0){\\nx}}\n", 315 $x ) 316 ); 317 } 318 } 319 320 sub hyperbelfunktion { 321 my ( $a, $e, $ymin, $ymax, $farbe ) = @_; 322 my $b = sqrt( $e * $e - $a * $a ); 323 my $i = 0; 324 my $t = 0; 325 for ( $i = 0 ; $i <= 3 ; $i = $i + 1 / 1000 ) { 326 if ( $b * sinh($i) < $ymax ) { 327 $t = $i; 328 } else { 329 $t = $t; 330 } 331 } 332 schreibeinarray( 333 10, 334 sprintf( 335 "\\parametricplot[linecolor=%s]{%g}{%g}{%g*COSH(t)|%g*SINH(t)}", 336 $farbe, -$t, $t, $a, $b 337 ) 338 ); 339 schreibeinarray( 340 10, 341 sprintf( 342 "\\parametricplot[linecolor=%s]{%g}{%g}{%g*COSH(t)|%g*SINH(t)}", 343 $farbe, -$t, $t, -$a, -$b 344 ) 345 ); 346 } 347 348 sub kreisboegen { 349 my ( $x1, $laenge, $kreise, $start ) = @_; 350 my ( 351 $xabstandlinks, $xabstandrechts, $alpha, 352 $beta, $gamma, $delta, 353 $i, $abstand, $eckelinks, 354 $eckerechts, $berg, $tal, 355 ); 356 if ( $start == 0 ) { $berg = "solid"; $tal = "dashed"; } 357 else { $berg = "dashed"; $tal = "solid"; } 358 } 359 360 sub kreisboegen2 { 361 my ( $x1, $laenge, $kreise, $start ) = @_; 362 my ( 363 $xabstandlinks, $xabstandrechts, $alpha, 364 $beta, $gamma, $delta, 365 $i, $abstand, $eckelinks, 366 $eckerechts, $berg, $tal, 367 ); 368 if ( $start == 0 ) { $berg = "solid"; $tal = "dashed"; } 369 else { $berg = "dashed"; $tal = "solid"; } 370 $xabstandlinks = abs( $x1 - $xmin ); 371 $xabstandrechts = abs( $xmax - $x1 ); 372 $eckelinks = 373 sqrt( 374 $ymax * $ymax + $xabstandlinks * $xabstandlinks ); 375 $eckerechts = 376 sqrt( 377 $ymax * $ymax + $xabstandrechts * $xabstandrechts ); 378 379 for ( $i = 0 ; $i <= 100 ; $i++ ) { 380 $abstand = ( $kreise * $laenge ) + $laenge * $i; 381 if ( $abstand <= $xabstandlinks ) { 382 $beta = 383 nachkommastellen( 384 radtodeg( acos( $ymax / $abstand ) ), 4 ); 385 if ( $abstand <= $eckelinks ) { 386 schreibeinarray( 387 10, 388 sprintf( 389 "\\psarc[linestyle=%s](%g,0){%g}{%g}{%g}", 390 $berg, $x1, 391 $abstand, 90 + $beta, 392 270 - $beta 393 ) 394 ); 395 } 396 } else { 397 $alpha = nachkommastellen( 398 radtodeg( 399 acos( $xabstandlinks / $abstand ) 400 ), 401 4 402 ); 403 $beta = 404 nachkommastellen( 405 radtodeg( acos( $ymax / $abstand ) ), 4 ); 406 if ( $abstand <= $eckelinks ) { 407 schreibeinarray( 408 10, 409 sprintf( 410 "\\psarc[linestyle=%s](%g,0){%g}{%g}{%g}", 411 $berg, $x1, 412 $abstand, 90 + $beta, 413 180 - $alpha 414 ) 415 ); 416 schreibeinarray( 417 10, 418 sprintf( 419 "\\psarc[linestyle=%s](%g,0){%g}{%g}{%g}", 420 $berg, $x1, 421 $abstand, 180 + $alpha, 422 270 - $beta 423 ) 424 ); 425 } 426 } 427 if ( $abstand <= $xabstandrechts ) { 428 $delta = 429 nachkommastellen( 430 radtodeg( acos( $ymax / $abstand ) ), 4 ); 431 if ( $abstand <= $eckerechts ) { 432 schreibeinarray( 433 10, 434 sprintf( 435 "\\psarc[linestyle=%s](%g,0){%g}{%g}{%g}", 436 $berg, $x1, 437 $abstand, 270 + $delta, 438 90 - $delta 439 ) 440 ); 441 } 442 } else { 443 $gamma = nachkommastellen( 444 radtodeg( 445 acos( $xabstandrechts / $abstand ) 446 ), 447 4 448 ); 449 $delta = 450 nachkommastellen( 451 radtodeg( acos( $ymax / $abstand ) ), 4 ); 452 if ( $abstand <= $eckerechts ) { 453 schreibeinarray( 454 10, 455 sprintf( 456 "\\psarc[linestyle=%s](%g,0){%g}{%g}{%g}", 457 $berg, $x1, $abstand, 458 $gamma, 90 - $delta 459 ) 460 ); 461 schreibeinarray( 462 10, 463 sprintf( 464 "\\psarc[linestyle=%s](%g,0){%g}{%g}{%g}", 465 $berg, $x1, 466 $abstand, 270 + $delta, 467 360 - $gamma 468 ) 469 ); 470 } 471 } 472 } 473 for ( $i = 0 ; $i <= 100 ; $i++ ) { 474 $abstand = 475 ( $kreise * $laenge + $laenge / 2 ) + $laenge * 476 $i; 477 if ( $abstand <= $xabstandlinks ) { 478 $beta = 479 nachkommastellen( 480 radtodeg( acos( $ymax / $abstand ) ), 4 ); 481 if ( $abstand <= $eckelinks ) { 482 schreibeinarray( 483 10, 484 sprintf( 485 "\\psarc[linestyle=%s](%g,0){%g}{%g}{%g}", 486 $tal, $x1, 487 $abstand, 90 + $beta, 488 270 - $beta 489 ) 490 ); 491 } 492 } else { 493 $alpha = nachkommastellen( 494 radtodeg( 495 acos( $xabstandlinks / $abstand ) 496 ), 497 4 498 ); 499 $beta = 500 nachkommastellen( 501 radtodeg( acos( $ymax / $abstand ) ), 4 ); 502 if ( $abstand <= $eckelinks ) { 503 schreibeinarray( 504 10, 505 sprintf( 506 "\\psarc[linestyle=%s](%g,0){%g}{%g}{%g}", 507 $tal, $x1, 508 $abstand, 90 + $beta, 509 180 - $alpha 510 ) 511 ); 512 schreibeinarray( 513 10, 514 sprintf( 515 "\\psarc[linestyle=%s](%g,0){%g}{%g}{%g}", 516 $tal, $x1, 517 $abstand, 180 + $alpha, 518 270 - $beta 519 ) 520 ); 521 } 522 } 523 if ( $abstand <= $xabstandrechts ) { 524 $delta = 525 nachkommastellen( 526 radtodeg( acos( $ymax / $abstand ) ), 4 ); 527 if ( $abstand <= $eckerechts ) { 528 schreibeinarray( 529 10, 530 sprintf( 531 "\\psarc[linestyle=%s](%g,0){%g}{%g}{%g}", 532 $tal, $x1, 533 $abstand, 270 + $delta, 534 90 - $delta 535 ) 536 ); 537 } 538 } else { 539 $gamma = 540 radtodeg( 541 acos( $xabstandrechts / $abstand ) ); 542 $delta = radtodeg( acos( $ymax / $abstand ) ); 543 if ( $abstand <= $eckerechts ) { 544 schreibeinarray( 545 10, 546 sprintf( 547 "\\psarc[linestyle=%s](%g,0){%g}{%g}{%g}", 548 $tal, $x1, $abstand, 549 $gamma, 90 - $delta 550 ) 551 ); 552 schreibeinarray( 553 10, 554 sprintf( 555 "\\psarc[linestyle=%s](%g,0){%g}{%g}{%g}", 556 $tal, $x1, 557 $abstand, 270 + $delta, 558 360 - $gamma 559 ) 560 ); 561 } 562 } 563 } 564 ausgabe(""); 565 } 566 567 sub hyperbel { 568 my ( $e, $laenge1, $laenge2, $anzahl ) = @_; 569 my ( 570 $a, $s, $d, $n, $x, $y, 571 $xhilf, $yhilf, $xnext, $ynext, $genau 572 ); 573 $genau = 0; 574 $d = ceil($e); 575 for ( $n = 0 ; $n <= $anzahl ; $n++ ) { 576 $s = $laenge1 * $n; 577 $xhilf = 578 nachkommastellen( 579 ( 2 * $d * $s + $s * $s ) / ( 4 * $e ), 4 ); 580 if ( ( $d * $d - ( $xhilf - $e ) * ( $xhilf - $e ) ) 581 >= 0 ) 582 { 583 $yhilf = nachkommastellen( 584 sqrt( 585 $d * $d - ( $xhilf - $e ) * 586 ( $xhilf - $e ) 587 ), 588 4 589 ); 590 $a = ( 591 sqrt( 592 ( $xhilf - $e ) * ( $xhilf - $e ) + 593 $yhilf * $yhilf 594 ) - sqrt( 595 ( $xhilf + $e ) * ( $xhilf + $e ) + 596 $yhilf * $yhilf 597 ) 598 ) / 2; 599 if ( $diff == 1 ) { 600 hyperbelfunktion( $a, $e, -$ymax, $ymax, 601 "blue" ); 602 } else { 603 hyperbelfunktion( $a, $e, -$ymax, $ymax, 604 "red" ); 605 } 606 } 607 } 608 for ( $n = 1 ; $n <= $anzahl ; $n++ ) { 609 $s = ( 2 * $n - 1 ) * $laenge1 / 2; 610 $xhilf = ( 2 * $d * $s + $s * $s ) / ( 4 * $e ); 611 if ( ( $d * $d - ( $xhilf - $e ) * ( $xhilf - $e ) ) 612 >= 0 ) 613 { 614 $yhilf = 615 sqrt( 616 $d * $d - ( $xhilf - $e ) * ( $xhilf - $e ) 617 ); 618 $a = ( 619 sqrt( 620 ( $xhilf - $e ) * ( $xhilf - $e ) + 621 $yhilf * $yhilf 622 ) - sqrt( 623 ( $xhilf + $e ) * ( $xhilf + $e ) + 624 $yhilf * $yhilf 625 ) 626 ) / 2; 627 if ( $diff == 1 ) { 628 hyperbelfunktion( $a, $e, -$ymax, $ymax, 629 "red" ); 630 } else { 631 hyperbelfunktion( $a, $e, -$ymax, $ymax, 632 "blue" ); 633 } 634 } 635 } 636 } 637 my $start1 = 0; 638 my $start2 = 0; 639 $kommandodateinummer = 0; 640 while ( exists $ARGV[$kommandodateinummer] ) { 641 $kommandodatei = $ARGV[$kommandodateinummer]; 642 $texdatei = $kommandodatei; 643 $texdatei =~ s/\.ptxt$//i; 644 $texdatei = $texdatei . " . adam "; 645 $kommandodateinummer++; 646 $eingabedateizeilen = 0; 647 leseeingabedatei($kommandodatei); 648 for ( $i = 0 ; $i < $eingabedateizeilen ; $i++ ) { 649 $zeile = $eingabedatei[$i]; 650 if ( $zeile =~ /^abstand( [-0-9\.]+)$/i ) { 651 setabstand($1); 652 } elsif ( $zeile =~ /^anzahlkreise( [-0-9\.]+)$/i ) 653 { 654 setkreisanzahl($1); 655 } elsif ( $zeile =~ 656 /^wellenlaenge( [-0-9\.]+),([-0-9\.]+)$/i ) 657 { 658 setwelleeins($1); 659 setwellezwei($2); 660 } elsif ( $zeile =~ /^gegen$/i ) { 661 $start2 = 1; 662 $diff = 1; 663 } elsif ( $zeile =~ /^boegen$/i ) { 664 setboegen(1); 665 } elsif ( $zeile =~ /^hyperbel$/i ) { 666 $hyperbel = 1; 667 } 668 669 # Alle anderen Befehle sind Schrott 670 else { 671 printf( "%% Unbekannter Befehl '%s'\n", 672 $zeile ); 673 } 674 } 675 } 676 seterreger( 677 getabstand(), getwelleeins(), 678 getwellezwei(), getkreisanzahl(), 679 getliniendicke() 680 ); 681 erzeugekreise( -$e, getwelleeins(), $start1, 682 getkreisanzahl() ); 683 erzeugekreise( $e, getwellezwei(), $start2, 684 getkreisanzahl() ); 685 if ( $hyperbel == 1 ) { 686 hyperbel( $e, getwelleeins(), getwellezwei(), 1000 ); 687 } 688 $leer = 1; 689 my $layer; 690 for ( $layer = 0 ; $layer <= 100 ; $layer++ ) { 691 692 for ( $i = 0 ; $i < $ausgabedateizeilen[$layer] ; $i++ ) 693 { 694 $leer = 0; 695 } 696 } 697 if ( $leer == 0 ) { 698 kopfdatei(); 699 fussdatei(); 700 for ( $layer = 0 ; $layer <= 11 ; $layer++ ) { 701 for ( 702 $i = 0 ; 703 $i < $ausgabedateizeilen[$layer] ; 704 $i++ 705 ) 706 { 707 printf( "%s \n", $ausgabedatei[$layer][$i] ); 708 } 709 } 710 } else { 711 printf("%% Die Datei ist leer \n"); 712 } 713

Letzte Änderung: 18.12.2009: 19:37:41 von X. Rendtel