/usr/lib/libreoffice/share/extensions/DmathsAddon/OOoGdmath/RepereTrace.xba is in libreoffice-dmaths 3.4+dfsg1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="RepereTrace" script:language="StarBasic">'OOoGdmath
'Copyright (C) 2005-2009 Gilles Daurat
'This program is free software; you can redistribute it and/or
'modify it under the terms of the GNU General Public License
'as published by the Free Software Foundation; either version 2
'of the License, or (at your option) any later version.ReperePoint
'This program is distributed in the hope that it will be useful,
'but WITHOUT ANY WARRANTY; without even the implied warranty of
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'GNU General Public License for more details.
'You should have received a copy of the GNU General Public License
'along with this program; if not, write to the Free Software
'Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Option Explicit
Private Sub RepereTraceConiques(Shapes)
Dim j, i, TypeConique, a, b, BFoyers, BDirectrices, BAsymptotes, k
Dim uneConique as Object
oRepereForm.Model.Label20.Label = Chaine("tracconi") '"Tracé des coniques"
For j = 0 To ListCount(oRepereForm, "ListBox6") - 1
i = 1
ExtraitConique GetList(oRepereForm, "ListBox6", j), i, TypeConique, a, b
BFoyers = GetList(oRepereForm, "ComboBox29", j)
BDirectrices = GetList(oRepereForm, "ComboBox30", j)
BAsymptotes = GetList(oRepereForm, "ComboBox31", j)
If i <> -1 Then
Select Case TypeConique
Case 0
uneConique = TraceEllipse(posx, posy, xmin, xmax, ymin, ymax, dx, dy, angleaxe, a, b, BFoyers, BDirectrices, Shapes)
Case 1
uneConique = TraceParabole(posx, posy, xmin, xmax, ymin, ymax, dx, dy, angleaxe, a, BFoyers, BDirectrices, Shapes)
Case 2
uneConique = TraceHyperbole(posx, posy, xmin, xmax, ymin, ymax, dx, dy, angleaxe, a, b, BFoyers, BDirectrices, BAsymptotes, Shapes)
End Select
OAttribut uneConique, GetList(oRepereForm, "ComboBox22", k), GetList(oRepereForm, "ComboBox23", k), GetList(oRepereForm, "ComboBox24", k)
End If
Next j
End Sub
Private Sub RepereTraceVecteurs(Shapes as Object)
Dim j, texte$, i, x0, y0, x1, y1
Dim unVecteur as Object
oRepereForm.Model.Label20.Label = Chaine("tracvect") '"Tracé des vecteurs"
For j = 0 To ListCount(oRepereForm, "ListBox3") - 1
texte$ = GetList(oRepereForm, "ListBox3", j)
If InStr(1, texte$, ";") <> 0 Then
i = 1
ExtraitVecteur texte$, i, x0, y0, x1, y1
Else
i = 1
ExtraitSegmentPoint texte$, i, x0, y0, x1, y1
End If
If i <> -1 Then
x0 = posx + x0 * dx + y0 * dy * Cos(angleaxe)
y0 = posy - y0 * dy * Sin(angleaxe)
x1 = posx + x1 * dx + y1 * dy * Cos(angleaxe)
y1 = posy - y1 * dy * Sin(angleaxe)
unVecteur=InsereVecteur(x0, y0, x1, y1, Shapes)
OAttribut UnVecteur, GetList(oRepereForm, "ComboBox12", j), GetList(oRepereForm, "ComboBox13", j), GetList(oRepereForm, "ComboBox14", j)
End If
Next j
End Sub
Private Sub RepereTracePoints(Shapes as Object)
Dim j, i, txx, tyy, np$, xx, yy, xxx, yyy, uneMarque as Object
Dim xx1, yy1, xx2, yy2, Pointille1, Pointille2, Coord$, gf, tf
oRepereForm.Model.Label20.Label = Chaine("tracpoi") '"Tracé des points"
For j = 0 To ListCount(oRepereForm, "ListBox1") - 1
i = 1
txx = "*"
tyy = "*"
ExtraitPoint GetList(oRepereForm, "ListBox1", j), i, np$, xx, yy, txx, tyy
If i <> -1 Then
xxx = posx + xx * dx + yy * dy * Cos(angleaxe)
yyy = posy - yy * dy * Sin(angleaxe)
Select Case Val(GetList(oRepereForm, "ComboBox38", j))
Case 0
uneMarque=InsereCercle(xxx, yyy, 100, Shapes)
Case 1
uneMarque=croix(xxx, yyy, Shapes)
Case 2
uneMarque=Plus(xxx, yyy, Shapes)
Case 3
uneMarque=InsereQuadrilatere(xxx - 100, yyy - 100, xxx + 100, yyy - 100, xxx + 100, yyy + 100, xxx - 100, yyy + 100, Shapes)
Case 4
uneMarque=InsereQuadrilatere(xxx, yyy - 100, xxx + 100, yyy, xxx, yyy + 100, xxx - 100, yyy, Shapes)
End Select
OAttribut uneMarque, GetList(oRepereForm, "ComboBox18", j), GetList(oRepereForm, "ComboBox19", j), GetList(oRepereForm, "ComboBox20", j)
If np$ <> "" Then InsereTexte np$, xxx, yyy, Shapes,0,sgn(xx),-sgn(yy)
' pointilles
If val(GetList(oRepereForm, "ComboBox35", j)) Or val(GetList(oRepereForm, "ComboBox36", j)) Then
xx1 = posx + 0 * dx + yy * dy * Cos(angleaxe)
yy1 = posy - yy * dy * Sin(angleaxe)
xx2 = posx + xx * dx
yy2 = posy
If val(GetList(oRepereForm, "ComboBox35", j)) Then
Pointille1 = InsereLigne(xx1, yy1, xxx, yyy,Shapes,oRepereForm.Model.Image5)
OAttribut Pointille1, GetList(oRepereForm, "ComboBox18", j), GetList(oRepereForm, "ComboBox19", j), "msoLineDash"
Pointille2 = InsereLigne(xx2, yy2, xxx, yyy,Shapes,oRepereForm.Model.Image5)
OAttribut Pointille2, GetList(oRepereForm, "ComboBox18", j), GetList(oRepereForm, "ComboBox19", j), "msoLineDash"
End If
If val(GetList(oRepereForm, "ComboBox36", j)) Then
If xx <> Int(xx) Or Not oRepereForm.Model.CheckBox4.State Then
Coord$ = Str(xx)
SupprimeEspace Coord$
gf = oRepereForm.Model.CheckBox25.State And InStr(1, txx, "/") <> 0
tf = oRepereForm.Model.CheckBox26.State And InStr(1, Coord$, ".") <> 0
If gf Then
Coord$ = txx
Else
If tf Then
TrouveFraction Coord$
Else
RemplacePointVirgule Coord$
End If
End If
InsereTexte Coord$, xx2, yy2, Shapes,0,0,sgn(yy)
If gf Or tf Then FractionZoneTexte objet(NbObjet - 1)
End If
If yy <> Int(yy) Or Not oRepereForm.Model.CheckBox4.State Then
Coord$ = Str(yy)
SupprimeEspace Coord$
gf = oRepereForm.Model.CheckBox25.State And InStr(1, tyy, "/") <> 0
tf = oRepereForm.Model.CheckBox26.State And InStr(1, Coord$, ".") <> 0
If gf Then
Coord$ = tyy
Else
If tf Then
TrouveFraction Coord$
Else
RemplacePointVirgule Coord$
End If
End If
InsereTexte Coord$, xx1, yy1, Shapes,0,-sgn(xx),0
If gf Or tf Then FractionZoneTexte objet(NbObjet - 1)
End If
End If
End If
NbPoint = NbPoint + 1
End If
Next j
End Sub
Private Sub RepereTraceNuages(Shapes)
Dim secArray() As Single
Dim ptInflex() as Long
Dim listePoints as New com.sun.star.awt.Point
Dim BezCoo as New com.sun.star.drawing.PolyPolygonBezierCoords
Dim arg() As String
Dim k, uneListe, texte$, i, j, np$, xx, yy, uneMarque as Object, LaCourbe
Dim nbPoint as Integer
oRepereForm.Model.Label20.Label = Chaine("tracnuage") '"Tracé des nuages de points"
For k = 0 To 4
uneListe = LesListes(k)
texte$ = GetList(oRepereForm, "ComboBox41", k)
ChargeParametre texte$, arg
nbPoint = ListCount(oRepereForm, LesListes(k))
If nbPoint > 0 Then
ReDim secArray(0 To nbPoint - 1, 0 To 1)
ReDim ptInflex(0 To nbPoint - 1)
ReDim listePoints(0 To nbPoint - 1)
For i = 0 To ListCount(oRepereForm, LesListes(k)) - 1
texte$ = GetList(oRepereForm, LesListes(k), i)
j = 1
ExtraitPoint texte$, j, np$, xx, yy
secArray(i, 0) = posx + xx * dx + yy * dy * Cos(angleaxe)
secArray(i, 1) = posy - yy * dy * Sin(angleaxe)
xx = secArray(i, 0)
yy = secArray(i, 1)
listePoints(i).X=xx
listePoints(i).Y=yy
ptInflex(i) = com.sun.star.drawing.PolygonFlags.SMOOTH
Select Case Val(arg(8))
Case 0
uneMarque = InsereCercle(xx, yy, 100, Shapes)
Case 1
uneMarque = croix(xx, yy, Shapes)
Case 2
uneMarque = Plus(xx, yy, Shapes)
Case 3
uneMarque = InsereQuadrilatere(xx - 100, yy - 100, xx + 100, yy - 100, xx + 100, yy + 100, xx - 100, yy + 100, Shapes)
Case 4
uneMarque = InsereQuadrilatere(xx, yy - 100, xx + 100, yy, xx, yy + 100, xx - 100, yy, Shapes)
End Select
OAttribut uneMarque, Val(arg(9)), ExtraitEpaisseur(arg(10)), ExtraitTypeTrait(arg(10))
Next i
If (arg(3)) Then
if (arg(5)) then
BezCoo.Coordinates = Array(listePoints())
BezCoo.Flags = Array(ptInflex())
laCourbe = oDocumentDessin.createInstance("com.sun.star.drawing.OpenBezierShape")
oPageDessin.add(laCourbe)
laCourbe.PolyPolygonBezier = BezCoo
Shapes.add(laCourbe)
else
laCourbe = InsereCourbe(secArray(), i, Shapes)
end if
OAttribut laCourbe, Val(arg(6)), ExtraitEpaisseur(arg(7)), ExtraitTypeTrait(arg(7))
End If
End If
Next k
End Sub
Private Sub RepereTraceFonctions(Shapes)
Dim intervalle As String
Dim triArray(0 To 1002, 0 To 1) As Single
Dim secArray() As Single
Dim UnArray(0 To 1002, 0 To 1) As Single
Dim DeuxArray() As Single
Dim TroisArray(0 To 1002, 0 To 1) As Single
Dim QuatreArray() As Single
Dim x1 As Double
Dim y1 As Double
Dim UneCourbe As Object
Dim MaFonction1 As String, MaFonction2 As String
Dim k, TraceZone1, TraceZone2, RGBZone1, RGBZone2, MaFonction, TypeFonction
Dim a, b, c, Defini, tmin, tmax, i, pas, pasb, ix, UneFonction$
Dim aDefini, Depassement, aix, bDefini, ancieny1, j, i1, i2, na
Dim Defini1, Defini2, x2, y2, xint1 as single, yint1 as single, xint2 as single, yint2 as single, xint3 as single, yint3 as single, xint4 as single, yint4 as single
Dim UneTangente, bDefini1, bDefini2, UneFonction1$, UneFonction2$
Dim aDefini1, aDefini2, fini, xx1, xx2
Dim tab() as string
oRepereForm.Model.Label20.Label = Chaine("tracfonc") '"Tracé des fonctions"
For k = 0 To ListCount(oRepereForm, "ListBox5") - 1
ChargeParametre GetList(oRepereForm, "ComboBox45", k),tab(), ";"
TraceZone1 = tab(0)
RGBZone1 = tab(1)
ChargeParametre GetList(oRepereForm, "ComboBox46", k),tab(), ";"
TraceZone2 = tab(0)
RGBZone2 = tab(1)
MaFonction = GetList(oRepereForm, "ListBox5", k)
TypeFonction = Val(GetList(oRepereForm, "ComboBox42", k))
If TypeFonction > 2 Then
intervalle = GetList(oRepereForm, "ComboBox43", k)
a = InStr(1, intervalle, "[")
b = InStr(1, intervalle, "]")
c = InStr(1, intervalle, ";")
tmin = CalculeFonction(Mid(intervalle, a + 1, c - a - 1), Defini)
tmax = CalculeFonction(Mid(intervalle, c + 1, b - c - 1), Defini)
End If
i = 1
nbcourbe = 0
Select Case TypeFonction
Case 1, 2
If TypeFonction = 2 Then
Echange xmax, ymax
Echange xmin, ymin
End If
pas = (xmax - xmin) / 100
pasb = pas
ix = xmin - pasb
x1 = Fix(ix * 1000000000) / 1000000000
If TypeFonction = 2 Then RemplaceY MaFonction, "x"
UneFonction$ = MaFonction
RemplaceX UneFonction$, x1
aDefini = 1
y1 = CalculeFonction(UneFonction$, aDefini)
Depassement = False
If aDefini = 1 Then
If (y1 > ymax Or y1 < ymin) Then
aDefini = 0
Depassement = True
End If
End If
aix = ix
ix = ix + pasb
Do
If Sgn(ix) * Sgn(aix) = -1 Then
ix = 0
Else
If aDefini <> 0 And SigneDerivee(MaFonction, ix, pasb) * SigneDerivee(MaFonction, aix, pasb) = -1 Then
ix = aix
ChercheChangementDerivee MaFonction, SigneDerivee(MaFonction, aix, pasb), ix, pasb
pasb = pas
End If
End If
x1 = Fix(ix * 1000000000000#) / 1000000000000#
aix = ix
UneFonction$ = MaFonction
RemplaceX UneFonction$, x1
Defini = 1
y1 = CalculeFonction(UneFonction$, Defini)
Depassement = False
If Defini = 1 Then
If (y1 > ymax Or y1 < ymin) Then
Defini = 0
Depassement = True
End If
End If
If aDefini <> Defini Then
bDefini = Defini
ChercheChangement MaFonction, aDefini, ix - pasb, pasb, x1
aix = x1
UneFonction$ = MaFonction
RemplaceX UneFonction$, x1
Defini = 1
y1 = CalculeFonction(UneFonction$, Defini)
If Defini = 1 Or Depassement Then
If TypeFonction = 1 Then
triArray(i-1, 0) = posx + x1 * dx + y1 * dy * Cos(angleaxe)
triArray(i-1, 1) = posy - y1 * dy * Sin(angleaxe)
ancieny1 = y1
If Depassement Then
If y1 > ymax Then y1 = ymax
If y1 < ymin Then y1 = ymin
End If
UnArray(i-1, 0) = posx + x1 * dx + y1 * dy * Cos(angleaxe)
UnArray(i-1, 1) = posy - max(0, y1) * dy * Sin(angleaxe)
TroisArray(i-1, 0) = posx + x1 * dx + y1 * dy * Cos(angleaxe)
TroisArray(i-1, 1) = posy - Min(0, y1) * dy * Sin(angleaxe)
y1 = ancieny1
Else
triArray(i-1, 0) = posx + y1 * dx + x1 * dy * Cos(angleaxe)
triArray(i-1, 1) = posy - x1 * dy * Sin(angleaxe)
End If
i = i + 1
End If
Defini = bDefini
aDefini = Defini
If i > 2 Then
pasb = pas
ReDim secArray(0 To i - 2, 0 To 1)
For j = 1 To i - 1
secArray(j-1, 0) = triArray(j-1, 0)
secArray(j-1, 1) = triArray(j-1, 1)
Next j
If TraceZone1 Then
ReDim DeuxArray(0 To i, 0 To 1)
For j = 1 To i - 1
DeuxArray(j-1, 0) = UnArray(j-1, 0)
DeuxArray(j-1, 1) = UnArray(j-1, 1)
Next j
DeuxArray(j-1, 0) = DeuxArray(j - 2, 0)
DeuxArray(j-1, 1) = posy
DeuxArray(j, 0) = DeuxArray(0, 0)
DeuxArray(j, 1) = posy
UneCourbe = InserePolygoneB(DeuxArray(), j, Shapes)
RemplissageForme UneCourbe, RGBZone1, 80
End If
If TraceZone2 Then
ReDim QuatreArray(0 To i, 0 To 1)
For j = 1 To i - 1
QuatreArray(j-1, 0) = TroisArray(j-1, 0)
QuatreArray(j-1, 1) = TroisArray(j-1, 1)
Next j
QuatreArray(j-1, 0) = QuatreArray(j - 2, 0)
QuatreArray(j-1, 1) = posy
QuatreArray(j, 0) = QuatreArray(0, 0)
QuatreArray(j, 1) = posy
UneCourbe = InserePolygoneB(QuatreArray(), j, Shapes)
RemplissageForme UneCourbe, RGBZone2, 80
End If
If Defini = 0 Or Depassement Then
UneCourbe = InsereCourbe(secArray(), ubound(secArray()), Shapes)
OAttribut UneCourbe, GetList(oRepereForm, "ComboBox2", k), GetList(oRepereForm, "ComboBox3", k), GetList(oRepereForm, "ComboBox4", k)
nbcourbe = nbcourbe + 1
End If
' For j = 1 To UneCourbe.Nodes.Count
' UneCourbe.Nodes.SetSegmentType j, msoSegmentCurve
' Next j
End If
i = 1
i1 = 1
i2 = 1
End If
ix = x1
pasb = pas
If Defini = 1 Or Depassement Then
aDefini = Defini
If TypeFonction = 1 Then
triArray(i-1, 0) = posx + x1 * dx + y1 * dy * Cos(angleaxe)
triArray(i-1, 1) = posy - y1 * dy * Sin(angleaxe)
ancieny1 = y1
If Depassement Then
If y1 > ymax Then y1 = ymax
If y1 < ymin Then y1 = ymin
End If
UnArray(i-1, 0) = posx + x1 * dx + y1 * dy * Cos(angleaxe)
UnArray(i-1, 1) = posy - max(0, y1) * dy * Sin(angleaxe)
TroisArray(i-1, 0) = posx + x1 * dx + y1 * dy * Cos(angleaxe)
TroisArray(i-1, 1) = posy - Min(0, y1) * dy * Sin(angleaxe)
y1 = ancieny1
Else
triArray(i-1, 0) = posx + y1 * dx + x1 * dy * Cos(angleaxe)
triArray(i-1, 1) = posy - x1 * dy * Sin(angleaxe)
End If
i = i + 1
End If
ix = ix + pasb
Loop While ((ix < xmax) And (TypeFonction = 1)) Or ((ix < ymax) And (TypeFonction = 2))
If i > 2 Then
ReDim secArray(0 To i - 2, 0 To 1)
For j = 1 To i - 1
secArray(j-1, 0) = triArray(j-1, 0)
secArray(j-1, 1) = triArray(j-1, 1)
Next j
If TraceZone1 Then
ReDim DeuxArray(0 To i, 0 To 1)
For j = 1 To i - 1
DeuxArray(j-1, 0) = UnArray(j-1, 0)
DeuxArray(j-1, 1) = UnArray(j-1, 1)
Next j
DeuxArray(j-1, 0) = DeuxArray(j - 2, 0)
DeuxArray(j-1, 1) = posy
DeuxArray(j, 0) = DeuxArray(0, 0)
DeuxArray(j, 1) = posy
UneCourbe = InserePolygoneB(DeuxArray(), i+1, Shapes)
RemplissageForme UneCourbe, RGBZone1, 80
End If
If TraceZone2 Then
ReDim QuatreArray(0 To i, 0 To 1)
For j = 1 To i - 1
QuatreArray(j-1, 0) = TroisArray(j-1, 0)
QuatreArray(j-1, 1) = TroisArray(j-1, 1)
Next j
QuatreArray(j-1, 0) = QuatreArray(j - 2, 0)
QuatreArray(j-1, 1) = posy
QuatreArray(j, 0) = QuatreArray(0, 0)
QuatreArray(j, 1) = posy
UneCourbe = InserePolygoneB(QuatreArray(), i+1, Shapes)
RemplissageForme UneCourbe, RGBZone2, 80
End If
If Not Depassement Then
nbcourbe = nbcourbe + 1
UneCourbe = InsereCourbe(secArray(), ubound(secArray())+1, Shapes)
OAttribut UneCourbe, GetList(oRepereForm, "ComboBox2", k), GetList(oRepereForm, "ComboBox3", k), GetList(oRepereForm, "ComboBox4", k)
End If
' For j = 1 To UneCourbe.Nodes.Count
' UneCourbe.Nodes.SetSegmentType j, msoSegmentCurve
' Next j
i = 1
End If
Dim tababscisse() As String
If TypeFonction = 1 And oRepereForm.Model.CheckBox29.State Then
na = ExtraitAbscisse(oRepereForm.Model.TextBox33.Text, tababscisse)
For i = 1 To na
UneFonction$ = MaFonction
RemplaceX UneFonction$, "(" & tababscisse(i) & ")"
Defini1 = 1
Defini2 = 1
x1 = CalculeFonction(tababscisse(i), Defini1)
y1 = CalculeFonction(UneFonction$, Defini2)
If Defini1 = 1 And Defini2 = 1 Then
Dim unangle
Dim oui1 as Boolean
Dim oui2 as Boolean
Dim oui3 as Boolean
Dim oui4 as Boolean
a = CalculeDerivee(MaFonction, x1)
unangle = Atn(a)
x2 = x1 + 10 * Cos(unangle)
y2 = y1 + 10 * Sin(unangle)
oui1 = TrouveIntersection(xmin, ymax, xmax, ymax, x1, y1, x2, y2, xint1, yint1)
oui2 = TrouveIntersection(xmin, ymin, xmax, ymin, x1, y1, x2, y2, xint2, yint2)
oui3 = TrouveIntersection(xmin, ymin, xmin, ymax, x1, y1, x2, y2, xint3, yint3)
oui4 = TrouveIntersection(xmax, ymin, xmax, ymax, x1, y1, x2, y2, xint4, yint4)
x1 = posx + x1 * dx + y1 * dy * Cos(angleaxe)
y1 = posy - y1 * dy * Sin(angleaxe)
x2 = posx + x2 * dx + y2 * dy * Cos(angleaxe)
y2 = posy - y2 * dy * Sin(angleaxe)
unangle = -Atn(a) + Pi / 2
UneTangente = InsereLigne(x1 + 50 * Cos(unangle), y1 + 50 * Sin(unangle), x1 - 50 * Cos(unangle), y1 - 50 * Sin(unangle), Shapes)
IOAttribut UneTangente, oRepereForm.Model.Image23
x1 = xmax + 1
If oui1 And xint1 >= xmin And xint1 <= xmax And yint1 >= ymin And yint1 <= ymax Then
If x1 = xmax + 1 Then
x1 = xint1
y1 = yint1
Else
x2 = xint1
y2 = yint1
End If
End If
If oui2 And xint2 >= xmin And xint2 <= xmax And yint2 >= ymin And yint2 <= ymax Then
If x1 = xmax + 1 Then
x1 = xint2
y1 = yint2
Else
x2 = xint2
y2 = yint2
End If
End If
If oui3 And xint3 >= xmin And xint3 <= xmax And yint3 >= ymin And yint3 <= ymax Then
If x1 = xmax + 1 Then
x1 = xint3
y1 = yint3
Else
x2 = xint3
y2 = yint3
End If
End If
If oui4 And xint4 >= xmin And xint4 <= xmax And yint4 >= ymin And yint4 <= ymax Then
If x1 = xmax + 1 Then
x1 = xint4
y1 = yint4
Else
x2 = xint4
y2 = yint4
End If
End If
x1 = posx + x1 * dx + y1 * dy * Cos(angleaxe)
y1 = posy - y1 * dy * Sin(angleaxe)
x2 = posx + x2 * dx + y2 * dy * Cos(angleaxe)
y2 = posy - y2 * dy * Sin(angleaxe)
UneTangente = InsereLigne(x1, y1, x2, y2, Shapes)
IOAttribut UneTangente, oRepereForm.Model.Image23
End If
Next i
End If
If TypeFonction = 2 Then
Echange xmax, ymax
Echange xmin, ymin
End If
Case 3, 4
bDefini1 = 1
bDefini2 = 1
a = InStr(1, MaFonction, ";")
MaFonction1 = Left(MaFonction, a - 1)
MaFonction2 = Mid(MaFonction, a + 1)
If TypeFonction = 4 Then
MaFonction1 = "(" & Left(MaFonction, a - 1) & ")*cos(" & Mid(MaFonction, a + 1) & ")"
MaFonction2 = "(" & Left(MaFonction, a - 1) & ")*sin(" & Mid(MaFonction, a + 1) & ")"
End If
pas = (tmax - tmin) / 100
pasb = pas
ix = tmin - pasb
x1 = Fix(ix * 1000000000) / 1000000000
RemplaceT MaFonction1, "x"
RemplaceT MaFonction2, "x"
UneFonction1$ = MaFonction1
UneFonction2$ = MaFonction2
RemplaceX UneFonction1$, x1
RemplaceX UneFonction2$, x1
aDefini1 = 1
aDefini2 = 1
y1 = CalculeFonction(UneFonction1$, aDefini1)
y2 = CalculeFonction(UneFonction2$, aDefini2)
If aDefini1 = 1 And (y1 > xmax Or y1 < xmin) Then aDefini1 = 0
If aDefini2 = 1 And (y2 > ymax Or y2 < ymin) Then aDefini2 = 0
aix = ix
ix = ix + pasb
fini = 0
Do
If Sgn(ix) * Sgn(aix) = -1 Then
ix = 0
Else
If aDefini1 <> 0 And SigneDerivee(MaFonction1, ix, pasb) * SigneDerivee(MaFonction1, aix, pasb) = -1 Then
ix = aix
ChercheChangementDerivee MaFonction1, SigneDerivee(MaFonction1, aix, pasb), ix, pasb
pasb = pas
End If
If aDefini2 <> 0 And SigneDerivee(MaFonction2, ix, pasb) * SigneDerivee(MaFonction2, aix, pasb) = -1 Then
ix = aix
ChercheChangementDerivee MaFonction2, SigneDerivee(MaFonction2, aix, pasb), ix, pasb
pasb = pas
End If
End If
x1 = Fix(ix * 1000000000000#) / 1000000000000#
aix = ix
UneFonction1$ = MaFonction1
UneFonction2$ = MaFonction2
RemplaceX UneFonction1$, x1
RemplaceX UneFonction2$, x1
Defini1 = 1
Defini2 = 1
y1 = CalculeFonction(UneFonction1$, Defini1)
y2 = CalculeFonction(UneFonction2$, Defini2)
If Defini1 = 1 And (y1 > xmax Or y1 < xmin) Then Defini1 = 0
If Defini2 = 1 And (y2 > ymax Or y2 < ymin) Then Defini2 = 0
If aDefini1 <> Defini1 Or aDefini2 <> Defini2 Then
If aDefini1 <> Defini1 Then
bDefini1 = Defini1
ChercheChangement MaFonction1, aDefini1, ix - pasb, pasb, xx1, True
x1 = xx1
End If
If aDefini2 <> Defini2 Then
bDefini2 = Defini2
ChercheChangement MaFonction2, aDefini2, ix - pasb, pasb, xx2
If xx2 > x1 Then x1 = xx2
End If
aix = x1
UneFonction1$ = MaFonction1
UneFonction2$ = MaFonction2
RemplaceX UneFonction1$, x1
RemplaceX UneFonction2$, x1
Defini1 = 1
Defini2 = 1
y1 = CalculeFonction(UneFonction1$, Defini1)
y2 = CalculeFonction(UneFonction2$, Defini1)
If Defini1 = 1 And Defini2 = 1 Then
triArray(i-1, 0) = posx + y1 * dx + y2 * dy * Cos(angleaxe)
triArray(i-1, 1) = posy - y2 * dy * Sin(angleaxe)
i = i + 1
End If
Defini1 = bDefini1
Defini2 = bDefini2
aDefini1 = Defini1
aDefini2 = Defini2
If i > 2 Then
pasb = pas
nbcourbe = nbcourbe + 1
ReDim secArray(0 To i - 2, 0 To 1)
For j = 1 To i - 1
secArray(j-1, 0) = triArray(j-1, 0)
secArray(j-1, 1) = triArray(j-1, 1)
Next j
UneCourbe = InsereCourbe(secArray(), i-1, Shapes)
OAttribut UneCourbe, GetList(oRepereForm, "ComboBox2", k), GetList(oRepereForm, "ComboBox3", k), GetList(oRepereForm, "ComboBox4", k)
' For j = 1 To UneCourbe.Nodes.Count
' UneCourbe.Nodes.SetSegmentType j, msoSegmentCurve
' Next j
End If
i = 1
End If
ix = x1
pasb = pas
If Defini1 = 1 And Defini2 = 1 Then
aDefini1 = 1
aDefini2 = 1
triArray(i-1, 0) = posx + y1 * dx + y2 * dy * Cos(angleaxe)
triArray(i-1, 1) = posy - y2 * dy * Sin(angleaxe)
i = i + 1
End If
ix = ix + pasb
If ix >= tmax And fini = 0 Then
ix = tmax
fini = 1
End If
Loop While (ix <= tmax)
If i > 2 Then
nbcourbe = nbcourbe + 1
ReDim secArray(0 To i - 2, 0 To 1)
For j = 1 To i - 1
secArray(j-1, 0) = triArray(j-1, 0)
secArray(j-1, 1) = triArray(j-1, 1)
Next j
UneCourbe = InsereCourbe(secArray(), i-1, Shapes)
OAttribut UneCourbe, GetList(oRepereForm, "ComboBox2", k), GetList(oRepereForm, "ComboBox3", k), GetList(oRepereForm, "ComboBox4", k)
' For j = 1 To UneCourbe.Nodes.Count
' UneCourbe.Nodes.SetSegmentType j, msoSegmentCurve
' Next j
i = 1
End If
End Select
Next k
End Sub
Private Function ExtraitAbscisse(texte, tababscisse) As Integer
Dim i, a, j, b
If Right(texte, 1) <> ";" Then texte = texte & ";"
i = NombreTexte(1, texte, ";")
ReDim tababscisse(1 To i)
a = 1
For j = 1 To i
b = InStr(a, texte, ";")
tababscisse(j) = Mid(texte, a, b - a)
a = b + 1
Next j
ExtraitAbscisse = i
End Function
Private Sub RepereTraceSegments(Shapes as Object)
Dim j, i, texte$, x0, y0, x1, y1, xi, yi, anglesegment, unCode$, k, trait1 as Object, trait2 as Object
oRepereForm.Model.Label20.Label = Chaine ("tracseg") '"Tracé des segments"
For j = 0 To ListCount(oRepereForm, "ListBox2") - 1
i = 1
texte$ = GetList(oRepereForm, "ListBox2", j)
If InStr(1, texte$, ";") <> 0 Then
ExtraitSegment texte$, i, x0, y0, x1, y1
Else
ExtraitSegmentPoint texte$, i, x0, y0, x1, y1
End If
If i <> -1 Then
x0 = posx + x0 * dx + y0 * dy * Cos(angleaxe)
y0 = posy - y0 * dy * Sin(angleaxe)
x1 = posx + x1 * dx + y1 * dy * Cos(angleaxe)
y1 = posy - y1 * dy * Sin(angleaxe)
trait1 = InsereLigne(x0, y0, x1, y1, Shapes)
OAttribut trait1, GetList(oRepereForm, "ComboBox15", j), GetList(oRepereForm, "ComboBox16", j), GetList(oRepereForm, "ComboBox17", j)
If InStr(1, texte$, ";") <> 0 Then
MarqueExtremites x0, y0, x1, y1, Shapes, trait1, trait2
OAttribut trait1, GetList(oRepereForm, "ComboBox15", j), GetList(oRepereForm, "ComboBox16", j), GetList(oRepereForm, "ComboBox17", j)
OAttribut trait2, GetList(oRepereForm, "ComboBox15", j), GetList(oRepereForm, "ComboBox16", j), GetList(oRepereForm, "ComboBox17", j)
End If
If val(GetList(oRepereForm, "ComboBox32", j)) Then
xi = (x0 + x1) / 2
yi = (y0 + y1) / 2
anglesegment = CalculeAngle(x0, y0, x1, y1) + Pi / 2
trait1 = MarqueMilieu(x0, y0, x1, y1, Shapes)
OAttribut trait1, GetList(oRepereForm, "ComboBox15", j), GetList(oRepereForm, "ComboBox16", j), GetList(oRepereForm, "ComboBox17", j)
If val(GetList(oRepereForm, "ComboBox34", j)) Then
trait1 = CodeLongueur(x0, y0, xi, yi, 2, Shapes)
OAttribut trait1, GetList(oRepereForm, "ComboBox15", j), GetList(oRepereForm, "ComboBox16", j), GetList(oRepereForm, "ComboBox17", j)
trait1 = CodeLongueur(xi, yi, x1, y1, 2, Shapes)
OAttribut trait1, GetList(oRepereForm, "ComboBox15", k), GetList(oRepereForm, "ComboBox16", k), GetList(oRepereForm, "ComboBox17", k)
End If
If GetList(oRepereForm, "ComboBox33", j) <> "*" Then
InsereTexte(xi + 15 * Cos(anglesegment), yi + 15 * Sin(anglesegment), GetList(oRepereForm, "ComboBox33", j), Shapes)
End If
End If
End If
Next j
End Sub
Private Sub RepereTraceDroites(Shapes as Object)
Dim secArray() As Single
Dim triArray() As Single
Dim j, i, texte$, a, b, c
Dim x1, y1, x2, y2, xx1, yy1, xx2, yy2, x6, y6, x5, y5, x4, y4, x3, y3
Dim tab1, tab2, zone, zone1, ang1
Dim unVecteur as Object
oRepereForm.Model.Label20.Label = Chaine("tracdroi") '"Tracé des droites"
For j = 0 To ListCount(oRepereForm, "ListBox4") - 1
i = 1
texte$ = GetList(oRepereForm, "ListBox4", j)
If InStr(1, texte$, "(") <> 0 And InStr(1, texte$, ")") <> 0 Then
ExtraitDroitePoint texte$, i, a, b, c, eqdroite$
Else
If InStr(1, texte$, ">") Then AnalyseEquationDroite texte$, a, b, c, ">"
If InStr(1, texte$, "<") Then AnalyseEquationDroite texte$, a, b, c, "<"
If InStr(1, texte$, "=") Then AnalyseEquationDroite texte$, a, b, c, "="
' ExtraitDroite texte$, i, a, b, c, eqdroite$
End If
If i <> -1 Then
If a = 0 Then
x1 = xmin
y1 = -c / b
x2 = xmax
y2 = -c / b
Else
If b = 0 Then
x1 = -c / a
y1 = ymax
x2 = -c / a
y2 = ymin
Else
x1 = xmin
y1 = (-a * x1 - c) / b
If y1 < ymin Then
y1 = ymin
x1 = (-c - b * y1) / a
End If
If y1 > ymax Then
y1 = ymax
x1 = (-c - b * y1) / a
End If
x2 = xmax
y2 = (-a * x2 - c) / b
If y2 > ymax Then
y2 = ymax
x2 = (-c - b * y2) / a
End If
If y2 < ymin Then
y2 = ymin
x2 = (-c - b * y2) / a
End If
End If
End If
xx1 = x1
yy1 = y1
xx2 = x2
yy2 = y2
x1 = posx + x1 * dx + y1 * dy * Cos(angleaxe)
y1 = posy - y1 * dy * Sin(angleaxe)
x2 = posx + x2 * dx + y2 * dy * Cos(angleaxe)
y2 = posy - y2 * dy * Sin(angleaxe)
unVecteur = InsereLigne(x1, y1, x2, y2, Shapes)
If InStr(1, texte$, ">") <> 0 Or InStr(1, texte$, "<") <> 0 Then
x6 = posx + xmin * dx + ymin * dy * Cos(angleaxe)
y6 = posy - ymin * dy * Sin(angleaxe)
x5 = posx + xmax * dx + ymin * dy * Cos(angleaxe)
y5 = posy - ymin * dy * Sin(angleaxe)
x4 = posx + xmax * dx + ymax * dy * Cos(angleaxe)
y4 = posy - ymax * dy * Sin(angleaxe)
x3 = posx + xmin * dx + ymax * dy * Cos(angleaxe)
y3 = posy - ymax * dy * Sin(angleaxe)
tab1 = Array("", "3213", "34213", "345213", "4214", "45214", "63216", "634216")
tab2 = Array("", "124561", "12561", "1261", "125631", "12631", "12451", "1251")
If xx1 = xmin Then
If yy2 = ymax Then zone = 1
If xx2 = xmax Then zone = 2
If yy2 = ymin Then zone = 3
End If
If yy1 = ymax Then
If xx2 = xmax Then zone = 4
If yy2 = ymin Then zone = 5
End If
If yy1 = ymin Then
If yy2 = ymax Then zone = 6
If xx2 = xmax Then zone = 7
End If
ReDim secArray(0 To Len(tab1(zone))-1, 0 To 1)
ReDim triArray(0 To Len(tab2(zone))-1, 0 To 1)
RempliTableau secArray(), tab1(zone), x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6
RempliTableau triArray(), tab2(zone), x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6
If (InStr(1, texte$, ">") And b > 0) Or (InStr(1, texte$, "<") And b < 0) Then zone1 = InserePolygoneB(secArray(), Len(tab1(zone)), Shapes)
If (InStr(1, texte$, "<") And b > 0) Or (InStr(1, texte$, ">") And b < 0) Then zone1 = InserePolygoneB(triArray(), Len(tab2(zone)), Shapes)
RemplissageForme zone1, Val(GetList(oRepereForm, "ComboBox44", j)),80
End If
OAttribut UnVecteur, GetList(oRepereForm, "ComboBox9", j), GetList(oRepereForm, "ComboBox10", j), GetList(oRepereForm, "ComboBox11", j)
If val(GetList(oRepereForm, "ComboBox37", j)) Then
If b = 0 Then
ang1 = 90
Else
ang1 = Atn(-a / b) * 180 / Pi
End If
InsereTexte texte$, x2 - 500 * Sin(ang1 * Pi / 180), y2 - 500 * Cos(ang1 * Pi / 180), Shapes, (ang1 - (90 - angleaxe * 180 / Pi))*100
End If
NbDroite = NbDroite + 1
End If
Next j
End Sub
Private Sub RempliTableau(secArray, texte, x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6)
Dim i
For i = 1 To Len(texte)
Select Case Val(Mid(texte, i, 1))
Case 1
secArray(i-1, 0) = x1
secArray(i-1, 1) = y1
Case 2
secArray(i-1, 0) = x2
secArray(i-1, 1) = y2
Case 3
secArray(i-1, 0) = x3
secArray(i-1, 1) = y3
Case 4
secArray(i-1, 0) = x4
secArray(i-1, 1) = y4
Case 5
secArray(i-1, 0) = x5
secArray(i-1, 1) = y5
Case 6
secArray(i-1, 0) = x6
secArray(i-1, 1) = y6
End Select
Next i
End Sub
Function TraceParabole(posx, posy, xmin, xmax, ymin, ymax, dx, dy, angleaxe, p, TraceFoyer, TraceDirectrice, Ajoute) as Object
Dim secArray(0 To 127, 0 To 1) As Single
Dim secArray2() As Single
Dim i, xi, j, xx, yy, x0, y0, x1, y1
Dim courbe1 as Object
i = 1
xi = Min(p * 2.5, xmax)
For j = xi To 0 Step -xi / 63
xx = j
yy = Sqr(2 * p * j)
If yy <= ymax Then
CalculeCoordonnees xx, yy, posx, posy, dx, dy, angleaxe
secArray(i-1, 0) = xx
secArray(i-1, 1) = yy
i = i + 1
End If
Next j
For j = 0 + xi / 63 To xi Step xi / 63
xx = j
yy = -Sqr(2 * p * j)
If yy >= ymin Then
CalculeCoordonnees xx, yy, posx, posy, dx, dy, angleaxe
secArray(i-1, 0) = xx
secArray(i-1, 1) = yy
i = i + 1
End If
Next j
ReDim secArray2(0 To i - 2, 0 To 1) As Single
For j = 1 To i - 1
secArray2(j-1, 0) = secArray(j-1, 0)
secArray2(j-1, 1) = secArray(j-1, 1)
Next j
courbe1 = InsereCourbe(secArray2(), i-1, Ajoute)
If TraceFoyer Then
xx = p / 2
yy = 0
CalculeCoordonnees xx, yy, posx, posy, dx, dy, angleaxe
croix xx, yy, Ajoute
InsereTexte "F", xx - 10, yy - 10, Ajoute
End If
If TraceDirectrice Then
x0 = -p / 2
y0 = ymin
x1 = x0
y1 = ymax
CalculeCoordonnees x0, y0, posx, posy, dx, dy, angleaxe
CalculeCoordonnees x1, y1, posx, posy, dx, dy, angleaxe
InsereLigne x0, y0, x1, y1, Ajoute
End If
TraceParabole = courbe1
End Function
Function TraceHyperbole(posx, posy, xmin, xmax, ymin, ymax, dx, dy, angleaxe, a, b, TraceFoyer, TraceDirectrice, TraceAsymptote, Ajoute) as Object
Dim secArray(0 To 127, 0 To 1) As Single
Dim secArray2() As Single
Dim i, j, xx, yy, x0, y0, x1, y1
Dim pgroupe as Object
Dim courbe1 as Object
pgroupe = InitialiseGroupe()
i = 1
For j = ymin To ymax Step (ymax - ymin) / 127
xx = Sqr((1 + j ^ 2 / (b ^ 2)) * a ^ 2)
yy = j
If xx >= xmin And xx <= xmax Then
CalculeCoordonnees xx, yy, posx, posy, dx, dy, angleaxe
If i < 128 Then
secArray(i-1, 0) = xx
secArray(i-1, 1) = yy
i = i + 1
End If
End If
Next j
ReDim secArray2(0 To i - 2, 0 To 1) As Single
For j = 1 To i - 1
secArray2(j-1, 0) = secArray(j-1, 0)
secArray2(j-1, 1) = secArray(j-1, 1)
Next j
InsereCourbe(secArray2(), i-1, pgroupe)
i = 1
For j = ymin To ymax Step (ymax - ymin) / 127
xx = -Sqr((1 + j ^ 2 / (b ^ 2)) * a ^ 2)
yy = j
If xx >= xmin And xx <= xmax Then
CalculeCoordonnees xx, yy, posx, posy, dx, dy, angleaxe
If i < 128 Then
secArray(i-1, 0) = xx
secArray(i-1, 1) = yy
i = i + 1
End If
End If
Next j
ReDim secArray2(0 To i - 2, 0 To 1) As Single
For j = 1 To i - 1
secArray2(j-1, 0) = secArray(j-1, 0)
secArray2(j-1, 1) = secArray(j-1, 1)
Next j
InsereCourbe(secArray2(), i-1, pgroupe)
courbe1=GroupeObjet(pGroupe)
Ajoute.add(courbe1)
If TraceFoyer Then
xx = -Sqr(a ^ 2 + b ^ 2)
yy = 0
CalculeCoordonnees xx, yy, posx, posy, dx, dy, angleaxe
croix xx, yy, Ajoute
InsereTexte "F", xx - 10, yy - 10, Ajoute
xx = Sqr(a ^ 2 + b ^ 2)
yy = 0
CalculeCoordonnees xx, yy, posx, posy, dx, dy, angleaxe
croix xx, yy, Ajoute
InsereTexte "F'", xx - 10, yy - 10, Ajoute
End If
If TraceDirectrice Then
x0 = -(a ^ 2 / Sqr(a ^ 2 + b ^ 2))
y0 = ymin
x1 = x0
y1 = ymax
CalculeCoordonnees x0, y0, posx, posy, dx, dy, angleaxe
CalculeCoordonnees x1, y1, posx, posy, dx, dy, angleaxe
InsereLigne x0, y0, x1, y1, Ajoute
x0 = a ^ 2 / Sqr(a ^ 2 + b ^ 2)
x1 = x0
y0 = ymin
y1 = ymax
CalculeCoordonnees x0, y0, posx, posy, dx, dy, angleaxe
CalculeCoordonnees x1, y1, posx, posy, dx, dy, angleaxe
InsereLigne x0, y0, x1, y1, Ajoute
End If
If TraceAsymptote Then
y0 = ymin
x0 = y0 * a / b
If x0 < xmin Or x0 > xmax Then
x0 = xmin
y0 = x0 * b / a
End If
y1 = ymax
x1 = y1 * a / b
If x1 < xmin Or x1 > xmax Then
x1 = xmax
y1 = x1 * b / a
End If
CalculeCoordonnees x0, y0, posx, posy, dx, dy, angleaxe
CalculeCoordonnees x1, y1, posx, posy, dx, dy, angleaxe
InsereLigne x0, y0, x1, y1, Ajoute
y0 = ymin
x0 = -y0 * a / b
If x0 < xmin Or x0 > xmax Then
x0 = xmin
y0 = -x0 * b / a
End If
y1 = ymax
x1 = -y1 * a / b
If x1 < xmin Or x1 > xmax Then
x1 = xmax
y1 = -x1 * b / a
End If
CalculeCoordonnees x0, y0, posx, posy, dx, dy, angleaxe
CalculeCoordonnees x1, y1, posx, posy, dx, dy, angleaxe
InsereLigne x0, y0, x1, y1, Ajoute
End If
TraceHyperbole = courbe1
End Function
Function TraceEllipse(posx, posy, xmin, xmax, ymin, ymax, dx, dy, angleaxe, a, b, TraceFoyer, TraceDirectrice, Ajoute) as Object
Dim secArray(0 To 126, 0 To 1) As Single
Dim secArray2() As Single
Dim i, j, xx, yy, k, InverseAxe, x0, y0, x1, y1
Dim pgroupe as Object
Dim courbe1 as Object
pgroupe = InitialiseGroupe()
i = 1
For j = 0 To 2 * Pi Step 0.05
xx = a * Cos(j)
yy = b * Sin(j)
If xx < xmin Or xx > xmax Or yy < ymin Or yy > ymax Then
If i > 2 Then
ReDim secArray2(0 To i - 2, 0 To 1) As Single
For k = 1 To i - 1
secArray2(k-1, 0) = secArray(k-1, 0)
secArray2(k-1, 1) = secArray(k-1, 1)
Next k
InsereCourbe(secArray2(), i-1, pgroupe)
End If
i = 1
Else
CalculeCoordonnees xx, yy, posx, posy, dx, dy, angleaxe
secArray(i-1, 0) = xx
secArray(i-1, 1) = yy
i = i + 1
End If
Next j
If i = 127 Then
secArray(i-1, 0) = secArray(0, 0)
secArray(i-1, 1) = secArray(0, 1)
InsereCourbe secArray(), 127, pgroupe
Else
If i > 2 Then
ReDim secArray2(0 To i - 2, 0 To 1) As Single
For k = 1 To i - 1
secArray2(k-1, 0) = secArray(k-1, 0)
secArray2(k-1, 1) = secArray(k-1, 1)
Next k
InsereCourbe(secArray2(), i-1, pgroupe)
End If
End If
courbe1=GroupeObjet(pGroupe)
Ajoute.add(courbe1)
InverseAxe = (a < b)
If TraceFoyer Then
xx = Sqr(max(a, b) ^ 2 - Min(b, a) ^ 2)
If xx <= MIif(InverseAxe, ymax, xmax) Then
yy = 0
If InverseAxe Then Echange xx, yy
CalculeCoordonnees xx, yy, posx, posy, dx, dy, angleaxe
croix xx, yy, Ajoute
InsereTexte "F", xx - 10, yy - 10, Ajoute
End If
xx = -Sqr(max(a, b) ^ 2 - Min(b, a) ^ 2)
If xx >= MIif(InverseAxe, ymin, xmin) Then
yy = 0
If InverseAxe Then Echange xx, yy
CalculeCoordonnees xx, yy, posx, posy, dx, dy, angleaxe
croix xx, yy, Ajoute
InsereTexte "F'", xx - 10, yy - 10, Ajoute
End If
End If
If TraceDirectrice Then
x0 = a ^ 2 / Sqr(max(a, b) ^ 2 - Min(b, a) ^ 2)
If x0 <= MIif(InverseAxe, ymax, xmax) Then
y0 = ymin
x1 = x0
y1 = ymax
If InverseAxe Then
Echange x0, y0
Echange x1, y1
End If
CalculeCoordonnees x0, y0, posx, posy, dx, dy, angleaxe
CalculeCoordonnees x1, y1, posx, posy, dx, dy, angleaxe
InsereLigne x0, y0, x1, y1, Ajoute
End If
x0 = -a ^ 2 / Sqr(max(a, b) ^ 2 - Min(b, a) ^ 2)
If x0 >= MIif(InverseAxe, ymin, xmin) Then
x1 = x0
y0 = ymin
y1 = ymax
If InverseAxe Then
Echange x0, y0
Echange x1, y1
End If
CalculeCoordonnees x0, y0, posx, posy, dx, dy, angleaxe
CalculeCoordonnees x1, y1, posx, posy, dx, dy, angleaxe
InsereLigne x0, y0, x1, y1, Ajoute
End If
End If
TraceEllipse = courbe1
End Function
Sub AnalyseEquationDroite(texte$, a, b, c, Optional carac as String)
Dim i, i1, i2, i3, j, oppose, pp$, Defini
Dim ai
if ismissing(carac) then carac="="
i = 0
a = "*"
b = "*"
c = "*"
oppose = 1
Do
i1 = InStr(i + 1, texte$, "+")
If i1 = 0 Then i1 = 1000
i2 = InStr(i + 1, texte$, "-")
If i2 = 0 Then i2 = 1000
i3 = InStr(i + 1, texte$, carac)
If i3 = 0 Then i3 = 1000
j = Min(i1, Min(i2, i3))
If j = 1000 Then j = Len(texte$) + 1
if i=0 then ai=1 else ai=i
pp$ = Mid(texte$, ai, j - ai)
If InStr(1, pp$, "x") <> 0 Then
RemplaceTexte pp$, "x", "*1"
RemplaceTexte pp$, "**", "*"
RemplaceTexte pp$, "-*", "-"
RemplaceTexte pp$, "+*", "-"
If Left(pp, 1) = "*" Then pp$ = Mid(pp, 2)
a = CalculeFonction(pp$, Defini) * oppose
ElseIf InStr(1, pp$, "y") <> 0 Then
RemplaceTexte pp$, "y", "*1"
RemplaceTexte pp$, "**", "*"
RemplaceTexte pp$, "-*", "-"
RemplaceTexte pp$, "+*", "-"
If Left(pp, 1) = "*" Then pp$ = Mid(pp, 2)
b = CalculeFonction(pp$, Defini) * oppose
Else
If Left(pp, 1) = "=" Then pp$ = Mid(pp, 2)
c = CalculeFonction(pp$, Defini) * oppose
End If
If j = i3 Then oppose = -1
i = j
Loop While (j <> Len(texte$) + 1)
If a = "*" Then a = 0
If b = "*" Then b = 0
If c = "*" Then c = 0
End Sub
</script:module>
|