├── 3phase.dxf ├── 3phase.geo ├── 3phase.jpg ├── 3phase.p2dat ├── 3phase.py ├── DigiSim.dxf ├── DigiSim.fig ├── DigiSim.geo ├── DigiSim.jpg ├── DigiSim.m ├── DigiSim.p2dat ├── DigiSim.py ├── Image3D.mat ├── Image3D.py ├── LICENSE.txt ├── README.md ├── User Manual.docx ├── boundary_close.m ├── concrete.dxf ├── concrete.geo ├── concrete.inp ├── concrete.jpg ├── concrete.p2dat ├── concrete.py ├── concrete.xls ├── example1.m ├── example2.m ├── example3.m ├── example4.m ├── geometry.xls ├── mesh.stl ├── resource ├── data.mat └── logo.jpg └── subroutine ├── addthick.m ├── axis_length_direction.m ├── ball_generate.m ├── boundary_smooth.m ├── cart_sph.m ├── classify_poly5.m ├── dis_cal.m ├── dis_cal_surf.m ├── dxf_file_write.m ├── geo_sta_plot.m ├── geom_area.m ├── geom_axis.m ├── geom_plot.m ├── geom_scale.m ├── geom_stas.m ├── get_particle.m ├── get_refine_point.m ├── get_surf_points.m ├── get_xyz.m ├── gmsh_file_write.m ├── gmsh_write4.m ├── gmsh_write_refinment.m ├── judge_bou2.m ├── mbr_plot.m ├── merge_surf.m ├── minBoundingBox.m ├── min_bound_box2.m ├── out_abaqus_python.m ├── out_line.m ├── panduan_in.m ├── point_min_distance.m ├── point_surf_dist.m ├── rayTriangleIntersection ├── Readme.txt ├── license.txt ├── rayTriangleIntersection.m ├── screenshot.png └── test.m ├── regulization.m ├── sort_boun.m ├── sort_line.m ├── sort_line_mod2.m ├── vectorization2.m ├── vectorization3.m ├── voxel_surf.m ├── write_abaqus_2d.m ├── write_abaqus_2d_refinement.m ├── write_dxf_end.m ├── write_dxf_head.m ├── write_dxf_line.m ├── write_dxf_poly_line.m └── write_pfc_2d_group.m /3phase.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeoGroup/DigiSim/1255f9a8bab70532cca7505e487eac7efa5138d1/3phase.jpg -------------------------------------------------------------------------------- /DigiSim.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | ENTITIES 5 | 0 6 | POLYLINE 7 | 8 8 | 2 9 | 62 10 | 0 11 | 66 12 | 1 13 | 0 14 | VERTEX 15 | 8 16 | 2 17 | 62 18 | 0 19 | 10 20 | 212.000000 21 | 20 22 | 313.000000 23 | 30 24 | 0.000000 25 | 0 26 | VERTEX 27 | 8 28 | 2 29 | 62 30 | 0 31 | 10 32 | 233.000000 33 | 20 34 | 290.000000 35 | 30 36 | 0.000000 37 | 0 38 | VERTEX 39 | 8 40 | 2 41 | 62 42 | 0 43 | 10 44 | 241.000000 45 | 20 46 | 264.000000 47 | 30 48 | 0.000000 49 | 0 50 | VERTEX 51 | 8 52 | 2 53 | 62 54 | 0 55 | 10 56 | 239.000000 57 | 20 58 | 231.000000 59 | 30 60 | 0.000000 61 | 0 62 | VERTEX 63 | 8 64 | 2 65 | 62 66 | 0 67 | 10 68 | 227.000000 69 | 20 70 | 206.000000 71 | 30 72 | 0.000000 73 | 0 74 | VERTEX 75 | 8 76 | 2 77 | 62 78 | 0 79 | 10 80 | 209.000000 81 | 20 82 | 189.000000 83 | 30 84 | 0.000000 85 | 0 86 | VERTEX 87 | 8 88 | 2 89 | 62 90 | 0 91 | 10 92 | 187.000000 93 | 20 94 | 179.000000 95 | 30 96 | 0.000000 97 | 0 98 | VERTEX 99 | 8 100 | 2 101 | 62 102 | 0 103 | 10 104 | 172.000000 105 | 20 106 | 176.000000 107 | 30 108 | 0.000000 109 | 0 110 | VERTEX 111 | 8 112 | 2 113 | 62 114 | 0 115 | 10 116 | 117.000000 117 | 20 118 | 176.000000 119 | 30 120 | 0.000000 121 | 0 122 | VERTEX 123 | 8 124 | 2 125 | 62 126 | 0 127 | 10 128 | 117.000000 129 | 20 130 | 327.000000 131 | 30 132 | 0.000000 133 | 0 134 | VERTEX 135 | 8 136 | 2 137 | 62 138 | 0 139 | 10 140 | 175.000000 141 | 20 142 | 327.000000 143 | 30 144 | 0.000000 145 | 0 146 | VERTEX 147 | 8 148 | 2 149 | 62 150 | 0 151 | 10 152 | 195.000000 153 | 20 154 | 322.000000 155 | 30 156 | 0.000000 157 | 0 158 | VERTEX 159 | 8 160 | 2 161 | 62 162 | 0 163 | 10 164 | 212.000000 165 | 20 166 | 313.000000 167 | 30 168 | 0.000000 169 | 0 170 | SEQEND 171 | 0 172 | POLYLINE 173 | 8 174 | 2 175 | 62 176 | 0 177 | 66 178 | 1 179 | 0 180 | VERTEX 181 | 8 182 | 2 183 | 62 184 | 0 185 | 10 186 | 137.000000 187 | 20 188 | 310.000000 189 | 30 190 | 0.000000 191 | 0 192 | VERTEX 193 | 8 194 | 2 195 | 62 196 | 0 197 | 10 198 | 166.000000 199 | 20 200 | 310.000000 201 | 30 202 | 0.000000 203 | 0 204 | VERTEX 205 | 8 206 | 2 207 | 62 208 | 0 209 | 10 210 | 189.000000 211 | 20 212 | 305.000000 213 | 30 214 | 0.000000 215 | 0 216 | VERTEX 217 | 8 218 | 2 219 | 62 220 | 0 221 | 10 222 | 204.000000 223 | 20 224 | 296.000000 225 | 30 226 | 0.000000 227 | 0 228 | VERTEX 229 | 8 230 | 2 231 | 62 232 | 0 233 | 10 234 | 216.000000 235 | 20 236 | 279.000000 237 | 30 238 | 0.000000 239 | 0 240 | VERTEX 241 | 8 242 | 2 243 | 62 244 | 0 245 | 10 246 | 220.000000 247 | 20 248 | 263.000000 249 | 30 250 | 0.000000 251 | 0 252 | VERTEX 253 | 8 254 | 2 255 | 62 256 | 0 257 | 10 258 | 217.000000 259 | 20 260 | 229.000000 261 | 30 262 | 0.000000 263 | 0 264 | VERTEX 265 | 8 266 | 2 267 | 62 268 | 0 269 | 10 270 | 209.000000 271 | 20 272 | 214.000000 273 | 30 274 | 0.000000 275 | 0 276 | VERTEX 277 | 8 278 | 2 279 | 62 280 | 0 281 | 10 282 | 188.000000 283 | 20 284 | 198.000000 285 | 30 286 | 0.000000 287 | 0 288 | VERTEX 289 | 8 290 | 2 291 | 62 292 | 0 293 | 10 294 | 161.000000 295 | 20 296 | 193.000000 297 | 30 298 | 0.000000 299 | 0 300 | VERTEX 301 | 8 302 | 2 303 | 62 304 | 0 305 | 10 306 | 137.000000 307 | 20 308 | 194.000000 309 | 30 310 | 0.000000 311 | 0 312 | VERTEX 313 | 8 314 | 2 315 | 62 316 | 0 317 | 10 318 | 137.000000 319 | 20 320 | 310.000000 321 | 30 322 | 0.000000 323 | 0 324 | SEQEND 325 | 0 326 | POLYLINE 327 | 8 328 | 2 329 | 62 330 | 0 331 | 66 332 | 1 333 | 0 334 | VERTEX 335 | 8 336 | 2 337 | 62 338 | 0 339 | 10 340 | 269.000000 341 | 20 342 | 327.000000 343 | 30 344 | 0.000000 345 | 0 346 | VERTEX 347 | 8 348 | 2 349 | 62 350 | 0 351 | 10 352 | 289.000000 353 | 20 354 | 327.000000 355 | 30 356 | 0.000000 357 | 0 358 | VERTEX 359 | 8 360 | 2 361 | 62 362 | 0 363 | 10 364 | 289.000000 365 | 20 366 | 176.000000 367 | 30 368 | 0.000000 369 | 0 370 | VERTEX 371 | 8 372 | 2 373 | 62 374 | 0 375 | 10 376 | 269.000000 377 | 20 378 | 176.000000 379 | 30 380 | 0.000000 381 | 0 382 | VERTEX 383 | 8 384 | 2 385 | 62 386 | 0 387 | 10 388 | 269.000000 389 | 20 390 | 327.000000 391 | 30 392 | 0.000000 393 | 0 394 | SEQEND 395 | 0 396 | POLYLINE 397 | 8 398 | 2 399 | 62 400 | 0 401 | 66 402 | 1 403 | 0 404 | VERTEX 405 | 8 406 | 2 407 | 62 408 | 0 409 | 10 410 | 439.000000 411 | 20 412 | 323.000000 413 | 30 414 | 0.000000 415 | 0 416 | VERTEX 417 | 8 418 | 2 419 | 62 420 | 0 421 | 10 422 | 440.000000 423 | 20 424 | 301.000000 425 | 30 426 | 0.000000 427 | 0 428 | VERTEX 429 | 8 430 | 2 431 | 62 432 | 0 433 | 10 434 | 407.000000 435 | 20 436 | 312.000000 437 | 30 438 | 0.000000 439 | 0 440 | VERTEX 441 | 8 442 | 2 443 | 62 444 | 0 445 | 10 446 | 381.000000 447 | 20 448 | 311.000000 449 | 30 450 | 0.000000 451 | 0 452 | VERTEX 453 | 8 454 | 2 455 | 62 456 | 0 457 | 10 458 | 362.000000 459 | 20 460 | 302.000000 461 | 30 462 | 0.000000 463 | 0 464 | VERTEX 465 | 8 466 | 2 467 | 62 468 | 0 469 | 10 470 | 352.000000 471 | 20 472 | 292.000000 473 | 30 474 | 0.000000 475 | 0 476 | VERTEX 477 | 8 478 | 2 479 | 62 480 | 0 481 | 10 482 | 344.000000 483 | 20 484 | 278.000000 485 | 30 486 | 0.000000 487 | 0 488 | VERTEX 489 | 8 490 | 2 491 | 62 492 | 0 493 | 10 494 | 340.000000 495 | 20 496 | 263.000000 497 | 30 498 | 0.000000 499 | 0 500 | VERTEX 501 | 8 502 | 2 503 | 62 504 | 0 505 | 10 506 | 340.000000 507 | 20 508 | 238.000000 509 | 30 510 | 0.000000 511 | 0 512 | VERTEX 513 | 8 514 | 2 515 | 62 516 | 0 517 | 10 518 | 350.000000 519 | 20 520 | 211.000000 521 | 30 522 | 0.000000 523 | 0 524 | VERTEX 525 | 8 526 | 2 527 | 62 528 | 0 529 | 10 530 | 364.000000 531 | 20 532 | 198.000000 533 | 30 534 | 0.000000 535 | 0 536 | VERTEX 537 | 8 538 | 2 539 | 62 540 | 0 541 | 10 542 | 386.000000 543 | 20 544 | 191.000000 545 | 30 546 | 0.000000 547 | 0 548 | VERTEX 549 | 8 550 | 2 551 | 62 552 | 0 553 | 10 554 | 409.000000 555 | 20 556 | 192.000000 557 | 30 558 | 0.000000 559 | 0 560 | VERTEX 561 | 8 562 | 2 563 | 62 564 | 0 565 | 10 566 | 423.000000 567 | 20 568 | 197.000000 569 | 30 570 | 0.000000 571 | 0 572 | VERTEX 573 | 8 574 | 2 575 | 62 576 | 0 577 | 10 578 | 423.000000 579 | 20 580 | 238.000000 581 | 30 582 | 0.000000 583 | 0 584 | VERTEX 585 | 8 586 | 2 587 | 62 588 | 0 589 | 10 590 | 390.000000 591 | 20 592 | 238.000000 593 | 30 594 | 0.000000 595 | 0 596 | VERTEX 597 | 8 598 | 2 599 | 62 600 | 0 601 | 10 602 | 390.000000 603 | 20 604 | 255.000000 605 | 30 606 | 0.000000 607 | 0 608 | VERTEX 609 | 8 610 | 2 611 | 62 612 | 0 613 | 10 614 | 443.000000 615 | 20 616 | 256.000000 617 | 30 618 | 0.000000 619 | 0 620 | VERTEX 621 | 8 622 | 2 623 | 62 624 | 0 625 | 10 626 | 443.000000 627 | 20 628 | 186.000000 629 | 30 630 | 0.000000 631 | 0 632 | VERTEX 633 | 8 634 | 2 635 | 62 636 | 0 637 | 10 638 | 426.000000 639 | 20 640 | 178.000000 641 | 30 642 | 0.000000 643 | 0 644 | VERTEX 645 | 8 646 | 2 647 | 62 648 | 0 649 | 10 650 | 399.000000 651 | 20 652 | 173.000000 653 | 30 654 | 0.000000 655 | 0 656 | VERTEX 657 | 8 658 | 2 659 | 62 660 | 0 661 | 10 662 | 372.000000 663 | 20 664 | 175.000000 665 | 30 666 | 0.000000 667 | 0 668 | VERTEX 669 | 8 670 | 2 671 | 62 672 | 0 673 | 10 674 | 350.000000 675 | 20 676 | 184.000000 677 | 30 678 | 0.000000 679 | 0 680 | VERTEX 681 | 8 682 | 2 683 | 62 684 | 0 685 | 10 686 | 329.000000 687 | 20 688 | 206.000000 689 | 30 690 | 0.000000 691 | 0 692 | VERTEX 693 | 8 694 | 2 695 | 62 696 | 0 697 | 10 698 | 319.000000 699 | 20 700 | 235.000000 701 | 30 702 | 0.000000 703 | 0 704 | VERTEX 705 | 8 706 | 2 707 | 62 708 | 0 709 | 10 710 | 319.000000 711 | 20 712 | 264.000000 713 | 30 714 | 0.000000 715 | 0 716 | VERTEX 717 | 8 718 | 2 719 | 62 720 | 0 721 | 10 722 | 329.000000 723 | 20 724 | 293.000000 725 | 30 726 | 0.000000 727 | 0 728 | VERTEX 729 | 8 730 | 2 731 | 62 732 | 0 733 | 10 734 | 346.000000 735 | 20 736 | 313.000000 737 | 30 738 | 0.000000 739 | 0 740 | VERTEX 741 | 8 742 | 2 743 | 62 744 | 0 745 | 10 746 | 372.000000 747 | 20 748 | 327.000000 749 | 30 750 | 0.000000 751 | 0 752 | VERTEX 753 | 8 754 | 2 755 | 62 756 | 0 757 | 10 758 | 410.000000 759 | 20 760 | 330.000000 761 | 30 762 | 0.000000 763 | 0 764 | VERTEX 765 | 8 766 | 2 767 | 62 768 | 0 769 | 10 770 | 439.000000 771 | 20 772 | 323.000000 773 | 30 774 | 0.000000 775 | 0 776 | SEQEND 777 | 0 778 | POLYLINE 779 | 8 780 | 2 781 | 62 782 | 0 783 | 66 784 | 1 785 | 0 786 | VERTEX 787 | 8 788 | 2 789 | 62 790 | 0 791 | 10 792 | 477.000000 793 | 20 794 | 327.000000 795 | 30 796 | 0.000000 797 | 0 798 | VERTEX 799 | 8 800 | 2 801 | 62 802 | 0 803 | 10 804 | 497.000000 805 | 20 806 | 327.000000 807 | 30 808 | 0.000000 809 | 0 810 | VERTEX 811 | 8 812 | 2 813 | 62 814 | 0 815 | 10 816 | 497.000000 817 | 20 818 | 176.000000 819 | 30 820 | 0.000000 821 | 0 822 | VERTEX 823 | 8 824 | 2 825 | 62 826 | 0 827 | 10 828 | 477.000000 829 | 20 830 | 176.000000 831 | 30 832 | 0.000000 833 | 0 834 | VERTEX 835 | 8 836 | 2 837 | 62 838 | 0 839 | 10 840 | 477.000000 841 | 20 842 | 327.000000 843 | 30 844 | 0.000000 845 | 0 846 | SEQEND 847 | 0 848 | POLYLINE 849 | 8 850 | 2 851 | 62 852 | 0 853 | 66 854 | 1 855 | 0 856 | VERTEX 857 | 8 858 | 2 859 | 62 860 | 0 861 | 10 862 | 616.000000 863 | 20 864 | 325.000000 865 | 30 866 | 0.000000 867 | 0 868 | VERTEX 869 | 8 870 | 2 871 | 62 872 | 0 873 | 10 874 | 616.000000 875 | 20 876 | 303.000000 877 | 30 878 | 0.000000 879 | 0 880 | VERTEX 881 | 8 882 | 2 883 | 62 884 | 0 885 | 10 886 | 593.000000 887 | 20 888 | 312.000000 889 | 30 890 | 0.000000 891 | 0 892 | VERTEX 893 | 8 894 | 2 895 | 62 896 | 0 897 | 10 898 | 567.000000 899 | 20 900 | 311.000000 901 | 30 902 | 0.000000 903 | 0 904 | VERTEX 905 | 8 906 | 2 907 | 62 908 | 0 909 | 10 910 | 553.000000 911 | 20 912 | 301.000000 913 | 30 914 | 0.000000 915 | 0 916 | VERTEX 917 | 8 918 | 2 919 | 62 920 | 0 921 | 10 922 | 551.000000 923 | 20 924 | 284.000000 925 | 30 926 | 0.000000 927 | 0 928 | VERTEX 929 | 8 930 | 2 931 | 62 932 | 0 933 | 10 934 | 560.000000 935 | 20 936 | 272.000000 937 | 30 938 | 0.000000 939 | 0 940 | VERTEX 941 | 8 942 | 2 943 | 62 944 | 0 945 | 10 946 | 597.000000 947 | 20 948 | 253.000000 949 | 30 950 | 0.000000 951 | 0 952 | VERTEX 953 | 8 954 | 2 955 | 62 956 | 0 957 | 10 958 | 616.000000 959 | 20 960 | 237.000000 961 | 30 962 | 0.000000 963 | 0 964 | VERTEX 965 | 8 966 | 2 967 | 62 968 | 0 969 | 10 970 | 623.000000 971 | 20 972 | 220.000000 973 | 30 974 | 0.000000 975 | 0 976 | VERTEX 977 | 8 978 | 2 979 | 62 980 | 0 981 | 10 982 | 622.000000 983 | 20 984 | 203.000000 985 | 30 986 | 0.000000 987 | 0 988 | VERTEX 989 | 8 990 | 2 991 | 62 992 | 0 993 | 10 994 | 617.000000 995 | 20 996 | 192.000000 997 | 30 998 | 0.000000 999 | 0 1000 | VERTEX 1001 | 8 1002 | 2 1003 | 62 1004 | 0 1005 | 10 1006 | 603.000000 1007 | 20 1008 | 180.000000 1009 | 30 1010 | 0.000000 1011 | 0 1012 | VERTEX 1013 | 8 1014 | 2 1015 | 62 1016 | 0 1017 | 10 1018 | 584.000000 1019 | 20 1020 | 174.000000 1021 | 30 1022 | 0.000000 1023 | 0 1024 | VERTEX 1025 | 8 1026 | 2 1027 | 62 1028 | 0 1029 | 10 1030 | 554.000000 1031 | 20 1032 | 174.000000 1033 | 30 1034 | 0.000000 1035 | 0 1036 | VERTEX 1037 | 8 1038 | 2 1039 | 62 1040 | 0 1041 | 10 1042 | 530.000000 1043 | 20 1044 | 181.000000 1045 | 30 1046 | 0.000000 1047 | 0 1048 | VERTEX 1049 | 8 1050 | 2 1051 | 62 1052 | 0 1053 | 10 1054 | 529.000000 1055 | 20 1056 | 204.000000 1057 | 30 1058 | 0.000000 1059 | 0 1060 | VERTEX 1061 | 8 1062 | 2 1063 | 62 1064 | 0 1065 | 10 1066 | 548.000000 1067 | 20 1068 | 194.000000 1069 | 30 1070 | 0.000000 1071 | 0 1072 | VERTEX 1073 | 8 1074 | 2 1075 | 62 1076 | 0 1077 | 10 1078 | 581.000000 1079 | 20 1080 | 191.000000 1081 | 30 1082 | 0.000000 1083 | 0 1084 | VERTEX 1085 | 8 1086 | 2 1087 | 62 1088 | 0 1089 | 10 1090 | 597.000000 1091 | 20 1092 | 198.000000 1093 | 30 1094 | 0.000000 1095 | 0 1096 | VERTEX 1097 | 8 1098 | 2 1099 | 62 1100 | 0 1101 | 10 1102 | 602.000000 1103 | 20 1104 | 209.000000 1105 | 30 1106 | 0.000000 1107 | 0 1108 | VERTEX 1109 | 8 1110 | 2 1111 | 62 1112 | 0 1113 | 10 1114 | 601.000000 1115 | 20 1116 | 221.000000 1117 | 30 1118 | 0.000000 1119 | 0 1120 | VERTEX 1121 | 8 1122 | 2 1123 | 62 1124 | 0 1125 | 10 1126 | 592.000000 1127 | 20 1128 | 232.000000 1129 | 30 1130 | 0.000000 1131 | 0 1132 | VERTEX 1133 | 8 1134 | 2 1135 | 62 1136 | 0 1137 | 10 1138 | 555.000000 1139 | 20 1140 | 251.000000 1141 | 30 1142 | 0.000000 1143 | 0 1144 | VERTEX 1145 | 8 1146 | 2 1147 | 62 1148 | 0 1149 | 10 1150 | 535.000000 1151 | 20 1152 | 268.000000 1153 | 30 1154 | 0.000000 1155 | 0 1156 | VERTEX 1157 | 8 1158 | 2 1159 | 62 1160 | 0 1161 | 10 1162 | 530.000000 1163 | 20 1164 | 280.000000 1165 | 30 1166 | 0.000000 1167 | 0 1168 | VERTEX 1169 | 8 1170 | 2 1171 | 62 1172 | 0 1173 | 10 1174 | 530.000000 1175 | 20 1176 | 295.000000 1177 | 30 1178 | 0.000000 1179 | 0 1180 | VERTEX 1181 | 8 1182 | 2 1183 | 62 1184 | 0 1185 | 10 1186 | 535.000000 1187 | 20 1188 | 310.000000 1189 | 30 1190 | 0.000000 1191 | 0 1192 | VERTEX 1193 | 8 1194 | 2 1195 | 62 1196 | 0 1197 | 10 1198 | 550.000000 1199 | 20 1200 | 323.000000 1201 | 30 1202 | 0.000000 1203 | 0 1204 | VERTEX 1205 | 8 1206 | 2 1207 | 62 1208 | 0 1209 | 10 1210 | 567.000000 1211 | 20 1212 | 329.000000 1213 | 30 1214 | 0.000000 1215 | 0 1216 | VERTEX 1217 | 8 1218 | 2 1219 | 62 1220 | 0 1221 | 10 1222 | 596.000000 1223 | 20 1224 | 330.000000 1225 | 30 1226 | 0.000000 1227 | 0 1228 | VERTEX 1229 | 8 1230 | 2 1231 | 62 1232 | 0 1233 | 10 1234 | 616.000000 1235 | 20 1236 | 325.000000 1237 | 30 1238 | 0.000000 1239 | 0 1240 | SEQEND 1241 | 0 1242 | POLYLINE 1243 | 8 1244 | 2 1245 | 62 1246 | 0 1247 | 66 1248 | 1 1249 | 0 1250 | VERTEX 1251 | 8 1252 | 2 1253 | 62 1254 | 0 1255 | 10 1256 | 651.000000 1257 | 20 1258 | 327.000000 1259 | 30 1260 | 0.000000 1261 | 0 1262 | VERTEX 1263 | 8 1264 | 2 1265 | 62 1266 | 0 1267 | 10 1268 | 671.000000 1269 | 20 1270 | 327.000000 1271 | 30 1272 | 0.000000 1273 | 0 1274 | VERTEX 1275 | 8 1276 | 2 1277 | 62 1278 | 0 1279 | 10 1280 | 671.000000 1281 | 20 1282 | 176.000000 1283 | 30 1284 | 0.000000 1285 | 0 1286 | VERTEX 1287 | 8 1288 | 2 1289 | 62 1290 | 0 1291 | 10 1292 | 651.000000 1293 | 20 1294 | 176.000000 1295 | 30 1296 | 0.000000 1297 | 0 1298 | VERTEX 1299 | 8 1300 | 2 1301 | 62 1302 | 0 1303 | 10 1304 | 651.000000 1305 | 20 1306 | 327.000000 1307 | 30 1308 | 0.000000 1309 | 0 1310 | SEQEND 1311 | 0 1312 | POLYLINE 1313 | 8 1314 | 2 1315 | 62 1316 | 0 1317 | 66 1318 | 1 1319 | 0 1320 | VERTEX 1321 | 8 1322 | 2 1323 | 62 1324 | 0 1325 | 10 1326 | 710.000000 1327 | 20 1328 | 327.000000 1329 | 30 1330 | 0.000000 1331 | 0 1332 | VERTEX 1333 | 8 1334 | 2 1335 | 62 1336 | 0 1337 | 10 1338 | 738.000000 1339 | 20 1340 | 327.000000 1341 | 30 1342 | 0.000000 1343 | 0 1344 | VERTEX 1345 | 8 1346 | 2 1347 | 62 1348 | 0 1349 | 10 1350 | 788.000000 1351 | 20 1352 | 206.000000 1353 | 30 1354 | 0.000000 1355 | 0 1356 | VERTEX 1357 | 8 1358 | 2 1359 | 62 1360 | 0 1361 | 10 1362 | 841.000000 1363 | 20 1364 | 327.000000 1365 | 30 1366 | 0.000000 1367 | 0 1368 | VERTEX 1369 | 8 1370 | 2 1371 | 62 1372 | 0 1373 | 10 1374 | 867.000000 1375 | 20 1376 | 327.000000 1377 | 30 1378 | 0.000000 1379 | 0 1380 | VERTEX 1381 | 8 1382 | 2 1383 | 62 1384 | 0 1385 | 10 1386 | 867.000000 1387 | 20 1388 | 176.000000 1389 | 30 1390 | 0.000000 1391 | 0 1392 | VERTEX 1393 | 8 1394 | 2 1395 | 62 1396 | 0 1397 | 10 1398 | 847.000000 1399 | 20 1400 | 176.000000 1401 | 30 1402 | 0.000000 1403 | 0 1404 | VERTEX 1405 | 8 1406 | 2 1407 | 62 1408 | 0 1409 | 10 1410 | 848.000000 1411 | 20 1412 | 301.000000 1413 | 30 1414 | 0.000000 1415 | 0 1416 | VERTEX 1417 | 8 1418 | 2 1419 | 62 1420 | 0 1421 | 10 1422 | 795.000000 1423 | 20 1424 | 177.000000 1425 | 30 1426 | 0.000000 1427 | 0 1428 | VERTEX 1429 | 8 1430 | 2 1431 | 62 1432 | 0 1433 | 10 1434 | 783.000000 1435 | 20 1436 | 176.000000 1437 | 30 1438 | 0.000000 1439 | 0 1440 | VERTEX 1441 | 8 1442 | 2 1443 | 62 1444 | 0 1445 | 10 1446 | 735.000000 1447 | 20 1448 | 284.000000 1449 | 30 1450 | 0.000000 1451 | 0 1452 | VERTEX 1453 | 8 1454 | 2 1455 | 62 1456 | 0 1457 | 10 1458 | 730.000000 1459 | 20 1460 | 302.000000 1461 | 30 1462 | 0.000000 1463 | 0 1464 | VERTEX 1465 | 8 1466 | 2 1467 | 62 1468 | 0 1469 | 10 1470 | 730.000000 1471 | 20 1472 | 176.000000 1473 | 30 1474 | 0.000000 1475 | 0 1476 | VERTEX 1477 | 8 1478 | 2 1479 | 62 1480 | 0 1481 | 10 1482 | 710.000000 1483 | 20 1484 | 176.000000 1485 | 30 1486 | 0.000000 1487 | 0 1488 | VERTEX 1489 | 8 1490 | 2 1491 | 62 1492 | 0 1493 | 10 1494 | 710.000000 1495 | 20 1496 | 327.000000 1497 | 30 1498 | 0.000000 1499 | 0 1500 | SEQEND 1501 | 0 1502 | POLYLINE 1503 | 8 1504 | 2 1505 | 62 1506 | 0 1507 | 66 1508 | 1 1509 | 0 1510 | VERTEX 1511 | 8 1512 | 2 1513 | 62 1514 | 0 1515 | 10 1516 | 0.000000 1517 | 20 1518 | 0.000000 1519 | 30 1520 | 0.000000 1521 | 0 1522 | VERTEX 1523 | 8 1524 | 2 1525 | 62 1526 | 0 1527 | 10 1528 | 0.000000 1529 | 20 1530 | 500.000000 1531 | 30 1532 | 0.000000 1533 | 0 1534 | VERTEX 1535 | 8 1536 | 2 1537 | 62 1538 | 0 1539 | 10 1540 | 1000.000000 1541 | 20 1542 | 500.000000 1543 | 30 1544 | 0.000000 1545 | 0 1546 | VERTEX 1547 | 8 1548 | 2 1549 | 62 1550 | 0 1551 | 10 1552 | 1000.000000 1553 | 20 1554 | 0.000000 1555 | 30 1556 | 0.000000 1557 | 0 1558 | VERTEX 1559 | 8 1560 | 2 1561 | 62 1562 | 0 1563 | 10 1564 | 0.000000 1565 | 20 1566 | 0.000000 1567 | 30 1568 | 0.000000 1569 | 0 1570 | SEQEND 1571 | 0 1572 | ENDSEC 1573 | 0 1574 | EOF 1575 | -------------------------------------------------------------------------------- /DigiSim.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeoGroup/DigiSim/1255f9a8bab70532cca7505e487eac7efa5138d1/DigiSim.fig -------------------------------------------------------------------------------- /DigiSim.geo: -------------------------------------------------------------------------------- 1 | lc = 10.0000; 2 | lc2 = 20.0000; 3 | Point(1)={137,310,0,lc}; 4 | Point(2)={166,310,0,lc}; 5 | Point(3)={189,305,0,lc}; 6 | Point(4)={204,296,0,lc}; 7 | Point(5)={216,279,0,lc}; 8 | Point(6)={220,263,0,lc}; 9 | Point(7)={217,229,0,lc}; 10 | Point(8)={209,214,0,lc}; 11 | Point(9)={188,198,0,lc}; 12 | Point(10)={161,193,0,lc}; 13 | Point(11)={137,194,0,lc}; 14 | Line(1)={1,2 }; 15 | Line(2)={2,3 }; 16 | Line(3)={3,4 }; 17 | Line(4)={4,5 }; 18 | Line(5)={5,6 }; 19 | Line(6)={6,7 }; 20 | Line(7)={7,8 }; 21 | Line(8)={8,9 }; 22 | Line(9)={9,10 }; 23 | Line(10)={10,11 }; 24 | Line(11)={11,1 }; 25 | Line Loop(1)={1,2,3,4,5,6,7,8,9,10,11}; 26 | Plane Surface(1)={1}; 27 | Point(12)={212,313,0,lc}; 28 | Point(13)={233,290,0,lc}; 29 | Point(14)={241,264,0,lc}; 30 | Point(15)={239,231,0,lc}; 31 | Point(16)={227,206,0,lc}; 32 | Point(17)={209,189,0,lc}; 33 | Point(18)={187,179,0,lc}; 34 | Point(19)={172,176,0,lc}; 35 | Point(20)={117,176,0,lc}; 36 | Point(21)={117,327,0,lc}; 37 | Point(22)={175,327,0,lc}; 38 | Point(23)={195,322,0,lc}; 39 | Line(12)={12,13 }; 40 | Line(13)={13,14 }; 41 | Line(14)={14,15 }; 42 | Line(15)={15,16 }; 43 | Line(16)={16,17 }; 44 | Line(17)={17,18 }; 45 | Line(18)={18,19 }; 46 | Line(19)={19,20 }; 47 | Line(20)={20,21 }; 48 | Line(21)={21,22 }; 49 | Line(22)={22,23 }; 50 | Line(23)={23,12 }; 51 | Line Loop(2)={12,13,14,15,16,17,18,19,20,21,22,23}; 52 | Plane Surface(2)={2,1}; 53 | Point(24)={269,327,0,lc}; 54 | Point(25)={289,327,0,lc}; 55 | Point(26)={289,176,0,lc}; 56 | Point(27)={269,176,0,lc}; 57 | Line(24)={24,25 }; 58 | Line(25)={25,26 }; 59 | Line(26)={26,27 }; 60 | Line(27)={27,24 }; 61 | Line Loop(3)={24,25,26,27}; 62 | Plane Surface(3)={3}; 63 | Point(28)={439,323,0,lc}; 64 | Point(29)={440,301,0,lc}; 65 | Point(30)={407,312,0,lc}; 66 | Point(31)={381,311,0,lc}; 67 | Point(32)={362,302,0,lc}; 68 | Point(33)={352,292,0,lc}; 69 | Point(34)={344,278,0,lc}; 70 | Point(35)={340,263,0,lc}; 71 | Point(36)={340,238,0,lc}; 72 | Point(37)={350,211,0,lc}; 73 | Point(38)={364,198,0,lc}; 74 | Point(39)={386,191,0,lc}; 75 | Point(40)={409,192,0,lc}; 76 | Point(41)={423,197,0,lc}; 77 | Point(42)={423,238,0,lc}; 78 | Point(43)={390,238,0,lc}; 79 | Point(44)={390,255,0,lc}; 80 | Point(45)={443,256,0,lc}; 81 | Point(46)={443,186,0,lc}; 82 | Point(47)={426,178,0,lc}; 83 | Point(48)={399,173,0,lc}; 84 | Point(49)={372,175,0,lc}; 85 | Point(50)={350,184,0,lc}; 86 | Point(51)={329,206,0,lc}; 87 | Point(52)={319,235,0,lc}; 88 | Point(53)={319,264,0,lc}; 89 | Point(54)={329,293,0,lc}; 90 | Point(55)={346,313,0,lc}; 91 | Point(56)={372,327,0,lc}; 92 | Point(57)={410,330,0,lc}; 93 | Line(28)={28,29 }; 94 | Line(29)={29,30 }; 95 | Line(30)={30,31 }; 96 | Line(31)={31,32 }; 97 | Line(32)={32,33 }; 98 | Line(33)={33,34 }; 99 | Line(34)={34,35 }; 100 | Line(35)={35,36 }; 101 | Line(36)={36,37 }; 102 | Line(37)={37,38 }; 103 | Line(38)={38,39 }; 104 | Line(39)={39,40 }; 105 | Line(40)={40,41 }; 106 | Line(41)={41,42 }; 107 | Line(42)={42,43 }; 108 | Line(43)={43,44 }; 109 | Line(44)={44,45 }; 110 | Line(45)={45,46 }; 111 | Line(46)={46,47 }; 112 | Line(47)={47,48 }; 113 | Line(48)={48,49 }; 114 | Line(49)={49,50 }; 115 | Line(50)={50,51 }; 116 | Line(51)={51,52 }; 117 | Line(52)={52,53 }; 118 | Line(53)={53,54 }; 119 | Line(54)={54,55 }; 120 | Line(55)={55,56 }; 121 | Line(56)={56,57 }; 122 | Line(57)={57,28 }; 123 | Line Loop(4)={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}; 124 | Plane Surface(4)={4}; 125 | Point(58)={477,327,0,lc}; 126 | Point(59)={497,327,0,lc}; 127 | Point(60)={497,176,0,lc}; 128 | Point(61)={477,176,0,lc}; 129 | Line(58)={58,59 }; 130 | Line(59)={59,60 }; 131 | Line(60)={60,61 }; 132 | Line(61)={61,58 }; 133 | Line Loop(5)={58,59,60,61}; 134 | Plane Surface(5)={5}; 135 | Point(62)={616,325,0,lc}; 136 | Point(63)={616,303,0,lc}; 137 | Point(64)={593,312,0,lc}; 138 | Point(65)={567,311,0,lc}; 139 | Point(66)={553,301,0,lc}; 140 | Point(67)={551,284,0,lc}; 141 | Point(68)={560,272,0,lc}; 142 | Point(69)={597,253,0,lc}; 143 | Point(70)={616,237,0,lc}; 144 | Point(71)={623,220,0,lc}; 145 | Point(72)={622,203,0,lc}; 146 | Point(73)={617,192,0,lc}; 147 | Point(74)={603,180,0,lc}; 148 | Point(75)={584,174,0,lc}; 149 | Point(76)={554,174,0,lc}; 150 | Point(77)={530,181,0,lc}; 151 | Point(78)={529,204,0,lc}; 152 | Point(79)={548,194,0,lc}; 153 | Point(80)={581,191,0,lc}; 154 | Point(81)={597,198,0,lc}; 155 | Point(82)={602,209,0,lc}; 156 | Point(83)={601,221,0,lc}; 157 | Point(84)={592,232,0,lc}; 158 | Point(85)={555,251,0,lc}; 159 | Point(86)={535,268,0,lc}; 160 | Point(87)={530,280,0,lc}; 161 | Point(88)={530,295,0,lc}; 162 | Point(89)={535,310,0,lc}; 163 | Point(90)={550,323,0,lc}; 164 | Point(91)={567,329,0,lc}; 165 | Point(92)={596,330,0,lc}; 166 | Line(62)={62,63 }; 167 | Line(63)={63,64 }; 168 | Line(64)={64,65 }; 169 | Line(65)={65,66 }; 170 | Line(66)={66,67 }; 171 | Line(67)={67,68 }; 172 | Line(68)={68,69 }; 173 | Line(69)={69,70 }; 174 | Line(70)={70,71 }; 175 | Line(71)={71,72 }; 176 | Line(72)={72,73 }; 177 | Line(73)={73,74 }; 178 | Line(74)={74,75 }; 179 | Line(75)={75,76 }; 180 | Line(76)={76,77 }; 181 | Line(77)={77,78 }; 182 | Line(78)={78,79 }; 183 | Line(79)={79,80 }; 184 | Line(80)={80,81 }; 185 | Line(81)={81,82 }; 186 | Line(82)={82,83 }; 187 | Line(83)={83,84 }; 188 | Line(84)={84,85 }; 189 | Line(85)={85,86 }; 190 | Line(86)={86,87 }; 191 | Line(87)={87,88 }; 192 | Line(88)={88,89 }; 193 | Line(89)={89,90 }; 194 | Line(90)={90,91 }; 195 | Line(91)={91,92 }; 196 | Line(92)={92,62 }; 197 | Line Loop(6)={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}; 198 | Plane Surface(6)={6}; 199 | Point(93)={651,327,0,lc}; 200 | Point(94)={671,327,0,lc}; 201 | Point(95)={671,176,0,lc}; 202 | Point(96)={651,176,0,lc}; 203 | Line(93)={93,94 }; 204 | Line(94)={94,95 }; 205 | Line(95)={95,96 }; 206 | Line(96)={96,93 }; 207 | Line Loop(7)={93,94,95,96}; 208 | Plane Surface(7)={7}; 209 | Point(97)={710,327,0,lc}; 210 | Point(98)={738,327,0,lc}; 211 | Point(99)={788,206,0,lc}; 212 | Point(100)={841,327,0,lc}; 213 | Point(101)={867,327,0,lc}; 214 | Point(102)={867,176,0,lc}; 215 | Point(103)={847,176,0,lc}; 216 | Point(104)={848,301,0,lc}; 217 | Point(105)={795,177,0,lc}; 218 | Point(106)={783,176,0,lc}; 219 | Point(107)={735,284,0,lc}; 220 | Point(108)={730,302,0,lc}; 221 | Point(109)={730,176,0,lc}; 222 | Point(110)={710,176,0,lc}; 223 | Line(97)={97,98 }; 224 | Line(98)={98,99 }; 225 | Line(99)={99,100 }; 226 | Line(100)={100,101 }; 227 | Line(101)={101,102 }; 228 | Line(102)={102,103 }; 229 | Line(103)={103,104 }; 230 | Line(104)={104,105 }; 231 | Line(105)={105,106 }; 232 | Line(106)={106,107 }; 233 | Line(107)={107,108 }; 234 | Line(108)={108,109 }; 235 | Line(109)={109,110 }; 236 | Line(110)={110,97 }; 237 | Line Loop(8)={97,98,99,100,101,102,103,104,105,106,107,108,109,110}; 238 | Plane Surface(8)={8}; 239 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 240 | Point(111)={0,0,0,lc2}; 241 | Point(112)={0,500,0,lc2}; 242 | Line(111)={111,112 }; 243 | Point(113)={1000,500,0,lc2}; 244 | Line(112)={112,113 }; 245 | Point(114)={1000,0,0,lc2}; 246 | Line(113)={113,114 }; 247 | Line(114)={114,111 }; 248 | Line Loop(9)={111,112,113,114}; 249 | Plane Surface(9)={9,2,3,4,5,6,7,8}; 250 | -------------------------------------------------------------------------------- /DigiSim.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeoGroup/DigiSim/1255f9a8bab70532cca7505e487eac7efa5138d1/DigiSim.jpg -------------------------------------------------------------------------------- /DigiSim.m: -------------------------------------------------------------------------------- 1 | function varargout = DigiSim(varargin) 2 | % DIGISIM MATLAB code for DigiSim.fig 3 | % DIGISIM, by itself, creates a new DIGISIM or raises the existing 4 | % singleton*. 5 | % 6 | % H = DIGISIM returns the handle to a new DIGISIM or the handle to 7 | % the existing singleton*. 8 | % 9 | % DIGISIM('CALLBACK',hObject,eventData,handles,...) calls the local 10 | % function named CALLBACK in DIGISIM.M with the given input arguments. 11 | % 12 | % DIGISIM('Property','Value',...) creates a new DIGISIM or raises the 13 | % existing singleton*. Starting from the left, property value pairs are 14 | % applied to the GUI before DigiSim_OpeningFcn gets called. An 15 | % unrecognized property name or invalid value makes property application 16 | % stop. All inputs are passed to DigiSim_OpeningFcn via varargin. 17 | % 18 | % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one 19 | % instance to run (singleton)". 20 | % 21 | % See also: GUIDE, GUIDATA, GUIHANDLES 22 | 23 | % Edit the above text to modify the response to help DigiSim 24 | 25 | % Last Modified by GUIDE v2.5 17-Jan-2018 18:20:39 26 | 27 | % Begin initialization code - DO NOT EDIT 28 | gui_Singleton = 1; 29 | gui_State = struct('gui_Name', mfilename, ... 30 | 'gui_Singleton', gui_Singleton, ... 31 | 'gui_OpeningFcn', @DigiSim_OpeningFcn, ... 32 | 'gui_OutputFcn', @DigiSim_OutputFcn, ... 33 | 'gui_LayoutFcn', [] , ... 34 | 'gui_Callback', []); 35 | if nargin && ischar(varargin{1}) 36 | gui_State.gui_Callback = str2func(varargin{1}); 37 | end 38 | 39 | if nargout 40 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); 41 | else 42 | gui_mainfcn(gui_State, varargin{:}); 43 | end 44 | % End initialization code - DO NOT EDIT 45 | 46 | 47 | % --- Executes just before DigiSim is made visible. 48 | % update 49 | function DigiSim_OpeningFcn(hObject, eventdata, handles, varargin) 50 | % This function has no output args, see OutputFcn. 51 | % hObject handle to figure 52 | % eventdata reserved - to be defined in a future version of MATLAB 53 | % handles structure with handles and user data (see GUIDATA) 54 | % varargin command line arguments to DigiSim (see VARARGIN) 55 | 56 | % Choose default command line output for DigiSim 57 | handles.output = hObject; 58 | 59 | axes(handles.axes1) 60 | addpath subroutine 61 | addpath resource 62 | load data.mat 63 | geom_plot(P); 64 | P=[]; 65 | % I=imread('logofem2.jpg'); 66 | % image(I) ; 67 | axis off; 68 | axes(handles.axes2) 69 | I=imread('logo.jpg'); 70 | imshow(I) ; 71 | axis off; 72 | % axes(handles.axes3) 73 | % axis off; 74 | % axes(handles.axes4) 75 | % axis off; 76 | % Update handles structure 77 | guidata(hObject, handles); 78 | 79 | % UIWAIT makes DigiSim wait for user response (see UIRESUME) 80 | % uiwait(handles.figure1); 81 | 82 | 83 | % --- Outputs from this function are returned to the command line. 84 | function varargout = DigiSim_OutputFcn(hObject, eventdata, handles) 85 | % varargout cell array for returning output args (see VARARGOUT); 86 | % hObject handle to figure 87 | % eventdata reserved - to be defined in a future version of MATLAB 88 | % handles structure with handles and user data (see GUIDATA) 89 | 90 | % Get default command line output from handles structure 91 | varargout{1} = handles.output; 92 | 93 | 94 | % --- Executes on mouse press over axes background. 95 | function axes2_ButtonDownFcn(hObject, eventdata, handles) 96 | % hObject handle to axes2 (see GCBO) 97 | % eventdata reserved - to be defined in a future version of MATLAB 98 | % handles structure with handles and user data (see GUIDATA) 99 | 100 | 101 | 102 | function edit1_Callback(hObject, eventdata, handles) 103 | % hObject handle to edit1 (see GCBO) 104 | % eventdata reserved - to be defined in a future version of MATLAB 105 | % handles structure with handles and user data (see GUIDATA) 106 | 107 | % Hints: get(hObject,'String') returns contents of edit1 as text 108 | % str2double(get(hObject,'String')) returns contents of edit1 as a double 109 | 110 | 111 | % --- Executes during object creation, after setting all properties. 112 | function edit1_CreateFcn(hObject, eventdata, handles) 113 | % hObject handle to edit1 (see GCBO) 114 | % eventdata reserved - to be defined in a future version of MATLAB 115 | % handles empty - handles not created until after all CreateFcns called 116 | 117 | % Hint: edit controls usually have a white background on Windows. 118 | % See ISPC and COMPUTER. 119 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 120 | set(hObject,'BackgroundColor','white'); 121 | end 122 | 123 | 124 | 125 | function edit2_Callback(hObject, eventdata, handles) 126 | % hObject handle to edit2 (see GCBO) 127 | % eventdata reserved - to be defined in a future version of MATLAB 128 | % handles structure with handles and user data (see GUIDATA) 129 | 130 | % Hints: get(hObject,'String') returns contents of edit2 as text 131 | % str2double(get(hObject,'String')) returns contents of edit2 as a double 132 | 133 | 134 | % --- Executes during object creation, after setting all properties. 135 | function edit2_CreateFcn(hObject, eventdata, handles) 136 | % hObject handle to edit2 (see GCBO) 137 | % eventdata reserved - to be defined in a future version of MATLAB 138 | % handles empty - handles not created until after all CreateFcns called 139 | 140 | % Hint: edit controls usually have a white background on Windows. 141 | % See ISPC and COMPUTER. 142 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 143 | set(hObject,'BackgroundColor','white'); 144 | end 145 | 146 | 147 | 148 | function edit3_Callback(hObject, eventdata, handles) 149 | % hObject handle to edit3 (see GCBO) 150 | % eventdata reserved - to be defined in a future version of MATLAB 151 | % handles structure with handles and user data (see GUIDATA) 152 | 153 | % Hints: get(hObject,'String') returns contents of edit3 as text 154 | % str2double(get(hObject,'String')) returns contents of edit3 as a double 155 | 156 | 157 | % --- Executes during object creation, after setting all properties. 158 | function edit3_CreateFcn(hObject, eventdata, handles) 159 | % hObject handle to edit3 (see GCBO) 160 | % eventdata reserved - to be defined in a future version of MATLAB 161 | % handles empty - handles not created until after all CreateFcns called 162 | 163 | % Hint: edit controls usually have a white background on Windows. 164 | % See ISPC and COMPUTER. 165 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 166 | set(hObject,'BackgroundColor','white'); 167 | end 168 | 169 | 170 | % --- Executes on button press in pushbutton1. 171 | function pushbutton1_Callback(hObject, eventdata, handles) 172 | % hObject handle to pushbutton1 (see GCBO) 173 | % eventdata reserved - to be defined in a future version of MATLAB 174 | % handles structure with handles and user data (see GUIDATA) 175 | % addpath subroutine 176 | global FileName PathName I 177 | [FileName,PathName] = uigetfile('*.jpg','Select the digital image file'); 178 | fn=[PathName,FileName]; 179 | I=imread(fn); 180 | I=I(:,:,1); 181 | I(I<200)=0; 182 | I(I>200)=1; 183 | axes(handles.axes3) 184 | imshow(I*255); 185 | I=1-I; 186 | 187 | 188 | 189 | 190 | 191 | 192 | % --- Executes on button press in pushbutton2. 193 | function pushbutton2_Callback(hObject, eventdata, handles) 194 | % hObject handle to pushbutton2 (see GCBO) 195 | % eventdata reserved - to be defined in a future version of MATLAB 196 | % handles structure with handles and user data (see GUIDATA) 197 | addpath subroutine 198 | addpath resource 199 | global FileName PathName P I 200 | fn=[PathName,FileName]; 201 | error=str2double(get(handles.edit1,'String')); 202 | scale=str2double(get(handles.edit2,'String')); 203 | set(handles.pushbutton2,'String','Please Waiting'); 204 | pause(0.001); 205 | disp(fn); 206 | disp(size(I)); 207 | [P] = vectorization2(I,error); 208 | 209 | P=geom_scale(P,scale); 210 | % I=imread(fn); 211 | axes(handles.axes4) 212 | plot(nan,nan) 213 | geom_plot(P); 214 | 215 | set(handles.pushbutton2,'String','Finsh'); 216 | % imshow(I); 217 | 218 | 219 | % --- Executes on button press in pushbutton3. 220 | function pushbutton3_Callback(hObject, eventdata, handles) 221 | % hObject handle to pushbutton3 (see GCBO) 222 | % eventdata reserved - to be defined in a future version of MATLAB 223 | % handles structure with handles and user data (see GUIDATA) 224 | set(handles.pushbutton3,'String','Please Waiting'); 225 | pause(0.001); 226 | global FileName PathName P 227 | fn=[PathName,FileName(1:length(FileName)-4),'.xls']; 228 | [parea,fraction]=geom_area(P); 229 | mg=min_bound_box2(P); 230 | mbr_plot(mg) 231 | geom_stas(fn,parea,fraction,mg,P); 232 | set(handles.pushbutton3,'String','Finsh'); 233 | 234 | 235 | 236 | 237 | function edit4_Callback(hObject, eventdata, handles) 238 | % hObject handle to edit4 (see GCBO) 239 | % eventdata reserved - to be defined in a future version of MATLAB 240 | % handles structure with handles and user data (see GUIDATA) 241 | 242 | % Hints: get(hObject,'String') returns contents of edit4 as text 243 | % str2double(get(hObject,'String')) returns contents of edit4 as a double 244 | 245 | 246 | % --- Executes during object creation, after setting all properties. 247 | function edit4_CreateFcn(hObject, eventdata, handles) 248 | % hObject handle to edit4 (see GCBO) 249 | % eventdata reserved - to be defined in a future version of MATLAB 250 | % handles empty - handles not created until after all CreateFcns called 251 | 252 | % Hint: edit controls usually have a white background on Windows. 253 | % See ISPC and COMPUTER. 254 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 255 | set(hObject,'BackgroundColor','white'); 256 | end 257 | 258 | 259 | 260 | function edit5_Callback(hObject, eventdata, handles) 261 | % hObject handle to edit5 (see GCBO) 262 | % eventdata reserved - to be defined in a future version of MATLAB 263 | % handles structure with handles and user data (see GUIDATA) 264 | 265 | % Hints: get(hObject,'String') returns contents of edit5 as text 266 | % str2double(get(hObject,'String')) returns contents of edit5 as a double 267 | 268 | 269 | % --- Executes during object creation, after setting all properties. 270 | function edit5_CreateFcn(hObject, eventdata, handles) 271 | % hObject handle to edit5 (see GCBO) 272 | % eventdata reserved - to be defined in a future version of MATLAB 273 | % handles empty - handles not created until after all CreateFcns called 274 | 275 | % Hint: edit controls usually have a white background on Windows. 276 | % See ISPC and COMPUTER. 277 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 278 | set(hObject,'BackgroundColor','white'); 279 | end 280 | 281 | 282 | % --- Executes on button press in pushbutton4. 283 | function pushbutton4_Callback(hObject, eventdata, handles) 284 | % hObject handle to pushbutton4 (see GCBO) 285 | % eventdata reserved - to be defined in a future version of MATLAB 286 | % handles structure with handles and user data (see GUIDATA) 287 | set(handles.pushbutton4,'String','Please Waiting'); 288 | pause(0.001); 289 | global FileName PathName P 290 | dxf_file=[PathName,FileName(1:length(FileName)-4),'.dxf']; 291 | dxf_file_write(P,dxf_file); 292 | % disp('OK Dxf'); 293 | lc2=str2double(get(handles.edit3,'String')); 294 | lc=str2double(get(handles.edit4,'String')); 295 | radius=str2double(get(handles.edit5,'String')); 296 | gmsh_file=[PathName,FileName(1:length(FileName)-4),'.geo']; 297 | % lc=5;lc2=10;radius=1; 298 | gmsh_file_write(P,gmsh_file,lc,lc2); 299 | % disp('OK Gmsh'); 300 | abaqus_file=[PathName,FileName(1:length(FileName)-4),'.py']; 301 | write_abaqus_2d(abaqus_file,P) 302 | % disp('OK Abaqus'); 303 | pfc_file=[PathName,FileName(1:length(FileName)-4),'.p2dat']; 304 | write_pfc_2d_group(P,radius,pfc_file); 305 | % disp('OK PFC'); 306 | set(handles.pushbutton4,'String','Finsh'); 307 | 308 | 309 | % --- Executes on button press in pushbutton5. 310 | function pushbutton5_Callback(hObject, eventdata, handles) 311 | % hObject handle to pushbutton5 (see GCBO) 312 | % eventdata reserved - to be defined in a future version of MATLAB 313 | % handles structure with handles and user data (see GUIDATA) 314 | close(handles.figure1); 315 | -------------------------------------------------------------------------------- /DigiSim.py: -------------------------------------------------------------------------------- 1 | from abaqus import * 2 | from abaqusConstants import * 3 | s = mdb.models['Model-1'].ConstrainedSketch(name='__profile__', sheetSize=10.0) 4 | s.rectangle(point1=(0.000000, 0.000000), point2=(1000.000000, 500.000000)) 5 | p = mdb.models['Model-1'].Part(name='Part-1',dimensionality=TWO_D_PLANAR,type=DEFORMABLE_BODY) 6 | p.BaseShell(sketch=s) 7 | s0 = mdb.models['Model-1'].ConstrainedSketch(name='__profile__',sheetSize=200.0) 8 | g, v, d, c = s0.geometry, s0.vertices, s0.dimensions, s0.constraints 9 | s0.Line(point1=(212.000000, 313.000000), point2=(233.000000, 290.000000)) 10 | s0.Line(point1=(233.000000, 290.000000), point2=(241.000000, 264.000000)) 11 | s0.Line(point1=(241.000000, 264.000000), point2=(239.000000, 231.000000)) 12 | s0.Line(point1=(239.000000, 231.000000), point2=(227.000000, 206.000000)) 13 | s0.Line(point1=(227.000000, 206.000000), point2=(209.000000, 189.000000)) 14 | s0.Line(point1=(209.000000, 189.000000), point2=(187.000000, 179.000000)) 15 | s0.Line(point1=(187.000000, 179.000000), point2=(172.000000, 176.000000)) 16 | s0.Line(point1=(172.000000, 176.000000), point2=(117.000000, 176.000000)) 17 | s0.Line(point1=(117.000000, 176.000000), point2=(117.000000, 327.000000)) 18 | s0.Line(point1=(117.000000, 327.000000), point2=(175.000000, 327.000000)) 19 | s0.Line(point1=(175.000000, 327.000000), point2=(195.000000, 322.000000)) 20 | s0.Line(point1=(195.000000, 322.000000), point2=(212.000000, 313.000000)) 21 | s0.Line(point1=(137.000000, 310.000000), point2=(166.000000, 310.000000)) 22 | s0.Line(point1=(166.000000, 310.000000), point2=(189.000000, 305.000000)) 23 | s0.Line(point1=(189.000000, 305.000000), point2=(204.000000, 296.000000)) 24 | s0.Line(point1=(204.000000, 296.000000), point2=(216.000000, 279.000000)) 25 | s0.Line(point1=(216.000000, 279.000000), point2=(220.000000, 263.000000)) 26 | s0.Line(point1=(220.000000, 263.000000), point2=(217.000000, 229.000000)) 27 | s0.Line(point1=(217.000000, 229.000000), point2=(209.000000, 214.000000)) 28 | s0.Line(point1=(209.000000, 214.000000), point2=(188.000000, 198.000000)) 29 | s0.Line(point1=(188.000000, 198.000000), point2=(161.000000, 193.000000)) 30 | s0.Line(point1=(161.000000, 193.000000), point2=(137.000000, 194.000000)) 31 | s0.Line(point1=(137.000000, 194.000000), point2=(137.000000, 310.000000)) 32 | s0.Line(point1=(269.000000, 327.000000), point2=(289.000000, 327.000000)) 33 | s0.Line(point1=(289.000000, 327.000000), point2=(289.000000, 176.000000)) 34 | s0.Line(point1=(289.000000, 176.000000), point2=(269.000000, 176.000000)) 35 | s0.Line(point1=(269.000000, 176.000000), point2=(269.000000, 327.000000)) 36 | s0.Line(point1=(439.000000, 323.000000), point2=(440.000000, 301.000000)) 37 | s0.Line(point1=(440.000000, 301.000000), point2=(407.000000, 312.000000)) 38 | s0.Line(point1=(407.000000, 312.000000), point2=(381.000000, 311.000000)) 39 | s0.Line(point1=(381.000000, 311.000000), point2=(362.000000, 302.000000)) 40 | s0.Line(point1=(362.000000, 302.000000), point2=(352.000000, 292.000000)) 41 | s0.Line(point1=(352.000000, 292.000000), point2=(344.000000, 278.000000)) 42 | s0.Line(point1=(344.000000, 278.000000), point2=(340.000000, 263.000000)) 43 | s0.Line(point1=(340.000000, 263.000000), point2=(340.000000, 238.000000)) 44 | s0.Line(point1=(340.000000, 238.000000), point2=(350.000000, 211.000000)) 45 | s0.Line(point1=(350.000000, 211.000000), point2=(364.000000, 198.000000)) 46 | s0.Line(point1=(364.000000, 198.000000), point2=(386.000000, 191.000000)) 47 | s0.Line(point1=(386.000000, 191.000000), point2=(409.000000, 192.000000)) 48 | s0.Line(point1=(409.000000, 192.000000), point2=(423.000000, 197.000000)) 49 | s0.Line(point1=(423.000000, 197.000000), point2=(423.000000, 238.000000)) 50 | s0.Line(point1=(423.000000, 238.000000), point2=(390.000000, 238.000000)) 51 | s0.Line(point1=(390.000000, 238.000000), point2=(390.000000, 255.000000)) 52 | s0.Line(point1=(390.000000, 255.000000), point2=(443.000000, 256.000000)) 53 | s0.Line(point1=(443.000000, 256.000000), point2=(443.000000, 186.000000)) 54 | s0.Line(point1=(443.000000, 186.000000), point2=(426.000000, 178.000000)) 55 | s0.Line(point1=(426.000000, 178.000000), point2=(399.000000, 173.000000)) 56 | s0.Line(point1=(399.000000, 173.000000), point2=(372.000000, 175.000000)) 57 | s0.Line(point1=(372.000000, 175.000000), point2=(350.000000, 184.000000)) 58 | s0.Line(point1=(350.000000, 184.000000), point2=(329.000000, 206.000000)) 59 | s0.Line(point1=(329.000000, 206.000000), point2=(319.000000, 235.000000)) 60 | s0.Line(point1=(319.000000, 235.000000), point2=(319.000000, 264.000000)) 61 | s0.Line(point1=(319.000000, 264.000000), point2=(329.000000, 293.000000)) 62 | s0.Line(point1=(329.000000, 293.000000), point2=(346.000000, 313.000000)) 63 | s0.Line(point1=(346.000000, 313.000000), point2=(372.000000, 327.000000)) 64 | s0.Line(point1=(372.000000, 327.000000), point2=(410.000000, 330.000000)) 65 | s0.Line(point1=(410.000000, 330.000000), point2=(439.000000, 323.000000)) 66 | s0.Line(point1=(477.000000, 327.000000), point2=(497.000000, 327.000000)) 67 | s0.Line(point1=(497.000000, 327.000000), point2=(497.000000, 176.000000)) 68 | s0.Line(point1=(497.000000, 176.000000), point2=(477.000000, 176.000000)) 69 | s0.Line(point1=(477.000000, 176.000000), point2=(477.000000, 327.000000)) 70 | s0.Line(point1=(616.000000, 325.000000), point2=(616.000000, 303.000000)) 71 | s0.Line(point1=(616.000000, 303.000000), point2=(593.000000, 312.000000)) 72 | s0.Line(point1=(593.000000, 312.000000), point2=(567.000000, 311.000000)) 73 | s0.Line(point1=(567.000000, 311.000000), point2=(553.000000, 301.000000)) 74 | s0.Line(point1=(553.000000, 301.000000), point2=(551.000000, 284.000000)) 75 | s0.Line(point1=(551.000000, 284.000000), point2=(560.000000, 272.000000)) 76 | s0.Line(point1=(560.000000, 272.000000), point2=(597.000000, 253.000000)) 77 | s0.Line(point1=(597.000000, 253.000000), point2=(616.000000, 237.000000)) 78 | s0.Line(point1=(616.000000, 237.000000), point2=(623.000000, 220.000000)) 79 | s0.Line(point1=(623.000000, 220.000000), point2=(622.000000, 203.000000)) 80 | s0.Line(point1=(622.000000, 203.000000), point2=(617.000000, 192.000000)) 81 | s0.Line(point1=(617.000000, 192.000000), point2=(603.000000, 180.000000)) 82 | s0.Line(point1=(603.000000, 180.000000), point2=(584.000000, 174.000000)) 83 | s0.Line(point1=(584.000000, 174.000000), point2=(554.000000, 174.000000)) 84 | s0.Line(point1=(554.000000, 174.000000), point2=(530.000000, 181.000000)) 85 | s0.Line(point1=(530.000000, 181.000000), point2=(529.000000, 204.000000)) 86 | s0.Line(point1=(529.000000, 204.000000), point2=(548.000000, 194.000000)) 87 | s0.Line(point1=(548.000000, 194.000000), point2=(581.000000, 191.000000)) 88 | s0.Line(point1=(581.000000, 191.000000), point2=(597.000000, 198.000000)) 89 | s0.Line(point1=(597.000000, 198.000000), point2=(602.000000, 209.000000)) 90 | s0.Line(point1=(602.000000, 209.000000), point2=(601.000000, 221.000000)) 91 | s0.Line(point1=(601.000000, 221.000000), point2=(592.000000, 232.000000)) 92 | s0.Line(point1=(592.000000, 232.000000), point2=(555.000000, 251.000000)) 93 | s0.Line(point1=(555.000000, 251.000000), point2=(535.000000, 268.000000)) 94 | s0.Line(point1=(535.000000, 268.000000), point2=(530.000000, 280.000000)) 95 | s0.Line(point1=(530.000000, 280.000000), point2=(530.000000, 295.000000)) 96 | s0.Line(point1=(530.000000, 295.000000), point2=(535.000000, 310.000000)) 97 | s0.Line(point1=(535.000000, 310.000000), point2=(550.000000, 323.000000)) 98 | s0.Line(point1=(550.000000, 323.000000), point2=(567.000000, 329.000000)) 99 | s0.Line(point1=(567.000000, 329.000000), point2=(596.000000, 330.000000)) 100 | s0.Line(point1=(596.000000, 330.000000), point2=(616.000000, 325.000000)) 101 | s0.Line(point1=(651.000000, 327.000000), point2=(671.000000, 327.000000)) 102 | s0.Line(point1=(671.000000, 327.000000), point2=(671.000000, 176.000000)) 103 | s0.Line(point1=(671.000000, 176.000000), point2=(651.000000, 176.000000)) 104 | s0.Line(point1=(651.000000, 176.000000), point2=(651.000000, 327.000000)) 105 | s0.Line(point1=(710.000000, 327.000000), point2=(738.000000, 327.000000)) 106 | s0.Line(point1=(738.000000, 327.000000), point2=(788.000000, 206.000000)) 107 | s0.Line(point1=(788.000000, 206.000000), point2=(841.000000, 327.000000)) 108 | s0.Line(point1=(841.000000, 327.000000), point2=(867.000000, 327.000000)) 109 | s0.Line(point1=(867.000000, 327.000000), point2=(867.000000, 176.000000)) 110 | s0.Line(point1=(867.000000, 176.000000), point2=(847.000000, 176.000000)) 111 | s0.Line(point1=(847.000000, 176.000000), point2=(848.000000, 301.000000)) 112 | s0.Line(point1=(848.000000, 301.000000), point2=(795.000000, 177.000000)) 113 | s0.Line(point1=(795.000000, 177.000000), point2=(783.000000, 176.000000)) 114 | s0.Line(point1=(783.000000, 176.000000), point2=(735.000000, 284.000000)) 115 | s0.Line(point1=(735.000000, 284.000000), point2=(730.000000, 302.000000)) 116 | s0.Line(point1=(730.000000, 302.000000), point2=(730.000000, 176.000000)) 117 | s0.Line(point1=(730.000000, 176.000000), point2=(710.000000, 176.000000)) 118 | s0.Line(point1=(710.000000, 176.000000), point2=(710.000000, 327.000000)) 119 | p1 = mdb.models['Model-1'].parts['Part-1'] 120 | pickedFaces = p1.faces[0:1] 121 | p1.PartitionFaceBySketch(faces=pickedFaces, sketch=s0) 122 | f2=mdb.models['Model-1'].parts['Part-1'].faces 123 | for i in range(len(f2)): 124 | mdb.models['Model-1'].parts['Part-1'].Set(name = 'Set'+str(i) , faces=f2[i:i+1]) 125 | -------------------------------------------------------------------------------- /Image3D.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeoGroup/DigiSim/1255f9a8bab70532cca7505e487eac7efa5138d1/Image3D.mat -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DigiSim 2 | Matlab toolbox for digital image based simulation 3 | 4 | DigiSim is an open source software package for digital image processing based micromechanical Simulation. Both 2D bitmap and 3D volumetric images are supported. It is an easy, user-friendly and ready-to-use software developed using Matlab. The main object of this code is to model the micromechanical behavior of heterogeneous material based on the image captured by CT, MRI or digital camera. Both FEM and DEM model can be generated using DigiSim package. Besides, it also can be employed to extract the microstructure of material like inclusions, pores and cracks. 5 | 6 | Authors: Qing-xiang Meng , Lanlan Yang, Yue Li, Long Yan 7 | 8 | If you want to use these codes, Please cite the following articles: 9 | 10 | 1. Meng QX, Xu W.Y, Wang HL, Zhuang XY, Xie W-C, Timon Rabczuk, DigiSim — An Open Source Software Package for Heterogeneous Material Modeling Based on Digital Image Processing, Advances in Engineering Software, 2020, 148: 102836. 11 | 12 | 2. Meng QX, Wang HL, Xu WY, Zhang Q. A coupling method incorporating digital image processing and discrete element method for modeling of geomaterials. Eng Computation. 2018;35:411-31. 13 | 14 | 3. Meng QX, Wang HL, Xu WY, Cai M. A numerical homogenization study of the elastic property of a soil-rock mixture using random mesostructure generation. Computers and Geotechnics. 2018;98:48-57. 15 | 16 | 4. Lanlan Yang, Weiya Xu*, Qingxiang Meng, Wei-Chau Xie, Huanling Wang, Mengcheng Sun. Numerical Determination of RVE for Heterogeneous Geomaterials Based on Digital Image Processing technology [J]. Processes, 2019, 7(6): 346. 17 | 18 | 5. Yan L, Meng QX*, Xu WY, Wang HL, Zhang Q, Zhang JC, et al. A numerical method for analyzing the permeability of heterogeneous geomaterials based on digital image processing. Journal of Zhejiang University-SCIENCE A. 2017;18:124-37. 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /User Manual.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeoGroup/DigiSim/1255f9a8bab70532cca7505e487eac7efa5138d1/User Manual.docx -------------------------------------------------------------------------------- /boundary_close.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeoGroup/DigiSim/1255f9a8bab70532cca7505e487eac7efa5138d1/boundary_close.m -------------------------------------------------------------------------------- /concrete.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeoGroup/DigiSim/1255f9a8bab70532cca7505e487eac7efa5138d1/concrete.jpg -------------------------------------------------------------------------------- /concrete.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeoGroup/DigiSim/1255f9a8bab70532cca7505e487eac7efa5138d1/concrete.xls -------------------------------------------------------------------------------- /example1.m: -------------------------------------------------------------------------------- 1 | clear;clc 2 | tic; 3 | addpath subroutine 4 | image_file='DigiSim.jpg'; 5 | fn=image_file(1:length(image_file)-4); 6 | % image process 7 | x1=imread(image_file); 8 | x1=x1(:,:,1); 9 | x1(x1<200)=0; 10 | x1(x1>200)=1; 11 | imshow(x1*255); 12 | % Vectorization bitmap 13 | scale=1; error=2; 14 | [P] = vectorization2(1-x1,error); 15 | P=geom_scale(P,scale); 16 | figure(1); 17 | geom_plot(P); 18 | % Geometry information analysis 19 | [parea,fraction]=geom_area(P); 20 | mg=min_bound_box2(P); 21 | % mbr_plot(mg); 22 | % geo_file='geometry.xls'; 23 | % geom_stas(geo_file,parea,fraction,mg,P); 24 | % geo_sta_plot(mg,parea); 25 | % Geometry information OutPut 26 | dxf_file=[fn,'.dxf']; 27 | dxf_file_write(P,dxf_file); 28 | gmsh_file=[fn,'.geo']; 29 | lc=10;lc2=20; 30 | gmsh_file_write(P,gmsh_file,lc,lc2); 31 | abaqus_file=[fn,'.py']; 32 | write_abaqus_2d(abaqus_file,P); 33 | pfc_file=[fn,'.p2dat']; 34 | radius=3; 35 | write_pfc_2d_group(P,radius,pfc_file); 36 | toc; -------------------------------------------------------------------------------- /example2.m: -------------------------------------------------------------------------------- 1 | clear;clc 2 | tic; 3 | addpath subroutine 4 | image_file='concrete.jpg'; 5 | fn=image_file(1:length(image_file)-4); 6 | % image_file='DigiSim.jpg'; 7 | % image process 8 | x1=imread(image_file); 9 | x1=x1(:,:,1); 10 | x1(x1<200)=0; 11 | x1(x1>200)=1; 12 | % imshow(x1*255); 13 | % Vectorization bitmap 14 | scale=0.15; error=1.4; 15 | [P] = vectorization2(1-x1,error); 16 | P=geom_scale(P,scale); 17 | figure(1); 18 | geom_plot(P); 19 | pts=get_refine_point(P,500,0.025); 20 | 21 | % Geometry information analysis 22 | [parea,fraction]=geom_area(P); 23 | mg=min_bound_box2(P); 24 | mbr_plot(mg); 25 | geo_file='geometry.xls'; 26 | geom_stas(geo_file,parea,fraction,mg,P); 27 | geo_sta_plot(mg,parea); 28 | % Geometry information OutPut 29 | dxf_file=[fn,'.dxf']; 30 | dxf_file_write(P,dxf_file); 31 | gmsh_file=[fn,'.geo']; 32 | lc=0.4;lc2=5; 33 | gmsh_file_write(P,gmsh_file,lc,lc2,pts); 34 | % % gmsh_file_write(P,gmsh_file,lc,lc2); 35 | abaqus_file=[fn,'.py']; 36 | write_abaqus_2d(abaqus_file,P); 37 | pfc_file=[fn,'.p2dat']; 38 | radius=1; 39 | write_pfc_2d_group(P,radius,pfc_file); 40 | toc; -------------------------------------------------------------------------------- /example3.m: -------------------------------------------------------------------------------- 1 | clear;clc 2 | tic; 3 | addpath subroutine 4 | % image_file='DigiSim.jpg'; 5 | image_file='3phase.jpg'; 6 | scale=0.1; error=3.5; 7 | fn=image_file(1:length(image_file)-4); 8 | x1=imread(image_file); 9 | x=x1(:,:,1); 10 | % Vectorization bitmap 11 | x1=x; 12 | x1(x1<240)=0; 13 | x1(x1>240)=1; 14 | [P1] = vectorization2(x1,error); 15 | % imshow(x1*255); 16 | x2=x; 17 | x2(x2<195)=1; 18 | x2(x2>195)=0; 19 | [P2] = vectorization2(x2,error); 20 | P1(:,size(P1,2))=[]; 21 | P=[P1,P2]; 22 | group=[ones(1,size(P1,2)),ones(1,size(P2,2))*2]; 23 | % 24 | P=geom_scale(P,scale); 25 | figure(1); 26 | geom_plot(P,group); 27 | % Geometry information analysis 28 | [parea,fraction]=geom_area(P); 29 | mg=min_bound_box2(P); 30 | % Geometry information OutPut 31 | dxf_file=[fn,'.dxf']; 32 | dxf_file_write(P,dxf_file); 33 | abaqus_file=[fn,'.py']; 34 | write_abaqus_2d(abaqus_file,P,group); 35 | toc; -------------------------------------------------------------------------------- /example4.m: -------------------------------------------------------------------------------- 1 | clear;clc 2 | tic; 3 | addpath subroutine 4 | addpath subroutine\rayTriangleIntersection 5 | % image_file='DigiSim.jpg'; 6 | image_file='Image3D.mat';error=2.5; 7 | fn=image_file(1:length(image_file)-4); 8 | [particle,V] =vectorization3(image_file,error); 9 | fout=[fn,'.py']; 10 | out_abaqus_python( particle,V,fout); 11 | toc; -------------------------------------------------------------------------------- /geometry.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeoGroup/DigiSim/1255f9a8bab70532cca7505e487eac7efa5138d1/geometry.xls -------------------------------------------------------------------------------- /resource/data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeoGroup/DigiSim/1255f9a8bab70532cca7505e487eac7efa5138d1/resource/data.mat -------------------------------------------------------------------------------- /resource/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeoGroup/DigiSim/1255f9a8bab70532cca7505e487eac7efa5138d1/resource/logo.jpg -------------------------------------------------------------------------------- /subroutine/addthick.m: -------------------------------------------------------------------------------- 1 | function pf=addthick(p,thick) 2 | % Add thickness of a polygon 3 | pf=p; 4 | for i=1:length(p) 5 | if i==1 6 | a=[p(i,1)-p(length(p),1),p(i,2)-p(length(p),2)]; 7 | b=-[p(i,1)-p(i+1,1),p(i,2)-p(i+1,2)]; 8 | elseif i==length(p) 9 | a=[p(i,1)-p(i-1,1),p(i,2)-p(i-1,2)]; 10 | b=-[p(i,1)-p(1,1),p(i,2)-p(1,2)]; 11 | else 12 | a=[p(i,1)-p(i-1,1),p(i,2)-p(i-1,2)]; 13 | b=-[p(i,1)-p(i+1,1),p(i,2)-p(i+1,2)]; 14 | end 15 | a=[a(2),-a(1)]; 16 | b=[b(2),-b(1)]; 17 | a=a/norm(a); 18 | b=b/norm(b); 19 | a=a*thick; 20 | b=b*thick; 21 | % disp(a); 22 | pf(i,1)=p(i,1)+a(1)+b(1); 23 | pf(i,2)=p(i,2)+a(2)+b(2); 24 | % direction=(a+b); 25 | % direction=direction/norm(direction); 26 | % theta=acos(dot(a,b)/norm(a)/norm(b))/2; 27 | % tmp=a(1)*b(2)-a(2)*b(1); 28 | %http://blog.csdn.net/hy3316597/article/details/52732963 29 | % if tmp>0 30 | % leng=thick/sin(theta); 31 | % else 32 | % leng=-thick/sin(theta); 33 | % end 34 | % pf(i,1)=p(i,1)+a+b; 35 | % pf(i,2)=p(i,2)+direction(2)*leng; 36 | end 37 | 38 | end 39 | 40 | -------------------------------------------------------------------------------- /subroutine/axis_length_direction.m: -------------------------------------------------------------------------------- 1 | function [ e,l,w,alpha,beta] = axis_length_direction( p ) 2 | % Get the boundary of polygon 3 | % (y-y2)/(y1-y2) = (x-x2)/(x1-x2) 4 | % 1/(x1-x2)*x+[-1/(y1-y2)]*y+y2/(y1-y2)-x2/(x1-x2) 5 | e=zeros(5,2); 6 | n=size(p,1); 7 | D=pdist(p); 8 | D=squareform(D); 9 | T=max(D(:)); 10 | [row,col]=find(D==T); 11 | % row=sort(row); 12 | x1=p(row(1),1);x2=p(col(1),1); 13 | y1=p(row(1),2);y2=p(col(1),2); 14 | % plot(p(:,1),p(:,2),'-o');hold on 15 | % plot([x1,x2],[y1,y2],'-o');hold on 16 | l=sqrt((x2-x1)^2+(y2-y1)^2); 17 | A=1/(x1-x2);B=-1/(y1-y2);C=y2/(y1-y2)-x2/(x1-x2); 18 | if row(1)maxv 30 | maxv=abs(dist(i)); 31 | point=p(up(i),:); 32 | % maxi=i; 33 | end 34 | end 35 | w=maxv; 36 | % plot(point(1),point(2),'b*'); hold on 37 | a=[x2-x1,y2-y1]; 38 | b=[point(1)-x1,point(2)-y1]; 39 | c=dot(a,b)/norm(a)/norm(b)*norm(b)*a/norm(a); 40 | d=b-c; 41 | x1n=x1+d(1);y1n=y1+d(2); 42 | x2n=x2+d(1);y2n=y2+d(2); 43 | % plot([x1n,x2n],[y1n,y2n],'-*');hold on 44 | 45 | e(1,:)=[x2n,y2n]; 46 | e(2,:)=[x1n,y1n]; 47 | 48 | e(5,:)=e(1,:); 49 | maxv=0;point=[0,0]; 50 | for i=1:length(down) 51 | dist(i)=(A*p(down(i),1)+B*p(down(i),2)+C)/sqrt(A^2+B^2); 52 | if abs(dist(i))>maxv 53 | maxv=abs(dist(i)); 54 | point=p(down(i),:); 55 | % maxi=i; 56 | end 57 | end 58 | w=w+maxv; 59 | a=[x2-x1,y2-y1]; 60 | b=[point(1)-x1,point(2)-y1]; 61 | c=dot(a,b)/norm(a)/norm(b)*norm(b)*a/norm(a); 62 | d=b-c; 63 | x1n=x1+d(1);y1n=y1+d(2); 64 | x2n=x2+d(1);y2n=y2+d(2); 65 | % plot([x1n,x2n],[y1n,y2n],'-*');hold on 66 | % hold on;plot([x1n,x2n],[y1n,y2n],'-*'); 67 | e(4,:)=[x2n,y2n]; 68 | e(3,:)=[x1n,y1n]; 69 | % calcualte the axis direction 70 | if e(2,2)>=e(1,2) 71 | axis=e(2,:)-e(1,:); 72 | else 73 | axis=e(1,:)-e(2,:); 74 | end 75 | alpha=acos(axis(1)/norm(axis))*180/pi; 76 | if e(3,2)>=e(2,2) 77 | axis=e(3,:)-e(2,:); 78 | else 79 | axis=e(2,:)-e(3,:); 80 | end 81 | beta=acos(axis(1)/norm(axis))*180/pi; 82 | % plot(e(:,1),e(:,2)); 83 | end 84 | 85 | -------------------------------------------------------------------------------- /subroutine/ball_generate.m: -------------------------------------------------------------------------------- 1 | function ballid=ball_generate(P,radius) 2 | % radius=2; 3 | tmp=P{2,size(P,2)}; 4 | domain.size1=max(tmp(:,1)); 5 | domain.size2=max(tmp(:,2)); 6 | nx=floor(domain.size1/radius/2); 7 | ny=floor(domain.size2/radius/sqrt(3)); 8 | nball=0;%kk=0; 9 | % I=length(Polygon.poly); 10 | ball=zeros(100000,2); 11 | for i=1:ny%ny 12 | if mod(i,2)==1 13 | for j=1:nx%nx 14 | index=0; 15 | x=radius+(j-1)*2*radius; 16 | y=radius+(i-1)*sqrt(3)*radius; 17 | nball=nball+1; 18 | ball(nball,:)=[x,y]; 19 | end 20 | else 21 | for j=1:nx-1 22 | index=0; 23 | x=(j-1)*2*radius+2*radius; 24 | y=radius+(i-1)*sqrt(3)*radius;%-sqrt(3)/2*radius; 25 | nball=nball+1; 26 | ball(nball,:)=[x,y]; 27 | end 28 | end 29 | end 30 | ball=ball(1:nball,:); 31 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 32 | 33 | ballid=cell(size(P,2),1); 34 | 35 | for i=1:size(P,2)-1 36 | tmp=P{2,i}; 37 | xv=tmp(:,1);yv=tmp(:,2); 38 | % plot(xv,yv,'-');hold on 39 | if P{1,i}>1 40 | in=inpolygon(ball(:,1),ball(:,2),xv,yv); 41 | btmp=ball(in,:); 42 | bleft=ball(~in,:); 43 | for j=1:P{1,i}-1 44 | tmp=P{2+j,i}; 45 | xv=tmp(:,1);yv=tmp(:,2); 46 | % plot(xv,yv,'-');hold on 47 | in=inpolygon(btmp(:,1),btmp(:,2),xv,yv); 48 | bleft=[bleft;btmp(in,:)]; 49 | btmp=btmp(~in,:); 50 | end 51 | % plot(btmp(:,1),btmp(:,2),'o'); hold on 52 | ball=bleft; 53 | else 54 | in=inpolygon(ball(:,1),ball(:,2),xv,yv); 55 | btmp=ball(in,:); 56 | % plot(btmp(:,1),btmp(:,2),'o'); hold on 57 | ball=ball(~in,:); 58 | end 59 | ballid{i}=btmp; 60 | end 61 | ballid{i+1}=ball; 62 | % plot(ball(:,1),ball(:,2),'o','Color',[0.5 0.5 0.5]); 63 | % axis off 64 | end 65 | 66 | -------------------------------------------------------------------------------- /subroutine/boundary_smooth.m: -------------------------------------------------------------------------------- 1 | function mp=boundary_smooth(vert,error) 2 | % 3 | multi_point=vert(1:size(vert,1)-1,:); 4 | % 5 | D=pdist(multi_point); 6 | D=squareform(D); 7 | T=max(D(:)); 8 | [row,col]=find(D==T); 9 | % 10 | [P]=sort([row(1),col(1)]); 11 | line{1}=vert(P(1):P(2),:); 12 | line{2}=vert([P(1),P(2)],:); 13 | line2_1=vert(P(2):size(vert,1),:); 14 | line2_2=vert(2:P(1),:); 15 | line{3}=[line2_1;line2_2]; 16 | line{4}=vert([P(2),P(1)],:); 17 | % error=1.4; 18 | LM=10; 19 | K=0; 20 | tline{1000}=0; 21 | while LM>error 22 | K=0; 23 | LM=0; 24 | for i=1:length(line)/2 25 | % i 26 | a=line{2*i-1}; 27 | b=line{2*i}; 28 | [lj,pos]=dis_cal(a,b); 29 | if lj>error 30 | tline{K+1}=a(1:pos,:); 31 | tline{K+2}=a([1,pos],:); 32 | tline{K+3}=a(pos:size(a,1),:); 33 | tline{K+4}=a([pos,size(a,1)],:); 34 | K=K+4; 35 | else 36 | tline{K+1}=a; 37 | tline{K+2}=b; 38 | K=K+2; 39 | end 40 | if LM0 24 | if jl1 8 | for j=1:P{1,i}-1 9 | tmp=P{2+j,i}; 10 | parea(i)=parea(i)-polyarea(tmp(:,1)',tmp(:,2)',2); 11 | end 12 | end 13 | end 14 | fraction=sum(parea(1:size(P,2)-1))/parea(size(P,2)); 15 | end 16 | 17 | -------------------------------------------------------------------------------- /subroutine/geom_axis.m: -------------------------------------------------------------------------------- 1 | function paxis=geom_axis(P) 2 | %calculate the axis information of polygon 3 | % first cell is the bound box with maximum and minimum aixs 4 | % second cell is the length of long axis 5 | % third cell is the length of short axis 6 | % forth cell is the angle of long axis 7 | % fifth cell is the angle of short axis 8 | paxis=cell(size(P,2)-1,5); 9 | for i=1:size(P,2)-1 10 | p=P{2,i}; 11 | [ b,l,w,alpha,beta] = axis_length_direction( p ); 12 | paxis{i,1}=b; 13 | paxis{i,2}=l; 14 | paxis{i,3}=w; 15 | paxis{i,4}=alpha; 16 | paxis{i,5}=beta; 17 | end 18 | 19 | 20 | 21 | 22 | end 23 | 24 | -------------------------------------------------------------------------------- /subroutine/geom_plot.m: -------------------------------------------------------------------------------- 1 | function geom_plot(P,group) 2 | % Plot the geometry information 3 | if nargin==1 4 | for i=1:size(P,2) 5 | for j=1:P{1,i} 6 | tmp=P{j+1,i}; 7 | plot(tmp(:,1),tmp(:,2),'-');hold on 8 | end 9 | end 10 | % tmp=P{2,size(P,2)}; 11 | % axis([0 max(tmp(:,1))*1.2 0 max(tmp(:,2))*1.2]); 12 | axis off 13 | elseif nargin==2 14 | for i=1:size(P,2) 15 | if group(i)==1 16 | for j=1:P{1,i} 17 | tmp=P{j+1,i}; 18 | plot(tmp(:,1),tmp(:,2),'r-');hold on 19 | end 20 | else 21 | for j=1:P{1,i} 22 | tmp=P{j+1,i}; 23 | plot(tmp(:,1),tmp(:,2),'b-');hold on 24 | end 25 | end 26 | end 27 | % tmp=P{2,size(P,2)}; 28 | axis off 29 | end 30 | 31 | end -------------------------------------------------------------------------------- /subroutine/geom_scale.m: -------------------------------------------------------------------------------- 1 | function P=geom_scale(P,scale) 2 | % Geometry rescale with a uniform factor 3 | for i=1:size(P,2) 4 | for j=1:P{1,i} 5 | % tmp=P{j+1,i}; 6 | % plot(tmp(:,1),tmp(:,2),'-o');hold on 7 | P{j+1,i}=P{j+1,i}*scale; 8 | end 9 | end 10 | 11 | end 12 | 13 | -------------------------------------------------------------------------------- /subroutine/geom_stas.m: -------------------------------------------------------------------------------- 1 | function geom_stas(geo_file,parea,fraction,mg,P) 2 | % output the geometry information to xls file 3 | filename =geo_file; 4 | % filename = 'testdata.xlsx'; 5 | %area, length, width, alpha, beta 6 | MS=cell(5,size(P,2)-1); 7 | MS{1,1}='area'; 8 | MS{1,2}='length'; 9 | MS{1,3}='width'; 10 | MS{1,4}='alpha'; 11 | MS{1,5}='isboundary'; 12 | for i=2:size(P,2) 13 | MS{i,1}=parea(i-1); 14 | MS{i,2}=mg{i-1,2}; 15 | MS{i,3}=mg{i-1,3}; 16 | MS{i,4}=mg{i-1,4}; 17 | MS{i,5}=mg{i-1,6}; 18 | end 19 | % A = {'Time','Temperature'; 12,98; 13,99; 14,97}; 20 | sheet = 'Sheet1'; 21 | xlRange = 'A1'; 22 | xlswrite(filename,MS,sheet,xlRange) 23 | F={'Fraction(%)';fraction*100}; 24 | xlswrite(filename,F,sheet,'F1'); 25 | % minimum boundary rectangle 26 | 27 | end -------------------------------------------------------------------------------- /subroutine/get_particle.m: -------------------------------------------------------------------------------- 1 | function [particle] = get_particle(T,iparticle,error) 2 | % get one particle 3 | [l,m,n] = ind2sub(size(T),find(T == iparticle)); 4 | view(3) 5 | t_surf=cell(length(l)*6,1); 6 | t_center=zeros(3,length(l)*6); 7 | for I=1:length(m) 8 | [surfs,center] = voxel_surf(l(I),m(I),n(I)); 9 | for i=1:6 10 | x=surfs(1,(i-1)*4+1:4*i); 11 | y=surfs(2,(i-1)*4+1:4*i); 12 | z=surfs(3,(i-1)*4+1:4*i); 13 | t_surf{(I-1)*6+i}=[x;y;z]; 14 | end 15 | t_center(:,(I-1)*6+1:(I-1)*6+6)=center; 16 | end 17 | t_center=t_center'; 18 | [C,IA,IC]=unique(t_center,'rows'); 19 | index=1:1:length(l)*6; 20 | irep=setdiff(index,IA); 21 | tirep=t_center(irep,:); 22 | [c]=setdiff(C,tirep,'rows'); 23 | [C,ia,ib] = intersect(t_center,c,'rows'); 24 | 25 | zp=zeros(3,4*length(ia)); 26 | for i=1:length(ia) 27 | xyz=t_surf{ia(i)}; 28 | zp(:,4*(i-1)+1:4*i)=xyz; 29 | x=xyz(1,:); 30 | y=xyz(2,:); 31 | z=xyz(3,:); 32 | % patch(x,y,z,'blue'); hold on 33 | % plot3(t_center(ia(i),1),t_center(ia(i),2),t_center(ia(i),3),'*'); hold on 34 | end 35 | alpha(0.2); 36 | % plot3(zp(1,:),zp(2,:),zp(3,:),'*');hold on; 37 | zp2=unique(zp','rows'); 38 | % plot3(zp2(:,1),zp2(:,2),zp2(:,3),'*'); 39 | D=pdist(zp2); 40 | D=squareform(D); 41 | TD=max(D(:)); 42 | [row,col]=find(D==TD); 43 | [P]=sort([row(1),col(1)]); 44 | % plot3(zp2(P,1),zp2(P,2),zp2(P,3),'-o'); hold on 45 | line1=zp2(P,:); 46 | % add two points into maximum octahedron 47 | PT=zeros(6,3); 48 | PT(1,:)=line1(1,:); 49 | PT(3,:)=line1(2,:); 50 | 51 | [~,pos]=dis_cal(zp2,line1); 52 | P=[P,pos]; 53 | 54 | surf1=zp2(P,:); 55 | [~,pos]=get_surf_points(zp2,surf1,0.1); 56 | zp3=zp2(pos,:); 57 | % [x,y,z]= get_xyz(zp2,pos); %plot3(x,y,z,'o');hold on 58 | [~,pos]=dis_cal_surf(zp2,surf1,1); 59 | % [x,y,z]= get_xyz(zp2,pos); plot3(x,y,z,'*');hold on 60 | surf2=zp2([P(1),P(2),pos],:); 61 | [~,pos]=dis_cal_surf(zp3,surf2,2); 62 | % [x,y,z]= get_xyz(zp3,pos); plot3(x,y,z,'*');hold on 63 | % add a new point into maximum octahedron 64 | PT(2,:)=zp3(pos,:); 65 | 66 | [~,pos]=dis_cal_surf(zp3,surf2,3); 67 | % [x,y,z]= get_xyz(zp3,pos); plot3(x,y,z,'*');hold on 68 | % add a new point into maximum octahedron 69 | PT(4,:)=zp3(pos,:); 70 | 71 | % get the point out of surf 72 | [~,pos]=dis_cal_surf(zp2,surf1,2); 73 | % [x,y,z]= get_xyz(zp2,pos); plot3(x,y,z,'*');hold on 74 | PT(5,:)=zp2(pos,:); 75 | [jl,pos]=dis_cal_surf(zp2,surf1,3); 76 | % [x,y,z]= get_xyz(zp2,pos); plot3(x,y,z,'*');hold on 77 | PT(6,:)=zp2(pos,:); 78 | 79 | pcenter=sum(PT)/length(PT); 80 | 81 | %% get first polyhedron 82 | % error=1.8; 83 | TV=error+0.001; 84 | I=size(PT,1); 85 | while TV>error 86 | % disp('OK'); 87 | [azimuth,elevation,r] = cart_sph(PT,pcenter); 88 | [x,y,z]=sph2cart(azimuth,elevation,ones(size(r))); 89 | PR=[x,y,z]; % PR means the Cartesian Coordinates on a unit sphere 90 | X=PR; 91 | K = convhulln(X); 92 | % X=PT; 93 | % trisurf(K,X(:,1),X(:,2),X(:,3)); 94 | Pseg=cell(size(K,1),1); 95 | Pdis=zeros(size(K,1),1); 96 | tp=zp2; 97 | for i=1:size(K,1) 98 | it=0;tmp=tp; 99 | v1=PT(K(i,1),:);v2=PT(K(i,2),:);v3=PT(K(i,3),:); 100 | for j=1:size(tp,1) 101 | direction=tp(j,:)-pcenter; 102 | [flag, ~, ~, dist] = rayTriangleIntersection(pcenter, direction, v1, v2, v3); 103 | if flag==1 && dist>0 104 | it=it+1; 105 | tmp(it,:)=tp(j,:); 106 | end 107 | end 108 | Pseg{i,1}=tmp(1:it,:); 109 | 110 | [jl,pos]=dis_cal_surf(Pseg{i,1},PT(K(i,:),:),1); 111 | if jl>error 112 | I=I+1; 113 | PT(I,:)=tmp(pos,:); 114 | end 115 | Pdis(i,1)=jl; 116 | tp=setdiff(tp,Pseg{i,1},'rows'); 117 | end 118 | TV=max(Pdis); 119 | % disp(TV); 120 | end 121 | 122 | [azimuth,elevation,r] = cart_sph(PT,pcenter); 123 | [x,y,z]=sph2cart(azimuth,elevation,ones(size(r))); 124 | PR=[x,y,z]; % PR means the Cartesian Coordinates on a unit sphere 125 | X=PR; 126 | K = convhulln(X); 127 | % X=PT; 128 | 129 | 130 | [K,PT] = regulization(pcenter,K,PT,3); 131 | 132 | error=3; 133 | [lx,ly,lz]=size(T); 134 | for i=1:size(PT,1) 135 | tmp=PT(i,:); 136 | if abs(tmp(1))t2 15 | l=t1;w=t2; 16 | axis=bb(:,2)-bb(:,1); 17 | if axis(2)<0 18 | axis=-axis; 19 | end 20 | alpha=acos(axis(1)/norm(axis))*180/pi; 21 | if alpha>90 22 | beta=alpha-90; 23 | else 24 | beta=alpha+90; 25 | end 26 | else 27 | l=t2;w=t1; 28 | axis=bb(:,3)-bb(:,2); 29 | if axis(2)<0 30 | axis=-axis; 31 | end 32 | alpha=acos(axis(1)/norm(axis))*180/pi; 33 | if alpha>90 34 | beta=alpha-90; 35 | else 36 | beta=alpha+90; 37 | end 38 | end 39 | 40 | % bbox{i}=bb'; 41 | mg{i,1}=bb'; 42 | mg{i,2}=l; 43 | mg{i,3}=w; 44 | mg{i,4}=alpha; 45 | mg{i,5}=beta; 46 | % judge wether at the boundary 47 | tmp=P{2,i}; 48 | x1=min(tmp(:,1));x2=max(tmp(:,1)); 49 | y1=min(tmp(:,2));y2=max(tmp(:,2)); 50 | isb=0; 51 | if x1==0 && y1==0 52 | isb=1; 53 | elseif x1==0 && y2==Ly 54 | isb=1; 55 | elseif x2==Lx && y2==Ly 56 | isb=1; 57 | elseif x2==Lx && y1==0 58 | isb=1; 59 | elseif x1==0 && (y1~=0 || y2~=Ly) 60 | isb=1; 61 | elseif x2==Lx && (y1~=0 || y2~=Ly) 62 | isb=1; 63 | elseif (x1 ~=0 || x2~=Lx) && y1==0 64 | isb=1; 65 | elseif (x1 ~=0 || x2~=Lx) && y2==Ly 66 | isb=1; 67 | end 68 | mg{i,6}=isb; 69 | % plot(bb(1,:),bb(2,:),'-*');hold on 70 | end 71 | 72 | 73 | end 74 | 75 | -------------------------------------------------------------------------------- /subroutine/out_abaqus_python.m: -------------------------------------------------------------------------------- 1 | function out_abaqus_python( Particle,V,fpy ) 2 | % Write the polyhedron and domain inro pythonscript 3 | % fpy='testpoly.py'; 4 | % Particle=particle; 5 | [domain_size,domain_size2,domain_size3]=size(V); 6 | fid=fopen(fpy,'wt'); 7 | fprintf(fid,'#***************************************************\n'); 8 | fprintf(fid,'#** Written By MQX **\n'); 9 | fprintf(fid,'#** Hohai University **\n'); 10 | fprintf(fid,'#** %s **\n',datestr(now)); 11 | fprintf(fid,'#***************************************************\n'); 12 | fprintf(fid,'from abaqus import *\n'); 13 | fprintf(fid,'from abaqusConstants import *\n'); 14 | %fprintf(fid,'session.Viewport(name=''Viewport: 1'', origin=(0.0, 0.0), width=187.938018798828, \n'); 15 | %fprintf(fid,' height=229.658340454102)\n'); 16 | fprintf(fid,'session.viewports[''Viewport: 1''].makeCurrent()\n'); 17 | fprintf(fid,'session.viewports[''Viewport: 1''].maximize()\n'); 18 | fprintf(fid,'from caeModules import *\n'); 19 | fprintf(fid,'from driverUtils import executeOnCaeStartup\n'); 20 | fprintf(fid,'executeOnCaeStartup()\n'); 21 | %fprintf(fid,'session.viewports[''Viewport: 1''].partDisplay.geometryOptions.setValues(\n'); 22 | %fprintf(fid,' referenceRepresentation=ON)\n'); 23 | fprintf(fid,'Mdb()\n'); 24 | fprintf(fid,'session.viewports[''Viewport: 1''].setValues(displayedObject=None)\n'); 25 | fprintf(fid,'p = mdb.models[''Model-1''].Part(name=''Part-%d'', dimensionality=THREE_D, \n',1); 26 | fprintf(fid,' type=DEFORMABLE_BODY)\n'); 27 | fprintf(fid,'p = mdb.models[''Model-1''].parts[''Part-%d'']\n',1); 28 | for i=1:length(Particle) 29 | tp=Particle{i}.vert; 30 | tc=Particle{i}.poly; 31 | tpc=zeros(length(tc),3); 32 | for j=1:length(tc) 33 | tv=tc{j}; 34 | tpc(j,:)=sum(tp(tv,:))/length(tv); 35 | tv(length(tv)+1)=tv(1);tlc=zeros(3,3); 36 | for k=1:length(tv)-1 37 | tpos1=tp(tv(k),:); 38 | tpos2=tp(tv(k+1),:); 39 | tlc(k,:)=(tpos1+tpos2)/2; 40 | fprintf(fid,'p.WirePolyLine(points=(((%f, %f, %f), (%f, %f, %f)), ), mergeType=IMPRINT)\n',tpos1(1),tpos1(2),tpos1(3),tpos2(1),tpos2(2),tpos2(3)); 41 | end 42 | fprintf(fid,'e = p.edges\n'); 43 | fprintf(fid,'e1 = e.findAt(\n'); 44 | for k=1:length(tv)-1 45 | fprintf(fid,'((%f, %f, %f),),\n',tlc(k,1),tlc(k,2),tlc(k,3)); 46 | % fprintf(fid,'((%f, %f, %f),),\n',tlc(2,1),tlc(2,2),tlc(2,3)); 47 | % fprintf(fid,'((%f, %f, %f),),\n',tlc(3,1),tlc(3,2),tlc(3,3)); 48 | end 49 | fprintf(fid,')\n'); 50 | % p.CoverEdges(edgeList = e1, tryAnalytical=True) 51 | % for k=1:3 52 | % fprintf(fid,'e%d = e.findAt(((%f, %f, %f), )) \n',k,tlc(k,1),tlc(k,2),tlc(k,3)); 53 | % end 54 | fprintf(fid,'p.CoverEdges(edgeList = e1, tryAnalytical=True)\n'); 55 | end 56 | end 57 | % fprintf(fid,'f = p.faces\n'); 58 | %% Write the domain 59 | 60 | fprintf(fid,'s = mdb.models[''Model-1''].ConstrainedSketch(name=''__profile__'', \n'); 61 | fprintf(fid,' sheetSize=200.0)\n'); 62 | fprintf(fid,'g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints\n'); 63 | fprintf(fid,'s.setPrimaryObject(option=STANDALONE)\n'); 64 | fprintf(fid,'s.rectangle(point1=(%f, %f), point2=(%f, %f))\n',0,0,domain_size,domain_size2); 65 | fprintf(fid,'p = mdb.models[''Model-1''].Part(name=''Part-%d'', dimensionality=THREE_D, \n',2); 66 | fprintf(fid,' type=DEFORMABLE_BODY)\n'); 67 | fprintf(fid,'p = mdb.models[''Model-1''].parts[''Part-%d'']\n',2); 68 | fprintf(fid,'p.BaseSolidExtrude(sketch=s, depth=%f)\n',domain_size3); 69 | 70 | 71 | %% Assembly the model 72 | fprintf(fid,'a = mdb.models[''Model-1''].rootAssembly\n'); 73 | for i=1:2 74 | fprintf(fid,'p = mdb.models[''Model-1''].parts[''Part-%d'']\n',i); 75 | fprintf(fid,'a.Instance(name=''Part-%d-1'', part=p, dependent=ON)\n',i); 76 | end 77 | 78 | fprintf(fid,'a = mdb.models[''Model-1''].rootAssembly\n'); 79 | fprintf(fid,'a.InstanceFromBooleanMerge(name=''Part-%d'', instances=(\n',3); 80 | for i=1:2 81 | fprintf(fid,' a.instances[''Part-%d-1''],\n',i); 82 | end 83 | fprintf(fid,' ), keepIntersections=ON,originalInstances=DELETE, domain=GEOMETRY)\n'); 84 | % ins=mdb.models['Model-1'].rootAssembly.allinstances 85 | fprintf(fid,'v=mdb.models[''Model-1''].rootAssembly.instances[''Part-%d-1''].cells\n',3); 86 | fprintf(fid,'for i in range(len(v)):\n'); 87 | fprintf(fid,' mdb.models[''Model-1''].rootAssembly.Set(name = ''Set''+str(i+1) , cells=v[i:i+1])\n'); 88 | 89 | fclose(fid); 90 | end -------------------------------------------------------------------------------- /subroutine/out_line.m: -------------------------------------------------------------------------------- 1 | function [ P ] = out_line( LINE_OUT,num ) 2 | %UNTITLED Summary of this function goes here 3 | global L; 4 | error=2; 5 | P=cell(1,size(LINE_OUT,2)); 6 | for I = 1: num 7 | tmp=LINE_OUT{1,I}; 8 | if size(tmp,2)~=0 %%%%%%%% 9 | x=tmp(:,1); 10 | y=size(L,1)-tmp(:,2); 11 | for i=1:size(x,1) if abs(x(i)-0)<=error 12 | x(i)=0; 13 | elseif abs(x(i)-size(L,2))<=error 14 | x(i)=size(L,2); 15 | end 16 | end 17 | for i=1:size(y,1) 18 | if abs(y(i)-0)<=error 19 | y(i)=0; 20 | elseif abs(y(i)-size(L,1))<=error 21 | y(i)=size(L,1); 22 | end 23 | end 24 | plot(x,y); 25 | P{I}=[x,y]; 26 | text(mean(x(:)),mean(y(:)),num2str(I)) ; 27 | hold on 28 | else 29 | break; %%%%%%% 30 | end %%%%%%%% 31 | end 32 | 33 | end 34 | 35 | -------------------------------------------------------------------------------- /subroutine/panduan_in.m: -------------------------------------------------------------------------------- 1 | function [ pos ] = panduan_in(dat,vert) 2 | %judge the existence of Line 3 | if size(vert,2)==1 4 | T1=dat(:,1)-vert(1,1); 5 | T1=sum(abs(T1),2); 6 | pos=find(T1==0); 7 | elseif size(vert,2)==2 8 | T1=[dat(:,1)-vert(1,1),dat(:,2)-vert(1,2)]; 9 | T1=sum(abs(T1),2); 10 | pos=find(T1==0); 11 | elseif size(vert,2)==4 12 | T1=[dat(:,1)-vert(1,1),dat(:,2)-vert(1,2),dat(:,3)-vert(1,3),dat(:,4)-vert(1,4)]; 13 | T1=sum(abs(T1),2); 14 | pos=find(T1==0); 15 | end 16 | end 17 | 18 | -------------------------------------------------------------------------------- /subroutine/point_min_distance.m: -------------------------------------------------------------------------------- 1 | function points = point_min_distance(N,distance) 2 | % points with minimum distance 3 | x = rand(1, 100000); 4 | y = rand(1, 100000); 5 | minAllowableDistance = distance; %0.05 6 | numberOfPoints = N; 7 | % Initialize first point. 8 | keeperX = x(1); 9 | keeperY = y(1); 10 | % Try dropping down more points. 11 | counter = 2; 12 | for k = 2 : numberOfPoints 13 | % Get a trial point. 14 | thisX = x(k); 15 | thisY = y(k); 16 | % See how far is is away from existing keeper points. 17 | distances = sqrt((thisX-keeperX).^2 + (thisY - keeperY).^2); 18 | minDistance = min(distances); 19 | if minDistance >= minAllowableDistance 20 | keeperX(counter) = thisX; 21 | keeperY(counter) = thisY; 22 | counter = counter + 1; 23 | end 24 | end 25 | % plot(keeperX, keeperY, 'b*');grid on; 26 | points=[keeperX',keeperY']; 27 | end 28 | 29 | -------------------------------------------------------------------------------- /subroutine/point_surf_dist.m: -------------------------------------------------------------------------------- 1 | function dist = point_surf_dist(a,b) 2 | % a is the Cartesian Coordinates 3 | % b is the surf with three points 4 | va=[b(2,1)-b(1,1),b(2,2)-b(1,2),b(2,3)-b(1,3)]; 5 | vb=[b(3,1)-b(1,1),b(3,2)-b(1,2),b(3,3)-b(1,3)]; 6 | vc=cross(va,vb); 7 | vt=vc(1)*(a(:,1)-b(1,1))+vc(2)*(a(:,2)-b(1,2))+vc(3)*(a(:,3)-b(1,3)); 8 | dist=abs(vt)/sqrt(vc(1)^2+vc(2)^2+vc(3)^2); 9 | 10 | end 11 | 12 | -------------------------------------------------------------------------------- /subroutine/rayTriangleIntersection/Readme.txt: -------------------------------------------------------------------------------- 1 | README: rayTriangleIntersection 2 | 3 | Ray/triangle intersection using the algorithm proposed by Möller and Trumbore (1997). 4 | The zip file includes one example of intersection. 5 | 6 | Author: 7 | Jesús Mena 8 | 9 | References: 10 | [1] "Real Time Rendering". Third Edition. 11 | Tomas Akenine-Möller, Eric Haines and Naty Hoffman. 12 | A. K. Peters, Ltd. 2008 (Section 16.8) 13 | 14 | [2] "Fast, minimum storage ray-triangle intersection". 15 | Tomas Möller and Ben Trumbore. 16 | Journal of Graphics Tools, 2(1):21--28, 1997. 17 | 18 | [3] Other algorithms: 19 | http://www.realtimerendering.com/intersections.html 20 | 21 | Keyword: 22 | ray, triangle, intersection, ray tracing, render, computer graphics 23 | -------------------------------------------------------------------------------- /subroutine/rayTriangleIntersection/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009, Jesus Mena 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the distribution 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /subroutine/rayTriangleIntersection/rayTriangleIntersection.m: -------------------------------------------------------------------------------- 1 | function [flag, u, v, t] = rayTriangleIntersection (o, d, p0, p1, p2) 2 | % Ray/triangle intersection using the algorithm proposed by Möller and Trumbore (1997). 3 | % 4 | % Input: 5 | % o : origin. 6 | % d : direction. 7 | % p0, p1, p2: vertices of the triangle. 8 | % Output: 9 | % flag: (0) Reject, (1) Intersect. 10 | % u,v: barycentric coordinates. 11 | % t: distance from the ray origin. 12 | % Author: 13 | % Jesus Mena 14 | 15 | epsilon = 0.00001; 16 | 17 | e1 = p1-p0; 18 | e2 = p2-p0; 19 | q = cross(d,e2); 20 | a = dot(e1,q); % determinant of the matrix M 21 | 22 | if (a>-epsilon && a1.0) 42 | % the intersection is outside of the triangle 43 | [flag, u, v, t] = deal(0,0,0,0); 44 | return; 45 | end; 46 | 47 | t = f*dot(e2,r); % verified! 48 | flag = 1; 49 | return; 50 | end 51 | -------------------------------------------------------------------------------- /subroutine/rayTriangleIntersection/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeoGroup/DigiSim/1255f9a8bab70532cca7505e487eac7efa5138d1/subroutine/rayTriangleIntersection/screenshot.png -------------------------------------------------------------------------------- /subroutine/rayTriangleIntersection/test.m: -------------------------------------------------------------------------------- 1 | % TEST: Ray/triangle intersection using the algorithm proposed by Möller and Trumbore (1997). 2 | 3 | v0 = [10,0,0]; 4 | v1 = [0,10,0]; 5 | v2 = [0,0,10]; 6 | origin = [10 10 10]; 7 | direction = -[0.3 0.5 0.7]*1; 8 | 9 | triangle = [v0; v1; v2]; 10 | [flag, u, v, t] = rayTriangleIntersection(origin, direction, v0, v1, v2); 11 | intersection = origin + t*direction; 12 | 13 | figure; 14 | hold on; 15 | grid on; 16 | 17 | % triangle 18 | trisurf([1 2 3],triangle(:,1), triangle(:,2), triangle(:,3),'FaceColor','green','EdgeColor','none'); 19 | 20 | % origin 21 | text(origin(1), origin(2), origin(3), 'origin'); 22 | plot3(origin(1), origin(2), origin(3), 'k.', 'MarkerSize', 15); 23 | 24 | % direction 25 | quiver3(origin(1), origin(2), origin(3), direction(1), direction(2), direction(3), 15); 26 | 27 | % intersection 28 | plot3(intersection(1), intersection(2), intersection(3), 'r.', 'MarkerSize', 15); 29 | 30 | view(60,30); 31 | alpha(0.5); 32 | axis tight; 33 | xlabel('x'); 34 | ylabel('y'); 35 | zlabel('z'); 36 | -------------------------------------------------------------------------------- /subroutine/regulization.m: -------------------------------------------------------------------------------- 1 | function [K,PT] = regulization(pcenter,K,PT,error) 2 | % Remove small edges 3 | % K=particle{II}.conn; 4 | % PT=particle{II}.vert; 5 | % pcenter=particle{II}.pcenter; 6 | % error=5; 7 | LT=error-0.001; 8 | while LTLT 16 | LT=lt; 17 | end 18 | if lt1 40 | in=inpolygon(ball(:,1),ball(:,2),xv,yv); 41 | btmp=ball(in,:); 42 | bleft=ball(~in,:); 43 | for j=1:P{1,i}-1 44 | tmp=P{2+j,i}; 45 | xv=tmp(:,1);yv=tmp(:,2); 46 | % plot(xv,yv,'-');hold on 47 | in=inpolygon(btmp(:,1),btmp(:,2),xv,yv); 48 | bleft=[bleft;btmp(in,:)]; 49 | btmp=btmp(~in,:); 50 | end 51 | % plot(btmp(:,1),btmp(:,2),'o'); hold on 52 | ball=bleft; 53 | else 54 | in=inpolygon(ball(:,1),ball(:,2),xv,yv); 55 | btmp=ball(in,:); 56 | % plot(btmp(:,1),btmp(:,2),'o'); hold on 57 | ball=ball(~in,:); 58 | end 59 | ballid{i}=btmp; 60 | end 61 | ballid{i+1}=ball; 62 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 63 | fid=fopen(fname,'wt'); 64 | fprintf(fid,'new\n'); 65 | fprintf(fid,'domain extent %f %f\n',-(max(abs(domain.size1),abs(domain.size2))*2),(max(abs(domain.size1),abs(domain.size2))*2)); 66 | k=0; 67 | % for i=1:size(P,2) 68 | % tmp=ballid{i}; 69 | % for j=1:size(tmp,1) 70 | % k=k+1; 71 | % fprintf(fid,'ball create id %d position %f %f radius %f group %d\n',k, tmp(j,1),tmp(j,2),radius,i); 72 | % end 73 | % end 74 | if size(P,2)>=20 75 | for i=1:size(P,2) 76 | tmp=ballid{i}; 77 | if i~=size(P,2) 78 | for j=1:size(tmp,1) 79 | k=k+1; 80 | fprintf(fid,'ball create id %d position %f %f radius %f group %d\n',k, tmp(j,1),tmp(j,2),radius,1); 81 | end 82 | else 83 | for j=1:size(tmp,1) 84 | k=k+1; 85 | fprintf(fid,'ball create id %d position %f %f radius %f group %d\n',k, tmp(j,1),tmp(j,2),radius,0); 86 | end 87 | end 88 | end 89 | else 90 | for i=1:size(P,2) 91 | tmp=ballid{i}; 92 | for j=1:size(tmp,1) 93 | k=k+1; 94 | fprintf(fid,'ball create id %d position %f %f radius %f group %d\n',k, tmp(j,1),tmp(j,2),radius,i); 95 | end 96 | end 97 | end 98 | % plot(ball(:,1),ball(:,2),'o','Color',[0.5 0.5 0.5]); 99 | % axis off 100 | end 101 | 102 | --------------------------------------------------------------------------------