Compare commits
1095 Commits
3dm_import
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| ba7379e752 | |||
| 6646aee01c | |||
| 7f8382f1b8 | |||
| 4bcdb03598 | |||
| 68e9be7901 | |||
| 9e3bac4a68 | |||
| 1fee7b8e49 | |||
| f668d7ac11 | |||
| 4a1c13154f | |||
| 68a9848748 | |||
| f5059166ed | |||
| ad7f209fc9 | |||
| 8b5bfb6e19 | |||
| 1efd17f6ee | |||
| b8caeb49e0 | |||
| a9fc259745 | |||
| bbc98fe282 | |||
| a445ddd89b | |||
| e874b2eb36 | |||
| a45faa4793 | |||
| 344f0da7ff | |||
| cea869c6ee | |||
| 8ad2887c38 | |||
| 2b1d2a512d | |||
| a55770d702 | |||
| 2e4b1cdd40 | |||
| 3ffc0b40d8 | |||
| cd2cde40da | |||
| efc656a72c | |||
| e1eb139aee | |||
| e7d25b2d0e | |||
| ce05ce577c | |||
| ae2cac48d1 | |||
| 37e9a05347 | |||
| 02cb8a0d3c | |||
| 6942f5fc23 | |||
| 6c4bf3f05a | |||
| 4bc8590ce9 | |||
| 5b68e33d1f | |||
| a70f7ee9c9 | |||
| 95a070413a | |||
| 223489e80d | |||
| f6a535d94c | |||
| dbc3e7d2bf | |||
| a3d44261bb | |||
| 9220fd568f | |||
| 17346e1b42 | |||
| c95ef6764d | |||
| d0f2d56bdb | |||
| fb037f2f2a | |||
| 2d94dddccb | |||
| d2d025a594 | |||
| 64abf640f6 | |||
| cb2b63320a | |||
| 951d3781d6 | |||
| 27bd0e579e | |||
| ff7d564de8 | |||
| a27b9e871a | |||
| eb497cbd39 | |||
| dd3091fc13 | |||
| 69d463713c | |||
| 5e918ff3aa | |||
| b4522c712d | |||
| fa9a9e89cb | |||
| d51a0d2258 | |||
| 580230b38b | |||
| 4b24906d2e | |||
| 2094a1cc0d | |||
| b8b639699a | |||
| 0b86c4f72b | |||
| 5c93384690 | |||
| b77db4a5bc | |||
| c704d94829 | |||
| 0373021b7a | |||
| 6de856b3e1 | |||
| a231d8f26c | |||
| 745a7eb38c | |||
| 78c40ebca7 | |||
| a39af1c3a3 | |||
| c2a0f9dff1 | |||
| 6be67258d2 | |||
| 6c76943bf4 | |||
| 9306f5be9d | |||
| 944ce79776 | |||
| 313c735956 | |||
| 007ed1701c | |||
| 7385709bb4 | |||
| da4cd4c482 | |||
| dee744725c | |||
| 2aca943de4 | |||
| 25f6bae120 | |||
| c92d841011 | |||
| 398c8c430a | |||
| 79dc8f8fc2 | |||
| 1545bc07cd | |||
| 44edef378a | |||
| 679efc22e8 | |||
| 1076dc54dc | |||
| e091f253d0 | |||
| 3206961b88 | |||
| 48b2029d19 | |||
| a2ca0ac6f7 | |||
| 4155dd3e5a | |||
| 5a3b7e311c | |||
| 991586a880 | |||
| de4165889a | |||
| 42c5ffb014 | |||
| e394615f84 | |||
| 1008ba4229 | |||
| f4328430b9 | |||
| 1d6bc847da | |||
| d76beb09ee | |||
| 026436b914 | |||
| ebc5fd7ee7 | |||
| 82a211753e | |||
| a258e9cb31 | |||
| 157885f71a | |||
| f227a9cba7 | |||
| 39360eefd7 | |||
| 6b5fb15c9b | |||
| 4e698d4049 | |||
| e20bd7fd0c | |||
| 7e62acf351 | |||
| 421bc2eb3b | |||
| db98fa5d5a | |||
| 5f28258d16 | |||
| 8f06488b33 | |||
| ac7ba1b12c | |||
| 67131a1482 | |||
| a92cba8697 | |||
| 52cca7233e | |||
| b2beed0fe0 | |||
| 1f301b6100 | |||
| c74ca4932f | |||
| fafcd67a2c | |||
| 390cc3bd8b | |||
| b2ccda1b34 | |||
| 69916e7756 | |||
| 3a7b6f1343 | |||
| 71a054749c | |||
| 06d87d5c52 | |||
| 98c576afe0 | |||
| 6d544f93f4 | |||
| 3c1a7ff1bb | |||
| ae8f80d6e9 | |||
| 9b933bd26d | |||
| baa8736276 | |||
| 73bedf4f55 | |||
| bae8d4651d | |||
| c75a7e9514 | |||
| 233f64e68f | |||
| f9127ce64d | |||
| 86338db67d | |||
| da7ebd6f61 | |||
| 8db1765505 | |||
| 2438d1d23a | |||
| f790736fd7 | |||
| 985b69ae33 | |||
| 6faf5ccde2 | |||
| 2e129d7b06 | |||
| 5d2e1ff608 | |||
| a9f8ef2ff3 | |||
| 2b7070e408 | |||
| 571a24b419 | |||
| 5f132ae3d3 | |||
| fe5a09281e | |||
| b66522de33 | |||
| e87ef178c2 | |||
| 0987496caf | |||
| 5ad9c48285 | |||
| ec6eb3e645 | |||
| 64c3363426 | |||
| 2023ba3f7d | |||
| 27c1823a54 | |||
| f111827545 | |||
| 7cdc1ba5a3 | |||
| 1d68a1ee8e | |||
| b426ccc04d | |||
| a1c448d8dd | |||
| 25d53338c2 | |||
| 6f7b614c3a | |||
| f02f29c543 | |||
| 06cfe1bb96 | |||
| 736353bbac | |||
| f4b3312672 | |||
| 3178bb5f27 | |||
| 552ce70231 | |||
| c2a79b2665 | |||
| f72c949563 | |||
| bdcb00d1bd | |||
| 42fcb1847b | |||
| a7b36280f3 | |||
| cdef3931be | |||
| d3f2587cc2 | |||
| d343f474e4 | |||
| b7fee9696e | |||
| 4f48337f62 | |||
| 96907d5952 | |||
| 3c5d2571fe | |||
| 7005bf43a4 | |||
| 4726cf4d35 | |||
| b971eda771 | |||
| 3ded6fe87d | |||
| 5195c23dfb | |||
| 5f1255a625 | |||
| 82accd45c1 | |||
| e46768b14b | |||
| 32307efd78 | |||
| e84df69f6f | |||
| 669f38a731 | |||
| afef5597b2 | |||
| 4a0bd638fa | |||
| 4bfb38b9d5 | |||
| 0d62cd9bbd | |||
| 913d5f60ca | |||
| 3dddbdf5cd | |||
| 3245f7fe75 | |||
| f144cda136 | |||
| d374e133f0 | |||
| 0c435a646d | |||
| d0ac226753 | |||
| d92344f2bb | |||
| 51c584c6c4 | |||
| 176bbec8a7 | |||
| b3ebb35d01 | |||
| a508da8b18 | |||
| 91ca84f77a | |||
| d27fdb9904 | |||
| 3b816e2a45 | |||
| 1ad96ce8ca | |||
| 36422c43b3 | |||
| 11a46ca58c | |||
| 6e0aec3bec | |||
| 11dd35af44 | |||
| 17fe5f0c9c | |||
| c8e2d88bb7 | |||
| c6ac9fbcf8 | |||
| e636e75b76 | |||
| a01346577f | |||
| 61a5e53351 | |||
| 739c17b4b6 | |||
| 144ef16b0b | |||
| 58c635cb9d | |||
| a39b9a7651 | |||
| 75889983de | |||
| e4a14b629c | |||
| 3640a17632 | |||
| 2a3f809e4e | |||
| d7dd7b9f80 | |||
| cd48e2de3b | |||
| 8f43efe282 | |||
| 025bcbba1d | |||
| d0131deb40 | |||
| 1325f83291 | |||
| 961acdbc76 | |||
| 6789d74abc | |||
| 062c92377e | |||
| 383f4c7abd | |||
| 4cc6161918 | |||
| c0ebbee347 | |||
| e3b4f5bd2d | |||
| 5df3ab6d98 | |||
| 63fb9a638b | |||
| d62d6946c3 | |||
| 7f0237ced4 | |||
| 23621630d5 | |||
| b3abcf73c3 | |||
| 1219e9bd80 | |||
| dced59b9a1 | |||
| 3bf2972089 | |||
| 6dd3ea5cc2 | |||
| 592a92ebdb | |||
| 1321742afe | |||
| f1f93124a0 | |||
| c8e9d1e012 | |||
| 7b0cd0939b | |||
| 3b5ab5089b | |||
| b36d919d8f | |||
| e22a207f03 | |||
| 24dbef52c9 | |||
| 5498b1e25c | |||
| 86851bb67e | |||
| b99e12c56f | |||
| 129b1b919e | |||
| 711c250cfc | |||
| 0f05216474 | |||
| c57b7c95c1 | |||
| 62e041ed8c | |||
| 2983454ce2 | |||
| 6d5046cb6d | |||
| 91fcf43da9 | |||
| aef1a57e1c | |||
| 71316bac6a | |||
| f1c4f06461 | |||
| 412bbd2a8b | |||
| be64cedfc3 | |||
| 2a6b35d658 | |||
| f51c5c36d0 | |||
| 5599901185 | |||
| fb235bf985 | |||
| 717d7a3fe3 | |||
| c91f468dce | |||
| 1f36657efd | |||
| b70ad5c808 | |||
| da56ef91fd | |||
| 9bd7a152d7 | |||
| 5c287d49bb | |||
| 942f15b49d | |||
| 20b61cda42 | |||
| b1b1d6d434 | |||
| c7ad32ef30 | |||
| 6016db837e | |||
| 2051e0b5d9 | |||
| fddb3f5707 | |||
| 096dd84511 | |||
| e16a2078fc | |||
| e388ae34e3 | |||
| b64c747082 | |||
| 8afa3ae47d | |||
| 1eba68e95b | |||
| 047b339006 | |||
| acd7415835 | |||
| a48460ef76 | |||
| 8ab3896e3a | |||
| 2d481c8a71 | |||
| 7968a4e5ed | |||
| 39d295f412 | |||
| 0bf2cc2a77 | |||
| 433f486091 | |||
| fee6604d5e | |||
| c339fced5c | |||
| a87351778d | |||
| 42687457e0 | |||
| 4a541402da | |||
| ecef487746 | |||
| df483b5623 | |||
| e4d3f5f9a4 | |||
| 02e164dcdf | |||
| ead94e7915 | |||
| dfc3c29439 | |||
| ab538f4bf7 | |||
| 00b6f8583a | |||
| 4cf4a99107 | |||
| 137289e843 | |||
| e7b066e75e | |||
| cd0828f3e0 | |||
| 563697f840 | |||
| 61fc814528 | |||
| 7c90dbabea | |||
| 5ee0f3c373 | |||
| 098bdd0076 | |||
| 40b6da6b44 | |||
| b083dabc6b | |||
| 7fcc3ed42d | |||
| 4ed362f226 | |||
| 39d98f79fb | |||
| c79f7ba245 | |||
| 16354ff435 | |||
| f3a191dd62 | |||
| cb0a5092fb | |||
| 8730f55308 | |||
| 932e98d19c | |||
| 3a69dcfa79 | |||
| 5930674d4a | |||
| df6b20d97f | |||
| 4200af5296 | |||
| b0c9c5be2e | |||
| f2bb1deac4 | |||
| 94ec83aa60 | |||
| e183eec3ea | |||
| b179771ec9 | |||
| d7380a09c1 | |||
| afc316cd1d | |||
| b6f820258a | |||
| 116b605cb1 | |||
| 9f5ce42393 | |||
| 9716d93c15 | |||
| 3465179379 | |||
| c7aad8d917 | |||
| 8ddc1c70e1 | |||
| 5230261be8 | |||
| 8cc8d6eb03 | |||
| 7a95e4c5a3 | |||
| 1c0f182bbc | |||
| 736e20e599 | |||
| c71c8e8c12 | |||
| 9c7a29f939 | |||
| 40bb15e46b | |||
| fb957b61d2 | |||
| 4da9dcb062 | |||
| 60f9302c3f | |||
| 2553f15e7b | |||
| e8d31f2020 | |||
| 4c693ccd60 | |||
| c550fb1848 | |||
| e49bd5a2a0 | |||
| 81be6ce7b9 | |||
| 2d6bf3d9dc | |||
| b2244b7f43 | |||
| 53dcd9c863 | |||
| 75f70d2b30 | |||
| 36b1df1a27 | |||
| 5a445c5c0b | |||
| df828ab2ba | |||
| db855ca99b | |||
| d79cb50aca | |||
| 371ff54d9c | |||
| df7b4ff81f | |||
| f22ea484db | |||
| 574041cf18 | |||
| ff2cc4f999 | |||
| 05c0b0a18b | |||
| 1b9738eace | |||
| 8ee5bc74d5 | |||
| 0a8cc414a5 | |||
| 7a682653cd | |||
| 9286ab6535 | |||
| 85736ab03f | |||
| 673f5c7a9b | |||
| 34d0bcbdfe | |||
| 7abf3027d4 | |||
| ffe3d44cac | |||
| dd23b848ac | |||
| 33cca03698 | |||
| d4d14dd866 | |||
| d6f0fdac50 | |||
| 080605510c | |||
| 1a7b789ef3 | |||
| cc4183a677 | |||
| c2bae56656 | |||
| 38a5c0cbb3 | |||
| 81a8eb698e | |||
| ee4bb7d7c4 | |||
| 8b0d5bddbf | |||
| ba75033f0a | |||
| eb2b90c6f2 | |||
| 3b5c34cb05 | |||
| 2fe22a62c2 | |||
| ff6307fcca | |||
| c6e80a0b6a | |||
| b957cc75be | |||
| fc18539472 | |||
| de7229aee7 | |||
| 53e66032a0 | |||
| 2fc6c30c8f | |||
| f05c5f1261 | |||
| 6af5591cf6 | |||
| 41cbe862e5 | |||
| 057b8273e2 | |||
| 6421c12408 | |||
| 0aca5aeb07 | |||
| bdbd3583b8 | |||
| 626d5b0e51 | |||
| 0bffa0039c | |||
| 9819c8cee8 | |||
| 53ab676750 | |||
| afa4872c97 | |||
| bf56d53faf | |||
| f03adb9206 | |||
| 529fa2e4a0 | |||
| 6df1b90e95 | |||
| 9cba0e6d15 | |||
| f16de3a20c | |||
| 8cfa41d09f | |||
| b59b501366 | |||
| 504bb50b13 | |||
| 969f1266e7 | |||
| fa680b7799 | |||
| e185c85d5e | |||
| acb0a5bd5e | |||
| 62ce576d4d | |||
| 161d3d9b17 | |||
| d88baa070f | |||
| 2b087dde51 | |||
| 7894a8fdc8 | |||
| 0f14e8335a | |||
| 7edf4bced8 | |||
| 4a5639780b | |||
| 0a21a582be | |||
| 0e663c02c4 | |||
| 21afe8165c | |||
| 0247fe5e7c | |||
| 50bad83fba | |||
| 9c93d6c2f3 | |||
| 4d9a50cf94 | |||
| bbdaac5d8d | |||
| 0417c43bcf | |||
| 15585b8f11 | |||
| 59755ec8a5 | |||
| b16dd260d8 | |||
| d37a5a37b7 | |||
| 79dfb4ae87 | |||
| 8b75b6e4c3 | |||
| bcaad08b61 | |||
| cbdeffd93a | |||
| 0ce477a3e7 | |||
| 44eb4d1834 | |||
| 2e26b73208 | |||
| de3fa3201e | |||
| f068aafbb5 | |||
| daedb07135 | |||
| 702e1e446d | |||
| ea87db1ae1 | |||
| b65800843a | |||
| e4c5d8645d | |||
| 85b06c29b4 | |||
| 5254d0c5ca | |||
| 292c2bf87a | |||
| 9d038142a8 | |||
| c5573e438b | |||
| 8c7a0ac026 | |||
| e45bbf2afd | |||
| fc6de68d83 | |||
| a008c169ae | |||
| 3cd6c9299f | |||
| 8e5801d656 | |||
| 1691b7f84a | |||
| 76e4197729 | |||
| fb8bac8681 | |||
| 55a9685add | |||
| afa4be3717 | |||
| 57c03a54c9 | |||
| 91a9adaea4 | |||
| 8657fa32c5 | |||
| b7a4f0bff3 | |||
| f0716e2727 | |||
| b1acf7f4f0 | |||
| 851c053f7c | |||
| 71276a8de3 | |||
| b2e799e1d6 | |||
| eb9aaef53a | |||
| 49340d2629 | |||
| 0b9c9f375c | |||
| cd56f80790 | |||
| 65d826168b | |||
| ea012988df | |||
| 67f3df353f | |||
| 9d34df708d | |||
| 72947f1e36 | |||
| 1cdae73b24 | |||
| a2825b2b6d | |||
| 5bc7036e98 | |||
| 7e545aecd7 | |||
| 0fc8291ef5 | |||
| 0d668c1a4a | |||
| 4b1270f231 | |||
| 9263dc0516 | |||
| b0f7cb93fd | |||
| add3788db4 | |||
| 37c23faae3 | |||
| fa6f12ba3b | |||
| 730dd396f4 | |||
| 3b9f6773f2 | |||
| 97315f6ca4 | |||
| b2be420e36 | |||
| 4ee34b79f8 | |||
| e4ee403d24 | |||
| b709776f5f | |||
| b5a2490fd4 | |||
| 7a18cd1c5c | |||
| 26e1448bbb | |||
| a1ebdb4eb6 | |||
| 6603061f81 | |||
| 1c3d7bf2a6 | |||
| a4a030b776 | |||
| 64a8294ea0 | |||
| 847383d82d | |||
| c16d916a63 | |||
| 91cae44533 | |||
| 56c3e28ac3 | |||
| 3238c86cec | |||
| f050e682ef | |||
| 01c875b34f | |||
| 50b8a8aa94 | |||
| 9f1aad5e49 | |||
| a38c50197b | |||
| fe54dde44e | |||
| 62a3405d6a | |||
| cb9dd807ce | |||
| d60d38a24b | |||
| e598e7986f | |||
| 9bebd2f2ad | |||
| 36d5c39094 | |||
| 1b08f4bbdd | |||
| 4a952b1c9b | |||
| 7a25927054 | |||
| cf022921a7 | |||
| dc798aaaba | |||
| eed89dab37 | |||
| 990bc1a1e4 | |||
| 03433fe3af | |||
| e02611504b | |||
| a835433be4 | |||
| da8f40db17 | |||
| 5468e3f4fa | |||
| 88684e305f | |||
| f8ca8029d7 | |||
| aa9c46cbb5 | |||
| f0cf3c9559 | |||
| 9a638b9470 | |||
| b07fbfc72e | |||
| 0317c37557 | |||
| a98b6bcc09 | |||
| c19861a911 | |||
| 8f8597d442 | |||
| 0c0eb9ef8f | |||
| 4ffb7087bd | |||
| dc070c4556 | |||
| 60729d5f39 | |||
| da7e9dd6e2 | |||
| aeff9fb418 | |||
| e9e897593b | |||
| bfc09d135c | |||
| 0998d0fffc | |||
| 93c87ee720 | |||
| a67a0502fa | |||
| cec0a48be4 | |||
| 0cc63d40eb | |||
| 623eb6e630 | |||
| 1f22299096 | |||
| 3f6c439983 | |||
| 8e22267476 | |||
| aa2b6ccde5 | |||
| ec6cb79a8d | |||
| 76dceb4fc9 | |||
| b1564f7de0 | |||
| 21e4bd6d93 | |||
| 2101d72abe | |||
| 7a01f67c8b | |||
| 2267343afe | |||
| 9a5fe24781 | |||
| 4050aa11c5 | |||
| b75ddae396 | |||
| 2d3f8487ee | |||
| 964647d7e6 | |||
| f78dd0fa83 | |||
| 55ce22b06c | |||
| 50df4f3503 | |||
| 5c8f0c79f6 | |||
| de3f187ddf | |||
| f649954ee1 | |||
| 6e08f2a878 | |||
| 887922a715 | |||
| 640fef2e0a | |||
| 1a338a1a82 | |||
| 4f3fe68283 | |||
| 3908e11d18 | |||
| 4e6c5112e4 | |||
| e1ab88302f | |||
| 2b4090619b | |||
| b90289e42b | |||
| 5e84408685 | |||
| b53c2f833a | |||
| b5fcceaa75 | |||
| f0bfbb6c85 | |||
| 2710f735d1 | |||
| ddffbd2c88 | |||
| fde952499d | |||
| b28102a8cc | |||
| f46db233dc | |||
| df10b45c6b | |||
| 1b13580340 | |||
| 742305b99b | |||
| 1261de4dbb | |||
| b50588f974 | |||
| 9b87de9fa2 | |||
| 5bab4a9aa8 | |||
| c3e7d3d8c7 | |||
| 89c22ffd06 | |||
| 5375752609 | |||
| 0a8f26c993 | |||
| cba9c253e1 | |||
| 71f3bf8809 | |||
| d491536eb4 | |||
| e68465c80b | |||
| dfb8fd2160 | |||
| 746fa61e08 | |||
| d0e0c46e2c | |||
| 19c7f63303 | |||
| 87f6a29db3 | |||
| b04d1ed7a9 | |||
| 54dba7ab41 | |||
| 146c06d27f | |||
| 7c45c1e287 | |||
| d6dc5b8428 | |||
| 28695f9138 | |||
| 66cec4a872 | |||
| 8d1d3f766a | |||
| befed079c8 | |||
| b9138029db | |||
| 2246dbc284 | |||
| 67180b3569 | |||
| 3a2aa2c679 | |||
| 9dd4e043d4 | |||
| 4748bd5ac8 | |||
| 649f97e933 | |||
| 21feed172d | |||
| e853ff7f13 | |||
| 95ff8b21b9 | |||
| a7be952e11 | |||
| 7a67ce9333 | |||
| 695350d3f6 | |||
| aade1d19f1 | |||
| fd4677d099 | |||
| f7a28447fb | |||
| 79b470b18b | |||
| f6d3873ecb | |||
| 92a8cdad99 | |||
| 0c346e2bc7 | |||
| d54caf4ae3 | |||
| ff9ea34ae1 | |||
| c7035305e2 | |||
| bc3c1e377e | |||
| 98eff1b0b9 | |||
| 052cc9e841 | |||
| b6a7ce4eef | |||
| 7a66ad27d8 | |||
| b4878f1ac0 | |||
| 447ebe11e5 | |||
| 8981057d29 | |||
| 3270b573a8 | |||
| 6df0cf3203 | |||
| d67cca385e | |||
| f9d67442d6 | |||
| dea96ccbcc | |||
| 0f4be10330 | |||
| 121abf5864 | |||
| 38e836de2b | |||
| 376c4e3693 | |||
| 48ffd52b16 | |||
| 9a16259ff5 | |||
| 10ae269882 | |||
| 9d845179a4 | |||
| 88bf84cca1 | |||
| 5ba8f1df36 | |||
| c4a05bcb2f | |||
| 5841c9cae0 | |||
| 4fd03a78de | |||
| 420c072670 | |||
| 36477623b8 | |||
| 84d859dfe2 | |||
| 09220bfd68 | |||
| 42aaf6f3eb | |||
| 3f1f365451 | |||
| 9a29ee0e27 | |||
| 619905d720 | |||
| 36ce855ef3 | |||
| 9b0f2c7f59 | |||
| c637ccec47 | |||
| 8f27154604 | |||
| 5d02732db6 | |||
| 36657e17c4 | |||
| e2008bd479 | |||
| e32b85bc2d | |||
| 6dfc50e630 | |||
| b4820ff255 | |||
| 515247a394 | |||
| b5c649821f | |||
| 9ba0c6f4cc | |||
| 35fc94d8cb | |||
| a0316e280c | |||
| 84bcc715a8 | |||
| b34d31029b | |||
| f67865f9cc | |||
| f48053a541 | |||
| 8e917aa6d2 | |||
| f08dee836b | |||
| 261e9ac0c8 | |||
| b51d0c3e64 | |||
| ac23938dd0 | |||
| b9bac347e8 | |||
| 980a1f62df | |||
| 10c5d0fffe | |||
| d7d36b670a | |||
| 581551ee3e | |||
| 487ce0c84b | |||
| 5679733028 | |||
| cd0fc4e449 | |||
| e20b4b5b78 | |||
| b931582120 | |||
| bf14ab1332 | |||
| 3b81a6b92e | |||
| 01bf44cf1e | |||
| b5d879cd3d | |||
| 2b3c285190 | |||
| 99bb83211c | |||
| b854c9588b | |||
| 2361225321 | |||
| eaf1138624 | |||
| ef5c67a4d5 | |||
| 3e924113d3 | |||
| dcc3fc772a | |||
| a48f373e4d | |||
| ffd714d069 | |||
| dc082d495e | |||
| e8e57ff793 | |||
| 3e16c4b56c | |||
| 77d3fcc7af | |||
| 7322bf5034 | |||
| 2ed2a34d55 | |||
| d340505593 | |||
| 247849d112 | |||
| fcbdee1dba | |||
| 33d1ef4123 | |||
| fe2aba43e5 | |||
| c0b5f38301 | |||
| 1c157f323e | |||
| 3e6aa0d81b | |||
| 34089648b0 | |||
| 0bef1638d0 | |||
| 1d4bccac4b | |||
| cc7aa66904 | |||
| 303a270359 | |||
| 17759877d4 | |||
| 5f56152a8b | |||
| d6567e94c4 | |||
| d00064a671 | |||
| dc91f932f7 | |||
| a3f05c41fe | |||
| d911862c84 | |||
| 1b025ec60e | |||
| 9d18e1a9ba | |||
| 3143c00729 | |||
| 3a8900983a | |||
| 971a76e473 | |||
| 621bf93ee9 | |||
| 35c019a03e | |||
| de97f249a2 | |||
| 81f0cc23bf | |||
| 8a0234093e | |||
| 88d355f2f7 | |||
| 20fd06d67c | |||
| 52f2785e67 | |||
| 2e2bd0ceec | |||
| e4c3c9a2a4 | |||
| e490c173e8 | |||
| 7e165a6dea | |||
| 49ff6e79a8 | |||
| 1160e3d067 | |||
| 91d667bcfc | |||
| b23df89cd3 | |||
| cf9737a48e | |||
| ae52115bda | |||
| 3dd9466938 | |||
| c0f7eb6727 | |||
| 76e2843ed3 | |||
| faa2004c29 | |||
| c9a59dc5ea | |||
| aaaf951990 | |||
| cc263089ca | |||
| d99b8f4c86 | |||
| f5e5441469 | |||
| 4206a4822f | |||
| 788a5bc4eb | |||
| a5a96c2bb5 | |||
| 881691e678 | |||
| 80f4d64ad4 | |||
| 7d9a641e39 | |||
| d82ccd8947 | |||
| 318b1e4b2f | |||
| 583e30170a | |||
| fe46b8ebd2 | |||
| 6a845e4f81 | |||
| 46e18b3977 | |||
| 20d146268b | |||
| 5013fc2b6c | |||
| 32a0e1d2b5 | |||
| 7ce9e7e26c | |||
| 9a6e972521 | |||
| 8c008f36c2 | |||
| eae29d4854 | |||
| 2bd53476ca | |||
| 015065f3c8 | |||
| 12862a6c76 | |||
| 9d869411e8 | |||
| 0c3c17e0f4 | |||
| 47f6eedd9c | |||
| b36adefd10 | |||
| 8cf8c0def5 | |||
| 1e6a70c60d | |||
| 9712e8c526 | |||
| 6b1f932dfc | |||
| 7882964b26 | |||
| 9653ba8d53 | |||
| ba66891539 | |||
| 4ab4a2fc81 | |||
| a6d9811595 | |||
| c94a62f5b2 | |||
| 535011072d | |||
| 718f5ce716 | |||
| 3f02119ef7 | |||
| 632b711b2a | |||
| 07faeaaa11 | |||
| 104726c5ee | |||
| e2445c0a15 | |||
| d253312139 | |||
| 9880fa0173 | |||
| 5952eee22c | |||
| 4483434711 | |||
| d276809906 | |||
| 93678ce56c | |||
| 8c4b0bde37 | |||
| 67c03daa42 | |||
| 469d1c3445 | |||
| 4268da4a1f | |||
| 7d3284fef3 | |||
| 3857cd4b5a | |||
| a04a748552 | |||
| 13ecae3829 | |||
| 1acd97d42a | |||
| 4f485d0e87 | |||
| d48348fa1c | |||
| 003dd0bdef | |||
| 6a92f6b80f | |||
| bf3760808e | |||
| ec109908fa | |||
| 3630b85632 | |||
| 45226d0b6f | |||
| fdce6e1853 | |||
| 8ffa9d7fb7 | |||
| 96ea6bc73e | |||
| 360484c9af | |||
| 47606bffcd | |||
| 7a2af0b5f2 | |||
| 8d2ae598e5 | |||
| aea99a635f | |||
| ce139c6925 | |||
| 4b19936136 | |||
| 6efb3a6e7f | |||
| 5dcf5f5616 | |||
| 451ef8356b | |||
| 3a623996d2 | |||
| 4bada73c83 | |||
| 156d0eea4b | |||
| 6e810f050e | |||
| 6bfb5c619f | |||
| bd90fc2b59 | |||
| 5800093e53 | |||
| fae6a7cd78 | |||
| 65daddfced | |||
| c303b1273d | |||
| 95915b16e5 | |||
| ddade325c4 | |||
| 8d0c04e092 | |||
| 5d62db3e73 | |||
| 46b91bb49d | |||
| c8ce0a242e | |||
| 8be2246249 | |||
| 1005aae0e9 | |||
| 47e79756d1 | |||
| 0f8012ce61 | |||
| 595421bcdd | |||
| 2c159d7ce6 | |||
| b4058ad363 | |||
| 6b5de066b7 | |||
| 517a66b0fe | |||
| 56cff98cf3 | |||
| 3168bee865 | |||
| 3d2f8c1495 | |||
| 7cd83efd97 | |||
| 10f9aeb870 | |||
| c088ac9a08 | |||
| 932f590b61 | |||
| df4188002a | |||
| 005f75a4ba | |||
| b5a74807ef | |||
| 56d7726a58 | |||
| 9db53c7ee3 | |||
| 43c511b86f | |||
| 7043b2b318 | |||
| 3c458e9187 | |||
| 3fc056af67 | |||
| 46dbd17d7b | |||
| 86395eb2d1 | |||
| 5fbc75e4bd | |||
| 3d326c9ca2 | |||
| 2a43eca91c | |||
| debf3d65ba | |||
| cfe3672f8b | |||
| 9dfe558a83 | |||
| cc312f1529 | |||
| d88de3576d | |||
| 9e1d183343 | |||
| 09665eda9f | |||
| 44d080eae9 | |||
| d5e1be8be2 | |||
| d96660e6d1 | |||
| d72f7b6299 | |||
| 1f77e00f34 | |||
| 5c222cc59f | |||
| 7ee7fea375 | |||
| 1c2b127a91 | |||
| 0e927d7294 | |||
| 0dc918880e | |||
| ac5fe3ac65 | |||
| a9d6a87317 | |||
| 650540e573 | |||
| 0ae7e1876b | |||
| 4e7501ed7f | |||
| 751ea085a6 | |||
| 59f5c16c3b | |||
| 1280037d1d | |||
| c91c2a9720 | |||
| 7c44a6ec82 | |||
| 6277b2eaa8 | |||
| 92da41d421 | |||
| f7f30854a1 | |||
| 5eea981790 | |||
| f52608e15a | |||
| fbbb0739ee | |||
| 903f0c69bc | |||
| 15ed754512 | |||
| 2ca801e2ec | |||
| fc9312f0f2 | |||
| c2b36208e7 | |||
| b1e30147ea | |||
| 4903fcd9d2 | |||
| c3de378c7d | |||
| b818f5dcb2 | |||
| 6d2cc32568 | |||
| 9bee3fbb8f | |||
| cd303ff099 | |||
| c192d9a539 | |||
| fce40ffc38 | |||
| 5bd5efafb1 | |||
| d6fffd228e | |||
| b96daf4925 | |||
| c755406963 | |||
| 296b274190 | |||
| f378661948 | |||
| 37fc7b2164 | |||
| 91dca91153 | |||
| e30a2481a2 | |||
| 70f2f1cb01 | |||
| c158f8ac3e | |||
| a46fbb3f05 | |||
| b53a5adca4 | |||
| 7d6e3dc386 | |||
| f352ca0ae0 | |||
| 68d0198f3f | |||
| 0007121340 | |||
| a6e3c42340 | |||
| c0c01573ca | |||
| badbef94e6 | |||
| 610bd48747 | |||
| 2d5657a05a | |||
| 04b47e40b4 | |||
| 5bb1fdaed3 | |||
| a5714cc85d | |||
| 83a4c03979 | |||
| 058814a64b | |||
| 3c52ca3fef | |||
| 9ec04bff06 | |||
| fd2ba16258 | |||
| 18d7e471ae | |||
| d96ea77db7 | |||
| 041cbe4a8f | |||
| a3531c4841 | |||
| bfc6439dc0 | |||
| 4f16e8263a | |||
| d7ec1fd304 | |||
| b2bd8f7afe | |||
| cb0452a248 | |||
| b7a5123ba9 | |||
| 29c00caf4a | |||
| 73a65d8cf9 | |||
| 419d325409 | |||
| 349c515e3e | |||
| 69166fe585 | |||
| 8279e66cae | |||
| 1c34e40289 | |||
| e9c22b895b | |||
| ebda605497 | |||
| 06a69fa66b | |||
| 4daa62db97 | |||
| cb1edcf20a | |||
| d3d7f94c3a | |||
| 1aeb2809fa | |||
| 7cf933ec48 | |||
| f3346fd1f1 | |||
| 579bc5492c | |||
| 71ac2fde82 | |||
| 56d80f5bdd | |||
| 4704554728 | |||
| e4243a2df3 | |||
| 967f5aa795 | |||
| f0429aefa4 | |||
| c3b8677910 | |||
| 268983804e | |||
| 8c79bbb2b6 | |||
| 2d83c860f2 | |||
| 6a3fc0fd97 | |||
| 97fd05640b | |||
| 5d4b220dc7 | |||
| bca419ad63 |
+32
-5
@@ -149,11 +149,36 @@ MyAdjustLoops( ICurve* pCurve, ICURVEPLIST& CrvLst)
|
||||
}
|
||||
// altrimenti attraversamento
|
||||
else {
|
||||
if ( IsEven( nCross))
|
||||
inOk.Subtract( vIccInfo[i].IciA[0].dU, vIccInfo[i].IciB[0].dU) ;
|
||||
else
|
||||
inOk.Add( vIccInfo[i].IciA[0].dU, vIccInfo[i].IciB[0].dU) ;
|
||||
++ nCross ;
|
||||
double dParA = vIccInfo[i].IciA[0].dU ;
|
||||
double dParB = vIccInfo[i].IciB[0].dU ;
|
||||
if ( dParA > dParB)
|
||||
swap( dParA, dParB) ;
|
||||
// verifico se uno dei due intervalli dà origine ad un tratto trascurabile
|
||||
PtrOwner<ICurve> pCrv1( pMyCrv->CopyParamRange( dParA, dParB)) ;
|
||||
PtrOwner<ICurve> pCrv2( pMyCrv->CopyParamRange( dParB, dParA)) ;
|
||||
double dArea1 = 0, dArea2 = 0 ;
|
||||
if ( ! IsNull( pCrv1))
|
||||
pCrv1->GetAreaXY( dArea1) ;
|
||||
if ( ! IsNull( pCrv2))
|
||||
pCrv2->GetAreaXY( dArea2) ;
|
||||
|
||||
if ( abs( dArea1) > 1e6 * abs( dArea2)) {
|
||||
// se il tratto dParB->dParA non è significativo
|
||||
inOk.Subtract( dStart, dParA) ;
|
||||
inOk.Subtract( dParB, dEnd) ;
|
||||
}
|
||||
else if ( abs( dArea2) > 1e6 * abs( dArea1)) {
|
||||
// se il tratto dParA->dParB non è siginificativo
|
||||
inOk.Subtract( dParA, dParB) ;
|
||||
}
|
||||
else {
|
||||
// se entrambe le regioni sono significative
|
||||
if ( IsEven( nCross))
|
||||
inOk.Subtract( vIccInfo[i].IciA[0].dU, vIccInfo[i].IciB[0].dU) ;
|
||||
else
|
||||
inOk.Add( vIccInfo[i].IciA[0].dU, vIccInfo[i].IciB[0].dU) ;
|
||||
++ nCross ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,6 +317,8 @@ AdjustLoops( ICurve* pCurve, ICURVEPLIST& CrvLst, bool bNeedSameProp)
|
||||
pCrvCo->RemoveSmallDefects( 2 * LIN_TOL_MIN, ANG_TOL_STD_DEG, true) ;
|
||||
// unisco eventuali tratti allineati
|
||||
pCrvCo->MergeCurves( LIN_TOL_MIN, ANG_TOL_STD_DEG, true, bNeedSameProp) ;
|
||||
// richiudo i loop per sicurezza
|
||||
pCrvCo->Close() ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
#include "CurveBezier.h"
|
||||
#include "CurveComposite.h"
|
||||
#include "CreateCurveAux.h"
|
||||
#include "DistPointLine.h"
|
||||
#include "GeoConst.h"
|
||||
#include "/EgtDev/Include/EGkArcPntDirTgCurve.h"
|
||||
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EGkArcSpecial.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
@@ -297,7 +297,7 @@ GetArcPntDirTgBezier( const Point3d& ptP, const Vector3d& vtDir, const CurveBezi
|
||||
return nullptr ;
|
||||
// calcolo la circonferenza tangente a questa approssimazione
|
||||
Point3d ptTg ;
|
||||
PtrOwner<ICurve> pCrv( GetCurve( GetArcPntDirTgCurve( ptP, vtDir, *pCrvCompo, ptNear, vtN, &ptTg))) ;
|
||||
PtrOwner<ICurve> pCrv( GetArcPntDirTgCurve( ptP, vtDir, *pCrvCompo, ptNear, vtN, &ptTg)) ;
|
||||
if ( IsNull( pCrv))
|
||||
return nullptr ;
|
||||
// porto il punto di tangenza della circonferenza esattamente sulla curva di Bezier
|
||||
@@ -330,7 +330,7 @@ GetArcPntDirTgCompo( const Point3d& ptP, const Vector3d& vtDir, const CurveCompo
|
||||
pCrv = crvCompo.GetNextCurve()) {
|
||||
// recupero la circonferenza tangente alla curva elementare
|
||||
Point3d ptTg ;
|
||||
PtrOwner<ICurve> pCrvTmp( GetCurve( GetArcPntDirTgCurve( ptP, vtDir, *pCrv, ptNear, vtN, &ptTg))) ;
|
||||
PtrOwner<ICurve> pCrvTmp( GetArcPntDirTgCurve( ptP, vtDir, *pCrv, ptNear, vtN, &ptTg)) ;
|
||||
if ( IsNull( pCrvTmp))
|
||||
continue ;
|
||||
// verifico se è la più vicina al punto desiderato
|
||||
|
||||
+2
-1
@@ -134,7 +134,8 @@ GetArc3P( const Point3d& ptStart, const Point3d& ptOther, const Point3d& ptEnd,
|
||||
|
||||
// calcolo arco non riuscito, se i punti sono allineati nel giusto verso per essere una retta
|
||||
// verifico se i punti sono allineati nel giusto verso
|
||||
if ( ( ptOther - ptStart) * ( ptEnd - ptOther) > EPS_ZERO) {
|
||||
if ( ( ptOther - ptStart) * ( ptEnd - ptOther) > EPS_ZERO ||
|
||||
AreSamePointApprox( ptOther, ptStart) || AreSamePointApprox( ptEnd, ptOther)) {
|
||||
// creo l'oggetto retta
|
||||
PtrOwner<CurveLine> pLine( CreateBasicCurveLine()) ;
|
||||
if ( IsNull( pLine))
|
||||
|
||||
+31
-37
@@ -81,8 +81,7 @@ Attribs::Dump( const GeomDB& GDB, string& sOut, bool bMM, const char* szNewLine)
|
||||
}
|
||||
sOut += szNewLine ;
|
||||
// eventuali nome e stringhe informative
|
||||
STRLIST::const_iterator iIter ;
|
||||
for ( iIter = m_slInfo.begin() ; iIter != m_slInfo.end() ; ++ iIter)
|
||||
for ( auto iIter = m_slInfo.cbegin() ; iIter != m_slInfo.cend() ; ++ iIter)
|
||||
sOut += *iIter + szNewLine ;
|
||||
|
||||
return true ;
|
||||
@@ -101,7 +100,7 @@ Attribs::Save( NgeWriter& ngeOut) const
|
||||
// modo
|
||||
if ( ! ngeOut.WriteUchar( m_Data[MODE], ","))
|
||||
return false ;
|
||||
// stato (se SEL è convertito in ON)
|
||||
// stato (se SEL è convertito in ON)
|
||||
int nStat = (( m_Data[STATUS] > GDB_ST_ON) ? GDB_ST_ON : m_Data[STATUS]) ;
|
||||
if ( ! ngeOut.WriteUchar( nStat, ","))
|
||||
return false ;
|
||||
@@ -118,8 +117,7 @@ Attribs::Save( NgeWriter& ngeOut) const
|
||||
if ( ! ngeOut.WriteInt( int( m_slInfo.size()), ";", true))
|
||||
return false ;
|
||||
// stringhe di info
|
||||
STRLIST::const_iterator iIter ;
|
||||
for ( iIter = m_slInfo.begin() ; iIter != m_slInfo.end() ; ++ iIter) {
|
||||
for ( auto iIter = m_slInfo.cbegin() ; iIter != m_slInfo.cend() ; ++ iIter) {
|
||||
if ( ! ngeOut.WriteString( *iIter, nullptr, true))
|
||||
return false ;
|
||||
}
|
||||
@@ -135,22 +133,22 @@ Attribs::Load( NgeReader& ngeIn)
|
||||
unsigned char ucLev ;
|
||||
if ( ! ngeIn.ReadUchar( ucLev, ","))
|
||||
return false ;
|
||||
m_Data[LEVEL] = CLIP( ucLev, GDB_LV_USER, GDB_LV_TEMP) ;
|
||||
m_Data[LEVEL] = Clamp( ucLev, GDB_LV_USER, GDB_LV_TEMP) ;
|
||||
// modo
|
||||
unsigned char ucMode ;
|
||||
if ( ! ngeIn.ReadUchar( ucMode, ","))
|
||||
return false ;
|
||||
m_Data[MODE] = CLIP( ucMode, GDB_MD_STD, GDB_MD_HIDDEN) ;
|
||||
// stato (se SEL è convertito in ON)
|
||||
m_Data[MODE] = Clamp( ucMode, GDB_MD_STD, GDB_MD_HIDDEN) ;
|
||||
// stato (se SEL è convertito in ON)
|
||||
unsigned char ucStat ;
|
||||
if ( ! ngeIn.ReadUchar( ucStat, ","))
|
||||
return false ;
|
||||
m_Data[STATUS] = CLIP( ucStat, GDB_ST_OFF, GDB_ST_ON) ;
|
||||
m_Data[STATUS] = Clamp( ucStat, GDB_ST_OFF, GDB_ST_ON) ;
|
||||
// marcatura (sempre OFF)
|
||||
unsigned char ucMark ;
|
||||
if ( ! ngeIn.ReadUchar( ucMark, ";"))
|
||||
return false ;
|
||||
m_Data[MARK] = CLIP( ucMark, GDB_MK_OFF, GDB_MK_OFF) ;
|
||||
m_Data[MARK] = Clamp( ucMark, GDB_MK_OFF, GDB_MK_OFF) ;
|
||||
// materiale
|
||||
if ( ! ngeIn.ReadInt( m_Material, ";"))
|
||||
return false ;
|
||||
@@ -177,7 +175,7 @@ Attribs::Load( NgeReader& ngeIn)
|
||||
bool
|
||||
Attribs::DataFromString( const string& sParam)
|
||||
{
|
||||
// il primo parametro è diviso in 4 parti
|
||||
// il primo parametro è diviso in 4 parti
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam, ",", vsParams) ;
|
||||
// 4 parti
|
||||
@@ -187,22 +185,22 @@ Attribs::DataFromString( const string& sParam)
|
||||
int nLev ;
|
||||
if ( ! FromString( vsParams[0], nLev))
|
||||
return false ;
|
||||
m_Data[LEVEL] = CLIP( nLev, GDB_LV_USER, GDB_LV_TEMP) ;
|
||||
m_Data[LEVEL] = Clamp( nLev, GDB_LV_USER, GDB_LV_TEMP) ;
|
||||
// modo
|
||||
int nMode ;
|
||||
if ( ! FromString( vsParams[1], nMode))
|
||||
return false ;
|
||||
m_Data[MODE] = CLIP( nMode, GDB_MD_STD, GDB_MD_HIDDEN) ;
|
||||
m_Data[MODE] = Clamp( nMode, GDB_MD_STD, GDB_MD_HIDDEN) ;
|
||||
// stato (ammessi solo OFF e ON)
|
||||
int nStat ;
|
||||
if ( ! FromString( vsParams[2], nStat))
|
||||
return false ;
|
||||
m_Data[STATUS] = CLIP( nStat, GDB_ST_OFF, GDB_ST_ON) ;
|
||||
m_Data[STATUS] = Clamp( nStat, GDB_ST_OFF, GDB_ST_ON) ;
|
||||
// marcatura (ammesso solo OFF)
|
||||
int nMark ;
|
||||
if ( ! FromString( vsParams[3], nMark))
|
||||
return false ;
|
||||
m_Data[MARK] = CLIP( nMark, GDB_MK_OFF, GDB_MK_OFF) ;
|
||||
m_Data[MARK] = Clamp( nMark, GDB_MK_OFF, GDB_MK_OFF) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -215,10 +213,9 @@ Attribs::SetName( const string& sName)
|
||||
if ( sName.empty() || ! IsValidVal( sName))
|
||||
return false ;
|
||||
|
||||
// può essere solo la prima stringa
|
||||
STRLIST::iterator iIter ;
|
||||
if ( ( iIter = m_slInfo.begin()) != m_slInfo.end() &&
|
||||
FindKey( *iIter, NAME)) {
|
||||
// può essere solo la prima stringa
|
||||
auto iIter = m_slInfo.begin() ;
|
||||
if ( iIter != m_slInfo.end() && FindKey( *iIter, NAME)) {
|
||||
*iIter = NAME + EQUAL + sName ;
|
||||
return true ;
|
||||
}
|
||||
@@ -237,10 +234,9 @@ Attribs::SetName( const string& sName)
|
||||
bool
|
||||
Attribs::GetName( string& sName) const
|
||||
{
|
||||
// può essere solo la prima stringa
|
||||
STRLIST::const_iterator iIter ;
|
||||
if ( ( iIter = m_slInfo.begin()) != m_slInfo.end() &&
|
||||
FindKey( *iIter, NAME)) {
|
||||
// può essere solo la prima stringa
|
||||
const auto iIter = m_slInfo.cbegin() ;
|
||||
if ( iIter != m_slInfo.cend() && FindKey( *iIter, NAME)) {
|
||||
sName = iIter->substr( NAME.length() + 1) ;
|
||||
return true ;
|
||||
}
|
||||
@@ -252,23 +248,18 @@ Attribs::GetName( string& sName) const
|
||||
bool
|
||||
Attribs::ExistsName( void) const
|
||||
{
|
||||
// può essere solo la prima stringa
|
||||
STRLIST::const_iterator iIter ;
|
||||
if ( ( iIter = m_slInfo.begin()) != m_slInfo.end() &&
|
||||
FindKey( *iIter, NAME))
|
||||
return true ;
|
||||
|
||||
return false ;
|
||||
// può essere solo la prima stringa
|
||||
const auto iIter = m_slInfo.cbegin() ;
|
||||
return ( iIter != m_slInfo.cend() && FindKey( *iIter, NAME)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Attribs::RemoveName( void)
|
||||
{
|
||||
// può essere solo la prima stringa
|
||||
STRLIST::const_iterator iIter ;
|
||||
if ( ( iIter = m_slInfo.begin()) != m_slInfo.end() &&
|
||||
FindKey( *iIter, NAME)) {
|
||||
// può essere solo la prima stringa
|
||||
const auto iIter = m_slInfo.cbegin() ;
|
||||
if ( iIter != m_slInfo.cend() && FindKey( *iIter, NAME)) {
|
||||
m_slInfo.pop_front() ;
|
||||
return true ;
|
||||
}
|
||||
@@ -285,11 +276,11 @@ Attribs::SetInfo( const string& sKey, const string& sVal)
|
||||
if ( ! IsValidKey( sKey) || sVal.empty() || ! IsValidVal( sVal))
|
||||
return false ;
|
||||
|
||||
// se è il nome
|
||||
// se è il nome
|
||||
if ( sKey == NAME)
|
||||
return SetName( sVal) ;
|
||||
|
||||
// se esiste già una stringa con quella chiave la sostituisco
|
||||
// se esiste già una stringa con quella chiave la sostituisco
|
||||
for ( auto iIter = m_slInfo.begin() ; iIter != m_slInfo.end() ; ++ iIter) {
|
||||
if ( FindKey( *iIter, sKey)) {
|
||||
*iIter = sKey + EQUAL + sVal ;
|
||||
@@ -362,8 +353,11 @@ Attribs::GetAllInfo( STRVECTOR& vsInfo) const
|
||||
{
|
||||
// riservo spazio opportuno per il vettore delle stringhe
|
||||
vsInfo.clear() ;
|
||||
if ( (int) m_slInfo.size() == 0)
|
||||
|
||||
// se non ci sono info esco
|
||||
if ( m_slInfo.empty())
|
||||
return true ;
|
||||
|
||||
vsInfo.reserve( m_slInfo.size()) ;
|
||||
// recupero tutte le info tranne il nome (se presente sempre al primo posto)
|
||||
auto iIter = m_slInfo.cbegin() ;
|
||||
|
||||
@@ -16,14 +16,12 @@
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkColor.h"
|
||||
#include "/EgtDev/Include/EgtStringBase.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
|
||||
class NgeWriter ;
|
||||
class NgeReader ;
|
||||
class GeomDB ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
#define CLIP( nV, nMIN, nMAX) (( nV < nMIN) ? nMIN : (( nV > nMAX) ? nMAX : nV))
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Attribs
|
||||
{
|
||||
@@ -46,14 +44,14 @@ class Attribs
|
||||
bool Load( NgeReader& ngeIn) ;
|
||||
void SetLevel( int nLev)
|
||||
{ m_OldData[LEVEL] = m_Data[LEVEL] ;
|
||||
m_Data[LEVEL] = CLIP( nLev, GDB_LV_USER, GDB_LV_TEMP) ; }
|
||||
m_Data[LEVEL] = Clamp( nLev, GDB_LV_USER, GDB_LV_TEMP) ; }
|
||||
void RevertLevel( void)
|
||||
{ std::swap( m_Data[LEVEL], m_OldData[LEVEL]) ; }
|
||||
int GetLevel( void) const
|
||||
{ return m_Data[LEVEL] ; }
|
||||
void SetMode( int nMode)
|
||||
{ m_OldData[MODE] = m_Data[MODE] ;
|
||||
m_Data[MODE] = CLIP( nMode, GDB_MD_STD, GDB_MD_HIDDEN) ; }
|
||||
m_Data[MODE] = Clamp( nMode, GDB_MD_STD, GDB_MD_HIDDEN) ; }
|
||||
void RevertMode( void)
|
||||
{ std::swap( m_Data[MODE], m_OldData[MODE]) ; }
|
||||
int GetMode( void) const
|
||||
@@ -61,13 +59,13 @@ class Attribs
|
||||
void SetStatus( int nStat)
|
||||
{ if ( m_Data[STATUS] != GDB_ST_SEL)
|
||||
m_OldData[STATUS] = m_Data[STATUS] ;
|
||||
m_Data[STATUS] = CLIP( nStat, GDB_ST_OFF, GDB_ST_SEL) ; }
|
||||
m_Data[STATUS] = Clamp( nStat, GDB_ST_OFF, GDB_ST_SEL) ; }
|
||||
void RevertStatus( void)
|
||||
{ SetStatus( m_OldData[STATUS]) ; }
|
||||
int GetStatus( void) const
|
||||
{ return m_Data[STATUS] ; }
|
||||
void SetMark( void)
|
||||
{ m_Data[MARK] = GDB_MK_ON ; }
|
||||
void SetMark( int nMark)
|
||||
{ m_Data[MARK] = Clamp( nMark, GDB_MK_OFF, GDB_MK_ON_2) ; }
|
||||
void ResetMark( void)
|
||||
{ m_Data[MARK] = GDB_MK_OFF ; }
|
||||
int GetMark( void) const
|
||||
|
||||
+15
-12
@@ -14,10 +14,10 @@
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "BiArcs.h"
|
||||
#include "CurveLine.h"
|
||||
#include "CurveArc.h"
|
||||
#include "CurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkAngle.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkArcSpecial.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
@@ -50,7 +50,7 @@ GetBiArc( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dDir
|
||||
return nullptr ;
|
||||
|
||||
// preparo la curva composita per i biarchi
|
||||
PtrOwner<ICurveComposite> pBiArc( CreateCurveComposite()) ;
|
||||
PtrOwner<CurveComposite> pBiArc( CreateBasicCurveComposite()) ;
|
||||
if ( IsNull( pBiArc))
|
||||
return nullptr ;
|
||||
|
||||
@@ -83,7 +83,7 @@ GetBiArc( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dDir
|
||||
//----------------------------------------------------------------------------
|
||||
ICurve*
|
||||
GetBiArc( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dDir1Deg,
|
||||
const PolyLine& PL, double& dDist)
|
||||
const PolyLine& PL, double& dDist, double dTol)
|
||||
{
|
||||
// calcolo la curva dove giacciono i punti di giunzione tra i due archi del biarco
|
||||
PtrOwner<ICurve> pJCrv( CalcJCurve( ptP0, dDir0Deg, ptP1, dDir1Deg)) ;
|
||||
@@ -95,7 +95,7 @@ GetBiArc( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dDir
|
||||
pBiArc.Set( GetBiArc( ptP0, dDir0Deg, ptP1, dDir1Deg, 0.5)) ;
|
||||
}
|
||||
else {
|
||||
CurveArc* pArc = GetBasicCurveArc( pJCrv) ;
|
||||
const CurveArc* pArc = GetBasicCurveArc( pJCrv) ;
|
||||
if ( pArc == nullptr)
|
||||
return nullptr ;
|
||||
double dU = -1 ;
|
||||
@@ -122,7 +122,7 @@ GetBiArc( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dDir
|
||||
}
|
||||
}
|
||||
}
|
||||
// non c'è intersezione, assegno valore medio
|
||||
// non c'è intersezione, assegno valore medio
|
||||
if ( dU < -0.5)
|
||||
dU = 0.5 ;
|
||||
// elimino casi vicino agli estremi, danno solo problemi
|
||||
@@ -142,7 +142,10 @@ GetBiArc( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dDir
|
||||
Point3d ptPrev = ptCurr ;
|
||||
while ( bPnt) {
|
||||
double dLen = Dist( ptCurr, ptPrev) ;
|
||||
int nStep = ( dLen < STEP ? 2 : 1) * int( dLen / STEP) + 1 ;
|
||||
int nStep = int( dLen / STEP) + 1 ;
|
||||
int nMinStep = ( dLen > 50 * dTol ? 3 : ( dLen > 10 * dTol ? 2 : 1)) ;
|
||||
int nMaxStep = 10 ;
|
||||
nStep = Clamp( nStep, nMinStep, nMaxStep) ;
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
double dCoeff = double( i) / nStep ;
|
||||
Point3d ptP = Media( ptPrev, ptCurr, dCoeff) ;
|
||||
@@ -163,7 +166,7 @@ GetBiArc( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dDir
|
||||
static ICurve*
|
||||
CalcJCurve( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dDir1Deg)
|
||||
{
|
||||
// se i due punti coincidono, non si può fare alcunché
|
||||
// se i due punti coincidono, non si può fare alcunché
|
||||
if ( AreSamePointApprox( ptP0, ptP1))
|
||||
return nullptr ;
|
||||
|
||||
@@ -172,7 +175,7 @@ CalcJCurve( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dD
|
||||
|
||||
// se rotazione nulla, allora segmento di retta tra i due punti
|
||||
if ( abs( dAngDeg) < EPS_ANG_SMALL) {
|
||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||
PtrOwner<CurveLine> pLine( CreateBasicCurveLine()) ;
|
||||
if ( IsNull( pLine) || ! pLine->Set( ptP0, ptP1))
|
||||
return nullptr ;
|
||||
// inverto per avere parametrizzazione crescente allontanandosi da Dir0 e avvicinandosi a Dir1
|
||||
@@ -194,7 +197,7 @@ CalcJCurve( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dD
|
||||
Vector3d vtStart = ptP0 - ptCen ;
|
||||
double dRad, dAngStart ;
|
||||
vtStart.ToSpherical( &dRad, nullptr, &dAngStart) ;
|
||||
PtrOwner<ICurveArc> pArc( CreateCurveArc()) ;
|
||||
PtrOwner<CurveArc> pArc( CreateBasicCurveArc()) ;
|
||||
if ( IsNull( pArc) || ! pArc->SetXY( ptCen, dRad, dAngStart, dAngDeg, ( ptP1.z - ptP0.z)))
|
||||
return nullptr ;
|
||||
double dDirStartDeg = dAngStart + ( dAngDeg > 0 ? ANG_RIGHT : - ANG_RIGHT) ;
|
||||
@@ -205,14 +208,14 @@ CalcJCurve( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dD
|
||||
double dDir0RelDeg = DiffAngle( dDir0Deg, dDirDiffDeg) ;
|
||||
// direzione iniziale secondo arco limite rispetto a direzione P0->P1 (dalla finale simmetrico e invert)
|
||||
double dDir1RelDeg = - DiffAngle( dDir1Deg, dDirDiffDeg) ;
|
||||
// nel caso di direzioni a 180deg si sceglie la più compatta
|
||||
// nel caso di direzioni a 180deg si sceglie la più compatta
|
||||
if ( abs( abs( dDir1RelDeg) - ANG_STRAIGHT) < EPS_SMALL)
|
||||
dDir1RelDeg = ( dDir0RelDeg > 0 ? ANG_STRAIGHT : - ANG_STRAIGHT) ;
|
||||
else if ( abs( abs( dDir0RelDeg) - ANG_STRAIGHT) < EPS_SMALL)
|
||||
dDir0RelDeg = ( dDir1RelDeg > 0 ? ANG_STRAIGHT : - ANG_STRAIGHT) ;
|
||||
// intervallo angolare ammissibile a partire da direzione iniziale primo arco ammissibile ( == Dir0)
|
||||
double dDeltaAngDeg = - dDir0RelDeg + dDir1RelDeg ;
|
||||
// se non è nella regione, prendo l'altra parte di arco
|
||||
// se non è nella regione, prendo l'altra parte di arco
|
||||
if ( ! AngleInSpan( dDirStartRelDeg, dDir0RelDeg, dDeltaAngDeg))
|
||||
pArc->ToExplementary() ;
|
||||
// inverto per avere parametrizzazione crescente allontanandosi da Dir0 e avvicinandosi a Dir1
|
||||
|
||||
@@ -17,5 +17,5 @@
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ICurve* GetBiArc( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dDir1Deg,
|
||||
const PolyLine& PL, double& dDist) ;
|
||||
const PolyLine& PL, double& dDist, double dTol) ;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,57 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2024-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : CAvSilhouetteSurfTm.h Data : 16.06.24 Versione : 2.6f2
|
||||
// Contenuto : Dichiarazione della classe calcolo multi-silhouette.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 10.06.24 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CAvToolSurfTm.h"
|
||||
#include "SurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/EGkCAvSilhouetteSurfTm.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
class CAvParSilhouettesSurfTm : public ICAvParSilhouettesSurfTm
|
||||
{
|
||||
public :
|
||||
// generica
|
||||
bool SetData( const CISURFTMPVECTOR& vpStm, const Frame3d& frPlanes, double dTol) override ;
|
||||
bool SetData( const CISURFTMPVECTOR& vpStm, const Frame3d& frPlanes, double dTol,
|
||||
double dSideAng, double dDiam, double dCornRad, double dMaxMat, double dOffsR,
|
||||
double dMaxDepth) override ;
|
||||
bool GetSilhouette( double dLevel, POLYLINEVECTOR& vPL) override ;
|
||||
|
||||
public :
|
||||
CAvParSilhouettesSurfTm( void) ;
|
||||
|
||||
private :
|
||||
bool Prepare( void) ;
|
||||
|
||||
private :
|
||||
CISURFTMPVECTOR m_vpStm ;
|
||||
CAvToolSurfTm m_cavTstm ;
|
||||
Frame3d m_frGrid ;
|
||||
double m_dTol ;
|
||||
double m_dSharpedTol ;
|
||||
int m_nStepX ;
|
||||
int m_nStepY ;
|
||||
double m_dRad ;
|
||||
double m_dCornRad ;
|
||||
double m_dMaxMat ;
|
||||
double m_dSideAng ;
|
||||
double m_dOffsR ;
|
||||
double m_dDimZ ;
|
||||
double m_dLevelOffs ;
|
||||
double m_dMaxDepth ;
|
||||
bool m_bGridOk ;
|
||||
bool m_bTool ;
|
||||
DBLVECTOR m_vdGrid ;
|
||||
} ;
|
||||
@@ -140,16 +140,20 @@ MyCAvSimpleSurfFrMove::Translate( const Vector3d& vtDir, double& dLen)
|
||||
if ( scInfoCurr.nType == SCI_LINE_LINE || scInfoCurr.nType == SCI_PNT_LINE) {
|
||||
m_SCollInfo = scInfoCurr ;
|
||||
m_SCollInfo.nChunkM = j ;
|
||||
m_SCollInfo.nLoopM = 0 ;
|
||||
m_SCollInfo.nCrvM = k ;
|
||||
m_SCollInfo.nChunkF = i ;
|
||||
m_SCollInfo.nLoopF = 0 ;
|
||||
m_SCollInfo.nCrvF = l ;
|
||||
}
|
||||
}
|
||||
else if ( dNewLenXY < dPrevLenXY) {
|
||||
m_SCollInfo = scInfoCurr ;
|
||||
m_SCollInfo.nChunkM = j ;
|
||||
m_SCollInfo.nLoopM = 0 ;
|
||||
m_SCollInfo.nCrvM = k ;
|
||||
m_SCollInfo.nChunkF = i ;
|
||||
m_SCollInfo.nLoopF = 0 ;
|
||||
m_SCollInfo.nCrvF = l ;
|
||||
}
|
||||
pCrv2 = ( pCompo2 != nullptr ? pCompo2->GetNextCurve() : nullptr) ;
|
||||
|
||||
@@ -30,7 +30,7 @@ class MyCAvSimpleSurfFrMove
|
||||
const SCollInfo& GetSCollInfo()
|
||||
{ return m_SCollInfo ;}
|
||||
|
||||
private :
|
||||
protected :
|
||||
bool TranslateCurveNoCollisionCurve( const ICurve* pCrv1, const ICurve* pCrv2,
|
||||
const Vector3d& vtDir, double& dLen, SCollInfo& scInfo) ;
|
||||
bool TranslateLineNoCollisionLine( const CurveLine* pLine1, const CurveLine* pLine2,
|
||||
@@ -40,7 +40,7 @@ class MyCAvSimpleSurfFrMove
|
||||
bool RotateLineNoCollisionLine( const CurveLine* pLine1, const CurveLine* pLine2,
|
||||
const Point3d& ptCen, double& dAng) ;
|
||||
|
||||
private :
|
||||
protected :
|
||||
const SurfFlatRegion* m_pRegM ;
|
||||
const SurfFlatRegion* m_pRegF ;
|
||||
SCollInfo m_SCollInfo ;
|
||||
|
||||
@@ -0,0 +1,257 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2026-2026
|
||||
//----------------------------------------------------------------------------
|
||||
// File : CASurfFrMove.cpp Data : 26.03.2026 Versione : 3.1c7
|
||||
// Contenuto : Implementazione delle funzioni di movimento per SurfFlatRegion
|
||||
// senza collisione con altri oggetti dello stesso tipo e nello
|
||||
// stesso piano o in piani paralleli.
|
||||
//
|
||||
//
|
||||
// Modifiche : 26.03.2026 RE Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "CAvSurfFrMove.h"
|
||||
#include "SurfFlatRegion.h"
|
||||
#include "CurveLine.h"
|
||||
#include "CurveArc.h"
|
||||
#include "CurveComposite.h"
|
||||
#include "IntersLineArc.h"
|
||||
#include "GeoConst.h"
|
||||
#include "/EgtDev/Include/EGkCAvSurfFrMove.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// CASurfFrMove
|
||||
//----------------------------------------------------------------------------
|
||||
CAvSurfFrMove::CAvSurfFrMove( const ISurfFlatRegion& SfrM, const ISurfFlatRegion& SfrF)
|
||||
{
|
||||
// salvo puntatori alle regioni
|
||||
m_pRegM = &SfrM ;
|
||||
m_pRegF = &SfrF ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvSurfFrMove::Translate( const Vector3d& vtDir, double& dLen)
|
||||
{
|
||||
MyCAvSurfFrMove ScdMove( *m_pRegM, *m_pRegF) ;
|
||||
m_CollInfo.nType = SCI_NONE ;
|
||||
if ( ! ScdMove.Translate( vtDir, dLen))
|
||||
return false ;
|
||||
m_CollInfo = ScdMove.GetCollInfo() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvSurfFrMove::Rotate( const Point3d& ptCen, double& dAng)
|
||||
{
|
||||
MyCAvSurfFrMove ScdMove( *m_pRegM, *m_pRegF) ;
|
||||
m_CollInfo.nType = SCI_NONE ;
|
||||
return ScdMove.Rotate( ptCen, dAng) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MyCAvSurfFrMove::Translate( const Vector3d& vtDir, double& dLen)
|
||||
{
|
||||
// verifico validità regioni
|
||||
if ( m_pRegM == nullptr || m_pRegF == nullptr)
|
||||
return false ;
|
||||
|
||||
// verifico che le due regioni giacciano in piani paralleli
|
||||
if ( ! AreSameVectorApprox( m_pRegM->m_frF.VersZ(), m_pRegF->m_frF.VersZ()))
|
||||
return false ;
|
||||
|
||||
// reset info di collisione
|
||||
m_SCollInfo.nType = SCI_NONE ;
|
||||
|
||||
// porto il vettore di movimento nel riferimento intrinseco e ne annullo la componente Z
|
||||
Vector3d vtDirL = vtDir ;
|
||||
vtDirL.ToLoc( m_pRegM->m_frF) ;
|
||||
vtDirL.z = 0 ;
|
||||
double dLenXY = vtDirL.Len() ;
|
||||
if ( dLenXY < EPS_SMALL)
|
||||
return true ;
|
||||
vtDirL /= dLenXY ;
|
||||
dLenXY *= dLen ;
|
||||
double dNewLenXY = dLenXY ;
|
||||
|
||||
// ciclo sui chunk della seconda superficie
|
||||
for ( int nCF = 0 ; nCF < m_pRegF->GetChunkCount() ; ++ nCF) {
|
||||
// ciclo sui bordi dei chunk
|
||||
for ( int nLF = 0 ; nLF < m_pRegF->GetLoopCount( nCF) ; ++ nLF) {
|
||||
|
||||
// curva corrente del chunk della seconda regione in locale nel riferimento intrinseco della prima
|
||||
const ICurve* pCrv2Loc = nullptr ;
|
||||
PtrOwner<ICurve> pCopyCrv ;
|
||||
if ( AreSameFrame( m_pRegM->m_frF, m_pRegF->m_frF))
|
||||
pCrv2Loc = m_pRegF->GetMyLoop( nCF, nLF) ;
|
||||
else {
|
||||
pCopyCrv.Set( m_pRegF->GetMyLoop( nCF, nLF)->Clone()) ;
|
||||
if ( IsNull( pCopyCrv))
|
||||
return false ;
|
||||
pCopyCrv->LocToLoc( m_pRegF->m_frF, m_pRegM->m_frF) ;
|
||||
pCrv2Loc = pCopyCrv ;
|
||||
}
|
||||
const CurveComposite* pCompo2 = GetBasicCurveComposite( pCrv2Loc) ;
|
||||
|
||||
// ciclo sui chunk della prima superficie
|
||||
for ( int nCM = 0 ; nCM < m_pRegM->GetChunkCount() ; ++ nCM) {
|
||||
// ciclo sui bordi del chunk
|
||||
for ( int nLM = 0 ; nLM < m_pRegM->GetLoopCount( nCM) ; ++ nLM) {
|
||||
|
||||
// per CAv non ha senso confrontare due loop interni tra di loro.
|
||||
// posso confrontatare - due loop esterni (come per la CAvSimpleSurfFrMove)
|
||||
// - un loop esterno con uno interno (nel caso in cui un Chunk sia contenuto dentro un isola)
|
||||
if ( nLF > 0 && nLM > 0)
|
||||
continue ;
|
||||
|
||||
// curva corrente del chunk della prima regione (ovviamente già in locale al riferimento intrinseco)
|
||||
const ICurve* pCrv1Loc = m_pRegM->GetMyLoop( nCM, nLM) ;
|
||||
const CurveComposite* pCompo1 = GetBasicCurveComposite( pCrv1Loc) ;
|
||||
|
||||
// verifico la collisione tra le entità dei loop esterni dei due chunk
|
||||
int k = 0 ;
|
||||
const ICurve* pCrv1 = ( pCompo1 != nullptr ? pCompo1->GetFirstCurve() : pCrv1Loc) ;
|
||||
while ( pCrv1 != nullptr) {
|
||||
int l = 0 ;
|
||||
const ICurve* pCrv2 = ( pCompo2 != nullptr ? pCompo2->GetFirstCurve() : pCrv2Loc) ;
|
||||
while ( pCrv2 != nullptr) {
|
||||
SCollInfo cInfoCurr ;
|
||||
double dPrevLenXY = dNewLenXY ;
|
||||
if ( ! TranslateCurveNoCollisionCurve( pCrv1, pCrv2, vtDirL, dNewLenXY, cInfoCurr))
|
||||
return false ;
|
||||
if ( abs( dNewLenXY - dPrevLenXY) < EPS_SMALL) {
|
||||
if ( cInfoCurr.nType == SCI_LINE_LINE || cInfoCurr.nType == SCI_PNT_LINE) {
|
||||
m_SCollInfo = cInfoCurr ;
|
||||
m_SCollInfo.nChunkM = nCM ;
|
||||
m_SCollInfo.nLoopM = nLM ;
|
||||
m_SCollInfo.nCrvM = k ;
|
||||
m_SCollInfo.nChunkF = nCF ;
|
||||
m_SCollInfo.nLoopF = nLF ;
|
||||
m_SCollInfo.nCrvF = l ;
|
||||
}
|
||||
}
|
||||
else if ( dNewLenXY < dPrevLenXY) {
|
||||
m_SCollInfo = cInfoCurr ;
|
||||
m_SCollInfo.nChunkM = nCM ;
|
||||
m_SCollInfo.nLoopM = nLM ;
|
||||
m_SCollInfo.nCrvM = k ;
|
||||
m_SCollInfo.nChunkF = nCF ;
|
||||
m_SCollInfo.nLoopF = nLF ;
|
||||
m_SCollInfo.nCrvF = l ;
|
||||
}
|
||||
pCrv2 = ( pCompo2 != nullptr ? pCompo2->GetNextCurve() : nullptr) ;
|
||||
++ l ;
|
||||
}
|
||||
pCrv1 = ( pCompo1 != nullptr ? pCompo1->GetNextCurve() : nullptr) ;
|
||||
++ k ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// se da limitare il movimento
|
||||
if ( dNewLenXY < dLenXY - EPS_SMALL)
|
||||
dLen *= dNewLenXY / dLenXY ;
|
||||
|
||||
// porto i punti e le direzioni di SCollInfo da intrinseco a locale della prima regione
|
||||
if ( m_SCollInfo.nType != SCI_NONE) {
|
||||
m_SCollInfo.ptP1.ToGlob( m_pRegM->m_frF) ;
|
||||
m_SCollInfo.vtDirM.ToGlob( m_pRegM->m_frF) ;
|
||||
m_SCollInfo.vtDirF.ToGlob( m_pRegM->m_frF) ;
|
||||
}
|
||||
if ( m_SCollInfo.nType == SCI_LINE_LINE)
|
||||
m_SCollInfo.ptP2.ToGlob( m_pRegM->m_frF) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MyCAvSurfFrMove::Rotate( const Point3d& ptCen, double& dAng)
|
||||
{
|
||||
// verifico validità regioni
|
||||
if ( m_pRegM == nullptr || m_pRegF == nullptr)
|
||||
return false ;
|
||||
|
||||
// verifico che le due regioni giacciano in piani paralleli
|
||||
if ( ! AreSameVectorApprox( m_pRegM->m_frF.VersZ(), m_pRegF->m_frF.VersZ()))
|
||||
return false ;
|
||||
|
||||
// reset info di collisione
|
||||
m_SCollInfo.nType = SCI_NONE ;
|
||||
|
||||
// porto il centro di rotazione nel riferimento intrinseco e ne annullo la componente Z
|
||||
Point3d ptCenL = ptCen ;
|
||||
ptCenL.ToLoc( m_pRegM->m_frF) ;
|
||||
ptCenL.z = 0 ;
|
||||
if ( abs( dAng) < EPS_ANG_SMALL)
|
||||
return true ;
|
||||
double dNewAng = dAng ;
|
||||
|
||||
// ciclo sui chunk della seconda superficie
|
||||
for ( int nCF = 0 ; nCF < m_pRegF->GetChunkCount() ; ++ nCF) {
|
||||
// ciclo sui bordi del Chunk
|
||||
for ( int nLF = 0 ; nLF < m_pRegF->GetLoopCount( nCF) ; ++ nLF) {
|
||||
|
||||
// curva corrente del chunk della seconda regione in locale nel riferimento intrinseco della prima
|
||||
const ICurve* pCrv2Loc = nullptr ;
|
||||
PtrOwner<ICurve> pCopyCrv ;
|
||||
if ( AreSameFrame( m_pRegM->m_frF, m_pRegF->m_frF))
|
||||
pCrv2Loc = m_pRegF->GetMyLoop( nCF, nLF) ;
|
||||
else {
|
||||
pCopyCrv.Set( m_pRegF->GetMyLoop( nCF, nLF)->Clone()) ;
|
||||
if ( IsNull( pCopyCrv))
|
||||
return false ;
|
||||
pCopyCrv->LocToLoc( m_pRegF->m_frF, m_pRegM->m_frF) ;
|
||||
pCrv2Loc = pCopyCrv ;
|
||||
}
|
||||
const CurveComposite* pCompo2 = GetBasicCurveComposite( pCrv2Loc) ;
|
||||
|
||||
// ciclo sui chunk della prima superficie
|
||||
for ( int nCM = 0 ; nCM < m_pRegM->GetChunkCount() ; ++ nCM) {
|
||||
// ciclo sui bordi del chunk
|
||||
for ( int nLM = 0 ; nLM < m_pRegM->GetLoopCount( nCM) ; ++ nLM) {
|
||||
|
||||
// per CAv non ha senso confrontare due loop interni tra di loro.
|
||||
// posso confrontatare - due loop esterni (come per la CAvSimpleSurfFrMove)
|
||||
// - un loop esterno con uno interno (nel caso in cui un Chunk sia contenuto dentro un isola)
|
||||
if ( nLF > 0 && nLM > 0)
|
||||
continue ;
|
||||
|
||||
// curva esterna del chunk della prima regione (ovviamente già in locale al riferimento intrinseco)
|
||||
const ICurve* pCrv1Loc = m_pRegM->GetMyLoop( nCM, nLM) ;
|
||||
const CurveComposite* pCompo1 = GetBasicCurveComposite( pCrv1Loc) ;
|
||||
|
||||
// verifico la collisione tra le entità dei loop esterni dei due chunk
|
||||
const ICurve* pCrv1 = ( pCompo1 != nullptr ? pCompo1->GetFirstCurve() : pCrv1Loc) ;
|
||||
while ( pCrv1 != nullptr) {
|
||||
const ICurve* pCrv2 = ( pCompo2 != nullptr ? pCompo2->GetFirstCurve() : pCrv2Loc) ;
|
||||
while ( pCrv2 != nullptr) {
|
||||
if ( ! RotateCurveNoCollisionCurve( pCrv1, pCrv2, ptCenL, dNewAng))
|
||||
return false ;
|
||||
pCrv2 = ( pCompo2 != nullptr ? pCompo2->GetNextCurve() : nullptr) ;
|
||||
}
|
||||
pCrv1 = ( pCompo1 != nullptr ? pCompo1->GetNextCurve() : nullptr) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// se da limitare il movimento
|
||||
if ( ( dAng > 0 && dNewAng < dAng - EPS_ANG_SMALL) ||
|
||||
( dAng < 0 && dNewAng > dAng + EPS_ANG_SMALL))
|
||||
dAng = dNewAng ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2018
|
||||
//----------------------------------------------------------------------------
|
||||
// File : CAvSurfFrMove.h Data : 27.04.18 Versione : 3.1c7
|
||||
// Contenuto : Dich.ne classe privata per movimento di superfici flat region
|
||||
// nel loro piano evitando collisioni
|
||||
//
|
||||
// Modifiche : 26.03.2026 RE Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CAvSimpleSurfFrMove.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class MyCAvSurfFrMove : public MyCAvSimpleSurfFrMove
|
||||
{
|
||||
public :
|
||||
MyCAvSurfFrMove( const ISurfFlatRegion& SfrM, const ISurfFlatRegion& SfrF) :
|
||||
MyCAvSimpleSurfFrMove( SfrM, SfrF) {} ;
|
||||
|
||||
public :
|
||||
bool Translate( const Vector3d& vtDir, double& dLen) ;
|
||||
bool Rotate( const Point3d& ptCen, double& dAng) ;
|
||||
const SCollInfo& GetCollInfo()
|
||||
{ return m_SCollInfo ; }
|
||||
} ;
|
||||
+527
-56
@@ -1,21 +1,21 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2018-2018
|
||||
// EgalTech 2018-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : CAToolSurfTm.cpp Data : 08.05.18 Versione : 1.9e2
|
||||
// Contenuto : Implementazione della classe CAToolSurfTm.
|
||||
// File : CAvToolSurfTm.cpp Data : 07.06.24 Versione : 2.6f2
|
||||
// Contenuto : Implementazione della classe CAvToolSurfTm.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 27.04.18 DS Creazione modulo.
|
||||
//
|
||||
// 07.06.24 DS Con tolleranza lineare negativa non si controlla il punto medio.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "CAvToolTriangle.h"
|
||||
#include "CAvToolSurfTm.h"
|
||||
#include "DistPointLine.h"
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include <thread>
|
||||
#include <future>
|
||||
@@ -24,6 +24,7 @@ using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const int STEP_PE = 50 ;
|
||||
const double MAX_MOVE = 20000 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ICAvToolSurfTm*
|
||||
@@ -37,10 +38,29 @@ CreateCAvToolSurfTm( void)
|
||||
// CAvToolSurfTm
|
||||
//----------------------------------------------------------------------------
|
||||
CAvToolSurfTm::CAvToolSurfTm( void)
|
||||
: m_Tool( false)
|
||||
: m_frMove( false), m_Tool( false)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvToolSurfTm::Clear( void)
|
||||
{
|
||||
// pulisco la lista dei puntatori a Stm
|
||||
m_vSTM.clear() ;
|
||||
// pulisco e inizializzo la prima posizione della lista delle basi per gli indici dei triangoli
|
||||
m_vBaseInd.clear() ;
|
||||
m_vBaseInd.emplace_back( 0) ;
|
||||
// pulisco HashGrid 2d
|
||||
m_HGrids.Clear() ;
|
||||
// reset utensile
|
||||
m_Tool.Clear() ;
|
||||
// reset riferimento
|
||||
m_frMove.Reset( false) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvToolSurfTm::SetSurfTm( const ISurfTriMesh& Stm)
|
||||
@@ -50,6 +70,9 @@ CAvToolSurfTm::SetSurfTm( const ISurfTriMesh& Stm)
|
||||
// pulisco e inizializzo la prima posizione della lista delle basi per gli indici dei triangoli
|
||||
m_vBaseInd.clear() ;
|
||||
m_vBaseInd.emplace_back( 0) ;
|
||||
// pulisco HashGrid 2d
|
||||
m_HGrids.Clear() ;
|
||||
// non tocco l'utensile
|
||||
// aggiungo la superficie
|
||||
return AddSurfTm( Stm) ;
|
||||
}
|
||||
@@ -58,7 +81,7 @@ CAvToolSurfTm::SetSurfTm( const ISurfTriMesh& Stm)
|
||||
bool
|
||||
CAvToolSurfTm::AddSurfTm( const ISurfTriMesh& Stm)
|
||||
{
|
||||
// verifico validità superficie
|
||||
// verifico validità superficie
|
||||
const SurfTriMesh* pStm = GetBasicSurfTriMesh( &Stm) ;
|
||||
if ( pStm == nullptr || ! pStm->IsValid())
|
||||
return false ;
|
||||
@@ -99,40 +122,227 @@ CAvToolSurfTm::SetGenTool( const ICurveComposite* pToolOutline)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvToolSurfTm::TestPosition( const Point3d& ptT, const Vector3d& vtDir, const Vector3d& vtMove, double& dTotDist)
|
||||
CAvToolSurfTm::TestPosition( const Point3d& ptT, const Vector3d& vtDir, const Vector3d& vtMove,
|
||||
double& dTotDist, Vector3d* pvtTriaN) const
|
||||
{
|
||||
// Se utensile non definito, errore
|
||||
if ( m_Tool.GetType() == Tool::UNDEF)
|
||||
return false ;
|
||||
// Imposto il riferimento di movimento
|
||||
if ( ! AreSameOrOppositeVectorApprox( vtDir, vtMove))
|
||||
m_frMove.Set( ORIG, vtMove, vtDir) ;
|
||||
else
|
||||
m_frMove.Set( ORIG, vtMove) ;
|
||||
// Eseguo controllo
|
||||
// Se direzioni non definite, errore
|
||||
if ( vtDir.IsSmall() || vtMove.IsSmall())
|
||||
return false ;
|
||||
// Se riferimento di movimento già presente
|
||||
if ( m_frMove.IsValid()) {
|
||||
// Calcolo nuovo riferimento di movimento
|
||||
Frame3d frMove ;
|
||||
if ( ! AreSameOrOppositeVectorApprox( vtDir, vtMove))
|
||||
frMove.Set( ORIG, vtMove, vtDir) ;
|
||||
else
|
||||
frMove.Set( ORIG, vtMove) ;
|
||||
// Se riferimenti di movimento uguali, sfrutto HashGrid 2d
|
||||
if ( AreSameFrame( frMove, m_frMove)) {
|
||||
// Eseguo controllo
|
||||
Point3d ptCurr = ptT ;
|
||||
Vector3d vtTriaN ;
|
||||
dTotDist = MyTestPositionHG( ptCurr, vtDir, vtTriaN) ;
|
||||
if ( pvtTriaN != nullptr)
|
||||
*pvtTriaN = vtTriaN ;
|
||||
return ( dTotDist > - EPS_SMALL) ;
|
||||
}
|
||||
}
|
||||
// Altrimenti eseguo controllo diretto
|
||||
Point3d ptCurr = ptT ;
|
||||
dTotDist = MyTestPosition( ptCurr, vtDir) ;
|
||||
Vector3d vtTriaN ;
|
||||
dTotDist = MyTestPosition( ptCurr, vtDir, vtMove, vtTriaN) ;
|
||||
if ( pvtTriaN != nullptr)
|
||||
*pvtTriaN = vtTriaN ;
|
||||
return ( dTotDist > - EPS_SMALL) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvToolSurfTm::TestPath( PNTULIST& lPntM, const Vector3d& vtDir, const Vector3d& vtMove, double dLinTol)
|
||||
CAvToolSurfTm::TestPositionAdv( const Point3d& ptT, const Vector3d& vtDir, const Vector3d& vtMove,
|
||||
double& dTotDist, VCT3DVECTOR& vVtN) const
|
||||
{
|
||||
// Funzione per calcolo collisione tra utensile e superfici ;
|
||||
// dToTDist è la distanza di traslazione del punto ptT lungo vtDir per evitare la collisione,
|
||||
// vVtN è la normale del triangolo che genera collsione ( NB. Nel caso di più triangoli concorrenti,
|
||||
// vengono restituite tutte le normali trovate)
|
||||
|
||||
// Inizializzazione parametri
|
||||
dTotDist = 0 ;
|
||||
vVtN.clear() ;
|
||||
// Se utensile non definito, errore
|
||||
if ( m_Tool.GetType() == Tool::UNDEF)
|
||||
return false ;
|
||||
// Se direzioni non definite, errore
|
||||
if ( vtDir.IsSmall() || vtMove.IsSmall())
|
||||
return false ;
|
||||
// Se riferimento di movimento già presente
|
||||
if ( m_frMove.IsValid()) {
|
||||
// Calcolo nuovo riferimento di movimento
|
||||
Frame3d frMove ;
|
||||
if ( ! AreSameOrOppositeVectorApprox( vtDir, vtMove))
|
||||
frMove.Set( ORIG, vtMove, vtDir) ;
|
||||
else
|
||||
frMove.Set( ORIG, vtMove) ;
|
||||
// Se riferimenti di movimento uguali, sfrutto HashGrid 2d
|
||||
if ( AreSameFrame( frMove, m_frMove)) {
|
||||
// Eseguo controllo
|
||||
Point3d ptCurr = ptT ;
|
||||
dTotDist = MyTestPositionHGAdv( ptCurr, vtDir, vVtN) ;
|
||||
return ( dTotDist > - EPS_SMALL) ;
|
||||
}
|
||||
}
|
||||
// Altrimenti eseguo controllo diretto
|
||||
Point3d ptCurr = ptT ;
|
||||
dTotDist = MyTestPositionAdv( ptCurr, vtDir, vtMove, vVtN) ;
|
||||
return ( dTotDist > - EPS_SMALL) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvToolSurfTm::TestSeries( PNTUVECTOR& vPntM, const Vector3d& vtDir, const Vector3d& vtMove, double dProgCoeff)
|
||||
{
|
||||
// Se utensile non definito, errore
|
||||
if ( m_Tool.GetType() == Tool::UNDEF)
|
||||
return false ;
|
||||
// Se lista vuota, non devo fare alcunché
|
||||
// Se direzioni non definite, errore
|
||||
if ( vtDir.IsSmall() || vtMove.IsSmall())
|
||||
return false ;
|
||||
// Se vettore vuoto, non devo fare alcunché
|
||||
if ( vPntM.empty())
|
||||
return true ;
|
||||
// Calcolo nuovo riferimento di movimento
|
||||
Frame3d frMove ;
|
||||
if ( ! AreSameOrOppositeVectorApprox( vtDir, vtMove))
|
||||
frMove.Set( ORIG, vtMove, vtDir) ;
|
||||
else
|
||||
frMove.Set( ORIG, vtMove) ;
|
||||
// Se riferimento di movimento non presente o diverso dal calcolato
|
||||
if ( ! m_frMove.IsValid() || ! AreSameFrame( frMove, m_frMove)) {
|
||||
// Salvo nuovo riferimento
|
||||
m_frMove = frMove ;
|
||||
// Ricalcolo HashGrid
|
||||
if ( ! PrepareHashGrid())
|
||||
return false ;
|
||||
}
|
||||
// Determino il numero di punti dell'insieme
|
||||
m_nTotPnt = int( vPntM.size()) ;
|
||||
// Recupero il numero massimo di thread concorrenti
|
||||
int nThreadMax = thread::hardware_concurrency() ;
|
||||
bool bOk = true ;
|
||||
// Se un solo thread o pochi punti
|
||||
if ( nThreadMax <= 1 || m_nTotPnt < 500) {
|
||||
m_nCurrPnt = 0 ;
|
||||
bOk = TestSubSeries( -1, vPntM, vtDir, 0, m_nTotPnt - 1, dProgCoeff) ;
|
||||
ProcessEvents( int( 100 * dProgCoeff), 0) ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
const int MAX_PARTS = 32 ;
|
||||
INTINTVECTOR vFstLst( MAX_PARTS) ;
|
||||
// calcolo le parti del vettore
|
||||
int nPartCnt = min( nThreadMax, MAX_PARTS) ;
|
||||
int nPartDim = m_nTotPnt / nPartCnt + 1 ;
|
||||
for ( int i = 0 ; i < nPartCnt ; ++ i) {
|
||||
vFstLst[i].first = i * nPartDim ;
|
||||
vFstLst[i].second = min( ( i + 1) * nPartDim, m_nTotPnt) - 1 ;
|
||||
}
|
||||
// processo le parti
|
||||
m_nCurrPnt = 0 ;
|
||||
m_bBreak = false ;
|
||||
future<bool> vRes[MAX_PARTS] ;
|
||||
for ( int i = 0 ; i < nPartCnt ; ++ i)
|
||||
vRes[i] = async( launch::async, &CAvToolSurfTm::TestSubSeries, this, i, ref( vPntM), cref( vtDir), vFstLst[i].first, vFstLst[i].second, dProgCoeff) ;
|
||||
// attendo i risultati
|
||||
int nFin = 0 ;
|
||||
int nNextPE = 0 ;
|
||||
while ( nFin < nPartCnt) {
|
||||
for ( int i = 0 ; i < nPartCnt ; ++ i) {
|
||||
if ( vRes[i].valid() && vRes[i].wait_for( chrono::nanoseconds{ 1}) == future_status::ready) {
|
||||
bOk = vRes[i].get() && bOk ;
|
||||
++ nFin ;
|
||||
}
|
||||
}
|
||||
if ( m_nCurrPnt > nNextPE) {
|
||||
int nRes = ProcessEvents( int( m_nCurrPnt * 100. / m_nTotPnt * dProgCoeff), 10) ;
|
||||
nNextPE += STEP_PE ;
|
||||
if ( nRes == 1)
|
||||
m_bBreak = true ;
|
||||
}
|
||||
}
|
||||
ProcessEvents( int( 100 * dProgCoeff), 0) ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvToolSurfTm::TestSubSeries( int nId, PNTUVECTOR& vPntM, const Vector3d& vtDir, int nFirst, int nLast, double dProgCoeff)
|
||||
{
|
||||
// Se vettore vuoto, non devo fare alcunché
|
||||
if ( vPntM.empty())
|
||||
return true ;
|
||||
// Ciclo sui punti da verificare
|
||||
for ( int i = nFirst ; i <= nLast ; ++ i) {
|
||||
// verifico il punto
|
||||
Vector3d vtTriaN ;
|
||||
double dMove = MyTestPositionHG( vPntM[i].first, vtDir, vtTriaN) ;
|
||||
vPntM[i].second = dMove ;
|
||||
if ( dMove < - EPS_SMALL)
|
||||
return false ;
|
||||
++ m_nCurrPnt ;
|
||||
// se singolo thread
|
||||
if ( nId == -1) {
|
||||
// gestione eventi (ogni STEP_PE punti)
|
||||
if (( m_nCurrPnt % STEP_PE) == 0) {
|
||||
int nRes = ProcessEvents( int( m_nCurrPnt * 100. / m_nTotPnt * dProgCoeff), 0) ;
|
||||
if ( nRes == 1)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti multithread
|
||||
else {
|
||||
if ( m_bBreak)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvToolSurfTm::TestPath( PNTULIST& lPntM, const Vector3d& vtDir, const Vector3d& vtMove, double dLinTol, double dProgCoeff)
|
||||
{
|
||||
// Se utensile non definito, errore
|
||||
if ( m_Tool.GetType() == Tool::UNDEF)
|
||||
return false ;
|
||||
// Se direzioni non definite, errore
|
||||
if ( vtDir.IsSmall() || vtMove.IsSmall())
|
||||
return false ;
|
||||
// Se lista vuota, non devo fare alcunché
|
||||
if ( lPntM.empty())
|
||||
return true ;
|
||||
// Imposto il riferimento di movimento
|
||||
if ( ! AreSameOrOppositeVectorApprox( vtDir, vtMove))
|
||||
m_frMove.Set( ORIG, vtMove, vtDir) ;
|
||||
// Controllo la tolleranza lineare (se negativa non vanno fatti controlli sui punti medi)
|
||||
if ( dLinTol > -EPS_ZERO)
|
||||
dLinTol = max( dLinTol, EPS_SMALL) ;
|
||||
else
|
||||
m_frMove.Set( ORIG, vtMove) ;
|
||||
// Predispongo Hash Grid
|
||||
if ( ! PrepareHashGrid())
|
||||
return false ;
|
||||
dLinTol = -1 ;
|
||||
// Calcolo nuovo riferimento di movimento
|
||||
Frame3d frMove ;
|
||||
if ( ! AreSameOrOppositeVectorApprox( vtDir, vtMove))
|
||||
frMove.Set( ORIG, vtMove, vtDir) ;
|
||||
else
|
||||
frMove.Set( ORIG, vtMove) ;
|
||||
// Se riferimento di movimento non presente o diverso dal calcolato
|
||||
if ( ! m_frMove.IsValid() || ! AreSameFrame( frMove, m_frMove)) {
|
||||
// Salvo nuovo riferimento
|
||||
m_frMove = frMove ;
|
||||
// Ricalcolo HashGrid
|
||||
if ( ! PrepareHashGrid())
|
||||
return false ;
|
||||
}
|
||||
// Determino il numero di punti del path
|
||||
m_nTotPnt = int( lPntM.size()) ;
|
||||
// Recupero il numero massimo di thread concorrenti
|
||||
@@ -140,8 +350,9 @@ CAvToolSurfTm::TestPath( PNTULIST& lPntM, const Vector3d& vtDir, const Vector3d&
|
||||
bool bOk = true ;
|
||||
// Se un solo thread o pochi punti
|
||||
if ( nThreadMax <= 1 || m_nTotPnt < 500) {
|
||||
bOk = TestSubPath( -1, lPntM, vtDir, dLinTol) ;
|
||||
ProcessEvents( 100, 0) ;
|
||||
m_nCurrPnt = 0 ;
|
||||
bOk = TestSubPath( -1, lPntM, vtDir, dLinTol, dProgCoeff) ;
|
||||
ProcessEvents( int( 100 * dProgCoeff), 0) ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
@@ -161,7 +372,7 @@ CAvToolSurfTm::TestPath( PNTULIST& lPntM, const Vector3d& vtDir, const Vector3d&
|
||||
m_bBreak = false ;
|
||||
future<bool> vRes[MAX_PARTS] ;
|
||||
for ( int i = 0 ; i < nPartCnt ; ++ i)
|
||||
vRes[i] = async( launch::async, &CAvToolSurfTm::TestSubPath, this, i, ref( vlPntM[i]), cref( vtDir), dLinTol) ;
|
||||
vRes[i] = async( launch::async, &CAvToolSurfTm::TestSubPath, this, i, ref( vlPntM[i]), cref( vtDir), dLinTol, dProgCoeff) ;
|
||||
// attendo i risultati
|
||||
int nFin = 0 ;
|
||||
int nNextPE = 0 ;
|
||||
@@ -173,7 +384,7 @@ CAvToolSurfTm::TestPath( PNTULIST& lPntM, const Vector3d& vtDir, const Vector3d&
|
||||
}
|
||||
}
|
||||
if ( m_nCurrPnt > nNextPE) {
|
||||
int nRes = ProcessEvents( int( m_nCurrPnt * 100. / m_nTotPnt), 10) ;
|
||||
int nRes = ProcessEvents( int( m_nCurrPnt * 100. / m_nTotPnt * dProgCoeff), 10) ;
|
||||
nNextPE += STEP_PE ;
|
||||
if ( nRes == 1)
|
||||
m_bBreak = true ;
|
||||
@@ -185,18 +396,98 @@ CAvToolSurfTm::TestPath( PNTULIST& lPntM, const Vector3d& vtDir, const Vector3d&
|
||||
lPntM.pop_back() ;
|
||||
lPntM.splice( lPntM.end(), vlPntM[i]) ;
|
||||
}
|
||||
ProcessEvents( 100, 0) ;
|
||||
ProcessEvents( int( 100 * dProgCoeff), 0) ;
|
||||
}
|
||||
// pulisco HashGrid 2d
|
||||
m_HGrids.Clear() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvToolSurfTm::TestSubPath( int nId, PNTULIST& lPntM, const Vector3d& vtDir, double dLinTol)
|
||||
CAvToolSurfTm::TestSeriesAdv( PNTUVVECTVECTOR& vPntM, const Vector3d& vtDir, const Vector3d& vtMove, double dProgCoeff)
|
||||
{
|
||||
// Se lista vuota, non devo fare alcunché
|
||||
// NB. la posizione del punto non viene modificata :
|
||||
// get<0> vPntM[i] è il punto su cui viene posizionata la testa dell'utensile ( const)
|
||||
// get<1> vPntM[i] è il parametro di traslazione del punto lungo vtDir per evitare collisioni con i triangoli
|
||||
// get<2> vPntM[i] è un vettore di Vector3d contenente tutte le normali di tangenza ( a meno di 10 * EPS_SMALL)
|
||||
|
||||
// Se utensile non definito, errore
|
||||
if ( m_Tool.GetType() == Tool::UNDEF)
|
||||
return false ;
|
||||
// Se direzioni non definite, errore
|
||||
if ( vtDir.IsSmall() || vtMove.IsSmall())
|
||||
return false ;
|
||||
// Se vettore vuoto, non devo fare alcunché
|
||||
if ( vPntM.empty())
|
||||
return true ;
|
||||
// Calcolo nuovo riferimento di movimento
|
||||
Frame3d frMove ;
|
||||
if ( ! AreSameOrOppositeVectorApprox( vtDir, vtMove))
|
||||
frMove.Set( ORIG, vtMove, vtDir) ;
|
||||
else
|
||||
frMove.Set( ORIG, vtMove) ;
|
||||
// Se riferimento di movimento non presente o diverso dal calcolato
|
||||
if ( ! m_frMove.IsValid() || ! AreSameFrame( frMove, m_frMove)) {
|
||||
// Salvo nuovo riferimento
|
||||
m_frMove = frMove ;
|
||||
// Ricalcolo HashGrid
|
||||
if ( ! PrepareHashGrid())
|
||||
return false ;
|
||||
}
|
||||
// Determino il numero di punti del path
|
||||
m_nTotPnt = int( vPntM.size()) ;
|
||||
// Recupero il numero massimo di thread concorrenti
|
||||
int nThreadMax = thread::hardware_concurrency() ;
|
||||
bool bOk = true ;
|
||||
// Se un solo thread o pochi punti
|
||||
if ( nThreadMax <= 1 || m_nTotPnt < 500) {
|
||||
m_nCurrPnt = 0 ;
|
||||
bOk = TestSubSeriesAdv( -1, vPntM, vtDir, 0, m_nTotPnt - 1, dProgCoeff) ;
|
||||
ProcessEvents( int( 100 * dProgCoeff), 0) ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
const int MAX_PARTS = 32 ;
|
||||
INTINTVECTOR vFstLst( MAX_PARTS) ;
|
||||
// calcolo le parti del vettore
|
||||
int nPartCnt = min( nThreadMax, MAX_PARTS) ;
|
||||
int nPartDim = m_nTotPnt / nPartCnt + 1 ;
|
||||
for ( int i = 0 ; i < nPartCnt ; ++ i) {
|
||||
vFstLst[i].first = i * nPartDim ;
|
||||
vFstLst[i].second = min( ( i + 1) * nPartDim, m_nTotPnt) - 1 ;
|
||||
}
|
||||
// processo le parti
|
||||
m_nCurrPnt = 0 ;
|
||||
m_bBreak = false ;
|
||||
future<bool> vRes[MAX_PARTS] ;
|
||||
for ( int i = 0 ; i < nPartCnt ; ++ i)
|
||||
vRes[i] = async( launch::async, &CAvToolSurfTm::TestSubSeriesAdv, this, i, ref( vPntM), cref( vtDir), vFstLst[i].first, vFstLst[i].second, dProgCoeff) ;
|
||||
// attendo i risultati
|
||||
int nFin = 0 ;
|
||||
int nNextPE = 0 ;
|
||||
while ( nFin < nPartCnt) {
|
||||
for ( int i = 0 ; i < nPartCnt ; ++ i) {
|
||||
if ( vRes[i].valid() && vRes[i].wait_for( chrono::nanoseconds{ 1}) == future_status::ready) {
|
||||
bOk = vRes[i].get() && bOk ;
|
||||
++ nFin ;
|
||||
}
|
||||
}
|
||||
if ( m_nCurrPnt > nNextPE) {
|
||||
int nRes = ProcessEvents( int( m_nCurrPnt * 100. / m_nTotPnt * dProgCoeff), 10) ;
|
||||
nNextPE += STEP_PE ;
|
||||
if ( nRes == 1)
|
||||
m_bBreak = true ;
|
||||
}
|
||||
}
|
||||
ProcessEvents( int( 100 * dProgCoeff), 0) ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvToolSurfTm::TestSubPath( int nId, PNTULIST& lPntM, const Vector3d& vtDir, double dLinTol, double dProgCoeff)
|
||||
{
|
||||
// Se lista vuota, non devo fare alcunché
|
||||
if ( lPntM.empty())
|
||||
return true ;
|
||||
// Ciclo sui punti
|
||||
@@ -206,11 +497,13 @@ CAvToolSurfTm::TestSubPath( int nId, PNTULIST& lPntM, const Vector3d& vtDir, dou
|
||||
while ( itPntMCurr != lPntM.end()) {
|
||||
// verifico il punto
|
||||
ptCurr = itPntMCurr->first ;
|
||||
itPntMCurr->second = MyTestPositionHG( itPntMCurr->first, vtDir) ;
|
||||
if ( itPntMCurr->second < - EPS_SMALL)
|
||||
Vector3d vtTriaN ;
|
||||
double dMove = MyTestPositionHG( itPntMCurr->first, vtDir, vtTriaN) ;
|
||||
itPntMCurr->second = dMove ;
|
||||
if ( dMove < - EPS_SMALL)
|
||||
return false ;
|
||||
// se esiste il punto precedente devo verificare il medio
|
||||
if ( itPntMPrev != lPntM.end()) {
|
||||
// se esiste il punto precedente e richiesto devo verificare il medio
|
||||
if ( itPntMPrev != lPntM.end() && dLinTol > 0) {
|
||||
MyTestMidPointHG( lPntM, itPntMPrev, itPntMCurr, ptPrev, ptCurr, vtDir, dLinTol, 1) ;
|
||||
}
|
||||
// passo al successivo
|
||||
@@ -222,7 +515,7 @@ CAvToolSurfTm::TestSubPath( int nId, PNTULIST& lPntM, const Vector3d& vtDir, dou
|
||||
if ( nId == -1) {
|
||||
// gestione eventi (ogni STEP_PE punti)
|
||||
if (( m_nCurrPnt % STEP_PE) == 0) {
|
||||
int nRes = ProcessEvents( int( m_nCurrPnt * 100. / m_nTotPnt), 0) ;
|
||||
int nRes = ProcessEvents( int( m_nCurrPnt * 100. / m_nTotPnt * dProgCoeff), 0) ;
|
||||
if ( nRes == 1)
|
||||
return false ;
|
||||
}
|
||||
@@ -236,10 +529,44 @@ CAvToolSurfTm::TestSubPath( int nId, PNTULIST& lPntM, const Vector3d& vtDir, dou
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvToolSurfTm::TestSubSeriesAdv( int nId, PNTUVVECTVECTOR& vPntM, const Vector3d& vtDir, int nFirst, int nLast, double dProgCoeff)
|
||||
{
|
||||
// Se vettore vuoto, non devo fare alcunché
|
||||
if ( vPntM.empty())
|
||||
return true ;
|
||||
// Ciclo sui punti da verificare
|
||||
for ( int i = nFirst ; i <= nLast ; ++ i) {
|
||||
// verifico il punto
|
||||
Point3d ptCurr = get<0>( vPntM[i]) ;
|
||||
get<1>( vPntM[i]) = MyTestPositionHGAdv( ptCurr, vtDir, get<2>( vPntM[i])) ;
|
||||
if ( get<1>( vPntM[i]) < - EPS_SMALL)
|
||||
return false ;
|
||||
++ m_nCurrPnt ;
|
||||
// se singolo thread
|
||||
if ( nId == -1) {
|
||||
// gestione eventi (ogni STEP_PE punti)
|
||||
if (( m_nCurrPnt % STEP_PE) == 0) {
|
||||
int nRes = ProcessEvents( int( m_nCurrPnt * 100. / m_nTotPnt * dProgCoeff), 0) ;
|
||||
if ( nRes == 1)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti multithread
|
||||
else {
|
||||
if ( m_bBreak)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CAvToolSurfTm::MyTestMidPointHG( PNTULIST& lPntM, const PNTULIST::iterator& itPntMPrev, const PNTULIST::iterator& itPntMCurr,
|
||||
const Point3d& ptPrev, const Point3d& ptCurr, const Vector3d& vtDir, double dLinTol, int nLev)
|
||||
const Point3d& ptPrev, const Point3d& ptCurr, const Vector3d& vtDir, double dLinTol, int nLev) const
|
||||
{
|
||||
// se superato limite di ricursione, esco
|
||||
const int MAX_LEV = 10 ;
|
||||
@@ -249,7 +576,8 @@ CAvToolSurfTm::MyTestMidPointHG( PNTULIST& lPntM, const PNTULIST::iterator& itPn
|
||||
Point3d ptMid = Media( ptPrev, ptCurr, 0.5) ;
|
||||
// ne effettuo la correzione per evitare la collisione
|
||||
Point3d ptNewMid = ptMid ;
|
||||
double dMidMove = MyTestPositionHG( ptNewMid, vtDir) ;
|
||||
Vector3d vtTriaN ;
|
||||
double dMidMove = MyTestPositionHG( ptNewMid, vtDir, vtTriaN) ;
|
||||
if ( dMidMove < - EPS_SMALL)
|
||||
return false ;
|
||||
// massima distanza ammissibile
|
||||
@@ -258,7 +586,7 @@ CAvToolSurfTm::MyTestMidPointHG( PNTULIST& lPntM, const PNTULIST::iterator& itPn
|
||||
if ( abs(( Media( itPntMPrev->first, itPntMCurr->first, 0.5) - ptNewMid) * m_frMove.VersZ()) > 0.5 * dLinTol ||
|
||||
SqDist( itPntMPrev->first, itPntMCurr->first) > dMaxSqDist) {
|
||||
// aggiungo
|
||||
lPntM.emplace( itPntMCurr, ptNewMid, - dMidMove) ;
|
||||
lPntM.emplace( itPntMCurr, ptNewMid, dMidMove) ;
|
||||
auto itPntMMid = itPntMCurr ;
|
||||
-- itPntMMid ;
|
||||
// verifico intervallo precedente
|
||||
@@ -271,20 +599,48 @@ CAvToolSurfTm::MyTestMidPointHG( PNTULIST& lPntM, const PNTULIST::iterator& itPn
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
CAvToolSurfTm::MyTestPosition( Point3d& ptT, const Vector3d& vtDir)
|
||||
CAvToolSurfTm::MyTestPosition( Point3d& ptT, const Vector3d& vtDir, const Vector3d& vtMove, Vector3d& vtTriaN) const
|
||||
{
|
||||
// box dell'utensile con suo movimento
|
||||
BBox3d b3Tool ;
|
||||
// utensile
|
||||
b3Tool.Add( ptT) ;
|
||||
b3Tool.Add( ptT - vtDir * m_Tool.GetHeigth()) ;
|
||||
if ( vtDir.IsX())
|
||||
b3Tool.Expand( 0, m_Tool.GetRadius(), m_Tool.GetRadius()) ;
|
||||
else if ( vtDir.IsY())
|
||||
b3Tool.Expand( m_Tool.GetRadius(), 0, m_Tool.GetRadius()) ;
|
||||
else if ( vtDir.IsZ())
|
||||
b3Tool.Expand( m_Tool.GetRadius(), m_Tool.GetRadius(), 0) ;
|
||||
else {
|
||||
double dExpandX = m_Tool.GetRadius() * sqrt( 1 - vtDir.x * vtDir.x) ;
|
||||
double dExpandY = m_Tool.GetRadius() * sqrt( 1 - vtDir.y * vtDir.y) ;
|
||||
double dExpandZ = m_Tool.GetRadius() * sqrt( 1 - vtDir.z * vtDir.z) ;
|
||||
b3Tool.Expand( dExpandX, dExpandY, dExpandZ) ;
|
||||
}
|
||||
// aggiungo movimento
|
||||
BBox3d b3Moved = b3Tool ;
|
||||
b3Moved.Translate( MAX_MOVE * vtMove) ;
|
||||
b3Tool.Add( b3Moved) ;
|
||||
|
||||
// determino movimento minimo per evitare collisione con superfici
|
||||
double dTotDist = 0 ;
|
||||
vtTriaN = V_NULL ;
|
||||
for ( auto pStm : m_vSTM) {
|
||||
Triangle3d Tria ;
|
||||
for ( int nTria = pStm->GetFirstTriangle( Tria) ;
|
||||
nTria != SVT_NULL ;
|
||||
nTria = pStm->GetNextTriangle( nTria, Tria)) {
|
||||
double dDist = CAvToolTriangle( m_Tool, ptT, vtDir, Tria, m_frMove.VersZ()) ;
|
||||
if ( dDist < - EPS_SMALL)
|
||||
return -1 ;
|
||||
if ( dDist > EPS_SMALL) {
|
||||
dTotDist += dDist ;
|
||||
ptT += dDist * m_frMove.VersZ() ;
|
||||
INTVECTOR vTria ;
|
||||
if ( pStm->GetAllTriaOverlapBox( b3Tool, vTria)) {
|
||||
for ( int nTria : vTria) {
|
||||
Triangle3d Tria ;
|
||||
if ( pStm->GetTriangle( nTria, Tria)) {
|
||||
double dDist = CAvToolTriangle( m_Tool, ptT, vtDir, Tria, vtMove) ;
|
||||
if ( dDist < - EPS_SMALL)
|
||||
return -1 ;
|
||||
if ( dDist > EPS_SMALL) {
|
||||
dTotDist += dDist ;
|
||||
ptT += dDist * vtMove ;
|
||||
vtTriaN = Tria.GetN() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -293,7 +649,61 @@ CAvToolSurfTm::MyTestPosition( Point3d& ptT, const Vector3d& vtDir)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
CAvToolSurfTm::MyTestPositionHG( Point3d& ptT, const Vector3d& vtDir)
|
||||
CAvToolSurfTm::MyTestPositionAdv( Point3d& ptT, const Vector3d& vtDir, const Vector3d& vtMove, VCT3DVECTOR& vVtTriaN) const
|
||||
{
|
||||
// box dell'utensile con suo movimento
|
||||
BBox3d b3Tool ;
|
||||
// utensile
|
||||
b3Tool.Add( ptT) ;
|
||||
b3Tool.Add( ptT - vtDir * m_Tool.GetHeigth()) ;
|
||||
if ( vtDir.IsX())
|
||||
b3Tool.Expand( 0, m_Tool.GetRadius(), m_Tool.GetRadius()) ;
|
||||
else if ( vtDir.IsY())
|
||||
b3Tool.Expand( m_Tool.GetRadius(), 0, m_Tool.GetRadius()) ;
|
||||
else if ( vtDir.IsZ())
|
||||
b3Tool.Expand( m_Tool.GetRadius(), m_Tool.GetRadius(), 0) ;
|
||||
else {
|
||||
double dExpandX = m_Tool.GetRadius() * sqrt( 1 - vtDir.x * vtDir.x) ;
|
||||
double dExpandY = m_Tool.GetRadius() * sqrt( 1 - vtDir.y * vtDir.y) ;
|
||||
double dExpandZ = m_Tool.GetRadius() * sqrt( 1 - vtDir.z * vtDir.z) ;
|
||||
b3Tool.Expand( dExpandX, dExpandY, dExpandZ) ;
|
||||
}
|
||||
// aggiungo movimento
|
||||
BBox3d b3Moved = b3Tool ;
|
||||
b3Moved.Translate( MAX_MOVE * vtMove) ;
|
||||
b3Tool.Add( b3Moved) ;
|
||||
|
||||
// determino movimento minimo per evitare collisione con superfici
|
||||
double dTotDist = 0 ;
|
||||
vVtTriaN.clear() ;
|
||||
for ( auto pStm : m_vSTM) {
|
||||
INTVECTOR vTria ;
|
||||
if ( pStm->GetAllTriaOverlapBox( b3Tool, vTria)) {
|
||||
for ( int nTria : vTria) {
|
||||
Triangle3d Tria ;
|
||||
if ( pStm->GetTriangle( nTria, Tria)) {
|
||||
double dDist = CAvToolTriangle( m_Tool, ptT, vtDir, Tria, vtMove) ;
|
||||
if ( dDist < - EPS_SMALL)
|
||||
return -1 ;
|
||||
// se devo traslare il punto, c'è collisione
|
||||
if ( dDist > EPS_SMALL) {
|
||||
if ( dDist > 10 * EPS_SMALL) {
|
||||
vVtTriaN.clear() ;
|
||||
dTotDist += dDist ;
|
||||
ptT += ( dDist - 5 * EPS_SMALL) * m_frMove.VersZ() ;
|
||||
}
|
||||
vVtTriaN.push_back( Tria.GetN()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return dTotDist ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
CAvToolSurfTm::MyTestPositionHG( Point3d& ptT, const Vector3d& vtDir, Vector3d& vtTriaN) const
|
||||
{
|
||||
// calcolo box utensile nel riferimento di movimento
|
||||
BBox3d b3Tool ;
|
||||
@@ -313,8 +723,10 @@ CAvToolSurfTm::MyTestPositionHG( Point3d& ptT, const Vector3d& vtDir)
|
||||
double dExpandZ = m_Tool.GetRadius() * sqrt( 1 - vtDirL.z * vtDirL.z) ;
|
||||
b3Tool.Expand( dExpandX, dExpandY, dExpandZ) ;
|
||||
}
|
||||
// ciclo sui triangoli che intersecano box in 2d
|
||||
|
||||
// ciclo sui triangoli che intersecano box in 2d
|
||||
double dTotDist = 0 ;
|
||||
vtTriaN = V_NULL ;
|
||||
INTVECTOR vnIds ;
|
||||
if ( m_HGrids.Find( b3Tool, vnIds)) {
|
||||
for ( int i = 0 ; i < int( vnIds.size()) ; ++ i) {
|
||||
@@ -330,11 +742,70 @@ CAvToolSurfTm::MyTestPositionHG( Point3d& ptT, const Vector3d& vtDir)
|
||||
if ( dDist > EPS_SMALL) {
|
||||
dTotDist += dDist ;
|
||||
ptT += dDist * m_frMove.VersZ() ;
|
||||
vtTriaN = Tria.GetN() ;
|
||||
}
|
||||
else if ( dDist < -EPS_SMALL)
|
||||
return -1 ;
|
||||
}
|
||||
}
|
||||
|
||||
return dTotDist ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
CAvToolSurfTm::MyTestPositionHGAdv( Point3d& ptT, const Vector3d& vtDir, VCT3DVECTOR& vVtTriaN) const
|
||||
{
|
||||
// calcolo box utensile nel riferimento di movimento
|
||||
BBox3d b3Tool ;
|
||||
Point3d ptTL = ptT ; ptTL.ToLoc( m_frMove) ;
|
||||
Vector3d vtDirL = vtDir ; vtDirL.ToLoc( m_frMove) ;
|
||||
b3Tool.Add( ptTL) ;
|
||||
b3Tool.Add( ptTL - vtDirL * m_Tool.GetHeigth()) ;
|
||||
if ( vtDirL.IsX())
|
||||
b3Tool.Expand( 0, m_Tool.GetRadius(), m_Tool.GetRadius()) ;
|
||||
else if ( vtDirL.IsY())
|
||||
b3Tool.Expand( m_Tool.GetRadius(), 0, m_Tool.GetRadius()) ;
|
||||
else if ( vtDirL.IsZ())
|
||||
b3Tool.Expand( m_Tool.GetRadius(), m_Tool.GetRadius(), 0) ;
|
||||
else {
|
||||
double dExpandX = m_Tool.GetRadius() * sqrt( 1 - vtDirL.x * vtDirL.x) ;
|
||||
double dExpandY = m_Tool.GetRadius() * sqrt( 1 - vtDirL.y * vtDirL.y) ;
|
||||
double dExpandZ = m_Tool.GetRadius() * sqrt( 1 - vtDirL.z * vtDirL.z) ;
|
||||
b3Tool.Expand( dExpandX, dExpandY, dExpandZ) ;
|
||||
}
|
||||
|
||||
// ciclo sui triangoli che intersecano box in 2d
|
||||
double dTotDist = 0. ;
|
||||
INTVECTOR vnIds ;
|
||||
if ( m_HGrids.Find( b3Tool, vnIds)) {
|
||||
for ( int i = 0 ; i < int( vnIds.size()) ; ++ i) {
|
||||
// recupero la superficie
|
||||
int nInd = vnIds[i] ;
|
||||
int nSurf = GetSurfInd( nInd) ;
|
||||
if ( nSurf == -1)
|
||||
return -1 ;
|
||||
// recupero il triangolo
|
||||
int nT = nInd - m_vBaseInd[nSurf] ;
|
||||
Triangle3d Tria ;
|
||||
if ( ! m_vSTM[nSurf]->GetTriangle( nT, Tria))
|
||||
return -1 ;
|
||||
// calcolo della collisione
|
||||
double dDist = CAvToolTriangle( m_Tool, ptT, vtDir, Tria, m_frMove.VersZ()) ;
|
||||
if ( dDist < - EPS_SMALL)
|
||||
return -1 ;
|
||||
// se devo traslare il punto, c'è collisione
|
||||
if ( dDist > EPS_SMALL) {
|
||||
if ( dDist > 10 * EPS_SMALL) {
|
||||
vVtTriaN.clear() ;
|
||||
dTotDist += dDist ;
|
||||
ptT += ( dDist - 5 * EPS_SMALL) * m_frMove.VersZ() ;
|
||||
}
|
||||
vVtTriaN.push_back( Tria.GetN()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dTotDist ;
|
||||
}
|
||||
|
||||
@@ -345,7 +816,7 @@ CAvToolSurfTm::PrepareHashGrid( void)
|
||||
// pulisco HashGrid 2d
|
||||
m_HGrids.Clear() ;
|
||||
// verifico esistenza superfici
|
||||
if ( m_vSTM.size() == 0 || m_vBaseInd.size() < m_vSTM.size() + 1)
|
||||
if ( m_vSTM.empty() || m_vBaseInd.size() < m_vSTM.size() + 1)
|
||||
return false ;
|
||||
// creo HashGrid 2d
|
||||
const int LIM_HG_TRIA = 256 ;
|
||||
@@ -372,7 +843,7 @@ CAvToolSurfTm::PrepareHashGrid( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
CAvToolSurfTm::GetSurfInd( int nT)
|
||||
CAvToolSurfTm::GetSurfInd( int nT) const
|
||||
{
|
||||
// verifico la presenza di almeno un intervallo
|
||||
if ( m_vBaseInd.size() < 2)
|
||||
|
||||
+32
-7
@@ -34,22 +34,47 @@ class CAvToolSurfTm : public ICAvToolSurfTm
|
||||
{ return m_Tool.GetRadius() ; }
|
||||
double GetToolHeight( void) const override
|
||||
{ return m_Tool.GetHeigth() ; }
|
||||
double GetToolTipHeight( void) const override
|
||||
{ return m_Tool.GetTipHeigth() ; } ;
|
||||
double GetToolTipRadius( void) const override
|
||||
{ return m_Tool.GetTipRadius() ; } ;
|
||||
double GetToolCornRadius( void) const override
|
||||
{ return m_Tool.GetCornRadius() ; } ;
|
||||
CISURFTMPVECTOR GetvStm( void) const {
|
||||
CISURFTMPVECTOR vcStm ;
|
||||
for ( int i = 0 ; i < int( m_vSTM.size()) ; ++ i)
|
||||
vcStm.emplace_back( CloneSurfTriMesh( m_vSTM[i])) ;
|
||||
return vcStm ;
|
||||
}
|
||||
const ICurveComposite& GetToolOutline( bool bApprox = false) const override
|
||||
{ return ( bApprox ? m_Tool.GetApproxOutline() : m_Tool.GetOutline()) ;}
|
||||
bool TestPosition( const Point3d& ptT, const Vector3d& vtDir, const Vector3d& vtMove, double& dTotDist) override ;
|
||||
bool TestPath( PNTULIST& lPntM, const Vector3d& vtDir, const Vector3d& vtMove, double dLinTol) override ;
|
||||
|
||||
bool TestPosition( const Point3d& ptT, const Vector3d& vtDir, const Vector3d& vtMove,
|
||||
double& dTotDist, Vector3d* pvtTriaN = nullptr) const override ;
|
||||
bool TestPositionAdv( const Point3d& ptT, const Vector3d& vtDir, const Vector3d& vtMove,
|
||||
double& dTotDist, VCT3DVECTOR& vVtN) const override ;
|
||||
|
||||
bool TestSeries( PNTUVECTOR& vPntM, const Vector3d& vtDir, const Vector3d& vtMove, double dProgCoeff = 1) override ;
|
||||
bool TestSeriesAdv( PNTUVVECTVECTOR& vPntM, const Vector3d& vtDir, const Vector3d& vtMove, double dProgCoeff = 1) override ;
|
||||
|
||||
bool TestPath( PNTULIST& lPntM, const Vector3d& vtDir, const Vector3d& vtMove, double dLinTol, double dProgCoeff = 1) override ;
|
||||
|
||||
public :
|
||||
CAvToolSurfTm( void) ;
|
||||
bool Clear( void) ;
|
||||
|
||||
private :
|
||||
bool TestSubPath( int nId, PNTULIST& lPntM, const Vector3d& vtDir, double dLinTol) ;
|
||||
double MyTestPosition( Point3d& ptT, const Vector3d& vtDir) ;
|
||||
double MyTestPositionHG( Point3d& ptT, const Vector3d& vtDir) ;
|
||||
bool TestSubSeries( int nId, PNTUVECTOR& vPntM, const Vector3d& vtDir, int nFirst, int nLast, double dProgCoeff) ;
|
||||
bool TestSubSeriesAdv( int nId, PNTUVVECTVECTOR& vPntM, const Vector3d& vtDir, int nFirst, int nLast, double dProgCoeff) ;
|
||||
bool TestSubPath( int nId, PNTULIST& lPntM, const Vector3d& vtDir, double dLinTol, double dProgCoeff) ;
|
||||
double MyTestPosition( Point3d& ptT, const Vector3d& vtDir, const Vector3d& vtMove, Vector3d& vtTriaN) const ;
|
||||
double MyTestPositionAdv( Point3d& ptT, const Vector3d& vtDir, const Vector3d& vtMove, VCT3DVECTOR& vVtTriaN) const ;
|
||||
double MyTestPositionHG( Point3d& ptT, const Vector3d& vtDir, Vector3d& vtTriaN) const ;
|
||||
double MyTestPositionHGAdv( Point3d& ptT, const Vector3d& vtDir, VCT3DVECTOR& vVtTriaN) const ;
|
||||
bool MyTestMidPointHG( PNTULIST& lPntM, const PNTULIST::iterator& itPntMPrev, const PNTULIST::iterator& itPntMCurr,
|
||||
const Point3d& ptPrev, const Point3d& ptCurr, const Vector3d& vtDir, double dLinTol, int nLev) ;
|
||||
const Point3d& ptPrev, const Point3d& ptCurr, const Vector3d& vtDir, double dLinTol, int nLev) const ;
|
||||
bool PrepareHashGrid( void) ;
|
||||
int GetSurfInd( int nT) ;
|
||||
int GetSurfInd( int nT) const ;
|
||||
|
||||
private :
|
||||
typedef std::vector<const SurfTriMesh*> CSURFTMPVECTOR ; // vettore di puntatori a const SurfTriMesh
|
||||
|
||||
+17
-17
@@ -17,8 +17,8 @@
|
||||
#include "CAvToolTriangle.h"
|
||||
#include "IntersLineSurfStd.h"
|
||||
#include "IntersLineTria.h"
|
||||
#include "DistPointLine.h"
|
||||
#include "CDeUtility.h"
|
||||
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||
#include "/EgtDev/Include/EGkIntervals.h"
|
||||
#include "/EgtDev/Include/ENkPolynomialRoots.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
@@ -146,18 +146,20 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
||||
const Triangle3d& trTria, const Vector3d& vtMove)
|
||||
{
|
||||
// Non ha senso che il movimento sia in direzione "opposta" a quella dell'asse utensile
|
||||
if ( vtMove * vtToolAx < - EPS_ZERO)
|
||||
if ( vtMove * vtToolAx < - 10 * EPS_ZERO)
|
||||
return -1. ;
|
||||
// Se avvicinamento non devo fare nulla
|
||||
if ( vtMove * trTria.GetN() < - EPS_ZERO)
|
||||
return 0. ;
|
||||
return 0. ;
|
||||
// Tolleranza su dischi (parti piatte perpendicolari all'asse utensile)
|
||||
double dEpsilon = ( vtMove * vtToolAx > 0.5 ? 0 : EPS_SMALL) ;
|
||||
// se utensile cilindrico
|
||||
if ( tlTool.GetType() == Tool::CYLMILL) {
|
||||
// parametri geometrici
|
||||
double dHeigth = tlTool.GetHeigth() ;
|
||||
double dRadius = tlTool.GetRadius() ;
|
||||
// prima determino l'allontanamento del disco inferiore
|
||||
double dDist = CAvDiskTriangle( ptToolOrig - ( dHeigth - EPS_SMALL) * vtToolAx, vtToolAx, dRadius, trTria, vtMove) ;
|
||||
double dDist = CAvDiskTriangle( ptToolOrig - ( dHeigth - dEpsilon) * vtToolAx, vtToolAx, dRadius, trTria, vtMove) ;
|
||||
if ( dDist < - EPS_SMALL)
|
||||
return dDist ;
|
||||
// poi verifico quello del cilindro (tenendo conto di quanto è stata allontanato il disco)
|
||||
@@ -165,7 +167,7 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
||||
if ( dDist2 < - EPS_SMALL)
|
||||
return dDist2 ;
|
||||
// verifico quello del disco sopra
|
||||
double dDist3 = CAvDiskTriangle( ptToolOrig - EPS_SMALL * vtToolAx + ( dDist + dDist2) * vtMove, vtToolAx, dRadius, trTria, vtMove) ;
|
||||
double dDist3 = CAvDiskTriangle( ptToolOrig - dEpsilon * vtToolAx + ( dDist + dDist2) * vtMove, vtToolAx, dRadius, trTria, vtMove) ;
|
||||
if ( dDist3 < - EPS_SMALL)
|
||||
return dDist3 ;
|
||||
return ( dDist + dDist2 + dDist3) ;
|
||||
@@ -189,7 +191,7 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
||||
return dDist2 ;
|
||||
// verifico quello del disco sopra
|
||||
Point3d ptDiskUpOrig = ptCylOrig + dDist2 * vtMove ;
|
||||
double dDist3 = CAvDiskTriangle( ptDiskUpOrig - EPS_SMALL * vtToolAx, vtToolAx, dRadius, trTria, vtMove) ;
|
||||
double dDist3 = CAvDiskTriangle( ptDiskUpOrig - dEpsilon * vtToolAx, vtToolAx, dRadius, trTria, vtMove) ;
|
||||
if ( dDist3 < - EPS_SMALL)
|
||||
return dDist3 ;
|
||||
return ( dDist + dDist2 + dDist3) ;
|
||||
@@ -199,7 +201,7 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
||||
// parametri geometrici
|
||||
double dCylHeigth = tlTool.GetHeigth() - tlTool.GetTipHeigth() ;
|
||||
// prima determino l'allontanamento del disco inferiore
|
||||
double dDist = CAvDiskTriangle( ptToolOrig - ( tlTool.GetHeigth() - EPS_SMALL) * vtToolAx, vtToolAx, tlTool.GetTipRadius(),
|
||||
double dDist = CAvDiskTriangle( ptToolOrig - ( tlTool.GetHeigth() - dEpsilon) * vtToolAx, vtToolAx, tlTool.GetTipRadius(),
|
||||
trTria, vtMove) ;
|
||||
if ( dDist < - EPS_SMALL)
|
||||
return dDist ;
|
||||
@@ -220,7 +222,7 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
||||
return dDist3 ;
|
||||
// verifico quello del disco sopra
|
||||
Point3d ptDiskUpOrig = ptCylOrig + vtMove * dDist3 ;
|
||||
double dDist4 = CAvDiskTriangle( ptDiskUpOrig - EPS_SMALL * vtToolAx, vtToolAx, tlTool.GetRadius(), trTria, vtMove) ;
|
||||
double dDist4 = CAvDiskTriangle( ptDiskUpOrig - dEpsilon * vtToolAx, vtToolAx, tlTool.GetRadius(), trTria, vtMove) ;
|
||||
if ( dDist4 < - EPS_SMALL)
|
||||
return dDist4 ;
|
||||
return ( dDist + dDist2 + dDist3 + dDist4) ;
|
||||
@@ -247,7 +249,7 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
||||
double dMaxR = max( tlTool.GetRadius(), tlTool.GetTipRadius()) ;
|
||||
double dCylHeigth = tlTool.GetHeigth() - tlTool.GetTipHeigth() ;
|
||||
// prima determino l'allontanamento del disco inferiore
|
||||
double dDist = CAvDiskTriangle( ptToolOrig - ( tlTool.GetHeigth() - EPS_SMALL) * vtToolAx, vtToolAx, tlTool.GetTipRadius(),
|
||||
double dDist = CAvDiskTriangle( ptToolOrig - ( tlTool.GetHeigth() - dEpsilon) * vtToolAx, vtToolAx, tlTool.GetTipRadius(),
|
||||
trTria, vtMove) ;
|
||||
if ( dDist < - EPS_SMALL)
|
||||
return dDist ;
|
||||
@@ -266,7 +268,7 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
||||
return dDist3 ;
|
||||
// verifico quello del disco sopra
|
||||
Point3d ptDiskUpOrig = ptCylOrig + vtMove * dDist3 ;
|
||||
double dDist4 = CAvDiskTriangle( ptDiskUpOrig - EPS_SMALL * vtToolAx, vtToolAx, tlTool.GetRadius(), trTria, vtMove) ;
|
||||
double dDist4 = CAvDiskTriangle( ptDiskUpOrig - dEpsilon * vtToolAx, vtToolAx, tlTool.GetRadius(), trTria, vtMove) ;
|
||||
if ( dDist4 < - EPS_SMALL)
|
||||
return dDist4 ;
|
||||
return ( dDist + dDist2 + dDist3 + dDist4) ;
|
||||
@@ -299,10 +301,10 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
||||
double dRadius = max( ptStart.x, ptEnd.x) ;
|
||||
// Se disco verso il basso dell'utensile
|
||||
if ( ptStart.x > ptEnd.x)
|
||||
dDist2 = CAvDiskTriangle( ptCompOrig + EPS_SMALL * vtToolAx, vtToolAx, dRadius, trTria, vtMove) ;
|
||||
dDist2 = CAvDiskTriangle( ptCompOrig + dEpsilon * vtToolAx, vtToolAx, dRadius, trTria, vtMove) ;
|
||||
// Se disco verso l'alto
|
||||
else
|
||||
dDist2 = CAvDiskTriangle( ptCompOrig - EPS_SMALL * vtToolAx, vtToolAx, dRadius, trTria, vtMove) ;
|
||||
dDist2 = CAvDiskTriangle( ptCompOrig - dEpsilon * vtToolAx, vtToolAx, dRadius, trTria, vtMove) ;
|
||||
}
|
||||
else {
|
||||
// Verifiche curva precedente per eventuale tappo sopra
|
||||
@@ -2438,12 +2440,10 @@ CAvDiskTriangle( const Point3d& ptDiskCen, const Vector3d& vtDiskAx, double dDis
|
||||
// Allontanamento dall'interno
|
||||
double dEscapeDist = max( DiskTriaInteriorEscapeDistGenMot( ptDiskCen, vtDiskAx, dDiskRad, trTria, vtMove), 0.) ;
|
||||
// Allontanamento dalla frontiera
|
||||
Vector3d vtMoveOrt = vtMove - vtMove * vtDiskAx * vtDiskAx ;
|
||||
Vector3d vtMoveOrt = OrthoCompo( vtMove, vtDiskAx) ;
|
||||
vtMoveOrt.Normalize() ;
|
||||
Frame3d DiskFrame ;
|
||||
Vector3d vtJ = vtDiskAx ^ vtMoveOrt ;
|
||||
vtJ.Normalize() ;
|
||||
DiskFrame.Set( ptDiskCen, vtMoveOrt, vtJ, vtDiskAx) ;
|
||||
DiskFrame.Set( ptDiskCen, vtDiskAx, vtMoveOrt) ;
|
||||
Triangle3d trTriaLoc = trTria ;
|
||||
Vector3d vtMoveLoc = vtMove ;
|
||||
trTriaLoc.ToLoc( DiskFrame) ;
|
||||
@@ -2501,7 +2501,7 @@ DiskSegmentEscapeDistLongMot( const Point3d& ptDiskCen, double dDiskRad,
|
||||
double dSegDist = 0. ;
|
||||
for ( int nSol = 0 ; nSol < nRoot ; ++ nSol) {
|
||||
// Soluzione interna al segmento
|
||||
if ( vdRoots[nSol] > 0. && vdRoots[nSol] < dSegLen) {
|
||||
if ( vdRoots[nSol] > 0. && vdRoots[nSol] < dSegLen + EPS_ZERO) {
|
||||
Point3d ptC = ptSeg + vdRoots[nSol] * vtSeg ;
|
||||
// Distanza del punto soluzione dal piano del disco nella posizione iniziale
|
||||
double dCurDist = PointPlaneSignedDist( ptC, ptDiskCen, vtMove) ;
|
||||
|
||||
+54
-7
@@ -1,13 +1,14 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2016-2020
|
||||
// EgalTech 2016-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : CDBoxSurfTm.cpp Data : 09.01.20 Versione : 2.2a2
|
||||
// File : CDeBoxClosedSurfTm.cpp Data : 24.03.24 Versione : 2.6c2
|
||||
// Contenuto : Implementazione della verifica di collisione tra
|
||||
// BoundingBox e Closed SurftriMesh.
|
||||
//
|
||||
//
|
||||
// Modifiche : 05.10.16 DS Creazione modulo.
|
||||
// 09.01.20 DS Cambio nome alla funzione.
|
||||
// 24.03.24 DS Aggiunta TestCylSurfTm.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -19,10 +20,23 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Il sistema di riferimento è allineato con il box e ha origine in un suo vertice.
|
||||
// La distanza di sicurezza ha effetto solo se maggiore di EPS_SMALL.
|
||||
// Il sistema di riferimento del box è riferito a quello della superficie.
|
||||
// La funzione restituisce :
|
||||
// - true in caso di collisione o inconsistenza dei parametri di input
|
||||
// - false in caso di assenza di collisione.
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, double dSafeDist, const ISurfTriMesh& Stm)
|
||||
CDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, const ISurfTriMesh& Stm, double dSafeDist)
|
||||
{
|
||||
// Se il box non è ben definito non ha senso proseguire
|
||||
if ( vtDiag.IsSmall())
|
||||
return true ;
|
||||
// Se superficie non valida o aperta, non ha senso proseguire
|
||||
if ( ! Stm.IsValid() || ! Stm.IsClosed())
|
||||
return true ;
|
||||
// Recupero BBox del poliedro
|
||||
BBox3d b3Poly = Stm.GetAllTriaBox() ;
|
||||
// Calcolo il BBox del parallelepipedo
|
||||
@@ -39,13 +53,10 @@ CDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, double dSafeDi
|
||||
for ( int nT : vT) {
|
||||
Triangle3d Tria ;
|
||||
if ( Stm.GetTriangle( nT, Tria)) {
|
||||
if ( CDeBoxTria( frBox, vtDiag, dSafeDist, Tria))
|
||||
if ( CDeBoxTria( frBox, vtDiag, Tria, dSafeDist))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Se superficie aperta, non c'è collisione
|
||||
if ( ! Stm.IsClosed())
|
||||
return false ;
|
||||
// Se il BBox del parallelepipedo non è interno a quello del poliedro e viceversa, non c'è collisione
|
||||
if ( ! b3Poly.Encloses( b3Box) && ! b3Box.Encloses( b3Poly))
|
||||
return false ;
|
||||
@@ -56,3 +67,39 @@ CDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, double dSafeDi
|
||||
// Se il box è interno c'è collisione
|
||||
return DistBoxCenSurfCalc.IsPointInside() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Verifica l'interferenza tra il box e la superficie : restituisce true in caso di interferenza.
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
TestBoxSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, const ISurfTriMesh& Stm, double dSafeDist)
|
||||
{
|
||||
// Se il box non è ben definito non ha senso proseguire
|
||||
if ( vtDiag.IsSmall())
|
||||
return true ;
|
||||
// Se superficie non valida, non ha senso proseguire
|
||||
if ( ! Stm.IsValid())
|
||||
return true ;
|
||||
// Recupero BBox del poliedro
|
||||
BBox3d b3Poly = Stm.GetAllTriaBox() ;
|
||||
// Calcolo il BBox del parallelepipedo
|
||||
BBox3d b3BoxL( ORIG, ORIG + vtDiag) ;
|
||||
if ( dSafeDist > EPS_SMALL)
|
||||
b3BoxL.Expand( dSafeDist) ;
|
||||
BBox3d b3Box = GetToGlob( b3BoxL, frBox) ;
|
||||
// Se i BBox non interferiscono, non c'è collisione
|
||||
if ( ! b3Poly.Overlaps( b3Box) || ! b3Poly.Overlaps( frBox, b3BoxL))
|
||||
return false ;
|
||||
// Verifico se il parallelepipedo interferisce con i triangoli del poliedro presenti nel suo BBox
|
||||
INTVECTOR vT ;
|
||||
Stm.GetAllTriaOverlapBox( b3Box, vT) ;
|
||||
for ( int nT : vT) {
|
||||
Triangle3d Tria ;
|
||||
if ( Stm.GetTriangle( nT, Tria)) {
|
||||
if ( CDeBoxTria( frBox, vtDiag, Tria, dSafeDist))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Non c'è interferenza
|
||||
return false ;
|
||||
}
|
||||
|
||||
+1
-1
@@ -171,7 +171,7 @@ CDeSimpleBoxTria( const Frame3d& frBox, const Vector3d& vtDiag, const Triangle3d
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CDeBoxTria( const Frame3d& frBox, const Vector3d& vtDiag, double dSafeDist, const Triangle3d& trTria)
|
||||
CDeBoxTria( const Frame3d& frBox, const Vector3d& vtDiag, const Triangle3d& trTria, double dSafeDist)
|
||||
{
|
||||
// Porto il triangolo nel riferimento del box
|
||||
Triangle3d trTriaL = trTria ;
|
||||
|
||||
+1
-1
@@ -17,4 +17,4 @@
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool CDeSimpleBoxTria( const Frame3d& frBox, const Vector3d& vtDiag, const Triangle3d& trTria) ;
|
||||
bool CDeBoxTria( const Frame3d& frBox, const Vector3d& vtDiag, double dSafeDist, const Triangle3d& trTria) ;
|
||||
bool CDeBoxTria( const Frame3d& frBox, const Vector3d& vtDiag, const Triangle3d& trTria, double dSafeDist) ;
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ CDeSimpleCapsTria( const Point3d& ptP1, const Point3d& ptP2, double dR, const Tr
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CDeCapsTria( const Point3d& ptP1, const Point3d& ptP2, double dR, double dSafeDist, const Triangle3d& trTria)
|
||||
CDeCapsTria( const Point3d& ptP1, const Point3d& ptP2, double dR, const Triangle3d& trTria, double dSafeDist)
|
||||
{
|
||||
return CDeSimpleCapsTria( ptP1, ptP2, dR + max( 0., dSafeDist), trTria) ;
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,4 +16,4 @@
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool CDeSimpleCapsTria( const Point3d& ptP1, const Point3d& ptP2, double dR, const Triangle3d& trTria) ;
|
||||
bool CDeCapsTria( const Point3d& ptP1, const Point3d& ptP2, double dR, double dSafeDist, const Triangle3d& trTria) ;
|
||||
bool CDeCapsTria( const Point3d& ptP1, const Point3d& ptP2, double dR, const Triangle3d& trTria, double dSafeDist) ;
|
||||
|
||||
+126
-19
@@ -1,12 +1,13 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2020-2020
|
||||
// EgalTech 2020-2026
|
||||
//----------------------------------------------------------------------------
|
||||
// File : CDeSurfTmSurfTm.h Data : 14.06.23 Versione : 2.5f3
|
||||
// File : CDeClosedSurfTmClosedSurfTm.h Data : 23.01.26 Versione : 3.1a3
|
||||
// Contenuto : Implementazione funzione verifica collisione tra
|
||||
// SurfTm e SurfTm.
|
||||
//
|
||||
// Modifiche : 13.11.20 LM Creazione modulo.
|
||||
//
|
||||
// 24.03.24 DS Aggiunta TestSurfTmSurfTm.
|
||||
// 23.01.26 DS In TestSurfTmSurfTm aggiunto flag per collisione quando una delle due è chiusa e contiene l'altra.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -22,32 +23,33 @@
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// La funzione restituisce true in caso di collisone, false in caso di assenza
|
||||
// di collisione o inconsistenza dei parametri di input.
|
||||
// Le due superfici devono essere espresse nel medesimo sistema di riferimento.
|
||||
// La distanza di sicurezza ha effetto solo se maggiore di EPS_SMALL.
|
||||
// Se necessario cerco la collisione con un offset della superficie B costituito
|
||||
// da sfere centrate nei vertici, cilindri con i segmenti per asse e il triangolo
|
||||
// originale traslato di una costante pari alla distanza di sicurezza lungo la
|
||||
// sua normale.
|
||||
// da sfere centrate nei vertici, cilindri con gli spigoli per asse e il triangolo
|
||||
// originale traslato della distanza di sicurezza lungo la sua normale.
|
||||
// La funzione restituisce :
|
||||
// - true in caso di collisione o inconsistenza dei parametri di input
|
||||
// - false in caso di assenza di collisione.
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CDeClosedSurfTmClosedSurfTm( const ISurfTriMesh& SurfA, const ISurfTriMesh& SurfB, double dSafeDist)
|
||||
{
|
||||
// Recupero le superfici base
|
||||
const SurfTriMesh* pSrfA = GetBasicSurfTriMesh( &SurfA) ;
|
||||
const SurfTriMesh* pSrfB = GetBasicSurfTriMesh( &SurfB) ;
|
||||
// Se le superfici non sono valide o non sono chiuse, non ha senso proseguire.
|
||||
// Se le superfici non sono valide o non sono chiuse, non ha senso proseguire
|
||||
if ( pSrfA == nullptr || ! pSrfA->IsValid() || ! pSrfA->IsClosed() ||
|
||||
pSrfB == nullptr || ! pSrfB->IsValid() || ! pSrfB->IsClosed())
|
||||
return false ;
|
||||
return true ;
|
||||
// Se i box delle superfici non si intersecano, ho finito.
|
||||
BBox3d b3BoxA, b3BoxB ;
|
||||
pSrfA->GetLocalBBox( b3BoxA) ;
|
||||
pSrfB->GetLocalBBox( b3BoxB) ;
|
||||
// Se è necessario, espando il box di B di una costante additiva pari alla distanza di sicurezza.
|
||||
// Se è necessario, espando il box di B di una costante additiva pari alla distanza di sicurezza.
|
||||
if ( dSafeDist > EPS_SMALL)
|
||||
b3BoxB.Expand( dSafeDist) ;
|
||||
// Se i box non si sovrappongono, non c'è collisione. Ho finito.
|
||||
// Se i box non si sovrappongono, non c'è collisione. Ho finito.
|
||||
if ( ! b3BoxA.Overlaps( b3BoxB))
|
||||
return false ;
|
||||
// Recupero i triangoli di A che interferiscono col box di B
|
||||
@@ -60,13 +62,13 @@ CDeClosedSurfTmClosedSurfTm( const ISurfTriMesh& SurfA, const ISurfTriMesh& Surf
|
||||
continue ;
|
||||
BBox3d b3BoxTriaA ;
|
||||
trTriaA.GetLocalBBox( b3BoxTriaA) ;
|
||||
// Se è necessario, espando il box di una costante additiva pari alla distanza di sicurezza.
|
||||
// Se è necessario, espando il box di una costante additiva pari alla distanza di sicurezza.
|
||||
if ( dSafeDist > EPS_SMALL)
|
||||
b3BoxTriaA.Expand( dSafeDist) ;
|
||||
// Recupero i triangoli di B che interferiscono col box del triangolo di A
|
||||
INTVECTOR vNearTria ;
|
||||
pSrfB->GetAllTriaOverlapBox( b3BoxTriaA, vNearTria) ;
|
||||
// Settare tutti i triangoli come già processati.
|
||||
// Settare tutti i triangoli come già processati.
|
||||
// Al termine della chiamata i TempInt dei triangoli valgono 0.
|
||||
pSrfB->ResetTempInts() ;
|
||||
// Ciclo sui triangoli della superficie B che cadono nel box del triangolo corrente della Superficie A.
|
||||
@@ -83,14 +85,14 @@ CDeClosedSurfTmClosedSurfTm( const ISurfTriMesh& SurfA, const ISurfTriMesh& Surf
|
||||
// Ciclo sui vertici del triangolo.
|
||||
for ( int nVB = 0 ; nVB < 3 ; ++ nVB) {
|
||||
// Se il triangolo adiacente al triangolo corrente su questo edge
|
||||
// non è stato processato, processo il vertice e l'edge.
|
||||
// non è stato processato, processo il vertice e l'edge.
|
||||
int nAdjTriaTempFlag ;
|
||||
if ( ! ( pSrfB->GetTempInt( nAdjTriaId[nVB], nAdjTriaTempFlag) || nAdjTriaTempFlag == 0))
|
||||
continue ;
|
||||
// Processo il vertice: se c'è collisione fra triangolo A e sfera ho finito.
|
||||
// Processo il vertice: se c'è collisione fra triangolo A e sfera ho finito.
|
||||
if ( CDeSimpleSpheTria( trTriaB.GetP( nVB), dSafeDist, trTriaA))
|
||||
return true ;
|
||||
// Processo l'edge: se c'è collisione fra triangolo A e cilindro ho finito.
|
||||
// Processo l'edge: se c'è collisione fra triangolo A e cilindro ho finito.
|
||||
Vector3d vtEdgeV = trTriaB.GetP( ( nVB + 1) % 3) - trTriaB.GetP( nVB) ;
|
||||
double dEdgeLen = vtEdgeV.Len() ;
|
||||
vtEdgeV /= dEdgeLen ;
|
||||
@@ -110,10 +112,10 @@ CDeClosedSurfTmClosedSurfTm( const ISurfTriMesh& SurfA, const ISurfTriMesh& Surf
|
||||
}
|
||||
}
|
||||
// Non ho trovato collisioni fra triangoli delle superfici.
|
||||
// Se il BBox della prima superficie non è interno a quello della seconda e viceversa, non c'è collisione
|
||||
// Se il BBox della prima superficie non è interno a quello della seconda e viceversa, non c'è collisione
|
||||
if ( ! b3BoxA.Encloses( b3BoxB) && ! b3BoxB.Encloses( b3BoxA))
|
||||
return false ;
|
||||
// La collisione c'è se una superficie è dentro l'altra.
|
||||
// La collisione c'è se una superficie è dentro l'altra.
|
||||
Point3d ptPointA, ptPointB ;
|
||||
pSrfA->GetFirstVertex( ptPointA) ;
|
||||
pSrfB->GetFirstVertex( ptPointB) ;
|
||||
@@ -121,3 +123,108 @@ CDeClosedSurfTmClosedSurfTm( const ISurfTriMesh& SurfA, const ISurfTriMesh& Surf
|
||||
DistPointSurfTm DistPoinBSrfA( ptPointB, *pSrfA) ;
|
||||
return ( DistPoinASrfB.IsPointInside() || DistPoinBSrfA.IsPointInside()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Verifica l'interferenza tra le due superfici : restituisce true in caso di interferenza.
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
TestSurfTmSurfTm( const ISurfTriMesh& SurfA, const ISurfTriMesh& SurfB, double dSafeDist, bool bTestEnclosion)
|
||||
{
|
||||
// Recupero le superfici base
|
||||
const SurfTriMesh* pSrfA = GetBasicSurfTriMesh( &SurfA) ;
|
||||
const SurfTriMesh* pSrfB = GetBasicSurfTriMesh( &SurfB) ;
|
||||
// Se le superfici non sono valide, non ha senso proseguire
|
||||
if ( pSrfA == nullptr || ! pSrfA->IsValid() ||
|
||||
pSrfB == nullptr || ! pSrfB->IsValid())
|
||||
return true ;
|
||||
// Se i box delle superfici non si intersecano, ho finito.
|
||||
BBox3d b3BoxA, b3BoxB ;
|
||||
pSrfA->GetLocalBBox( b3BoxA) ;
|
||||
pSrfB->GetLocalBBox( b3BoxB) ;
|
||||
// Se è necessario, espando il box di B di una costante additiva pari alla distanza di sicurezza.
|
||||
if ( dSafeDist > EPS_SMALL)
|
||||
b3BoxB.Expand( dSafeDist) ;
|
||||
// Se i box non si sovrappongono, non c'è collisione. Ho finito.
|
||||
if ( ! b3BoxA.Overlaps( b3BoxB))
|
||||
return false ;
|
||||
// Recupero i triangoli di A che interferiscono col box di B
|
||||
INTVECTOR vTriaIndex ;
|
||||
pSrfA->GetAllTriaOverlapBox( b3BoxB, vTriaIndex) ;
|
||||
// Ciclo sui triangoli della superficie A che interferiscono col box della superficie B.
|
||||
for ( int nTA : vTriaIndex) {
|
||||
Triangle3d trTriaA ;
|
||||
if ( ! ( pSrfA->GetTriangle( nTA, trTriaA) && trTriaA.Validate()))
|
||||
continue ;
|
||||
BBox3d b3BoxTriaA ;
|
||||
trTriaA.GetLocalBBox( b3BoxTriaA) ;
|
||||
// Se è necessario, espando il box di una costante additiva pari alla distanza di sicurezza.
|
||||
if ( dSafeDist > EPS_SMALL)
|
||||
b3BoxTriaA.Expand( dSafeDist) ;
|
||||
// Recupero i triangoli di B che interferiscono col box del triangolo di A
|
||||
INTVECTOR vNearTria ;
|
||||
pSrfB->GetAllTriaOverlapBox( b3BoxTriaA, vNearTria) ;
|
||||
// Settare tutti i triangoli come già processati.
|
||||
// Al termine della chiamata i TempInt dei triangoli valgono 0.
|
||||
pSrfB->ResetTempInts() ;
|
||||
// Ciclo sui triangoli della superficie B che cadono nel box del triangolo corrente della Superficie A.
|
||||
for ( int nTB : vNearTria) {
|
||||
// Recupero il triangolo corrente della superficie B.
|
||||
// Se triangolo non valido salto al successivo.
|
||||
Triangle3d trTriaB ;
|
||||
if ( ! ( pSrfB->GetTriangle( nTB, trTriaB) && trTriaB.Validate()))
|
||||
continue ;
|
||||
// Se necessario considero l'offset
|
||||
if ( dSafeDist > EPS_SMALL) {
|
||||
int nAdjTriaId[3] ;
|
||||
pSrfB->GetTriangleAdjacencies( nTB, nAdjTriaId) ;
|
||||
// Ciclo sui vertici del triangolo.
|
||||
for ( int nVB = 0 ; nVB < 3 ; ++ nVB) {
|
||||
// Se il triangolo adiacente al triangolo corrente su questo edge
|
||||
// non è stato processato, processo il vertice e l'edge.
|
||||
int nAdjTriaTempFlag ;
|
||||
if ( ! ( pSrfB->GetTempInt( nAdjTriaId[nVB], nAdjTriaTempFlag) || nAdjTriaTempFlag == 0))
|
||||
continue ;
|
||||
// Processo il vertice: se c'è collisione fra triangolo A e sfera ho finito.
|
||||
if ( CDeSimpleSpheTria( trTriaB.GetP( nVB), dSafeDist, trTriaA))
|
||||
return true ;
|
||||
// Processo l'edge: se c'è collisione fra triangolo A e cilindro ho finito.
|
||||
Vector3d vtEdgeV = trTriaB.GetP( ( nVB + 1) % 3) - trTriaB.GetP( nVB) ;
|
||||
double dEdgeLen = vtEdgeV.Len() ;
|
||||
vtEdgeV /= dEdgeLen ;
|
||||
Frame3d frCyl ;
|
||||
frCyl.Set( trTriaB.GetP( nVB), vtEdgeV) ;
|
||||
if ( CDeSimpleCylTria( frCyl, dSafeDist, dEdgeLen, trTriaA))
|
||||
return true ;
|
||||
}
|
||||
// Traslo il triangolo
|
||||
trTriaB.Translate( dSafeDist * trTriaB.GetN()) ;
|
||||
}
|
||||
// Processo il triangolo: se i due triangoli collidono ho finito.
|
||||
if ( CDeTriaTria( trTriaA, trTriaB))
|
||||
return true ;
|
||||
// Segno il triangolo come processato: nTemp = 1
|
||||
pSrfB->SetTempInt( nTB, 1) ;
|
||||
}
|
||||
}
|
||||
// Se non richiesto test di inclusione, non c'è interferenza
|
||||
if ( ! bTestEnclosion)
|
||||
return false ;
|
||||
// Se la prima superficie è chiusa, verifico se include totalmente la seconda
|
||||
if ( pSrfA->IsClosed() && b3BoxA.Encloses( b3BoxB)) {
|
||||
Point3d ptPointB ;
|
||||
pSrfB->GetFirstVertex( ptPointB) ;
|
||||
DistPointSurfTm DistPoinBSrfA( ptPointB, *pSrfA) ;
|
||||
if ( DistPoinBSrfA.IsPointInside() || DistPoinBSrfA.IsEpsilon( dSafeDist))
|
||||
return true ;
|
||||
}
|
||||
// Se la seconda superficie è chiusa, verifico se include totalmente la prima
|
||||
if ( pSrfB->IsClosed() && b3BoxB.Encloses( b3BoxA)) {
|
||||
Point3d ptPointA ;
|
||||
pSrfA->GetFirstVertex( ptPointA) ;
|
||||
DistPointSurfTm DistPoinASrfB( ptPointA, *pSrfB) ;
|
||||
if ( DistPoinASrfB.IsPointInside() || DistPoinASrfB.IsEpsilon( dSafeDist))
|
||||
return true ;
|
||||
}
|
||||
// Non c'è interferenza
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2020-2020
|
||||
// EgalTech 2020-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : CDCylSurfTm.cpp Data : 09.11.20 Versione :
|
||||
// File : CDeConeFrustumClosedSurfTm.cpp Data : 24.031.24 Versione : 2.6c2
|
||||
// Contenuto : Implementazione della verifica di collisione tra
|
||||
// Cone e Closed SurftriMesh.
|
||||
//
|
||||
//
|
||||
// Modifiche : 09.11.20 LM Creazione modulo.
|
||||
// 24.03.24 DS Aggiunta TestConeFrustumSurfTm.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -21,15 +22,22 @@ using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Il sistema di riferimento deve avere l'asse di simmetria del cono come asse Z e origine nel centro della base.
|
||||
// La distanza di sicurezza ha effetto solo se maggiore di epsilon, altrimenti è ignorata ed è ininfluente.
|
||||
// Il sistema di riferimento del cono deve essere immerso in quello della superficie.
|
||||
// La distanza di sicurezza ha effetto solo se maggiore di EPS_SMALL, altrimenti è ignorata ed è ininfluente.
|
||||
// Il sistema di riferimento del cono è riferito a quello della superficie.
|
||||
// La funzione restituisce :
|
||||
// - true in caso di collisione o inconsistenza dei parametri di input
|
||||
// - false in caso di assenza di collisione.
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CDeConeFrustumClosedSurfTm( const Frame3d& frCone, double dBaseRad, double dTopRad, double dHeight,
|
||||
double dSafeDist, const ISurfTriMesh& Stm)
|
||||
const ISurfTriMesh& Stm, double dSafeDist)
|
||||
{
|
||||
// Se il tronco di cono non è ben definito non ha senso proseguire
|
||||
if ( max( dBaseRad, dTopRad) < EPS_SMALL || dHeight < EPS_SMALL)
|
||||
return false ;
|
||||
return true ;
|
||||
// Se superficie non valida o aperta, non ha senso proseguire
|
||||
if ( ! Stm.IsValid() || ! Stm.IsClosed())
|
||||
return true ;
|
||||
// Recupero BBox della trimesh
|
||||
BBox3d b3Surf = Stm.GetAllTriaBox() ;
|
||||
// Calcolo il BBox del tronco di cono
|
||||
@@ -49,13 +57,10 @@ CDeConeFrustumClosedSurfTm( const Frame3d& frCone, double dBaseRad, double dTopR
|
||||
for ( int nT : vT) {
|
||||
Triangle3d trTria ;
|
||||
if ( Stm.GetTriangle( nT, trTria)) {
|
||||
if ( CDeConeFrustumTria( frCone, dBaseRad, dTopRad, dHeight, dSafeDist, trTria))
|
||||
if ( CDeConeFrustumTria( frCone, dBaseRad, dTopRad, dHeight, trTria, dSafeDist))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Se superficie aperta, non c'è collisione
|
||||
if ( ! Stm.IsClosed())
|
||||
return false ;
|
||||
// Se il BBox del tronco di cono non è interno a quello del poliedro e viceversa, non c'è collisione
|
||||
if ( ! b3Surf.Encloses( b3Cone) && ! b3Cone.Encloses( b3Surf))
|
||||
return false ;
|
||||
@@ -65,4 +70,44 @@ CDeConeFrustumClosedSurfTm( const Frame3d& frCone, double dBaseRad, double dTopR
|
||||
DistPointSurfTm DistConeCenSurfCalc( ptConeCen, Stm) ;
|
||||
// Se il tronco di cono è interno c'è collisione
|
||||
return DistConeCenSurfCalc.IsPointInside() ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Verifica l'interferenza tra il tronco di cono e la superficie : restituisce true in caso di interferenza.
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
TestConeFrustumSurfTm( const Frame3d& frCone, double dBaseRad, double dTopRad, double dHeight,
|
||||
const ISurfTriMesh& Stm, double dSafeDist)
|
||||
{
|
||||
// Se il tronco di cono non è ben definito non ha senso proseguire
|
||||
if ( max( dBaseRad, dTopRad) < EPS_SMALL || dHeight < EPS_SMALL)
|
||||
return true ;
|
||||
// Se superficie non valida, non ha senso proseguire
|
||||
if ( ! Stm.IsValid())
|
||||
return true ;
|
||||
// Recupero BBox della trimesh
|
||||
BBox3d b3Surf = Stm.GetAllTriaBox() ;
|
||||
// Calcolo il BBox del tronco di cono
|
||||
double dMaxRad = max( dBaseRad, dTopRad) ;
|
||||
BBox3d b3ConeL( Point3d( -dMaxRad, -dMaxRad, 0),
|
||||
Point3d( dMaxRad, dMaxRad, dHeight)) ;
|
||||
if ( dSafeDist > EPS_SMALL)
|
||||
b3ConeL.Expand( dSafeDist) ;
|
||||
BBox3d b3Cone = GetToGlob( b3ConeL, frCone) ;
|
||||
// Se i BBox non interferiscono, non c'è collisione
|
||||
if ( ! b3Surf.Overlaps( b3Cone) || ! b3Surf.Overlaps( frCone, b3ConeL))
|
||||
return false ;
|
||||
// Recupero i triangoli che interferiscono con il box del cono
|
||||
INTVECTOR vT ;
|
||||
Stm.GetAllTriaOverlapBox( b3Cone, vT) ;
|
||||
// Verifico se il tronco di cono interferisce con i triangoli del poliedro presenti nel suo BBox
|
||||
for ( int nT : vT) {
|
||||
Triangle3d trTria ;
|
||||
if ( Stm.GetTriangle( nT, trTria)) {
|
||||
if ( CDeConeFrustumTria( frCone, dBaseRad, dTopRad, dHeight, trTria, dSafeDist))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Non c'è interferenza
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ CDeSimpleConeFrustumTria( const Frame3d& frCone, double dMinRad, double dMaxRad,
|
||||
// La distanza di sicurezza ha effetto solo se maggiore di epsilon, altrimenti è ignorata ed è ininfluente.
|
||||
bool
|
||||
CDeConeFrustumTria( const Frame3d& frCone, double dBaseRad, double dTopRad, double dHeight,
|
||||
double dSafeDist, const Triangle3d& trTria)
|
||||
const Triangle3d& trTria, double dSafeDist)
|
||||
{
|
||||
// Se il tronco di cono o il triangolo non sono ben definiti non procedo
|
||||
if ( max( dBaseRad, dTopRad) < EPS_SMALL || dHeight < EPS_SMALL || ! trTria.IsValid())
|
||||
@@ -142,7 +142,7 @@ CDeConeFrustumTria( const Frame3d& frCone, double dBaseRad, double dTopRad, doub
|
||||
|
||||
// Se è un cilindro chiamo la routine apposita.
|
||||
if ( abs( dBaseRad - dTopRad) < EPS_SMALL)
|
||||
return CDeCylTria( frCone, max( dBaseRad, dTopRad), dHeight, dSafeDist, trTria) ;
|
||||
return CDeCylTria( frCone, max( dBaseRad, dTopRad), dHeight, trTria, dSafeDist) ;
|
||||
|
||||
// Se il raggio di base è maggiore del raggio top cambio il sistema di riferimento.
|
||||
double dMinRad = dBaseRad ;
|
||||
@@ -156,11 +156,11 @@ CDeConeFrustumTria( const Frame3d& frCone, double dBaseRad, double dTopRad, doub
|
||||
|
||||
// Se è un cono, chiamo la routine apposita
|
||||
if ( dMinRad < EPS_SMALL)
|
||||
return CDeConeTria( frMyCone, dMaxRad, dHeight, dSafeDist, trTria) ;
|
||||
return CDeConeTria( frMyCone, dMaxRad, dHeight, trTria, dSafeDist) ;
|
||||
|
||||
// Se distanza di sicurezza nulla
|
||||
if ( dSafeDist < EPS_SMALL)
|
||||
return CDeSimpleConeFrustumTria( frMyCone, dBaseRad, dTopRad, dHeight, trTria ) ;
|
||||
return CDeSimpleConeFrustumTria( frMyCone, dBaseRad, dTopRad, dHeight, trTria) ;
|
||||
|
||||
// Verifica preliminare con tronco di cono esteso
|
||||
double dDiffRad = dMaxRad - dMinRad ;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2020-2020
|
||||
//----------------------------------------------------------------------------
|
||||
// File : CDeConTria.cpp Data : 28.10.20 Versione : 2.2k1
|
||||
// File : CDeConeFrustumTria.h Data : 28.10.20 Versione : 2.2k1
|
||||
// Contenuto : Dichiarazione della verifica di collisione tra
|
||||
// Cone e Triangle3d.
|
||||
//
|
||||
@@ -20,6 +20,5 @@
|
||||
// Il sistema di riferimento deve avere l'origine nel centro della base minore e l'asse
|
||||
// di simmetria del cono, rivolto verso la direzione di apertura, come asse Z.
|
||||
bool CDeSimpleConeFrustumTria( const Frame3d& frCone, double dMinRad, double dMaxRad, double dHeight, const Triangle3d& trTria) ;
|
||||
// Il sistema di riferimento ha l'asse Z coincidente con l'asse di simmetria del cono e l'origine nel centro della base.
|
||||
bool CDeConeFrustumTria( const Frame3d& frCone, double dBaseRad, double dTopRad, double dHeight,
|
||||
double dSafeDist, const Triangle3d& trTria) ;
|
||||
const Triangle3d& trTria, double dSafeDist) ;
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ CDeSimpleConeTria( const Frame3d& frCone, double dRad, double dHeight, const Tri
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CDeConeTria( const Frame3d& frCone, double dRad, double dHeight, double dSafeDist, const Triangle3d& trTria)
|
||||
CDeConeTria( const Frame3d& frCone, double dRad, double dHeight, const Triangle3d& trTria, double dSafeDist)
|
||||
{
|
||||
// Verifico validità del cono
|
||||
if ( dRad < EPS_SMALL || dHeight < EPS_SMALL)
|
||||
|
||||
+1
-1
@@ -19,4 +19,4 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// Il sistema di riferimento ha asse Z coincidente con l'asse del cono e origine nel vertice del cono (punto più basso).
|
||||
bool CDeSimpleConeTria( const Frame3d& frCone, double dRad, double dHeight, const Triangle3d& trTria) ;
|
||||
bool CDeConeTria( const Frame3d& frCone, double dRad, double dHeight, double dSafeDist, const Triangle3d& trTria) ;
|
||||
bool CDeConeTria( const Frame3d& frCone, double dRad, double dHeight, const Triangle3d& trTria, double dSafeDist) ;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2020-2020
|
||||
// EgalTech 2020-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : CDeConvexTorusTria.cpp Data : 18.11.20 Versione :
|
||||
// File : CDeConvexTorusTria.cpp Data : 24.03.24 Versione : 2.6c2
|
||||
// Contenuto : Implementazione funzione verifica collisione tra
|
||||
// toro convesso e SurfTriMesh.
|
||||
//
|
||||
// Modifiche : 18.11.20 LM Creazione modulo.
|
||||
//
|
||||
// 24.03.24 DS Aggiunta TestConvexTorusSurfTm.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -18,17 +18,23 @@
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Il toro convesso è il disco limitato dalla sola parte esterna del toro.
|
||||
// Il toro convesso è il solido a disco limitato dalla sola parte esterna del toro.
|
||||
// Raggio principale R1, raggio secondario R2.
|
||||
// Il toro è posto nel piano XY del suo riferimento, centrato sull'origine.
|
||||
// La funzione restituisce true in caso di collisione.
|
||||
// La funzione restituisce :
|
||||
// - true in caso di collisione o inconsistenza dei parametri di input
|
||||
// - false in caso di assenza di collisione.
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CDeConvexTorusClosedSurfTm( const Frame3d& frTorus, double dRad1, double dRad2,
|
||||
double dSafeDist, const ISurfTriMesh& Stm)
|
||||
const ISurfTriMesh& Stm, double dSafeDist)
|
||||
{
|
||||
// I raggi devono essere non nulli e la superficie ben definita.
|
||||
if ( dRad1 < EPS_SMALL || dRad2 < EPS_SMALL || ! Stm.IsValid())
|
||||
return false ;
|
||||
// I raggi devono essere non nulli
|
||||
if ( dRad1 < EPS_SMALL || dRad2 < EPS_SMALL)
|
||||
return true ;
|
||||
// Se superficie non valida o aperta, non ha senso proseguire
|
||||
if ( ! Stm.IsValid() || ! Stm.IsClosed())
|
||||
return true ;
|
||||
// Box della superficie
|
||||
BBox3d b3Surf = Stm.GetAllTriaBox() ;
|
||||
// Box del toro (sempre completo)
|
||||
@@ -47,13 +53,10 @@ CDeConvexTorusClosedSurfTm( const Frame3d& frTorus, double dRad1, double dRad2,
|
||||
for ( int nT : vT) {
|
||||
Triangle3d trTria ;
|
||||
if ( Stm.GetTriangle( nT, trTria)) {
|
||||
if ( CDeConvexTorusTria( frTorus, dRad1, dRad2, CT_TOT, dSafeDist, trTria))
|
||||
if ( CDeConvexTorusTria( frTorus, dRad1, dRad2, CT_TOT, trTria, dSafeDist))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Se superficie aperta, non c'è collisione
|
||||
if ( ! Stm.IsClosed())
|
||||
return false ;
|
||||
// Se il BBox del toro non è interno a quello del poliedro e viceversa, non c'è collisione
|
||||
if ( ! b3Surf.Encloses( b3Torus) && ! b3Torus.Encloses( b3Surf))
|
||||
return false ;
|
||||
@@ -63,3 +66,42 @@ CDeConvexTorusClosedSurfTm( const Frame3d& frTorus, double dRad1, double dRad2,
|
||||
// Se il toro è interno c'è collisione
|
||||
return ( DistConeOrigSurfCalc.IsPointInside()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Verifica l'interferenza tra il toro convesso e la superficie : restituisce true in caso di interferenza
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
TestConvexTorusSurfTm( const Frame3d& frTorus, double dRad1, double dRad2,
|
||||
const ISurfTriMesh& Stm, double dSafeDist)
|
||||
{
|
||||
// I raggi devono essere non nulli
|
||||
if ( dRad1 < EPS_SMALL || dRad2 < EPS_SMALL)
|
||||
return true ;
|
||||
// Se superficie non valida, non ha senso proseguire
|
||||
if ( ! Stm.IsValid())
|
||||
return true ;
|
||||
// Box della superficie
|
||||
BBox3d b3Surf = Stm.GetAllTriaBox() ;
|
||||
// Box del toro (sempre completo)
|
||||
BBox3d b3TorusL( Point3d( -dRad1 - dRad2, -dRad1 - dRad2, -dRad2),
|
||||
Point3d( dRad1 + dRad2, dRad1 + dRad2, dRad2)) ;
|
||||
if ( dSafeDist > EPS_SMALL)
|
||||
b3TorusL.Expand( dSafeDist) ;
|
||||
BBox3d b3Torus = GetToGlob( b3TorusL, frTorus) ;
|
||||
// Se i BBox non interferiscono, non c'è collisione
|
||||
if ( ! b3Surf.Overlaps( b3Torus) || ! b3Surf.Overlaps( frTorus, b3TorusL))
|
||||
return false ;
|
||||
// Recupero i triangoli che interferiscono con il box del toro
|
||||
INTVECTOR vT ;
|
||||
Stm.GetAllTriaOverlapBox( b3Torus, vT) ;
|
||||
// Verifico se il toro interferisce con i triangoli del poliedro presenti nel suo BBox
|
||||
for ( int nT : vT) {
|
||||
Triangle3d trTria ;
|
||||
if ( Stm.GetTriangle( nT, trTria)) {
|
||||
if ( CDeConvexTorusTria( frTorus, dRad1, dRad2, CT_TOT, trTria, dSafeDist))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Non c'è interferenza
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ CDeSimpleConvexTorusTria( const Frame3d& frTorus, double dRad1, double dRad2, in
|
||||
bool bContinue = plyApprox.GetFirstPoint( ptSt) && plyApprox.GetNextPoint( ptEn) ;
|
||||
while ( bContinue && ! bCollision) {
|
||||
frConus.Set( Point3d( 0., 0., ptSt.z), Frame3d::TOP) ;
|
||||
bCollision = CDeConeFrustumTria( frConus, ptSt.x, ptEn.x, ptEn.z - ptSt.z, 0., trMyTria) ;
|
||||
bCollision = CDeSimpleConeFrustumTria( frConus, ptSt.x, ptEn.x, ptEn.z - ptSt.z, trMyTria) ;
|
||||
ptSt = ptEn ;
|
||||
bContinue = plyApprox.GetNextPoint( ptEn) ;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ CDeSimpleConvexTorusTria( const Frame3d& frTorus, double dRad1, double dRad2, in
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CDeConvexTorusTria( const Frame3d& frTorus, double dRad1, double dRad2, int nCtType,
|
||||
double dSafeDist, const Triangle3d& trTria)
|
||||
const Triangle3d& trTria, double dSafeDist)
|
||||
{
|
||||
// I raggi devono essere non nulli e il triangolo ben definito.
|
||||
if ( dRad1 < EPS_SMALL || dRad2 < EPS_SMALL || ! trTria.IsValid())
|
||||
|
||||
@@ -28,4 +28,4 @@ enum ConvexTorusType { CT_INF = -1, CT_SUP = 1, CT_TOT = 0} ;
|
||||
bool CDeSimpleConvexTorusTria( const Frame3d& frTorus, double dRad1, double dRad2, int nCtType,
|
||||
const Triangle3d& trTria) ;
|
||||
bool CDeConvexTorusTria( const Frame3d& frTorus, double dRad1, double dRad2, int nCtType,
|
||||
double dSafeDist, const Triangle3d& trTria) ;
|
||||
const Triangle3d& trTria, double dSafeDist) ;
|
||||
+62
-9
@@ -1,13 +1,13 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2020-2020
|
||||
// EgalTech 2020-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : CDCylSurfTm.cpp Data : 09.01.20 Versione : 2.2a2
|
||||
// File : CDeCylClosedSurfTm.cpp Data : 24.03.24 Versione : 2.6c2
|
||||
// Contenuto : Implementazione della verifica di collisione tra
|
||||
// Cylinder e Closed SurftriMesh.
|
||||
//
|
||||
//
|
||||
// Modifiche : 09.01.20 DS Creazione modulo.
|
||||
//
|
||||
// 24.03.24 DS Aggiunta TestCylSurfTm.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -19,17 +19,30 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Il sistema di riferimento deve avere l'asse di simmetria del cilindro come asse Z e origine nel centro della base o del top.
|
||||
// La distanza di sicurezza ha effetto solo se maggiore di EPS_SMALL, altrimenti è ignorata ed è ininfluente.
|
||||
// Il sistema di riferimento del cilindro è riferito a quello della superficie.
|
||||
// La funzione restituisce :
|
||||
// - true in caso di collisione o inconsistenza dei parametri di input
|
||||
// - false in caso di assenza di collisione.
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CDeCylClosedSurfTm( const Frame3d& frCyl, double dR, double dH, double dSafeDist, const ISurfTriMesh& Stm)
|
||||
CDeCylClosedSurfTm( const Frame3d& frCyl, double dR, double dH, const ISurfTriMesh& Stm, double dSafeDist)
|
||||
{
|
||||
// Il cilindro deve essere ben definito
|
||||
if ( dR < EPS_SMALL || dH < EPS_SMALL)
|
||||
return true ;
|
||||
// Se superficie non valida o aperta, non ha senso proseguire
|
||||
if ( ! Stm.IsValid() || ! Stm.IsClosed())
|
||||
return true ;
|
||||
// Recupero BBox del poliedro
|
||||
BBox3d b3Poly = Stm.GetAllTriaBox() ;
|
||||
// Sistemazioni cilindro
|
||||
Frame3d frMyCyl = frCyl ;
|
||||
if ( dH < 0) {
|
||||
frMyCyl.Translate( dH * frMyCyl.VersZ()) ;
|
||||
dH = - dH ;
|
||||
dH = -dH ;
|
||||
}
|
||||
// Calcolo il BBox del cilindro
|
||||
BBox3d b3CylL( Point3d( -dR, -dR, 0),
|
||||
@@ -46,13 +59,10 @@ CDeCylClosedSurfTm( const Frame3d& frCyl, double dR, double dH, double dSafeDist
|
||||
for ( int nT : vT) {
|
||||
Triangle3d Tria ;
|
||||
if ( Stm.GetTriangle( nT, Tria)) {
|
||||
if ( CDeCylTria( frMyCyl, dR, dH, dSafeDist, Tria))
|
||||
if ( CDeCylTria( frMyCyl, dR, dH, Tria, dSafeDist))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Se superficie aperta, non c'è collisione
|
||||
if ( ! Stm.IsClosed())
|
||||
return false ;
|
||||
// Se il BBox del cilindro non è interno a quello del poliedro e viceversa, non c'è collisione
|
||||
if ( ! b3Poly.Encloses( b3Cyl) && ! b3Cyl.Encloses( b3Poly))
|
||||
return false ;
|
||||
@@ -63,3 +73,46 @@ CDeCylClosedSurfTm( const Frame3d& frCyl, double dR, double dH, double dSafeDist
|
||||
// Se il cilindro è interno c'è collisione
|
||||
return ( DistCylCenSurfCalc.IsPointInside()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Verifica l'interferenza tra il cilindro e la superficie : restituisce true in caso di interferenza
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
TestCylSurfTm( const Frame3d& frCyl, double dR, double dH, const ISurfTriMesh& Stm, double dSafeDist)
|
||||
{
|
||||
// Il cilindro deve essere ben definito
|
||||
if ( dR < EPS_SMALL || dH < EPS_SMALL)
|
||||
return true ;
|
||||
// Se superficie non valida, non ha senso proseguire
|
||||
if ( ! Stm.IsValid())
|
||||
return true ;
|
||||
// Recupero BBox della superficie poligonale
|
||||
BBox3d b3Poly = Stm.GetAllTriaBox() ;
|
||||
// Sistemazioni cilindro
|
||||
Frame3d frMyCyl = frCyl ;
|
||||
if ( dH < 0) {
|
||||
frMyCyl.Translate( dH * frMyCyl.VersZ()) ;
|
||||
dH = -dH ;
|
||||
}
|
||||
// Calcolo il BBox del cilindro
|
||||
BBox3d b3CylL( Point3d( -dR, -dR, 0),
|
||||
Point3d( dR, dR, dH)) ;
|
||||
if ( dSafeDist > EPS_SMALL)
|
||||
b3CylL.Expand( dSafeDist) ;
|
||||
BBox3d b3Cyl = GetToGlob( b3CylL, frMyCyl) ;
|
||||
// Se i BBox non interferiscono, non c'è interferenza
|
||||
if ( ! b3Poly.Overlaps( b3Cyl) || ! b3Poly.Overlaps( frMyCyl, b3CylL))
|
||||
return false ;
|
||||
// Verifico se il cilindro interferisce con i triangoli del poliedro presenti nel suo BBox
|
||||
INTVECTOR vT ;
|
||||
Stm.GetAllTriaOverlapBox( b3Cyl, vT) ;
|
||||
for ( int nT : vT) {
|
||||
Triangle3d Tria ;
|
||||
if ( Stm.GetTriangle( nT, Tria)) {
|
||||
if ( CDeCylTria( frMyCyl, dR, dH, Tria, dSafeDist))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Non c'è interferenza
|
||||
return false ;
|
||||
}
|
||||
|
||||
+2
-2
@@ -13,9 +13,9 @@
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "DistPointLine.h"
|
||||
#include "CDeCylTria.h"
|
||||
#include "CDeConvexTorusTria.h"
|
||||
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||
#include "/EgtDev/Include/EGkPolygon3d.h"
|
||||
|
||||
using namespace std ;
|
||||
@@ -84,7 +84,7 @@ CDeSimpleCylTria( const Frame3d& frCyl, double dR, double dH, const Triangle3d&
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CDeCylTria( const Frame3d& frCyl, double dR, double dH, double dSafeDist, const Triangle3d& trTria)
|
||||
CDeCylTria( const Frame3d& frCyl, double dR, double dH, const Triangle3d& trTria, double dSafeDist)
|
||||
{
|
||||
// Se distanza di sicurezza nulla
|
||||
if ( dSafeDist < EPS_SMALL)
|
||||
|
||||
+1
-1
@@ -16,4 +16,4 @@
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool CDeSimpleCylTria( const Frame3d& frCyl, double dR, double dH, const Triangle3d& trTria) ;
|
||||
bool CDeCylTria( const Frame3d& frCyl, double dR, double dH, double dSafeDist, const Triangle3d& trTria) ;
|
||||
bool CDeCylTria( const Frame3d& frCyl, double dR, double dH, const Triangle3d& trTria, double dSafeDist) ;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2020-2020
|
||||
// EgalTech 2020-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : CDePyramidClosedSurfTm.h Data : 09.11.20 Versione :
|
||||
// File : CDeRectPrismoidClosedSurfTm.h Data : 24.03.24 Versione : 2.6c2
|
||||
// Contenuto : Implementazione funzione verifica collisione tra
|
||||
// Prismoide a basi rettangolari e Closed SurfTriMesh.
|
||||
//
|
||||
// Modifiche : 09.11.20 LM Creazione modulo.
|
||||
//
|
||||
// 24.03.24 DS Aggiunta TestRectPrismoidSurfTm.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -22,16 +22,23 @@ using namespace std ;
|
||||
// Il sistema di riferimento deve avere l'origine nel centro della Base, asse X lungo
|
||||
// un segmento della stessa e asse Z ortogonale alle basi e diretta verso la base Top.
|
||||
// Il sistema di riferimento della piramide deve essere immerso in quello della superficie.
|
||||
// La funzione restituisce :
|
||||
// - true in caso di collisione o inconsistenza dei parametri di input
|
||||
// - false in caso di assenza di collisione.
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CDeRectPrismoidClosedSurfTm( const Frame3d& frPrismoid, double dLenghtBaseX, double dLenghtBaseY,
|
||||
double dLenghtTopX, double dLenghtTopY, double dHeight,
|
||||
double dSafeDist, const ISurfTriMesh& Stm)
|
||||
const ISurfTriMesh& Stm, double dSafeDist)
|
||||
{
|
||||
// Se il tronco di piramide non è definito o la superficie non ben definita non ha senso proseguire.
|
||||
// Se il tronco di piramide non è definito non ha senso proseguire.
|
||||
if ( max( dLenghtBaseX, dLenghtTopX) < EPS_SMALL ||
|
||||
max( dLenghtBaseY, dLenghtTopY) < EPS_SMALL ||
|
||||
dHeight < EPS_SMALL || ! Stm.IsValid())
|
||||
return false ;
|
||||
dHeight < EPS_SMALL)
|
||||
return true ;
|
||||
// Se superficie non valida o aperta, non ha senso proseguire
|
||||
if ( ! Stm.IsValid() || ! Stm.IsClosed())
|
||||
return true ;
|
||||
// Recupero BBox della trimesh
|
||||
BBox3d b3Surf = Stm.GetAllTriaBox() ;
|
||||
// Calcolo il BBox del tronco di piramide
|
||||
@@ -53,13 +60,10 @@ CDeRectPrismoidClosedSurfTm( const Frame3d& frPrismoid, double dLenghtBaseX, dou
|
||||
Triangle3d trTria ;
|
||||
if ( Stm.GetTriangle( nT, trTria)) {
|
||||
if ( CDeRectPrismoidTria( frPrismoid, dLenghtBaseX, dLenghtBaseY, dLenghtTopX, dLenghtTopY, dHeight,
|
||||
dSafeDist, trTria))
|
||||
trTria, dSafeDist))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Se superficie aperta, non c'è collisione
|
||||
if ( ! Stm.IsClosed())
|
||||
return false ;
|
||||
// Se il BBox del tronco di piramide non è interno a quello del poliedro e viceversa, non c'è collisione
|
||||
if ( ! b3Surf.Encloses( b3Pyr) && ! b3Pyr.Encloses( b3Surf))
|
||||
return false ;
|
||||
@@ -70,3 +74,48 @@ CDeRectPrismoidClosedSurfTm( const Frame3d& frPrismoid, double dLenghtBaseX, dou
|
||||
// C'è collisione se il tronco di piramide è interno
|
||||
return ( DistPyrCenSurfCalc.IsPointInside()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Verifica l'interferenza tra il Prismoide a basi rettangolari e la superficie : restituisce true in caso di interferenza.
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
TestRectPrismoidSurfTm( const Frame3d& frPrismoid, double dLenghtBaseX, double dLenghtBaseY,
|
||||
double dLenghtTopX, double dLenghtTopY, double dHeight,
|
||||
const ISurfTriMesh& Stm, double dSafeDist)
|
||||
{
|
||||
// Se il tronco di piramide non è definito non ha senso proseguire.
|
||||
if ( max( dLenghtBaseX, dLenghtTopX) < EPS_SMALL ||
|
||||
max( dLenghtBaseY, dLenghtTopY) < EPS_SMALL ||
|
||||
dHeight < EPS_SMALL)
|
||||
return true ;
|
||||
// Se superficie non valida, non ha senso proseguire
|
||||
if ( ! Stm.IsValid())
|
||||
return true ;
|
||||
// Recupero BBox della trimesh
|
||||
BBox3d b3Surf = Stm.GetAllTriaBox() ;
|
||||
// Calcolo il BBox del tronco di piramide
|
||||
double dMaxLenX = max( dLenghtBaseX, dLenghtTopX) ;
|
||||
double dMaxLenY = max( dLenghtBaseY, dLenghtTopY) ;
|
||||
BBox3d b3PyrL( Point3d( -dMaxLenX / 2, -dMaxLenY / 2, 0.),
|
||||
Point3d( dMaxLenX / 2, dMaxLenY / 2, dHeight)) ;
|
||||
if ( dSafeDist > EPS_SMALL)
|
||||
b3PyrL.Expand( dSafeDist) ;
|
||||
BBox3d b3Pyr = GetToGlob( b3PyrL, frPrismoid) ;
|
||||
// Se i BBox non interferiscono, non c'è collisione
|
||||
if ( ! b3Surf.Overlaps( b3Pyr) || ! b3Surf.Overlaps( frPrismoid, b3PyrL))
|
||||
return false ;
|
||||
// Recupero i triangoli che interferiscono con il box del tronco di piramide.
|
||||
INTVECTOR vT ;
|
||||
Stm.GetAllTriaOverlapBox( b3Pyr, vT) ;
|
||||
// Verifico se il tronco di piramide interferisce con i triangoli del poliedro presenti nel suo BBox
|
||||
for ( int nT : vT) {
|
||||
Triangle3d trTria ;
|
||||
if ( Stm.GetTriangle( nT, trTria)) {
|
||||
if ( CDeRectPrismoidTria( frPrismoid, dLenghtBaseX, dLenghtBaseY, dLenghtTopX, dLenghtTopY, dHeight,
|
||||
trTria, dSafeDist))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Non c'è interferenza
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ CDeSimpleRectPrismoidTria( const Frame3d& frPrismoid, double dLenghtBaseX, doubl
|
||||
bool
|
||||
CDeRectPrismoidTria( const Frame3d& frPrismoid, double dLenghtBaseX, double dLenghtBaseY,
|
||||
double dLenghtTopX, double dLenghtTopY, double dHeight,
|
||||
double dSafeDist, const Triangle3d& trTria)
|
||||
const Triangle3d& trTria, double dSafeDist)
|
||||
{
|
||||
// Se il tronco di piramide o il triangolo non sono ben definiti non procedo
|
||||
if ( max( dLenghtBaseX, dLenghtTopX) < EPS_SMALL ||
|
||||
|
||||
@@ -26,4 +26,4 @@ bool CDeSimpleRectPrismoidTria( const Frame3d& frPrismoid, double dLenghtBaseX,
|
||||
// asse X lungo un lato della stessa e asse Z ortogonale alle basi e diretta verso la base Top.
|
||||
bool CDeRectPrismoidTria( const Frame3d& frPrismoid, double dLenghtBaseX, double dLenghtBaseY,
|
||||
double dLenghtTopX, double dLenghtTopY, double dHeight,
|
||||
double dSafeDist, const Triangle3d& trTria) ;
|
||||
const Triangle3d& trTria, double dSafeDist) ;
|
||||
|
||||
+50
-8
@@ -1,13 +1,13 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2020-2020
|
||||
// EgalTech 2020-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : CDCylSurfTm.cpp Data : 09.01.20 Versione : 2.2a2
|
||||
// File : CDCylSurfTm.cpp Data : 24.03.24 Versione : 2.6c2
|
||||
// Contenuto : Implementazione della verifica di collisione tra
|
||||
// Sphere e Closed SurftriMesh.
|
||||
//
|
||||
//
|
||||
// Modifiche : 09.01.20 DS Creazione modulo.
|
||||
//
|
||||
// 24.03.24 DS Aggiunta TestSpheSurfTm.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -19,10 +19,20 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// La funzione restituisce :
|
||||
// - true in caso di collisione o inconsistenza dei parametri di input
|
||||
// - false in caso di assenza di collisione.
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CDeSpheClosedSurfTm( const Point3d& ptCen, double dR, double dSafeDist, const ISurfTriMesh& Stm)
|
||||
CDeSpheClosedSurfTm( const Point3d& ptCen, double dR, const ISurfTriMesh& Stm, double dSafeDist)
|
||||
{
|
||||
// Il raggio deve essere non nullo
|
||||
if ( dR < EPS_SMALL)
|
||||
return true ;
|
||||
// Se superficie non valida o aperta, non ha senso proseguire
|
||||
if ( ! Stm.IsValid() || ! Stm.IsClosed())
|
||||
return true ;
|
||||
// Recupero BBox del poliedro
|
||||
BBox3d b3Poly = Stm.GetAllTriaBox() ;
|
||||
// Calcolo il BBox della sfera
|
||||
@@ -38,13 +48,10 @@ CDeSpheClosedSurfTm( const Point3d& ptCen, double dR, double dSafeDist, const IS
|
||||
for ( int nT : vT) {
|
||||
Triangle3d Tria ;
|
||||
if ( Stm.GetTriangle( nT, Tria)) {
|
||||
if ( CDeSpheTria( ptCen, dR, dSafeDist, Tria))
|
||||
if ( CDeSpheTria( ptCen, dR, Tria, dSafeDist))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Se superficie aperta, non c'è collisione
|
||||
if ( ! Stm.IsClosed())
|
||||
return false ;
|
||||
// Se il BBox della sfera non è interno a quello del poliedro e viceversa, non c'è collisione
|
||||
if ( ! b3Sphe.Encloses( b3Poly) && ! b3Poly.Encloses( b3Sphe))
|
||||
return false ;
|
||||
@@ -53,3 +60,38 @@ CDeSpheClosedSurfTm( const Point3d& ptCen, double dR, double dSafeDist, const IS
|
||||
// C'è collisione se la sfera è interna.
|
||||
return ( DistCenSurfCalc.IsPointInside()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Verifica l'interferenza tra la sfera e la superficie : restituisce true in caso di interferenza
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
TestSpheSurfTm( const Point3d& ptCen, double dR, const ISurfTriMesh& Stm, double dSafeDist)
|
||||
{
|
||||
// Il raggio deve essere non nullo
|
||||
if ( dR < EPS_SMALL)
|
||||
return true ;
|
||||
// Se superficie non valida, non ha senso proseguire
|
||||
if ( ! Stm.IsValid())
|
||||
return true ;
|
||||
// Recupero BBox del poliedro
|
||||
BBox3d b3Poly = Stm.GetAllTriaBox() ;
|
||||
// Calcolo il BBox della sfera
|
||||
BBox3d b3Sphe( ptCen, dR) ;
|
||||
if ( dSafeDist > EPS_SMALL)
|
||||
b3Sphe.Expand( dSafeDist) ;
|
||||
// Se i BBox non interferiscono, non c'è collisione
|
||||
if ( ! b3Sphe.Overlaps( b3Poly))
|
||||
return false ;
|
||||
// Verifico se la sfera interferisce con i triangoli del poliedro presenti nel suo BBox
|
||||
INTVECTOR vT ;
|
||||
Stm.GetAllTriaOverlapBox( b3Sphe, vT) ;
|
||||
for ( int nT : vT) {
|
||||
Triangle3d Tria ;
|
||||
if ( Stm.GetTriangle( nT, Tria)) {
|
||||
if ( CDeSpheTria( ptCen, dR, Tria, dSafeDist))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Non c'è interferenza
|
||||
return false ;
|
||||
}
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ CDeSimpleSpheTria( const Point3d& ptCen, double dR, const Triangle3d& trTria)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CDeSpheTria( const Point3d& ptCen, double dR, double dSafeDist, const Triangle3d& trTria)
|
||||
CDeSpheTria( const Point3d& ptCen, double dR, const Triangle3d& trTria, double dSafeDist)
|
||||
{
|
||||
return CDeSimpleSpheTria( ptCen, dR + max( 0., dSafeDist), trTria) ;
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,4 +16,4 @@
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool CDeSimpleSpheTria( const Point3d& ptCen, double dR, const Triangle3d& trTria) ;
|
||||
bool CDeSpheTria( const Point3d& ptCen, double dR, double dSafeDist, const Triangle3d& trTria) ;
|
||||
bool CDeSpheTria( const Point3d& ptCen, double dR, const Triangle3d& trTria, double dSafeDist) ;
|
||||
|
||||
+3
-4
@@ -12,11 +12,10 @@
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "DistLineLine.h"
|
||||
#include "CDeTriaTria.h"
|
||||
#include "/EgtDev/Include/EGkDistLineLine.h"
|
||||
#include "/EgtDev/Include/EGkIntersPlanePlane.h"
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -34,7 +33,7 @@ GetTwoGreater( int nVal0, int nVal1, int nVal2, int& nFirstMaxPos, int& nSecondM
|
||||
}
|
||||
else {
|
||||
nFirstMaxPos = 2 ;
|
||||
nSecondMaxPos = 1 ;
|
||||
nSecondMaxPos = 0 ;
|
||||
}
|
||||
}
|
||||
else if ( nVal0 > nVal2) {
|
||||
@@ -168,7 +167,7 @@ CDeTriaTria( const Triangle3d& trTriaA, const Triangle3d& trTriaB)
|
||||
Vector3d vtSegSecondB = trTriaB.GetP( ( nSecondMaxPosB + 1) % 3) - trTriaB.GetP( nSecondMaxPosB) ;
|
||||
double dSegLenSecondB = vtSegSecondB.Len() ;
|
||||
vtSegSecondB /= dSegLenSecondB ;
|
||||
DistLineLine LineLineDistCalcSecondB( ptLineP, vtLineV, 100., trTriaB.GetP( nSecondMaxPosA), vtSegSecondB, dSegLenSecondB, false) ;
|
||||
DistLineLine LineLineDistCalcSecondB( ptLineP, vtLineV, 100., trTriaB.GetP( nSecondMaxPosB), vtSegSecondB, dSegLenSecondB, false) ;
|
||||
double dIntParEnB, dOtherParSecondB ;
|
||||
LineLineDistCalcSecondB.GetPositionsAtMinDistPoints( dIntParEnB, dOtherParSecondB) ;
|
||||
// Ordino i parametri lungo la retta di intersezione fra i piani
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "CDeUtility.h"
|
||||
#include "DistPointLine.h"
|
||||
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||
#include "/EgtDev/Include/ENkPolynomialRoots.h"
|
||||
|
||||
using namespace std ;
|
||||
@@ -368,4 +368,4 @@ ClampSegmentOutPlane( const Plane3d& plPlane, Point3d& ptSegP, const Vector3d& v
|
||||
dSegLen -= dIntersLen ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2026
|
||||
//----------------------------------------------------------------------------
|
||||
// File : CalcDerivate.cpp Data : 03.02.26 Versione : 1.5h1
|
||||
// Contenuto : Funzioni per calcolo derivate secondo Bessel e Akima.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 03.02.26 DB Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "CalcDerivate.h"
|
||||
#include "/EgtDev/Include/EGkPoint3d.h"
|
||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
||||
#include "/EgtDev/Include/EGkGeoCollection.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ComputeAkimaTangents( bool bDetectCorner, const DBLVECTOR& vPar, const PNTVECTOR& vPnt, VCT3DVECTOR& vPrevDer, VCT3DVECTOR& vNextDer)
|
||||
{
|
||||
// pulisco i vettori dei parametri e delle tangenti
|
||||
vPrevDer.clear() ;
|
||||
vNextDer.clear() ;
|
||||
|
||||
// numero di punti
|
||||
int nSize = int( vPnt.size()) ;
|
||||
|
||||
// sono necessari almeno due punti
|
||||
if ( nSize < 2)
|
||||
return false ;
|
||||
|
||||
// calcolo le derivate
|
||||
vPrevDer.reserve( nSize) ;
|
||||
vNextDer.reserve( nSize) ;
|
||||
// se ci sono solo 2 punti, le tangenti devono essere dirette lungo la linea che li unisce
|
||||
if ( nSize == 2) {
|
||||
// non esiste derivata prima del primo punto
|
||||
vPrevDer.emplace_back( 0, 0, 0) ;
|
||||
vNextDer.push_back( ( vPnt[1] - vPnt[0]) / ( vPar[1] - vPar[0])) ;
|
||||
vPrevDer.push_back( vNextDer[0]) ;
|
||||
// non esiste derivata dopo il secondo e ultimo punto
|
||||
vNextDer.emplace_back( 0, 0, 0) ;
|
||||
return true ;
|
||||
}
|
||||
// verifico se curva chiusa (primo e ultimo punto coincidono)
|
||||
bool bClosed = AreSamePointApprox( vPnt.front(), vPnt.back()) ;
|
||||
// calcolo le derivate
|
||||
for ( int i = 0 ; i < nSize ; ++ i) {
|
||||
Vector3d vtPrevDer ;
|
||||
Vector3d vtNextDer ;
|
||||
// primo punto
|
||||
if ( i == 0) {
|
||||
// se curva chiusa, come precedente uso il penultimo punto
|
||||
if ( bClosed) {
|
||||
// se non ci sono almeno 5 punti
|
||||
if ( nSize < 5) {
|
||||
if ( ! CalcCircleMidDer( vPar[nSize-2] - vPar[nSize-1], vPnt[nSize-2], vPar[i], vPnt[i],
|
||||
vPar[i+1], vPnt[i+1], vtNextDer))
|
||||
return false ;
|
||||
vtPrevDer = vtNextDer ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
if ( ! CalcAkimaMidDer( vPar[nSize-3] - vPar[nSize-1], vPnt[nSize-3], vPar[nSize-2] - vPar[nSize-1], vPnt[nSize-2],
|
||||
vPar[i], vPnt[i], vPar[i+1], vPnt[i+1],
|
||||
vPar[i+2], vPnt[i+2], bDetectCorner,
|
||||
vtPrevDer, vtNextDer))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti, uso arco sui primi tre punti
|
||||
else {
|
||||
if ( ! CalcCircleStartDer( vPar[i], vPnt[i], vPar[i+1], vPnt[i+1],
|
||||
vPar[i+2], vPnt[i+2], vtNextDer))
|
||||
return false ;
|
||||
vtPrevDer = Vector3d( 0, 0, 0) ;
|
||||
}
|
||||
}
|
||||
// ultimo punto
|
||||
else if ( i == nSize - 1) {
|
||||
// se curva chiusa, le tg devono coincidere con quelle del primo
|
||||
if ( bClosed) {
|
||||
vtPrevDer = vPrevDer[0] ;
|
||||
vtNextDer = vNextDer[0] ;
|
||||
}
|
||||
// altrimenti, uso arco sugli ultimi tre punti
|
||||
else {
|
||||
if ( ! CalcCircleEndDer( vPar[i-2], vPnt[i-2], vPar[i-1], vPnt[i-1],
|
||||
vPar[i], vPnt[i], vtPrevDer))
|
||||
return false ;
|
||||
vtNextDer = Vector3d( 0, 0, 0) ;
|
||||
}
|
||||
}
|
||||
// punti intermedi
|
||||
else {
|
||||
// se secondo punto
|
||||
if ( i == 1) {
|
||||
// se curva aperta o non ci sono almeno 5 punti
|
||||
if ( ! bClosed || nSize < 5) {
|
||||
if ( ! CalcCircleMidDer( vPar[i-1], vPnt[i-1], vPar[i], vPnt[i],
|
||||
vPar[i+1], vPnt[i+1], vtPrevDer))
|
||||
return false ;
|
||||
vtNextDer = vtPrevDer ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
if ( ! CalcAkimaMidDer( vPar[nSize-2] - vPar[nSize-1], vPnt[nSize-2], vPar[i-1], vPnt[i-1],
|
||||
vPar[i], vPnt[i], vPar[i+1], vPnt[i+1],
|
||||
vPar[i+2], vPnt[i+2], bDetectCorner,
|
||||
vtPrevDer, vtNextDer))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// se penultimo punto
|
||||
else if ( i == nSize - 2) {
|
||||
// se curva aperta o non ci sono almeno 5 punti
|
||||
if ( ! bClosed || nSize < 5) {
|
||||
if ( ! CalcCircleMidDer( vPar[i-1], vPnt[i-1], vPar[i], vPnt[i],
|
||||
vPar[i+1], vPnt[i+1], vtPrevDer))
|
||||
return false ;
|
||||
vtNextDer = vtPrevDer ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
if ( ! CalcAkimaMidDer( vPar[i-2], vPnt[i-2], vPar[i-1], vPnt[i-1],
|
||||
vPar[i], vPnt[i], vPar[i+1], vPnt[i+1],
|
||||
vPar[1] + vPar[i+1], vPnt[1], bDetectCorner,
|
||||
vtPrevDer, vtNextDer))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
if ( ! CalcAkimaMidDer( vPar[i-2], vPnt[i-2], vPar[i-1], vPnt[i-1],
|
||||
vPar[i], vPnt[i], vPar[i+1], vPnt[i+1],
|
||||
vPar[i+2], vPnt[i+2], bDetectCorner,
|
||||
vtPrevDer, vtNextDer))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// salvo la derivata
|
||||
vPrevDer.push_back( vtPrevDer) ;
|
||||
vNextDer.push_back( vtNextDer) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ComputeBesselTangents( const DBLVECTOR& vPar, const PNTVECTOR& vPnt, VCT3DVECTOR& vPrevDer, VCT3DVECTOR& vNextDer)
|
||||
{
|
||||
// pulisco i vettori dei parametri e delle tangenti
|
||||
vPrevDer.clear() ;
|
||||
vNextDer.clear() ;
|
||||
|
||||
// numero di punti
|
||||
int nSize = int( vPnt.size()) ;
|
||||
|
||||
// sono necessari almeno due punti
|
||||
if ( nSize < 2)
|
||||
return false ;
|
||||
|
||||
// calcolo le derivate
|
||||
vPrevDer.reserve( nSize) ;
|
||||
vNextDer.reserve( nSize) ;
|
||||
// se ci sono solo 2 punti, le tangenti devono essere dirette lungo la linea che li unisce
|
||||
if ( nSize == 2) {
|
||||
// non esiste derivata prima del primo punto
|
||||
vPrevDer.emplace_back( 0, 0, 0) ;
|
||||
vNextDer.push_back( ( vPnt[1] - vPnt[0]) / ( vPar[1] - vPar[0])) ;
|
||||
vPrevDer.push_back( vNextDer[0]) ;
|
||||
// non esiste derivata dopo il secondo e ultimo punto
|
||||
vNextDer.emplace_back( 0, 0, 0) ;
|
||||
return true ;
|
||||
}
|
||||
// verifico se curva chiusa (primo e ultimo punto coincidono)
|
||||
bool bClosed = AreSamePointApprox( vPnt.front(), vPnt.back()) ;
|
||||
// calcolo le derivate
|
||||
for ( int i = 0 ; i < nSize ; ++ i) {
|
||||
Vector3d vtPrevDer ;
|
||||
Vector3d vtNextDer ;
|
||||
// primo punto
|
||||
if ( i == 0) {
|
||||
// se curva chiusa, come precedente uso il penultimo punto
|
||||
if ( bClosed) {
|
||||
if ( ! CalcBesselMidDer( vPar[nSize-2] - vPar[nSize-1], vPnt[nSize-2], vPar[i], vPnt[i],
|
||||
vPar[i+1], vPnt[i+1], vtNextDer))
|
||||
return false ;
|
||||
vtPrevDer = vtNextDer ;
|
||||
}
|
||||
// altrimenti, uso i primi tre punti
|
||||
else {
|
||||
if ( ! CalcBesselStartDer( vPar[i], vPnt[i], vPar[i+1], vPnt[i+1],
|
||||
vPar[i+2], vPnt[i+2], vtNextDer))
|
||||
return false ;
|
||||
vtPrevDer = Vector3d( 0, 0, 0) ;
|
||||
}
|
||||
}
|
||||
// ultimo punto
|
||||
else if ( i == nSize - 1) {
|
||||
// se curva chiusa, le tg devono coincidere con quelle del primo
|
||||
if ( bClosed) {
|
||||
vtPrevDer = vPrevDer[0] ;
|
||||
vtNextDer = vNextDer[0] ;
|
||||
}
|
||||
// altrimenti, uso gli ultimi tre punti
|
||||
else {
|
||||
if ( ! CalcBesselEndDer( vPar[i-2], vPnt[i-2], vPar[i-1], vPnt[i-1],
|
||||
vPar[i], vPnt[i], vtPrevDer))
|
||||
return false ;
|
||||
vtNextDer = Vector3d( 0, 0, 0) ;
|
||||
}
|
||||
}
|
||||
// punti intermedi
|
||||
else {
|
||||
if ( ! CalcBesselMidDer( vPar[i-1], vPnt[i-1], vPar[i], vPnt[i],
|
||||
vPar[i+1], vPnt[i+1], vtPrevDer))
|
||||
return false ;
|
||||
vtNextDer = vtPrevDer ;
|
||||
}
|
||||
// salvo la derivata
|
||||
vPrevDer.push_back( vtPrevDer) ;
|
||||
vNextDer.push_back( vtNextDer) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -14,6 +14,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EGkPoint3d.h"
|
||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
||||
#include "/EgtDev/Include/EGkGeoCollection.h"
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -179,3 +181,6 @@ CalcAkimaMidDer( double dU0, const Point3d& ptP0, double dU1, const Point3d& ptP
|
||||
}
|
||||
return ( ! vtPrevDer.IsZero() && ! vtNextDer.IsZero()) ;
|
||||
}
|
||||
|
||||
bool ComputeAkimaTangents( bool bDetectCorner, const DBLVECTOR& vPar, const PNTVECTOR& vPnt, VCT3DVECTOR& vPrevDer, VCT3DVECTOR& vNextDer) ;
|
||||
bool ComputeBesselTangents( const DBLVECTOR& vPar, const PNTVECTOR& vPnt, VCT3DVECTOR& vPrevDer, VCT3DVECTOR& vNextDer) ;
|
||||
+10271
File diff suppressed because it is too large
Load Diff
+28
-24
@@ -2,7 +2,7 @@
|
||||
// EgalTech 2013-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ChainCurves.cpp Data : 20.07.14 Versione : 1.5g3
|
||||
// Contenuto : Implementazione della funzione ChainCurves, per creare una o più
|
||||
// Contenuto : Implementazione della funzione ChainCurves, per creare una o più
|
||||
// curve composite a partire dalle curve date.
|
||||
//
|
||||
//
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "/EgtDev/Include/EGkChainCurves.h"
|
||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std ;
|
||||
@@ -43,10 +44,10 @@ bool
|
||||
ChainCurves::AddCurve( int nId, const Point3d& ptStart, const Vector3d& vtStart,
|
||||
const Point3d& ptEnd, const Vector3d& vtEnd)
|
||||
{
|
||||
// verifico validità Id
|
||||
// verifico validità Id
|
||||
if ( nId <= 0)
|
||||
return false ;
|
||||
// verifico non sia già stata aggiunta la stessa entità
|
||||
// verifico non sia già stata aggiunta la stessa entità
|
||||
if ( ! m_sCrvId.insert( nId).second)
|
||||
return true ;
|
||||
// inserisco i dati della curva nel vettore
|
||||
@@ -68,7 +69,7 @@ ChainCurves::GetChainFromNear( const Point3d& ptStart, bool bHaltOnFork, INTVECT
|
||||
m_bIsFork = false ;
|
||||
m_vFork.clear() ;
|
||||
|
||||
// recupero l'entità più vicina al punto di start
|
||||
// recupero l'entità più vicina al punto di start
|
||||
int nStart ;
|
||||
INTVECTOR vStart ;
|
||||
if ( ! m_PointGrid.FindNearest( ptStart, vStart) ||
|
||||
@@ -82,7 +83,7 @@ ChainCurves::GetChainFromNear( const Point3d& ptStart, bool bHaltOnFork, INTVECT
|
||||
// tolgo dal grid
|
||||
RemoveEntityFromGrid( nId) ;
|
||||
|
||||
// se devo fermarmi su biforcazione, verifico se sono già su vecchia biforcazione
|
||||
// se devo fermarmi su biforcazione, verifico se sono già su vecchia biforcazione
|
||||
bool bSkip = false ;
|
||||
if ( bHaltOnFork) {
|
||||
auto iIter = GetForkPoint( m_vCrvData[nId].ptEnd) ;
|
||||
@@ -93,7 +94,7 @@ ChainCurves::GetChainFromNear( const Point3d& ptStart, bool bHaltOnFork, INTVECT
|
||||
}
|
||||
}
|
||||
|
||||
// concateno dopo la fine dell'entità di partenza
|
||||
// concateno dopo la fine dell'entità di partenza
|
||||
INTVECTOR vIdsAfter ;
|
||||
bool bClosed = false ;
|
||||
if ( ! bSkip && ! GetChainFromPoint( m_vCrvData[nId].ptEnd, m_vCrvData[nId].vtEnd,
|
||||
@@ -102,7 +103,7 @@ ChainCurves::GetChainFromNear( const Point3d& ptStart, bool bHaltOnFork, INTVECT
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se devo fermarmi su biforcazione, verifico se sono già su vecchia biforcazione
|
||||
// se devo fermarmi su biforcazione, verifico se sono già su vecchia biforcazione
|
||||
bool bRevSkip = false ;
|
||||
if ( bHaltOnFork) {
|
||||
auto iIter = GetForkPoint( m_vCrvData[nId].ptStart) ;
|
||||
@@ -113,7 +114,7 @@ ChainCurves::GetChainFromNear( const Point3d& ptStart, bool bHaltOnFork, INTVECT
|
||||
}
|
||||
}
|
||||
|
||||
// se non ho già chiuso l'anello, concateno prima dell'inizio dell'entità di partenza
|
||||
// se non ho già chiuso l'anello, concateno prima dell'inizio dell'entità di partenza
|
||||
INTVECTOR vIdsBefore ;
|
||||
if ( ! bClosed) {
|
||||
bool bRevClosed ;
|
||||
@@ -168,7 +169,7 @@ ChainCurves::GetChainFromPoint( const Point3d& ptStart, const Vector3d& vtStart,
|
||||
ptCurr = bEquiv ? m_vCrvData[nId].ptEnd : m_vCrvData[nId].ptStart ;
|
||||
vtCurr = bEquiv ? m_vCrvData[nId].vtEnd : - m_vCrvData[nId].vtStart ;
|
||||
// verifico se sono arrivato al punto di chiusura
|
||||
if ( AreSamePointEpsilon( ptCurr, ptStop, m_dToler)) {
|
||||
if ( AreSamePointEpsilon( ptCurr, ptStop, 0.5 * EPS_SMALL)) {
|
||||
bStopped = true ;
|
||||
break ;
|
||||
}
|
||||
@@ -258,7 +259,7 @@ ChainCurves::RemoveEntityFromGrid( int nId)
|
||||
bool
|
||||
ChainCurves::ChooseStart( const Point3d& ptStart, const INTVECTOR& vStart, int& nStart)
|
||||
{
|
||||
// numero di entità candidate
|
||||
// numero di entità candidate
|
||||
int nSize = int( vStart.size()) ;
|
||||
|
||||
// se nessuna, errore
|
||||
@@ -273,7 +274,7 @@ ChainCurves::ChooseStart( const Point3d& ptStart, const INTVECTOR& vStart, int&
|
||||
|
||||
// altrimenti, cerco la migliore
|
||||
int nI = - 1 ;
|
||||
double dSqDistMin = SQ_INFINITO ;
|
||||
double dDistMin = INFINITO ;
|
||||
for ( int i = 0 ; i < nSize ; ++ i) {
|
||||
// recupero indice e verso
|
||||
int nId = abs( vStart[i]) - 1 ;
|
||||
@@ -281,9 +282,12 @@ ChainCurves::ChooseStart( const Point3d& ptStart, const INTVECTOR& vStart, int&
|
||||
// calcolo un punto vicino all'estremo lungo la tangente
|
||||
Point3d ptNear = ( bEquiv ? m_vCrvData[nId].ptStart + m_vCrvData[nId].vtStart :
|
||||
m_vCrvData[nId].ptEnd - m_vCrvData[nId].vtEnd) ;
|
||||
double dSqDist = SqDist( ptStart, ptNear) ;
|
||||
if ( dSqDist < dSqDistMin) {
|
||||
dSqDistMin = dSqDist ;
|
||||
double dDist = Dist( ptStart, ptNear) ;
|
||||
// tengo il segmento più vicino al punto
|
||||
// favorendo eventualmente quello equiverso se entro EPS da un concorrente
|
||||
if ( dDist < dDistMin - EPS_SMALL ||
|
||||
((dDist < dDistMin + EPS_SMALL) && bEquiv && vStart[nI] < 0)) {
|
||||
dDistMin = dDist ;
|
||||
nI = i ;
|
||||
}
|
||||
}
|
||||
@@ -302,7 +306,7 @@ bool
|
||||
ChainCurves::ChooseNext( const Point3d& ptCurr, const Vector3d& vtCurr, const INTVECTOR& vNext, bool bHaltOnFork, int& nNext)
|
||||
{
|
||||
INTVECTOR vMyNext = vNext ;
|
||||
// scarto quelle entità che sono più vicine all'altro estremo del più vicino
|
||||
// scarto quelle entità che sono più vicine all'altro estremo del più vicino
|
||||
int nM = -1 ;
|
||||
Point3d ptRef ;
|
||||
double dSqMinDist = m_dToler * m_dToler ;
|
||||
@@ -319,19 +323,19 @@ ChainCurves::ChooseNext( const Point3d& ptCurr, const Vector3d& vtCurr, const IN
|
||||
}
|
||||
}
|
||||
for ( int i = 0 ; i < int( vMyNext.size()) ; ++ i) {
|
||||
// salto l'entità più vicina
|
||||
// salto l'entità più vicina
|
||||
if ( i == nM)
|
||||
continue ;
|
||||
// recupero indice e verso
|
||||
int nId = abs( vMyNext[i]) - 1 ;
|
||||
bool bEquiv = ( vMyNext[i] > 0) ;
|
||||
// verifico se più vicino al più vicino
|
||||
// verifico se più vicino al più vicino
|
||||
double dCurrSqDist = SqDist( ptCurr, ( bEquiv ? m_vCrvData[nId].ptStart : m_vCrvData[nId].ptEnd)) ;
|
||||
double dRefSqDist = SqDist( ptRef, ( bEquiv ? m_vCrvData[nId].ptStart : m_vCrvData[nId].ptEnd)) ;
|
||||
if ( dRefSqDist < dCurrSqDist)
|
||||
vMyNext[i] = 0 ;
|
||||
}
|
||||
// cerco la direzione più vicina
|
||||
// cerco la direzione più vicina
|
||||
int nI = -1 ;
|
||||
int nF = 0 ;
|
||||
INTVECTOR vFork ;
|
||||
@@ -343,7 +347,7 @@ ChainCurves::ChooseNext( const Point3d& ptCurr, const Vector3d& vtCurr, const IN
|
||||
// recupero indice e verso
|
||||
int nId = abs( vMyNext[i]) - 1 ;
|
||||
bool bEquiv = ( vMyNext[i] > 0) ;
|
||||
// incremento contatore indice entità tra cui scegliere
|
||||
// incremento contatore indice entità tra cui scegliere
|
||||
++ nF ;
|
||||
vFork.push_back( vMyNext[i]) ;
|
||||
// se vietata inversione, salto se controverso
|
||||
@@ -387,7 +391,7 @@ bool
|
||||
ChainCurves::ChoosePrev( const Point3d& ptCurr, const Vector3d& vtCurr, const INTVECTOR& vPrev, bool bHaltOnFork, int& nPrev)
|
||||
{
|
||||
INTVECTOR vMyPrev = vPrev ;
|
||||
// scarto quelle entità che sono più vicine all'altro estremo del più vicino
|
||||
// scarto quelle entità che sono più vicine all'altro estremo del più vicino
|
||||
int nM = -1 ;
|
||||
Point3d ptRef ;
|
||||
double dSqMinDist = m_dToler * m_dToler ;
|
||||
@@ -404,19 +408,19 @@ ChainCurves::ChoosePrev( const Point3d& ptCurr, const Vector3d& vtCurr, const IN
|
||||
}
|
||||
}
|
||||
for ( int i = 0 ; i < int( vMyPrev.size()) ; ++ i) {
|
||||
// salto l'entità più vicina
|
||||
// salto l'entità più vicina
|
||||
if ( i == nM)
|
||||
continue ;
|
||||
// recupero indice e verso
|
||||
int nId = abs( vMyPrev[i]) - 1 ;
|
||||
bool bEquiv = ( vMyPrev[i] < 0) ;
|
||||
// verifico se più vicino al più vicino
|
||||
// verifico se più vicino al più vicino
|
||||
double dCurrSqDist = SqDist( ptCurr, ( bEquiv ? m_vCrvData[nId].ptEnd : m_vCrvData[nId].ptStart)) ;
|
||||
double dRefSqDist = SqDist( ptRef, ( bEquiv ? m_vCrvData[nId].ptEnd : m_vCrvData[nId].ptStart)) ;
|
||||
if ( dRefSqDist < dCurrSqDist)
|
||||
vMyPrev[i] = 0 ;
|
||||
}
|
||||
// cerco la direzione più vicina
|
||||
// cerco la direzione più vicina
|
||||
int nI = - 1 ;
|
||||
int nF = 0 ;
|
||||
double dProScaMax = - 1.1 ;
|
||||
@@ -428,7 +432,7 @@ ChainCurves::ChoosePrev( const Point3d& ptCurr, const Vector3d& vtCurr, const IN
|
||||
// recupero indice e verso
|
||||
int nId = abs( vMyPrev[i]) - 1 ;
|
||||
bool bEquiv = ( vMyPrev[i] < 0) ;
|
||||
// incremento contatore indice entità tra cui scegliere
|
||||
// incremento contatore indice entità tra cui scegliere
|
||||
++ nF ;
|
||||
vFork.push_back( vMyPrev[i]) ;
|
||||
// se vietata inversione, salto se controverso
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
#include "CurveBezier.h"
|
||||
#include "CurveComposite.h"
|
||||
#include "CreateCurveAux.h"
|
||||
#include "DistPointLine.h"
|
||||
#include "GeoConst.h"
|
||||
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||
#include "/EgtDev/Include/EGkCircleCenTgCurve.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
@@ -45,7 +45,8 @@ static const NamedColor StdColor[] = {
|
||||
{ "FUCHSIA", FUCHSIA},
|
||||
{ "PURPLE", PURPLE},
|
||||
{ "ORANGE", ORANGE},
|
||||
{ "BROWN", BROWN}
|
||||
{ "BROWN", BROWN},
|
||||
{ "INVISIBLE", INVISIBLE}
|
||||
} ;
|
||||
static const int NUM_STDCOLOR = ( sizeof(StdColor) / sizeof(StdColor[0]) ) ;
|
||||
|
||||
@@ -127,7 +128,7 @@ GetHSVFromColor( const Color& cCol)
|
||||
hsv.dSat = dDelta / dMax ;
|
||||
if ( cCol.GetRed() >= dMax) // tra giallo e magenta
|
||||
hsv.dHue = ( cCol.GetGreen() - cCol.GetBlue()) / dDelta ;
|
||||
else if( cCol.GetGreen() >= dMax) // tra ciano e giallo
|
||||
else if ( cCol.GetGreen() >= dMax) // tra ciano e giallo
|
||||
hsv.dHue = 2.0 + ( cCol.GetBlue() - cCol.GetRed()) / dDelta ;
|
||||
else // tra magenta e ciano
|
||||
hsv.dHue = 4.0 + ( cCol.GetRed() - cCol.GetGreen()) / dDelta ;
|
||||
|
||||
+164
-43
@@ -22,6 +22,7 @@
|
||||
#include "GeoObjFactory.h"
|
||||
#include "NgeWriter.h"
|
||||
#include "NgeReader.h"
|
||||
#include "Voronoi.h"
|
||||
#include "/EgtDev/Include/EGkAngle.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkUiUnits.h"
|
||||
@@ -61,15 +62,14 @@ class ArcApproxer
|
||||
//----------------------------------------------------------------------------
|
||||
CurveArc::CurveArc( void)
|
||||
: m_nStatus( TO_VERIFY), m_PtCen(), m_VtN(), m_VtS(), m_dRad(),
|
||||
m_dAngCenDeg(), m_dDeltaN(), m_VtExtr(), m_dThick()
|
||||
m_dAngCenDeg(), m_dDeltaN(), m_VtExtr(), m_dThick(), m_nTempProp{0,0}, m_dTempParam{0.0, 0.0}, m_pVoronoiObj( nullptr)
|
||||
{
|
||||
m_nTempProp[0] = 0 ;
|
||||
m_nTempProp[1] = 0 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
CurveArc::~CurveArc( void)
|
||||
{
|
||||
ResetVoronoiObject() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -91,7 +91,9 @@ CurveArc::Set( const Point3d& ptCen, const Vector3d& vtN, double dRad,
|
||||
// sistemo i versori
|
||||
m_VtN.Normalize() ;
|
||||
m_VtS.Normalize() ;
|
||||
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -117,6 +119,8 @@ CurveArc::Set( const Point3d& ptCen, const Vector3d& vtN, double dRad)
|
||||
m_dDeltaN = 0 ;
|
||||
m_nStatus = TO_VERIFY ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -138,6 +142,8 @@ CurveArc::SetXY( const Point3d& ptCen, double dRad, double dAngIniDeg, double dA
|
||||
m_dDeltaN = dDeltaZ ;
|
||||
m_nStatus = TO_VERIFY ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -159,6 +165,8 @@ CurveArc::SetXY( const Point3d& ptCen, double dRad)
|
||||
m_dDeltaN = 0 ;
|
||||
m_nStatus = TO_VERIFY ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -181,7 +189,7 @@ CurveArc::Set3P( const Point3d& ptStart, const Point3d& ptOther, const Point3d&
|
||||
// calcolo del versore normale
|
||||
m_VtN = vtA ^ vtB ;
|
||||
double dNSqLen = m_VtN.SqLen() ;
|
||||
// se i punti sono praticamente allineati non si può calcolare la circonferenza
|
||||
// se i punti sono praticamente allineati non si può calcolare la circonferenza
|
||||
if ( ! m_VtN.Normalize( EPS_ZERO))
|
||||
return false ;
|
||||
// calcolo del centro
|
||||
@@ -208,19 +216,21 @@ CurveArc::Set3P( const Point3d& ptStart, const Point3d& ptOther, const Point3d&
|
||||
if ( ! m_VtS.GetRotation( ( ptEnd - m_PtCen), m_VtN, dAng2Deg, bDet2) || ! bDet2)
|
||||
return false ;
|
||||
// deduzione dell'angolo al centro
|
||||
// se uno dei due angoli è nullo, errore
|
||||
// se uno dei due angoli è nullo, errore
|
||||
if ( abs( dAng1Deg) < EPS_ANG_SMALL || abs( dAng2Deg) < EPS_ANG_SMALL)
|
||||
return false ;
|
||||
// se i due angoli hanno lo stesso segno e Ang1 è minore di Ang2 in modulo
|
||||
// se i due angoli hanno lo stesso segno e Ang1 è minore di Ang2 in modulo
|
||||
else if ( dAng1Deg * dAng2Deg > 0 && abs( dAng1Deg) < abs( dAng2Deg))
|
||||
m_dAngCenDeg = dAng2Deg ;
|
||||
// altrimenti hanno segno opposto oppure Ang1 è maggiore di Ang2 in modulo
|
||||
// altrimenti hanno segno opposto oppure Ang1 è maggiore di Ang2 in modulo
|
||||
else
|
||||
m_dAngCenDeg = - _copysign( ANG_FULL, dAng2Deg) + dAng2Deg ;
|
||||
}
|
||||
// non c'è DeltaN
|
||||
// non c'è DeltaN
|
||||
m_dDeltaN = 0 ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -245,7 +255,7 @@ CurveArc::Set2PNB( const Point3d& ptIni, const Point3d& ptFin, const Vector3d& v
|
||||
Vector3d vtDiff = ptFin - ptIni ;
|
||||
if ( vtDiff.IsSmall())
|
||||
return false ;
|
||||
// deltaN eventuale ( è componente parallela a VtN)
|
||||
// deltaN eventuale ( è componente parallela a VtN)
|
||||
m_dDeltaN = vtDiff * m_VtN ;
|
||||
vtDiff -= m_dDeltaN * m_VtN ;
|
||||
if ( abs( m_dDeltaN) < EPS_SMALL)
|
||||
@@ -268,6 +278,8 @@ CurveArc::Set2PNB( const Point3d& ptIni, const Point3d& ptFin, const Vector3d& v
|
||||
// calcolo l'angolo al centro
|
||||
m_dAngCenDeg = 4 * atan( dBulge) * RADTODEG ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -292,7 +304,7 @@ CurveArc::Set2PD( const Point3d& ptStart, const Point3d& ptEnd, double dDirStart
|
||||
// calcolo del versore normale
|
||||
m_VtN = vtA ^ vtB ;
|
||||
double dNSqLen = m_VtN.SqLen() ;
|
||||
// se tangente e punti sono praticamente allineati non si può calcolare la circonferenza
|
||||
// se tangente e punti sono praticamente allineati non si può calcolare la circonferenza
|
||||
if ( ! m_VtN.Normalize( EPS_ZERO))
|
||||
return false ;
|
||||
// calcolo del centro
|
||||
@@ -309,7 +321,7 @@ CurveArc::Set2PD( const Point3d& ptStart, const Point3d& ptEnd, double dDirStart
|
||||
double dAng1Deg ;
|
||||
if ( ! m_VtS.GetRotation( ( ptEnd - m_PtCen), m_VtN, dAng1Deg, bDet1) || ! bDet1)
|
||||
return false ;
|
||||
// poichè il senso di rotazione è sempre CCW, se l'angolo è negativo prendo il suo complemento al giro
|
||||
// poichè il senso di rotazione è sempre CCW, se l'angolo è negativo prendo il suo complemento al giro
|
||||
if ( dAng1Deg < 0)
|
||||
m_dAngCenDeg = ANG_FULL + dAng1Deg ;
|
||||
else
|
||||
@@ -324,6 +336,8 @@ CurveArc::Set2PD( const Point3d& ptStart, const Point3d& ptEnd, double dDirStart
|
||||
m_dDeltaN = - m_dDeltaN ;
|
||||
}
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -384,7 +398,7 @@ CurveArc::Set2PRS( const Point3d& ptStart, const Point3d& ptEnd, double dRad, bo
|
||||
if ( dLenA > ( dRad - EPS_ZERO))
|
||||
dLenH = 0 ;
|
||||
else
|
||||
dLenH= sqrt( dRad * dRad - dLenA * dLenA) ;
|
||||
dLenH = sqrt( dRad * dRad - dLenA * dLenA) ;
|
||||
// versore dal punto medio della corda al centro
|
||||
Vector3d vtH = vtA / dLenA ;
|
||||
vtH.Rotate( Z_AX, 0, ( bCCW ? 1 : -1)) ;
|
||||
@@ -396,16 +410,19 @@ CurveArc::Set2PRS( const Point3d& ptStart, const Point3d& ptEnd, double dRad, bo
|
||||
m_dRad = dRad ;
|
||||
// calcolo il versore di start
|
||||
m_VtS = ( ptStart - m_PtCen) / m_dRad ;
|
||||
m_VtS.Normalize() ;
|
||||
// calcolo l'angolo al centro
|
||||
bool bDet ;
|
||||
if ( ! m_VtS.GetRotation( ( ptEnd - m_PtCen), m_VtN, m_dAngCenDeg, bDet) || ! bDet)
|
||||
return false ;
|
||||
// quando è 180deg il segno è determinato solo dal senso
|
||||
// quando è 180deg il segno è determinato solo dal senso
|
||||
if ( abs( m_dAngCenDeg - ANG_STRAIGHT) < 10 * EPS_ANG_SMALL &&
|
||||
( ( bCCW && m_dAngCenDeg < 0) ||
|
||||
( ! bCCW && m_dAngCenDeg > 0)))
|
||||
m_dAngCenDeg = - m_dAngCenDeg ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -460,6 +477,8 @@ CurveArc::SetCPA( const Point3d& ptCen, const Point3d& ptStart, double dAngCenDe
|
||||
// assegno l'angolo al centro
|
||||
m_dAngCenDeg = dAngCenDeg ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -511,11 +530,12 @@ CurveArc::SetC2P( const Point3d& ptCen, const Point3d& ptStart, const Point3d& p
|
||||
if ( m_dRad < EPS_ZERO)
|
||||
return false ;
|
||||
m_VtS /= m_dRad ;
|
||||
// calcolo l'angolo al centro (la funzione trova sempre il più piccolo)
|
||||
// calcolo l'angolo al centro (la funzione trova sempre il più piccolo)
|
||||
bool bDet ;
|
||||
if ( ! m_VtS.GetRotation( ( ptNearEnd - m_PtCen), m_VtN, m_dAngCenDeg, bDet) || ! bDet)
|
||||
return false ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -584,6 +604,8 @@ CurveArc::CopyFrom( const CurveArc& caSrc)
|
||||
m_dThick = caSrc.m_dThick ;
|
||||
m_nTempProp[0] = caSrc.m_nTempProp[0] ;
|
||||
m_nTempProp[1] = caSrc.m_nTempProp[1] ;
|
||||
m_dTempParam[0] = caSrc.m_dTempParam[0] ;
|
||||
m_dTempParam[1] = caSrc.m_dTempParam[1] ;
|
||||
return Set( caSrc.m_PtCen, caSrc.m_VtN, caSrc.m_dRad,
|
||||
caSrc.m_VtS, caSrc.m_dAngCenDeg, caSrc.m_dDeltaN) ;
|
||||
}
|
||||
@@ -712,7 +734,7 @@ CurveArc::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità del frame
|
||||
// verifico validità del frame
|
||||
if ( frRef.GetType() == Frame3d::ERR)
|
||||
return false ;
|
||||
// assegno il box nel riferimento
|
||||
@@ -799,7 +821,7 @@ CurveArc::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
||||
}
|
||||
}
|
||||
|
||||
// se c'è estrusione, devo tenerne conto
|
||||
// se c'è estrusione, devo tenerne conto
|
||||
if ( ! m_VtExtr.IsSmall() && abs( m_dThick) > EPS_SMALL) {
|
||||
Vector3d vtFrExtr = m_VtExtr ;
|
||||
vtFrExtr.ToGlob( frRef) ;
|
||||
@@ -817,7 +839,7 @@ bool
|
||||
CurveArc::Validate( void)
|
||||
{
|
||||
if ( m_nStatus == TO_VERIFY) {
|
||||
// limito l'angolo al centro a un giro se è piatto ( non è elica)
|
||||
// limito l'angolo al centro a un giro se è piatto ( non è elica)
|
||||
if ( abs( m_dDeltaN) < EPS_SMALL) {
|
||||
if ( m_dAngCenDeg > ANG_FULL)
|
||||
m_dAngCenDeg = ANG_FULL ;
|
||||
@@ -1146,7 +1168,7 @@ CurveArc::ApproxWithLines( double dLinTol, double dAngTolDeg, int nType, PolyLin
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se necessario, sistemo per convessità dalla parte ammessa
|
||||
// se necessario, sistemo per convessità dalla parte ammessa
|
||||
if ( nType == APL_RIGHT_CONVEX || nType == APL_LEFT_CONVEX) {
|
||||
if ( ! PL.MakeConvex( vtExtr, ( nType == APL_LEFT_CONVEX)))
|
||||
return false ;
|
||||
@@ -1220,7 +1242,7 @@ CurveArc::CopyParamRange( double dUStart, double dUEnd) const
|
||||
return nullptr ;
|
||||
// se il parametro start supera quello di end
|
||||
if ( dUStart > dUEnd - EPS_PARAM) {
|
||||
// se curva aperta, il trim la cancella completamente quindi non resta alcunchè
|
||||
// se curva aperta, il trim la cancella completamente quindi non resta alcunchè
|
||||
if ( ! IsClosed())
|
||||
return nullptr ;
|
||||
// se curva chiusa, il trim si avvolge attorno al punto di giunzione
|
||||
@@ -1261,7 +1283,9 @@ CurveArc::Invert( void)
|
||||
m_dAngCenDeg = - m_dAngCenDeg ;
|
||||
// l'incremento sulla normale inverte il segno
|
||||
m_dDeltaN = - m_dDeltaN ;
|
||||
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1270,7 +1294,7 @@ CurveArc::Invert( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveArc::SimpleOffset( double dDist, int nType)
|
||||
CurveArc::SimpleOffset( double dDist, int nType, double dMaxAngExt)
|
||||
{
|
||||
// la curva deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
@@ -1295,6 +1319,8 @@ CurveArc::SimpleOffset( double dDist, int nType)
|
||||
// aggiorno il raggio
|
||||
m_dRad = dNewRad ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1303,10 +1329,10 @@ CurveArc::SimpleOffset( double dDist, int nType)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveArc::MyExtendedOffset( double dDist, bool bAll, int nType)
|
||||
CurveArc::MyExtendedOffset( double dDist, bool bAll)
|
||||
{
|
||||
// bAll == true fa accettare raggi nulli ==> da usare solo internamente
|
||||
// quando si è sicuri di aumentare subito il raggio o di cancellare
|
||||
// quando si è sicuri di aumentare subito il raggio o di cancellare
|
||||
|
||||
// la curva deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
@@ -1339,6 +1365,8 @@ CurveArc::MyExtendedOffset( double dDist, bool bAll, int nType)
|
||||
// aggiorno il raggio
|
||||
m_dRad = dNewRad ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1382,7 +1410,7 @@ CurveArc::ModifyEnd( const Point3d& ptNewEnd)
|
||||
ptOldEndIntr.ToLoc( frIntr) ;
|
||||
Point3d ptEndIntr = ptNewEnd ;
|
||||
ptEndIntr.ToLoc( frIntr) ;
|
||||
// se coincidono nel piano XY, è cambiato solo il deltaN
|
||||
// se coincidono nel piano XY, è cambiato solo il deltaN
|
||||
if ( AreSamePointXYExact( ptOldEndIntr, ptEndIntr)) {
|
||||
m_dDeltaN += ptEndIntr.z - ptOldEndIntr.z ;
|
||||
}
|
||||
@@ -1411,6 +1439,8 @@ CurveArc::ModifyEnd( const Point3d& ptNewEnd)
|
||||
m_dDeltaN = arcAux.m_dDeltaN ;
|
||||
}
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1496,6 +1526,8 @@ CurveArc::TrimStartAtLen( double dLenTrim)
|
||||
}
|
||||
}
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1523,6 +1555,8 @@ CurveArc::TrimEndAtLen( double dLenTrim)
|
||||
m_dDeltaN *= dLenTrim / dLen ;
|
||||
}
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1566,6 +1600,8 @@ CurveArc::ExtendEndByLen( double dLenExt)
|
||||
else if ( abs( m_dAngCenDeg) > ANG_FULL)
|
||||
m_dAngCenDeg = _copysign( ANG_FULL, m_dAngCenDeg) ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1580,6 +1616,10 @@ CurveArc::Translate( const Vector3d& vtMove)
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// traslo Voronoi
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
m_pVoronoiObj->Translate( vtMove) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1597,10 +1637,14 @@ CurveArc::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, dou
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// verifico validità dell'asse di rotazione
|
||||
// verifico validità dell'asse di rotazione
|
||||
if ( vtAx.IsSmall())
|
||||
return false ;
|
||||
|
||||
// ruoto Voronoi
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
m_pVoronoiObj->Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1630,6 +1674,8 @@ CurveArc::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dC
|
||||
// verifico non sia nulla
|
||||
if ( abs( dCoeffX) < EPS_ZERO || m_dRad * abs( dCoeffX) <= EPS_SMALL)
|
||||
return false ;
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
// scalo il centro e le dimensioni lineari
|
||||
@@ -1657,6 +1703,8 @@ CurveArc::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dC
|
||||
// verifico non sia nulla
|
||||
if ( abs( dCoeffY) < EPS_ZERO || m_dRad * abs( dCoeffY) <= EPS_SMALL)
|
||||
return false ;
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
// scalo il centro e le dimensioni lineari
|
||||
@@ -1684,6 +1732,8 @@ CurveArc::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dC
|
||||
// verifico non sia nulla
|
||||
if ( abs( dCoeffZ) < EPS_ZERO || m_dRad * abs( dCoeffZ) <= EPS_SMALL)
|
||||
return false ;
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
// scalo il centro e le dimensioni lineari
|
||||
@@ -1711,6 +1761,8 @@ CurveArc::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dC
|
||||
// verifico non sia nulla
|
||||
if ( abs( dCoeffX) < EPS_ZERO || m_dRad * abs( dCoeffX) <= EPS_SMALL)
|
||||
return false ;
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
// scalo il centro e le dimensioni lineari
|
||||
@@ -1740,10 +1792,12 @@ CurveArc::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// verifico validità del piano di specchiatura
|
||||
// verifico validità del piano di specchiatura
|
||||
if ( vtNorm.IsSmall())
|
||||
return false ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1766,15 +1820,17 @@ CurveArc::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vt
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// verifico validità dei parametri
|
||||
// verifico validità dei parametri
|
||||
if ( vtNorm.IsSmall() || vtDir.IsSmall())
|
||||
return false ;
|
||||
|
||||
// possibile solo se l'arco è piatto e il piano di scorrimento coincide con quello dell'arco
|
||||
// possibile solo se l'arco è piatto e il piano di scorrimento coincide con quello dell'arco
|
||||
if ( ! ( abs( m_dDeltaN) < EPS_SMALL) ||
|
||||
! AreSameOrOppositeVectorExact( m_VtN, vtNorm))
|
||||
return false ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1798,14 +1854,18 @@ CurveArc::ToGlob( const Frame3d& frRef)
|
||||
// la curva deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità del frame
|
||||
// verifico validità del frame
|
||||
if ( frRef.GetType() == Frame3d::ERR)
|
||||
return false ;
|
||||
|
||||
// se frame identità, non devo fare alcunché
|
||||
// se frame identità, non devo fare alcunché
|
||||
if ( IsGlobFrame( frRef))
|
||||
return true ;
|
||||
|
||||
// trasformo Voronoi
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
m_pVoronoiObj->ToGlob( frRef) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1823,14 +1883,18 @@ CurveArc::ToLoc( const Frame3d& frRef)
|
||||
// la curva deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità del frame
|
||||
// verifico validità del frame
|
||||
if ( frRef.GetType() == Frame3d::ERR)
|
||||
return false ;
|
||||
|
||||
// se frame identità, non devo fare alcunché
|
||||
// se frame identità, non devo fare alcunché
|
||||
if ( IsGlobFrame( frRef))
|
||||
return true ;
|
||||
|
||||
// trasformo Voronoi
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
m_pVoronoiObj->ToLoc( frRef) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1848,14 +1912,18 @@ CurveArc::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
||||
// la curva deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità dei frame
|
||||
// verifico validità dei frame
|
||||
if ( frOri.GetType() == Frame3d::ERR || frDest.GetType() == Frame3d::ERR)
|
||||
return false ;
|
||||
|
||||
// se i due riferimenti coincidono, non devo fare alcunché
|
||||
// se i due riferimenti coincidono, non devo fare alcunché
|
||||
if ( AreSameFrame( frOri, frDest))
|
||||
return true ;
|
||||
|
||||
// trasformo Voronoi
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
m_pVoronoiObj->LocToLoc( frOri, frDest) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1879,6 +1947,8 @@ CurveArc::InvertN( void)
|
||||
m_dAngCenDeg = - m_dAngCenDeg ;
|
||||
m_dDeltaN = - m_dDeltaN ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1930,12 +2000,12 @@ CurveArc::MyCalcPointParamPosiz( const Point3d& ptP, double& dU, int& nPos, doub
|
||||
// verifica posizione punto su arco
|
||||
nPos = PP_NULL ; // fuori
|
||||
if ( abs( DiffAngle( dAngDeg, 0) * DEGTORAD * m_dRad) < dLinTol) {
|
||||
nPos = ( IsACircle() ? PP_MID : PP_START) ; // se cerchio è interno, altrimenti vicino a inizio
|
||||
nPos = ( IsACircle() ? PP_MID : PP_START) ; // se cerchio è interno, altrimenti vicino a inizio
|
||||
dU = AngleNearAngle( dAngDeg, 0) / m_dAngCenDeg ;
|
||||
dU = max( dU, 0.) ;
|
||||
}
|
||||
else if ( abs( DiffAngle( dAngDeg, m_dAngCenDeg) * DEGTORAD * m_dRad) < dLinTol) {
|
||||
nPos = ( IsACircle() ? PP_MID : PP_END) ; // se cerchio è interno, altrimenti vicino a fine
|
||||
nPos = ( IsACircle() ? PP_MID : PP_END) ; // se cerchio è interno, altrimenti vicino a fine
|
||||
dU = AngleNearAngle( dAngDeg, m_dAngCenDeg) / m_dAngCenDeg ;
|
||||
dU = min( dU, 1.) ;
|
||||
}
|
||||
@@ -1952,13 +2022,15 @@ CurveArc::ChangeRadius( double dNewRadius)
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// verifico validità del raggio
|
||||
// verifico validità del raggio
|
||||
if ( ! ( dNewRadius > EPS_SMALL && dNewRadius < MAX_ARC_RAD))
|
||||
return false ;
|
||||
|
||||
// cambio il raggio
|
||||
m_dRad = dNewRadius ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1978,6 +2050,8 @@ CurveArc::ChangeDeltaN( double dNewDeltaN)
|
||||
// cambio il parametro
|
||||
m_dDeltaN = dNewDeltaN ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1994,13 +2068,15 @@ CurveArc::ChangeAngCenter( double dNewAngCenDeg)
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// verifico accettabilità angolo
|
||||
// verifico accettabilità angolo
|
||||
if ( ! ( abs( m_dAngCenDeg) > EPS_ANG_ZERO))
|
||||
return false ;
|
||||
|
||||
// cambio il parametro
|
||||
m_dAngCenDeg = dNewAngCenDeg ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -2025,6 +2101,8 @@ CurveArc::ChangeStartPoint( double dU)
|
||||
if ( ! vtDir.Normalize())
|
||||
return false ;
|
||||
m_VtS = vtDir ;
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
return true ;
|
||||
@@ -2044,6 +2122,8 @@ CurveArc::ToExplementary( void)
|
||||
// basta prendere l'angolo al centro che completa il giro
|
||||
m_dAngCenDeg = - _copysign( ANG_FULL, m_dAngCenDeg) + m_dAngCenDeg ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -2073,6 +2153,8 @@ CurveArc::Flip( void)
|
||||
m_VtS.Normalize() ;
|
||||
m_dAngCenDeg = - m_dAngCenDeg ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -2082,11 +2164,11 @@ CurveArc::Flip( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Oggetto locale per approssimazione di archi
|
||||
// Approx interna è quella cordale standard.
|
||||
// Approx esterna è quella tangente a inizio e fine con metà tratto e un punto in più.
|
||||
// Approx interna è quella cordale standard.
|
||||
// Approx esterna è quella tangente a inizio e fine con metà tratto e un punto in più.
|
||||
// I punti si calcolano a partire dal triangolo tra due punti consecutivi interni e il centro,
|
||||
// usando il versore medio dal centro e moltiplicandolo per il coefficiente ( 2 / ( 1 + cosA)).
|
||||
// Il versore dell'ultimo punto è già stato calcolato per il penultimo.
|
||||
// Il versore dell'ultimo punto è già stato calcolato per il penultimo.
|
||||
//----------------------------------------------------------------------------
|
||||
ArcApproxer::ArcApproxer( double dLinTol, double dAngTolDeg, bool bInside, const CurveArc& arArc)
|
||||
{
|
||||
@@ -2187,3 +2269,42 @@ ArcApproxer::GetPoint( double& dU, Point3d& ptP)
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveArc::CalcVoronoiObject() const
|
||||
{
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// creo oggetto vroni con la curva
|
||||
m_pVoronoiObj = new( std::nothrow) Voronoi( this, false) ;
|
||||
if ( m_pVoronoiObj == nullptr)
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Voronoi*
|
||||
CurveArc::GetVoronoiObject() const
|
||||
{
|
||||
if ( m_nStatus != OK)
|
||||
return nullptr ;
|
||||
|
||||
// se non è stato calcolato, lo calcolo
|
||||
if ( m_pVoronoiObj == nullptr)
|
||||
CalcVoronoiObject() ;
|
||||
|
||||
// restituisco Voronoi
|
||||
return m_pVoronoiObj ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
CurveArc::ResetVoronoiObject() const
|
||||
{
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
delete m_pVoronoiObj ;
|
||||
m_pVoronoiObj = nullptr ;
|
||||
}
|
||||
|
||||
+22
-7
@@ -19,6 +19,8 @@
|
||||
#include "GeoObjRW.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
|
||||
class Voronoi ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class CurveArc : public ICurveArc, public IGeoObjRW
|
||||
{
|
||||
@@ -54,6 +56,11 @@ class CurveArc : public ICurveArc, public IGeoObjRW
|
||||
m_nTempProp[nPropInd] = nProp ; }
|
||||
int GetTempProp( int nPropInd = 0) const override
|
||||
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
||||
void SetTempParam( double dParam, int nParamInd = 0) override
|
||||
{ if ( nParamInd >= 0 && nParamInd < 2)
|
||||
m_dTempParam[nParamInd] = dParam ; }
|
||||
double GetTempParam( int nParamInd = 0) const override
|
||||
{ return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; }
|
||||
|
||||
public : // ICurve
|
||||
bool IsSimple( void) const override
|
||||
@@ -109,7 +116,7 @@ class CurveArc : public ICurveArc, public IGeoObjRW
|
||||
{ return ApproxWithArcs( dLinTol, dAngTolDeg, PA) ; }
|
||||
ICurve* CopyParamRange( double dUStart, double dUEnd) const override ;
|
||||
bool Invert( void) override ;
|
||||
bool SimpleOffset( double dDist, int nType = OFF_FILLET) override ;
|
||||
bool SimpleOffset( double dDist, int nType = OFF_FILLET, double dMaxAngExt = ANG_RIGHT) override ;
|
||||
bool ModifyStart( const Point3d& ptNewStart) override ;
|
||||
bool ModifyEnd( const Point3d& ptNewEnd) override ;
|
||||
bool SetExtrusion( const Vector3d& vtExtr) override
|
||||
@@ -171,32 +178,38 @@ class CurveArc : public ICurveArc, public IGeoObjRW
|
||||
bool ChangeDeltaN( double dNewDeltaN) override ;
|
||||
bool ChangeAngCenter( double dNewAngCenDeg) override ;
|
||||
bool ChangeStartPoint( double dU) override ;
|
||||
bool ExtendedOffset( double dDist, int nType = OFF_FILLET) override
|
||||
{ return MyExtendedOffset( dDist, false, nType) ; }
|
||||
bool ExtendedOffset( double dDist) override
|
||||
{ return MyExtendedOffset( dDist, false) ; }
|
||||
bool ToExplementary( void) override ;
|
||||
bool Flip( void) override ;
|
||||
|
||||
public : // IGeoObjRW
|
||||
int GetNgeId( void) const override ;
|
||||
bool Save( NgeWriter& ngeOut) const override ;
|
||||
bool PreSave( GdbGeo& Wrapper) const override { return true ; }
|
||||
bool PostSave( GdbGeo& Wrapper) const override { return true ; }
|
||||
bool Load( NgeReader& ngeIn) override ;
|
||||
bool PostLoad( GdbGeo& Wrapper) override { return true ; }
|
||||
|
||||
public :
|
||||
CurveArc( void) ;
|
||||
CurveArc( const CurveArc& caSrc)
|
||||
CurveArc( const CurveArc& caSrc) : m_pVoronoiObj( nullptr)
|
||||
{ if ( ! CopyFrom( caSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "CurveArc : copy constructor error")}
|
||||
CurveArc& operator =( const CurveArc& caSrc)
|
||||
{ if ( ! CopyFrom( caSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "CurveArc : copy error")
|
||||
return *this ; }
|
||||
bool MyExtendedOffset( double dDist, bool bAll, int nType = OFF_FILLET) ;
|
||||
bool MyExtendedOffset( double dDist, bool bAll) ;
|
||||
bool MyCalcPointParamPosiz( const Point3d& ptP, double& dU, int& nPos, double dLinTol) const ;
|
||||
Voronoi* GetVoronoiObject( void) const ;
|
||||
void ResetVoronoiObject( void) const ;
|
||||
|
||||
private :
|
||||
bool CopyFrom( const CurveArc& caSrc) ;
|
||||
bool Validate( void) ;
|
||||
bool GetDir( double dU, Vector3d& vtDir) const ;
|
||||
bool GetDir( double dU, Vector3d& vtDir) const ;
|
||||
bool CalcVoronoiObject( void) const ;
|
||||
|
||||
private :
|
||||
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
|
||||
@@ -212,7 +225,9 @@ class CurveArc : public ICurveArc, public IGeoObjRW
|
||||
double m_dDeltaN ; // variazione di quota lungo VtN della fine rispetto all'inizio
|
||||
Vector3d m_VtExtr ; // vettore estrusione (normalmente coincide con m_VtN)
|
||||
double m_dThick ; // spessore
|
||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||
mutable Voronoi* m_pVoronoiObj ; // Voronoi
|
||||
} ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
+1847
-78
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,8 @@
|
||||
|
||||
#include "/EgtDev/Include/EGkCurveAux.h"
|
||||
|
||||
class Voronoi ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool IsClosed( const ICurve& crvC) ;
|
||||
bool IsValidParam( const ICurve& crvC, double dPar, ICurve::Side nSide) ;
|
||||
@@ -31,3 +33,6 @@ bool CurveGetArea( const ICurve& crvC, Plane3d& plPlane, double& dArea) ;
|
||||
bool CurveDump( const ICurve& crvC, std::string& sOut, bool bMM, const char* szNewLine) ;
|
||||
bool CopyExtrusion( const ICurve* pSouCrv, ICurve* pDestCrv) ;
|
||||
bool CopyThickness( const ICurve* pSouCrv, ICurve* pDestCrv) ;
|
||||
ICurveBezier* ApproxCurveBezierWithSingleCubic( const ICurve* pCrv) ;
|
||||
Voronoi* GetCurveVoronoi( const ICurve& crvC) ;
|
||||
bool GetChainedCurves( ICRVCOMPOPOVECTOR& vCrv, double dChainTol, bool bAllowInvert) ;
|
||||
+437
-29
@@ -13,25 +13,30 @@
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "CurveAux.h"
|
||||
#include "CurveBezier.h"
|
||||
#include "CurveComposite.h"
|
||||
#include "DistPointCrvBezier.h"
|
||||
#include "BiArcs.h"
|
||||
#include "GeoConst.h"
|
||||
#include "PolygonPlane.h"
|
||||
#include "DistPointLine.h"
|
||||
#include "GeoObjFactory.h"
|
||||
#include "NgeWriter.h"
|
||||
#include "NgeReader.h"
|
||||
#include "PolynomialPoint3d.h"
|
||||
#include "Bernstein.h"
|
||||
#include "deCasteljau.h"
|
||||
#include "Voronoi.h"
|
||||
#include "IntersLineLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkUiUnits.h"
|
||||
#include "/EgtDev/Include/ENkPolynomial.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include <array>
|
||||
|
||||
using namespace std ;
|
||||
@@ -45,15 +50,14 @@ GEOOBJ_REGISTER( CRV_BEZIER, NGE_C_BEZ, CurveBezier) ;
|
||||
//----------------------------------------------------------------------------
|
||||
CurveBezier::CurveBezier( void)
|
||||
: m_nStatus( TO_VERIFY), m_nDeg(), m_bRat( false), m_dParSing( -2),
|
||||
m_VtExtr(), m_dThick()
|
||||
m_VtExtr(), m_dThick(), m_nTempProp{0,0}, m_dTempParam{0.0,0.0}, m_pVoronoiObj( nullptr)
|
||||
{
|
||||
m_nTempProp[0] = 0 ;
|
||||
m_nTempProp[1] = 0 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
CurveBezier::~CurveBezier( void)
|
||||
{
|
||||
ResetVoronoiObject() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -77,6 +81,8 @@ CurveBezier::Init( int nDeg, bool bIsRational)
|
||||
m_vWeCtrl.clear() ;
|
||||
m_nStatus = TO_VERIFY ;
|
||||
|
||||
// imposto ricalcolo Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -87,8 +93,11 @@ CurveBezier::Init( int nDeg, bool bIsRational)
|
||||
bool
|
||||
CurveBezier::SetControlPoint( int nInd, const Point3d& ptCtrl)
|
||||
{
|
||||
// verifico validità indice
|
||||
if ( m_nStatus != OK || m_bRat || nInd < 0 || nInd > m_nDeg)
|
||||
// verifico validità indice e punto
|
||||
if ( m_nStatus != OK || m_bRat || nInd < 0 || nInd > m_nDeg || ! ptCtrl.IsValid())
|
||||
return false ;
|
||||
|
||||
if ( abs( ptCtrl.x) > INFINITO || abs( ptCtrl.y) > INFINITO || abs( ptCtrl.z) > INFINITO)
|
||||
return false ;
|
||||
|
||||
// assegno il valore
|
||||
@@ -101,6 +110,8 @@ CurveBezier::SetControlPoint( int nInd, const Point3d& ptCtrl)
|
||||
// annullo analisi presenza singolarità
|
||||
m_dParSing = - 2 ;
|
||||
|
||||
// imposto ricalcolo Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -115,8 +126,11 @@ CurveBezier::SetControlPoint( int nInd, const Point3d& ptCtrl, double dW)
|
||||
if ( m_nStatus != OK || ! m_bRat || nInd < 0 || nInd > m_nDeg)
|
||||
return false ;
|
||||
|
||||
// verifico che il peso non sia nullo o negativo
|
||||
if ( dW < EPS_SMALL)
|
||||
// verifico che il punto sia valido e il peso non sia nullo o negativo
|
||||
if ( ! ptCtrl.IsValid() || dW < EPS_SMALL || ! isfinite( dW) || dW > INFINITO)
|
||||
return false ;
|
||||
|
||||
if ( abs( ptCtrl.x) > INFINITO || abs( ptCtrl.y) > INFINITO || abs( ptCtrl.z) > INFINITO)
|
||||
return false ;
|
||||
|
||||
// assegno il valore e il peso
|
||||
@@ -126,12 +140,40 @@ CurveBezier::SetControlPoint( int nInd, const Point3d& ptCtrl, double dW)
|
||||
// annullo analisi presenza singolarità
|
||||
m_dParSing = - 2 ;
|
||||
|
||||
// imposto ricalcolo Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::SetControlWeight( int nInd, double dW)
|
||||
{
|
||||
// verifico validità, razionalità e indice
|
||||
if ( m_nStatus != OK || ! m_bRat || nInd < 0 || nInd > m_nDeg)
|
||||
return false ;
|
||||
|
||||
// verifico che il peso non sia nullo o negativo
|
||||
if ( dW < EPS_SMALL || ! isfinite( dW) || dW > INFINITO)
|
||||
return false ;
|
||||
|
||||
// assegno il valore e il peso
|
||||
m_vWeCtrl[nInd] = dW ;
|
||||
|
||||
// annullo analisi presenza singolarità
|
||||
m_dParSing = - 2 ;
|
||||
|
||||
// imposto ricalcolo Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::FromArc( const ICurveArc& crArc)
|
||||
@@ -189,6 +231,35 @@ CurveBezier::FromArc( const ICurveArc& crArc)
|
||||
SetControlPoint( 1, ptNew1, dW) ;
|
||||
SetControlPoint( 2, ptNew2, dW) ;
|
||||
SetControlPoint( 3, ptEnd, 1) ;
|
||||
|
||||
//// anziché usare una bezier cubica approssimo le eliche con più bezier quadratiche razionali.
|
||||
//// più è grande l'angolo al centro dell'arco e maggiore sarà l'errore di approssimazione
|
||||
//
|
||||
// // quadratica razionale
|
||||
// // peso del punto di controllo intermedio
|
||||
// double dW = dCosAhalf ;
|
||||
// // calcolo dei punti di controllo
|
||||
// Point3d ptStart ;
|
||||
// crArc.GetStartPoint( ptStart) ;
|
||||
// Point3d ptEnd ;
|
||||
// crArc.GetEndPoint( ptEnd) ;
|
||||
// // Point3d ptMed = Media( ptStart, ptEnd, 0.5) ;
|
||||
// //Vector3d vtDir = ptMed - crArc.GetCenter() ;
|
||||
// // Point3d ptNew = crArc.GetCenter() + vtDir / ( dCosAhalf * dCosAhalf) ;
|
||||
// Vector3d vtStart ; crArc.GetStartDir( vtStart) ;
|
||||
// Vector3d vtEnd ; crArc.GetEndDir( vtEnd) ;
|
||||
// PtrOwner<CurveLine> pCrvLine1( CreateBasicCurveLine()) ;
|
||||
// pCrvLine1->SetPVL( ptStart, vtStart, 10) ;
|
||||
// PtrOwner<CurveLine> pCrvLine2( CreateBasicCurveLine()) ;
|
||||
// pCrvLine2->SetPVL( ptEnd, vtEnd, 10) ;
|
||||
// IntersLineLine ill( *pCrvLine1, *pCrvLine2, false) ;
|
||||
// IntCrvCrvInfo iccInfo ; ill.GetIntCrvCrvInfo( iccInfo) ;
|
||||
// Point3d ptNew = 0.5 * (iccInfo.IciA->ptI + iccInfo.IciB->ptI) ;
|
||||
// // inserimento nella curva dei punti di controllo con i pesi
|
||||
// Init( 2, true) ;
|
||||
// SetControlPoint( 0, ptStart, 1) ;
|
||||
// SetControlPoint( 1, ptNew, dW) ;
|
||||
// SetControlPoint( 2, ptEnd, 1) ;
|
||||
}
|
||||
|
||||
// copio estrusione e spessore
|
||||
@@ -198,6 +269,29 @@ CurveBezier::FromArc( const ICurveArc& crArc)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::FromLine( const ICurveLine& crLine)
|
||||
{
|
||||
if ( m_nStatus != OK || ! crLine.IsValid())
|
||||
return false ;
|
||||
int nCount = 0 ;
|
||||
Point3d ptStart ; crLine.GetStartPoint( ptStart) ;
|
||||
SetControlPoint( nCount, ptStart) ;
|
||||
++nCount ;
|
||||
double dPart = 1. / m_nDeg ;
|
||||
for ( int i = 1 ; i < m_nDeg ; ++i) {
|
||||
double dU = i * dPart ;
|
||||
Point3d ptMid ; crLine.GetPointD1D2( dU, ICurve::FROM_MINUS, ptMid) ;
|
||||
SetControlPoint( nCount, ptMid) ;
|
||||
++nCount ;
|
||||
}
|
||||
Point3d ptEnd ; crLine.GetEndPoint( ptEnd) ;
|
||||
SetControlPoint( nCount, ptEnd) ;
|
||||
++nCount ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::IsAPoint( void) const
|
||||
@@ -278,8 +372,11 @@ CurveBezier::CopyFrom( const CurveBezier& cbSrc)
|
||||
{
|
||||
if ( &cbSrc == this)
|
||||
return true ;
|
||||
if ( ! cbSrc.IsValid())
|
||||
return false ;
|
||||
if ( ! Init( cbSrc.m_nDeg, cbSrc.m_bRat))
|
||||
return false ;
|
||||
m_dParSing = cbSrc.m_dParSing ;
|
||||
m_vPtCtrl = cbSrc.m_vPtCtrl ;
|
||||
if ( cbSrc.m_bRat)
|
||||
m_vWeCtrl = cbSrc.m_vWeCtrl ;
|
||||
@@ -287,6 +384,8 @@ CurveBezier::CopyFrom( const CurveBezier& cbSrc)
|
||||
m_dThick = cbSrc.m_dThick ;
|
||||
m_nTempProp[0] = cbSrc.m_nTempProp[0] ;
|
||||
m_nTempProp[1] = cbSrc.m_nTempProp[1] ;
|
||||
m_dTempParam[0] = cbSrc.m_dTempParam[0] ;
|
||||
m_dTempParam[1] = cbSrc.m_dTempParam[1] ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -425,24 +524,23 @@ bool
|
||||
CurveBezier::Validate( void)
|
||||
{
|
||||
if ( m_nStatus == TO_VERIFY) {
|
||||
for ( const auto& ptP : m_vPtCtrl) {
|
||||
if ( ! ptP.IsValid()) {
|
||||
m_nStatus = ERR ;
|
||||
break ;
|
||||
for ( const auto& ptP : m_vPtCtrl) {
|
||||
if ( ! ptP.IsValid()) {
|
||||
m_nStatus = ERR ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( m_nStatus == TO_VERIFY) {
|
||||
for ( const auto& dWe : m_vWeCtrl) {
|
||||
if ( ! isfinite( dWe)) {
|
||||
m_nStatus = ERR ;
|
||||
break ;
|
||||
for ( const auto& dWe : m_vWeCtrl) {
|
||||
if ( ! isfinite( dWe)) {
|
||||
m_nStatus = ERR ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_nStatus == TO_VERIFY)
|
||||
m_nStatus = ( ( m_nDeg > 0 && m_vPtCtrl.size() > 0) ? OK : ERR) ;
|
||||
m_nStatus = ( ( m_nDeg >= 1 && m_vPtCtrl.size() >= 2) ? OK : ERR) ;
|
||||
|
||||
return ( m_nStatus == OK) ;
|
||||
}
|
||||
@@ -620,7 +718,7 @@ CurveBezier::GetMidPoint( Point3d& ptMid) const
|
||||
return false ;
|
||||
// determino il valore del parametro a metà lunghezza
|
||||
double dLen, dMid ;
|
||||
if ( ! GetLength( dLen) || ! GetParamAtLength( 0.5 * dLen, dMid))
|
||||
if ( ! GetLengthAtParam( 1, dLen) || ! GetParamAtLength( 0.5 * dLen, dMid))
|
||||
return false ;
|
||||
// calcolo il punto
|
||||
return GetPointD1D2( dMid, ptMid) ;
|
||||
@@ -657,7 +755,7 @@ CurveBezier::GetMidDir( Vector3d& vtDir) const
|
||||
return false ;
|
||||
// determino il valore del parametro a metà lunghezza
|
||||
double dLen, dMid ;
|
||||
if ( ! GetLength( dLen) || ! GetParamAtLength( 0.5 * dLen, dMid))
|
||||
if ( ! GetLengthAtParam( 1, dLen) || ! GetParamAtLength( 0.5 * dLen, dMid))
|
||||
return false ;
|
||||
// calcolo la direzione
|
||||
return ::GetTang( *this, dMid, FROM_MINUS, vtDir) ;
|
||||
@@ -1479,7 +1577,7 @@ CurveBezier::BiArcOrSplit( int nLev, PolyLine& PL, double dLinTol, double dAngTo
|
||||
return false ;
|
||||
vtDir.ToSpherical( nullptr, nullptr, &dDir1Deg) ;
|
||||
// costruisco un biarco sulla polilinea (secondo metodo di Z. Sir)
|
||||
pCrv.Set( GetBiArc( ptP0, dDir0Deg, ptP1, dDir1Deg, PL, dMaxDist)) ;
|
||||
pCrv.Set( GetBiArc( ptP0, dDir0Deg, ptP1, dDir1Deg, PL, dMaxDist, dLinTol)) ;
|
||||
if ( IsNull( pCrv))
|
||||
return false ;
|
||||
}
|
||||
@@ -1567,6 +1665,10 @@ CurveBezier::BiArcOrSplit( int nLev, PolyLine& PL, double dLinTol, double dAngTo
|
||||
ICurve*
|
||||
CurveBezier::CopyParamRange( double dUStart, double dUEnd) const
|
||||
{
|
||||
// la curva deve essere valida
|
||||
if ( m_nStatus != OK)
|
||||
return nullptr ;
|
||||
|
||||
// i parametri start ed end devono essere compresi nel dominio parametrico della curva
|
||||
if ( dUStart < - EPS_PARAM || dUStart > 1 + EPS_PARAM ||
|
||||
dUEnd < - EPS_PARAM || dUEnd > 1 + EPS_PARAM)
|
||||
@@ -1607,6 +1709,8 @@ CurveBezier::Invert( void)
|
||||
for ( int i = 0 ; i < nMid ; ++ i)
|
||||
swap( m_vPtCtrl[i], m_vPtCtrl[m_nDeg-i]) ;
|
||||
|
||||
// imposto ricalcolo Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1624,6 +1728,8 @@ CurveBezier::ModifyStart( const Point3d& ptNewStart)
|
||||
// modifico il primo punto di controllo
|
||||
m_vPtCtrl[0] = ptNewStart ;
|
||||
|
||||
// imposto ricalcolo Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1641,6 +1747,8 @@ CurveBezier::ModifyEnd( const Point3d& ptNewEnd)
|
||||
// modifico l'ultimo punto di controllo
|
||||
m_vPtCtrl[m_nDeg] = ptNewEnd ;
|
||||
|
||||
// imposto ricalcolo Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1665,6 +1773,8 @@ CurveBezier::TrimStartAtParam( double dUTrim)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// imposto ricalcolo Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1689,6 +1799,8 @@ CurveBezier::TrimEndAtParam( double dUTrim)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// imposto ricalcolo Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1699,6 +1811,10 @@ CurveBezier::TrimEndAtParam( double dUTrim)
|
||||
bool
|
||||
CurveBezier::TrimStartEndAtParam( double dUStartTrim, double dUEndTrim)
|
||||
{
|
||||
// la curva deve essere valida
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// i parametri start ed end devono essere compresi nel dominio parametrico della curva
|
||||
if ( dUStartTrim < - EPS_PARAM || dUStartTrim > 1 + EPS_PARAM ||
|
||||
dUEndTrim < - EPS_PARAM || dUEndTrim > 1 + EPS_PARAM)
|
||||
@@ -1706,18 +1822,34 @@ CurveBezier::TrimStartEndAtParam( double dUStartTrim, double dUEndTrim)
|
||||
// verifico che i trim non cancellino interamente la curva
|
||||
if ( dUStartTrim > dUEndTrim - EPS_PARAM)
|
||||
return false ;
|
||||
// se razionale devo trovare il punto di trim iniziale per ricalcolare il parametro di trim
|
||||
Point3d ptStart ;
|
||||
if ( m_bRat)
|
||||
GetPointD1D2( dUStartTrim, ptStart) ;
|
||||
// trim finale
|
||||
if ( ! TrimEndAtParam( dUEndTrim))
|
||||
return false ;
|
||||
// trim iniziale con il parametro opportunamente ricalcolato
|
||||
double dNewUStartTrim = dUStartTrim / dUEndTrim ;
|
||||
return TrimStartAtParam( dNewUStartTrim) ;
|
||||
double dNewUStartTrim ;
|
||||
if ( m_bRat)
|
||||
GetParamAtPoint( ptStart, dNewUStartTrim) ;
|
||||
else
|
||||
dNewUStartTrim = dUStartTrim / dUEndTrim ;
|
||||
//trim iniziale
|
||||
if ( ! TrimStartAtParam( dNewUStartTrim))
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::TrimStartAtLen( double dLenTrim)
|
||||
{
|
||||
// la curva deve essere valida
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// lunghezze negative vengono considerate nulle
|
||||
dLenTrim = max( dLenTrim, 0.) ;
|
||||
|
||||
@@ -1727,13 +1859,20 @@ CurveBezier::TrimStartAtLen( double dLenTrim)
|
||||
return false ;
|
||||
|
||||
// utilizzo il trim sui parametri
|
||||
return TrimStartAtParam( dUTrim) ;
|
||||
if ( ! TrimStartAtParam( dUTrim))
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::TrimEndAtLen( double dLenTrim)
|
||||
{
|
||||
// la curva deve essere valida
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// lunghezze negative vengono considerate nulle
|
||||
dLenTrim = max( dLenTrim, 0.) ;
|
||||
|
||||
@@ -1743,19 +1882,26 @@ CurveBezier::TrimEndAtLen( double dLenTrim)
|
||||
return false ;
|
||||
|
||||
// utilizzo il trim sui parametri
|
||||
return TrimEndAtParam( dUTrim) ;
|
||||
if ( ! TrimEndAtParam( dUTrim))
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::ExtendStartByLen( double dLenExt)
|
||||
{
|
||||
// la curva deve essere valida
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// la lunghezza deve essere positiva
|
||||
if ( dLenExt < - EPS_ZERO)
|
||||
return false ;
|
||||
// determino la lunghezza originale della curva
|
||||
double dLen ;
|
||||
if ( ! GetLength( dLen))
|
||||
if ( ! GetLengthAtParam( 1, dLen))
|
||||
return false ;
|
||||
// stimo il valore del parametro al nuovo punto iniziale
|
||||
double dUTrim = - dLenExt / dLen ;
|
||||
@@ -1789,6 +1935,9 @@ CurveBezier::ExtendStartByLen( double dLenExt)
|
||||
m_vWeCtrl[i] = vWeCtrl[i] ;
|
||||
}
|
||||
}
|
||||
|
||||
// imposto ricalcolo Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
return true ;
|
||||
@@ -1798,12 +1947,16 @@ CurveBezier::ExtendStartByLen( double dLenExt)
|
||||
bool
|
||||
CurveBezier::ExtendEndByLen( double dLenExt)
|
||||
{
|
||||
// la curva deve essere valida
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// la lunghezza deve essere positiva
|
||||
if ( dLenExt < - EPS_ZERO)
|
||||
return false ;
|
||||
// determino la lunghezza originale della curva
|
||||
double dLen ;
|
||||
if ( ! GetLength( dLen))
|
||||
if ( ! GetLengthAtParam( 1, dLen))
|
||||
return false ;
|
||||
// stimo il valore del parametro al nuovo punto finale
|
||||
double dUTrim = 1 + dLenExt / dLen ;
|
||||
@@ -1837,6 +1990,9 @@ CurveBezier::ExtendEndByLen( double dLenExt)
|
||||
m_vWeCtrl[i] = vWeCtrl[i] ;
|
||||
}
|
||||
}
|
||||
|
||||
// imposto ricalcolo Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
return true ;
|
||||
@@ -1850,6 +2006,10 @@ CurveBezier::Translate( const Vector3d& vtMove)
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// traslo Voronoi
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
m_pVoronoiObj->Translate( vtMove) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1872,6 +2032,10 @@ CurveBezier::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng,
|
||||
if ( vtAx.IsSmall())
|
||||
return false ;
|
||||
|
||||
// ruoto Voronoi
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
m_pVoronoiObj->Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1914,6 +2078,8 @@ CurveBezier::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double
|
||||
if ( ! bOk)
|
||||
return false ;
|
||||
|
||||
// imposto ricalcolo Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1943,6 +2109,8 @@ CurveBezier::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
if ( vtNorm.IsSmall())
|
||||
return false ;
|
||||
|
||||
// imposto ricalcolo Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1967,6 +2135,8 @@ CurveBezier::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d&
|
||||
if ( vtNorm.IsSmall() || vtDir.IsSmall())
|
||||
return false ;
|
||||
|
||||
// imposto ricalcolo Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1999,6 +2169,10 @@ CurveBezier::ToGlob( const Frame3d& frRef)
|
||||
if ( IsGlobFrame( frRef))
|
||||
return true ;
|
||||
|
||||
// trasformo Voronoi
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
m_pVoronoiObj->ToGlob( frRef) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -2026,6 +2200,10 @@ CurveBezier::ToLoc( const Frame3d& frRef)
|
||||
if ( IsGlobFrame( frRef))
|
||||
return true ;
|
||||
|
||||
// trasformo Voronoi
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
m_pVoronoiObj->ToLoc( frRef) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -2053,6 +2231,10 @@ CurveBezier::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
||||
if ( AreSameFrame( frOri, frDest))
|
||||
return true ;
|
||||
|
||||
// trasformo Voronoi
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
m_pVoronoiObj->LocToLoc( frOri, frDest) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -2064,3 +2246,229 @@ CurveBezier::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::CalcVoronoiObject() const
|
||||
{
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// creo oggetto vroni con la curva
|
||||
m_pVoronoiObj = new( std::nothrow) Voronoi( this, false) ;
|
||||
if ( m_pVoronoiObj == nullptr)
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Voronoi*
|
||||
CurveBezier::GetVoronoiObject() const
|
||||
{
|
||||
if ( m_nStatus != OK)
|
||||
return nullptr ;
|
||||
|
||||
// se non è stato calcolato, lo calcolo
|
||||
if ( m_pVoronoiObj == nullptr)
|
||||
CalcVoronoiObject() ;
|
||||
|
||||
// restituisco Voronoi
|
||||
return m_pVoronoiObj ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
CurveBezier::ResetVoronoiObject() const
|
||||
{
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
delete m_pVoronoiObj ;
|
||||
m_pVoronoiObj = nullptr ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::MakeRational( void)
|
||||
{
|
||||
// la curva deve essere valida
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
if ( m_bRat)
|
||||
return true ;
|
||||
// creo il vettore dei pesi e li setto tutti a 1
|
||||
m_vWeCtrl.assign( m_nDeg + 1, 1) ;
|
||||
// aggiorno il flag rational
|
||||
m_bRat = true ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::MakeRationalStandardForm( void)
|
||||
{
|
||||
// la curva deve essere valida
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
if ( ! m_bRat)
|
||||
return false ;
|
||||
double dW0 = m_vWeCtrl.front() ;
|
||||
double dWn = m_vWeCtrl.back() ;
|
||||
if ( dW0 > 1 - EPS_ZERO && dWn > 1 - EPS_ZERO)
|
||||
return true ;
|
||||
if ( dW0 < EPS_ZERO || dWn < EPS_ZERO)
|
||||
return false ;
|
||||
|
||||
// formula del Farin
|
||||
double dCoeff = pow( dW0 / dWn, 1. / m_nDeg) ;
|
||||
for ( int i = 0 ; i < m_nDeg + 1 ; ++i)
|
||||
m_vWeCtrl[i] *= Pow( dCoeff, i) / dW0 ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::MakeNonRational( double dTol)
|
||||
{
|
||||
// la curva deve essere valida
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
if ( ! m_bRat)
|
||||
return true ;
|
||||
|
||||
// controllo se i pesi sono tutti == 1 allora è una finta razionale e mi basta fare una copia dei punti di controllo
|
||||
bool bIsActualRat = false ;
|
||||
for ( int i = 0 ; i < m_nDeg ; ++i) {
|
||||
if ( abs( m_vWeCtrl[i] - 1) > EPS_SMALL) {
|
||||
bIsActualRat = true ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
bool bOk = true ;
|
||||
if ( ! bIsActualRat) {
|
||||
// semplicemente tolgo il booleano della razionalità e i punti restano gli stessi
|
||||
m_bRat = false ;
|
||||
}
|
||||
else {
|
||||
// provo ad approssimare la curva di bezier con una controparte non razionale
|
||||
int nDeg = m_nDeg ;
|
||||
// se ho una curva razionale di grado 2 verifico se è un arco, in quel caso la converto in una curva di grado 3 non razionale con la funzione dedicata
|
||||
if ( nDeg == 2 && m_bRat) {
|
||||
// prendo due punti sulla curva e calcolo l'intersezione dei due assi dei segmenti formati da pt2-pt0 e pt3-pt1
|
||||
Point3d pt0 ; GetStartPoint( pt0) ;
|
||||
Point3d pt1 ; GetPointD1D2( 0.3, pt1) ;
|
||||
Point3d pt2 ; GetPointD1D2( 0.6, pt2) ;
|
||||
Point3d pt3 ; GetEndPoint( pt3) ;
|
||||
|
||||
Vector3d vtDir1 = pt2 - pt0 ;
|
||||
Vector3d vtDir2 = pt3 - pt1 ;
|
||||
Vector3d vtN = vtDir2 ^ vtDir1 ;
|
||||
|
||||
CurveLine cl1 ; cl1.Set( pt1, pt1 + (vtDir1 ^ vtN) * 5) ;
|
||||
CurveLine cl2 ; cl1.Set( pt2, pt2 + (vtDir2 ^ vtN) * 5) ;
|
||||
IntersLineLine ill( cl1, cl2, false) ;
|
||||
IntCrvCrvInfo iccInfo ; ill.GetIntCrvCrvInfo( iccInfo) ;
|
||||
Point3d ptCen = iccInfo.IciA[0].ptI ;
|
||||
|
||||
// se sia l'inizio che la fine della curva distano uguale dal punto di intersezione tra i due assi trovati allora la curva è un arco di circonferenza
|
||||
if ( abs(Dist( pt0, ptCen) - Dist( pt3, ptCen)) < EPS_SMALL) {
|
||||
PtrOwner<ICurveBezier> pNew ( ApproxArcCurveBezierWithSingleCubic( this, ptCen, vtN)) ;
|
||||
|
||||
if ( IsNull( pNew) || ! pNew->IsValid())
|
||||
return false ;
|
||||
Init( 3, false) ;
|
||||
for ( int i = 0 ; i < 3 ; ++i)
|
||||
SetControlPoint( i, pNew->GetControlPoint(i)) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
// punto di rientro in caso fallisca il primo tentativo
|
||||
retry :
|
||||
nDeg += 2 ;
|
||||
PtrOwner<CurveBezier> pNewBez( CreateBasicCurveBezier()) ;
|
||||
pNewBez->Init( nDeg, false) ;
|
||||
PNTVECTOR vPntCtrl ;
|
||||
PNTVECTOR vPntSampling ;
|
||||
for ( int p = 0 ; p < nDeg + 1 ; ++p) {
|
||||
Point3d pt ; GetPointD1D2( double( p) / nDeg, pt) ;
|
||||
pNewBez->SetControlPoint( p, pt) ;
|
||||
vPntCtrl.push_back( pt) ;
|
||||
}
|
||||
vPntSampling = vPntCtrl ;
|
||||
int c = 0 ;
|
||||
double dErr = INFINITO ;
|
||||
while ( dErr > dTol && c < 100) {
|
||||
double dErrMax = 0 ;
|
||||
// calcolo le differenze tra i punti di sampling sulla nuova curva e quelli sulla curva originale
|
||||
for ( int p = 0 ; p < nDeg + 1 ; ++p) {
|
||||
Point3d pt ; pNewBez->GetPointD1D2( double( p) / nDeg, pt) ;
|
||||
Vector3d vDiff = vPntSampling[p] - pt ;
|
||||
double dErrLoc = vDiff.Len() ;
|
||||
if ( dErrLoc > dErrMax)
|
||||
dErrMax = dErrLoc ;
|
||||
// aggiorno il vettore dei punti di controllo della nuova curva
|
||||
vPntCtrl[p] += vDiff ;
|
||||
}
|
||||
dErr = dErrMax ;
|
||||
// aggiorno i punti di controllo della nuova curva
|
||||
for ( int i = 0 ; i < nDeg + 1 ; ++i)
|
||||
pNewBez->SetControlPoint( i, vPntCtrl[i]) ;
|
||||
++c ;
|
||||
}
|
||||
|
||||
// calcolo l'errore di approssimazione sulla curva
|
||||
CalcApproxError( this, pNewBez, dErr) ;
|
||||
bOk = dErr < dTol ;
|
||||
if ( bOk) {
|
||||
// aggiorno la curva di bezier originale con quella approssimata
|
||||
Init( nDeg, false) ;
|
||||
for ( int i = 0 ; i < nDeg + 1 ; ++i) {
|
||||
SetControlPoint( i, pNewBez->GetControlPoint( i)) ;
|
||||
SetControlWeight( i, pNewBez->GetControlWeight( i)) ;
|
||||
}
|
||||
}
|
||||
else if ( nDeg < m_nDeg + 4)
|
||||
goto retry ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::IsALine( void) const
|
||||
{
|
||||
// la curva deve essere valida
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
Point3d ptStart ; GetStartPoint( ptStart) ;
|
||||
Point3d ptEnd ; GetEndPoint( ptEnd) ;
|
||||
for ( int i = 1 ; i < m_nDeg ; ++i) {
|
||||
Point3d ptCtrl = GetControlPoint( i) ;
|
||||
DistPointLine dpl( ptCtrl, ptStart, ptEnd) ;
|
||||
double dDist = 0 ; dpl.GetDist( dDist) ;
|
||||
if ( dDist > EPS_SMALL)
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
PNTVECTOR
|
||||
CurveBezier::GetAllControlPoints( void) const
|
||||
{
|
||||
PNTVECTOR vPntCtrl ;
|
||||
// la curva deve essere valida
|
||||
if ( m_nStatus != OK)
|
||||
return vPntCtrl ;
|
||||
|
||||
return m_vPtCtrl ;
|
||||
}
|
||||
+37
-16
@@ -19,7 +19,8 @@
|
||||
#include "DllMain.h"
|
||||
#include "GeoObjRW.h"
|
||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
||||
|
||||
class Voronoi ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class CurveBezier : public ICurveBezier, public IGeoObjRW
|
||||
@@ -56,6 +57,11 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
||||
m_nTempProp[nPropInd] = nProp ; }
|
||||
int GetTempProp( int nPropInd = 0) const override
|
||||
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
||||
void SetTempParam( double dParam, int nParamInd = 0) override
|
||||
{ if ( nParamInd >= 0 && nParamInd < 2)
|
||||
m_dTempParam[nParamInd] = dParam ; }
|
||||
double GetTempParam( int nParamInd = 0) const override
|
||||
{ return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; }
|
||||
|
||||
public : // ICurve
|
||||
bool IsSimple( void) const override { return true ; }
|
||||
@@ -110,8 +116,8 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
||||
{ return ApproxWithArcs( dLinTol, dAngTolDeg, PA) ; }
|
||||
ICurve* CopyParamRange( double dUStart, double dUEnd) const override ;
|
||||
bool Invert( void) override ;
|
||||
bool SimpleOffset( double dDist, int nType = OFF_FILLET) override
|
||||
{ return false ; } // l'offset di crvBezier non è crvBezier tranne in casi molto particolari
|
||||
bool SimpleOffset( double dDist, int nType = OFF_FILLET, double dMaxAngExt = ANG_RIGHT) override
|
||||
{ return false ; } // l'offset di crvBezier non è crvBezier tranne in casi molto particolari
|
||||
bool ModifyStart( const Point3d& ptNewStart) override ;
|
||||
bool ModifyEnd( const Point3d& ptNewEnd) override ;
|
||||
bool SetExtrusion( const Vector3d& vtExtr) override
|
||||
@@ -131,7 +137,9 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
||||
bool Init( int nDeg, bool bIsRational) override ;
|
||||
bool SetControlPoint( int nInd, const Point3d& ptCtrl) override ;
|
||||
bool SetControlPoint( int nInd, const Point3d& ptCtrl, double dW) override ;
|
||||
bool SetControlWeight( int nInd, double dW) override ;
|
||||
bool FromArc( const ICurveArc& crArc) override ;
|
||||
bool FromLine( const ICurveLine& crLine) override ;
|
||||
int GetDegree( void) const override
|
||||
{ return m_nDeg ; }
|
||||
bool IsRational( void) const override
|
||||
@@ -141,15 +149,23 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
||||
double GetControlWeight( int nInd, bool* pbOk = NULL) const override ;
|
||||
bool GetControlPolygonLength( double& dLen) const override ;
|
||||
int GetSingularParam( double& dPar) const override ;
|
||||
bool MakeRational( void) override ;
|
||||
bool MakeRationalStandardForm( void) override ;
|
||||
bool MakeNonRational( double dTol) override ;
|
||||
bool IsALine( void) const override ;
|
||||
PNTVECTOR GetAllControlPoints( void) const ; // non aggiunta in interfaccia
|
||||
|
||||
public : // IGeoObjRW
|
||||
int GetNgeId( void) const override ;
|
||||
bool Save( NgeWriter& ngeOut) const override ;
|
||||
bool PreSave( GdbGeo& Wrapper) const override { return true ; }
|
||||
bool PostSave( GdbGeo& Wrapper) const override { return true ; }
|
||||
bool Load( NgeReader& ngeIn) override ;
|
||||
bool PostLoad( GdbGeo& Wrapper) override { return true ; }
|
||||
|
||||
public :
|
||||
CurveBezier( void) ;
|
||||
CurveBezier( const CurveBezier& cbSrc)
|
||||
CurveBezier( const CurveBezier& cbSrc) : m_pVoronoiObj( nullptr)
|
||||
{ if ( ! CopyFrom( cbSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "CurveBezier : copy constructor error")}
|
||||
CurveBezier& operator =( const CurveBezier& cbSrc)
|
||||
@@ -158,6 +174,8 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
||||
return *this ; }
|
||||
bool ApproxWithLines( int nStep, PolyLine& PL) const ;
|
||||
bool GetApproxLength( double& dLen) const ;
|
||||
Voronoi* GetVoronoiObject( void) const ;
|
||||
void ResetVoronoiObject( void) const ;
|
||||
|
||||
private :
|
||||
bool CopyFrom( const CurveBezier& cbSrc) ;
|
||||
@@ -174,23 +192,26 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
||||
bool ApproxWithArcsXY(double dLinTol, double dAngTolDeg, PolyArc& PA) const;
|
||||
bool BiArcOrSplit(int nLev, PolyLine& PL, double dLinTol, double dAngTolDeg, PolyArc& PA) const;
|
||||
bool ToPowerBase( PolynomialPoint3d& pol3P) const ;
|
||||
bool ToPowerBase( PolynomialPoint3d& pol3Num, Polynomial& polDen) const ;
|
||||
bool ToPowerBase( PolynomialPoint3d& pol3Num, Polynomial& polDen) const ;
|
||||
bool CalcVoronoiObject( void) const ;
|
||||
|
||||
private :
|
||||
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
|
||||
static const int MAXDEG = 11 ;
|
||||
static const int MAXDEG = 21 ;
|
||||
|
||||
private :
|
||||
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
||||
Status m_nStatus ; // stato
|
||||
int m_nDeg ; // grado
|
||||
bool m_bRat ; // flag di razionale/polinomiale
|
||||
mutable double m_dParSing ; // eventuale parametro della singolarità (-1=no, -2=da calcolare)
|
||||
PNTVECTOR m_vPtCtrl ; // vettore dei punti di controllo
|
||||
DBLVECTOR m_vWeCtrl ; // vettore dei pesi di controllo
|
||||
Vector3d m_VtExtr ; // vettore estrusione (normalmente coincide con m_VtN)
|
||||
double m_dThick ; // spessore
|
||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
||||
Status m_nStatus ; // stato
|
||||
int m_nDeg ; // grado
|
||||
bool m_bRat ; // flag di razionale/polinomiale
|
||||
mutable double m_dParSing ; // eventuale parametro della singolarità (-1=no, -2=da calcolare)
|
||||
PNTVECTOR m_vPtCtrl ; // vettore dei punti di controllo
|
||||
DBLVECTOR m_vWeCtrl ; // vettore dei pesi di controllo
|
||||
Vector3d m_VtExtr ; // vettore estrusione (normalmente coincide con m_VtN)
|
||||
double m_dThick ; // spessore
|
||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||
mutable Voronoi* m_pVoronoiObj ; // Voronoi
|
||||
} ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
+16
-212
@@ -16,8 +16,8 @@
|
||||
#include "CurveComposite.h"
|
||||
#include "CalcDerivate.h"
|
||||
#include "BiArcs.h"
|
||||
#include "DistPointLine.h"
|
||||
#include "RemoveCurveDefects.h"
|
||||
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveByApprox.h"
|
||||
#include "/EgtDev/Include/EGkPolyLine.h"
|
||||
#include "/EgtDev/Include/EGkPolyArc.h"
|
||||
@@ -202,213 +202,14 @@ CurveByApprox::CalcParameterization( void)
|
||||
bool
|
||||
CurveByApprox::CalcAkimaTangents( bool bDetectCorner)
|
||||
{
|
||||
// pulisco i vettori delle tangenti
|
||||
m_vPrevDer.clear() ;
|
||||
m_vNextDer.clear() ;
|
||||
|
||||
// numero di punti
|
||||
int nSize = int( m_vPnt.size()) ;
|
||||
|
||||
// sono necessari almeno due punti
|
||||
if ( nSize < 2)
|
||||
return false ;
|
||||
|
||||
// calcolo le derivate
|
||||
m_vPrevDer.reserve( nSize) ;
|
||||
m_vNextDer.reserve( nSize) ;
|
||||
// se ci sono solo 2 punti, le tangenti devono essere dirette lungo la linea che li unisce
|
||||
if ( nSize == 2) {
|
||||
// non esiste derivata prima del primo punto
|
||||
m_vPrevDer.emplace_back( 0, 0, 0) ;
|
||||
m_vNextDer.push_back( ( m_vPnt[1] - m_vPnt[0]) / ( m_vPar[1] - m_vPar[0])) ;
|
||||
m_vPrevDer.push_back( m_vNextDer[0]) ;
|
||||
// non esiste derivata dopo il secondo e ultimo punto
|
||||
m_vNextDer.emplace_back( 0, 0, 0) ;
|
||||
return true ;
|
||||
}
|
||||
// verifico se curva chiusa (primo e ultimo punto coincidono)
|
||||
bool bClosed = AreSamePointApprox( m_vPnt.front(), m_vPnt.back()) ;
|
||||
// calcolo le derivate
|
||||
for ( int i = 0 ; i < nSize ; ++ i) {
|
||||
Vector3d vtPrevDer ;
|
||||
Vector3d vtNextDer ;
|
||||
// primo punto
|
||||
if ( i == 0) {
|
||||
// se curva chiusa, come precedente uso il penultimo punto
|
||||
if ( bClosed) {
|
||||
// se non ci sono almeno 5 punti
|
||||
if ( nSize < 5) {
|
||||
if ( ! CalcCircleMidDer( m_vPar[nSize-2] - m_vPar[nSize-1], m_vPnt[nSize-2], m_vPar[i], m_vPnt[i],
|
||||
m_vPar[i+1], m_vPnt[i+1], vtNextDer))
|
||||
return false ;
|
||||
vtPrevDer = vtNextDer ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
if ( ! CalcAkimaMidDer( m_vPar[nSize-3] - m_vPar[nSize-1], m_vPnt[nSize-3], m_vPar[nSize-2] - m_vPar[nSize-1], m_vPnt[nSize-2],
|
||||
m_vPar[i], m_vPnt[i], m_vPar[i+1], m_vPnt[i+1],
|
||||
m_vPar[i+2], m_vPnt[i+2], bDetectCorner,
|
||||
vtPrevDer, vtNextDer))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti, uso arco sui primi tre punti
|
||||
else {
|
||||
if ( ! CalcCircleStartDer( m_vPar[i], m_vPnt[i], m_vPar[i+1], m_vPnt[i+1],
|
||||
m_vPar[i+2], m_vPnt[i+2], vtNextDer))
|
||||
return false ;
|
||||
vtPrevDer = Vector3d( 0, 0, 0) ;
|
||||
}
|
||||
}
|
||||
// ultimo punto
|
||||
else if ( i == nSize - 1) {
|
||||
// se curva chiusa, le tg devono coincidere con quelle del primo
|
||||
if ( bClosed) {
|
||||
vtPrevDer = m_vPrevDer[0] ;
|
||||
vtNextDer = m_vNextDer[0] ;
|
||||
}
|
||||
// altrimenti, uso arco sugli ultimi tre punti
|
||||
else {
|
||||
if ( ! CalcCircleEndDer( m_vPar[i-2], m_vPnt[i-2], m_vPar[i-1], m_vPnt[i-1],
|
||||
m_vPar[i], m_vPnt[i], vtPrevDer))
|
||||
return false ;
|
||||
vtNextDer = Vector3d( 0, 0, 0) ;
|
||||
}
|
||||
}
|
||||
// punti intermedi
|
||||
else {
|
||||
// se secondo punto
|
||||
if ( i == 1) {
|
||||
// se curva aperta o non ci sono almeno 5 punti
|
||||
if ( ! bClosed || nSize < 5) {
|
||||
if ( ! CalcCircleMidDer( m_vPar[i-1], m_vPnt[i-1], m_vPar[i], m_vPnt[i],
|
||||
m_vPar[i+1], m_vPnt[i+1], vtPrevDer))
|
||||
return false ;
|
||||
vtNextDer = vtPrevDer ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
if ( ! CalcAkimaMidDer( m_vPar[nSize-2] - m_vPar[nSize-1], m_vPnt[nSize-2], m_vPar[i-1], m_vPnt[i-1],
|
||||
m_vPar[i], m_vPnt[i], m_vPar[i+1], m_vPnt[i+1],
|
||||
m_vPar[i+2], m_vPnt[i+2], bDetectCorner,
|
||||
vtPrevDer, vtNextDer))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// se penultimo punto
|
||||
else if ( i == nSize - 2) {
|
||||
// se curva aperta o non ci sono almeno 5 punti
|
||||
if ( ! bClosed || nSize < 5) {
|
||||
if ( ! CalcCircleMidDer( m_vPar[i-1], m_vPnt[i-1], m_vPar[i], m_vPnt[i],
|
||||
m_vPar[i+1], m_vPnt[i+1], vtPrevDer))
|
||||
return false ;
|
||||
vtNextDer = vtPrevDer ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
if ( ! CalcAkimaMidDer( m_vPar[i-2], m_vPnt[i-2], m_vPar[i-1], m_vPnt[i-1],
|
||||
m_vPar[i], m_vPnt[i], m_vPar[i+1], m_vPnt[i+1],
|
||||
m_vPar[1] + m_vPar[i+1], m_vPnt[1], bDetectCorner,
|
||||
vtPrevDer, vtNextDer))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
if ( ! CalcAkimaMidDer( m_vPar[i-2], m_vPnt[i-2], m_vPar[i-1], m_vPnt[i-1],
|
||||
m_vPar[i], m_vPnt[i], m_vPar[i+1], m_vPnt[i+1],
|
||||
m_vPar[i+2], m_vPnt[i+2], bDetectCorner,
|
||||
vtPrevDer, vtNextDer))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// salvo la derivata
|
||||
m_vPrevDer.push_back( vtPrevDer) ;
|
||||
m_vNextDer.push_back( vtNextDer) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
return ComputeAkimaTangents( bDetectCorner, m_vPar, m_vPnt, m_vPrevDer, m_vNextDer) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveByApprox::CalcBesselTangents( void)
|
||||
{
|
||||
// pulisco i vettori delle tangenti
|
||||
m_vPrevDer.clear() ;
|
||||
m_vNextDer.clear() ;
|
||||
|
||||
// numero di punti
|
||||
int nSize = int( m_vPnt.size()) ;
|
||||
|
||||
// sono necessari almeno due punti
|
||||
if ( nSize < 2)
|
||||
return false ;
|
||||
|
||||
// calcolo le derivate
|
||||
m_vPrevDer.reserve( nSize) ;
|
||||
m_vNextDer.reserve( nSize) ;
|
||||
// se ci sono solo 2 punti, le tangenti devono essere dirette lungo la linea che li unisce
|
||||
if ( nSize == 2) {
|
||||
// non esiste derivata prima del primo punto
|
||||
m_vPrevDer.emplace_back( 0, 0, 0) ;
|
||||
m_vNextDer.push_back( ( m_vPnt[1] - m_vPnt[0]) / ( m_vPar[1] - m_vPar[0])) ;
|
||||
m_vPrevDer.push_back( m_vNextDer[0]) ;
|
||||
// non esiste derivata dopo il secondo e ultimo punto
|
||||
m_vNextDer.emplace_back( 0, 0, 0) ;
|
||||
return true ;
|
||||
}
|
||||
// verifico se curva chiusa (primo e ultimo punto coincidono)
|
||||
bool bClosed = AreSamePointApprox( m_vPnt.front(), m_vPnt.back()) ;
|
||||
// calcolo le derivate
|
||||
for ( int i = 0 ; i < nSize ; ++ i) {
|
||||
Vector3d vtPrevDer ;
|
||||
Vector3d vtNextDer ;
|
||||
// primo punto
|
||||
if ( i == 0) {
|
||||
// se curva chiusa, come precedente uso il penultimo punto
|
||||
if ( bClosed) {
|
||||
if ( ! CalcBesselMidDer( m_vPar[nSize-2] - m_vPar[nSize-1], m_vPnt[nSize-2], m_vPar[i], m_vPnt[i],
|
||||
m_vPar[i+1], m_vPnt[i+1], vtNextDer))
|
||||
return false ;
|
||||
vtPrevDer = vtNextDer ;
|
||||
}
|
||||
// altrimenti, uso i primi tre punti
|
||||
else {
|
||||
if ( ! CalcBesselStartDer( m_vPar[i], m_vPnt[i], m_vPar[i+1], m_vPnt[i+1],
|
||||
m_vPar[i+2], m_vPnt[i+2], vtNextDer))
|
||||
return false ;
|
||||
vtPrevDer = Vector3d( 0, 0, 0) ;
|
||||
}
|
||||
}
|
||||
// ultimo punto
|
||||
else if ( i == nSize - 1) {
|
||||
// se curva chiusa, le tg devono coincidere con quelle del primo
|
||||
if ( bClosed) {
|
||||
vtPrevDer = m_vPrevDer[0] ;
|
||||
vtNextDer = m_vNextDer[0] ;
|
||||
}
|
||||
// altrimenti, uso gli ultimi tre punti
|
||||
else {
|
||||
if ( ! CalcBesselEndDer( m_vPar[i-2], m_vPnt[i-2], m_vPar[i-1], m_vPnt[i-1],
|
||||
m_vPar[i], m_vPnt[i], vtPrevDer))
|
||||
return false ;
|
||||
vtNextDer = Vector3d( 0, 0, 0) ;
|
||||
}
|
||||
}
|
||||
// punti intermedi
|
||||
else {
|
||||
if ( ! CalcBesselMidDer( m_vPar[i-1], m_vPnt[i-1], m_vPar[i], m_vPnt[i],
|
||||
m_vPar[i+1], m_vPnt[i+1], vtPrevDer))
|
||||
return false ;
|
||||
vtNextDer = vtPrevDer ;
|
||||
}
|
||||
// salvo la derivata
|
||||
m_vPrevDer.push_back( vtPrevDer) ;
|
||||
m_vNextDer.push_back( vtNextDer) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
return ComputeBesselTangents( m_vPar, m_vPnt, m_vPrevDer, m_vNextDer) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -439,12 +240,12 @@ CurveByApprox::CalcSplitPoints( double dLinTol, double dAngTolDeg, double dLinFe
|
||||
m_vSplits.push_back(i) ;
|
||||
continue ;
|
||||
}
|
||||
// verifico linearità del tratto precedente
|
||||
// verifico linearità del tratto precedente
|
||||
bool bPrevLin = vtPrev.SqLen() > dSqLinFea &&
|
||||
( m_vNextDer[i-1] * m_vPrevDer[i]) > dAngTolCos &&
|
||||
( vtPrev ^ m_vNextDer[i-1]).SqLen() < dSqLinTol &&
|
||||
( vtPrev ^ m_vPrevDer[i]).SqLen() < dSqLinTol ;
|
||||
// verifico linearità del tratto successivo
|
||||
// verifico linearità del tratto successivo
|
||||
bool bNextLin = vtNext.SqLen() > dSqLinFea &&
|
||||
( m_vNextDer[i] * m_vPrevDer[i+1]) > dAngTolCos &&
|
||||
( vtNext ^ m_vNextDer[i]).SqLen() < dSqLinTol &&
|
||||
@@ -483,7 +284,7 @@ CurveByApprox::BiArcOrSplit( int nLev, PolyLine& PL, double dLinTol, double dAng
|
||||
PtrOwner<ICurve> pCrv ;
|
||||
double dMaxDist ;
|
||||
|
||||
// se la polilinea ha più di 2 punti
|
||||
// se la polilinea ha più di 2 punti
|
||||
if ( PL.GetPointNbr() > 2) {
|
||||
// calcolo punti e direzioni agli estremi della polilinea usando la curva di Bezier
|
||||
int nI ;
|
||||
@@ -501,11 +302,12 @@ CurveByApprox::BiArcOrSplit( int nLev, PolyLine& PL, double dLinTol, double dAng
|
||||
ptP1 = m_vPnt[nI] ;
|
||||
m_vPrevDer[nI].ToSpherical( nullptr, nullptr, &dDir1Deg) ;
|
||||
// costruisco un biarco sulla polilinea (secondo metodo di Z. Sir)
|
||||
pCrv.Set( GetBiArc( ptP0, dDir0Deg, ptP1, dDir1Deg, PL, dMaxDist)) ;
|
||||
pCrv.Set( GetBiArc( ptP0, dDir0Deg, ptP1, dDir1Deg, PL, dMaxDist, dLinTol)) ;
|
||||
// forzo la spezzatura della curva
|
||||
if ( IsNull( pCrv))
|
||||
return false ;
|
||||
dMaxDist = 2 * dLinTol ;
|
||||
}
|
||||
// se la polilinea è formata da 2 punti
|
||||
// se la polilinea è formata da 2 punti
|
||||
else if ( PL.GetPointNbr() == 2) {
|
||||
// se molto vicini, esco
|
||||
double dLen ;
|
||||
@@ -524,13 +326,15 @@ CurveByApprox::BiArcOrSplit( int nLev, PolyLine& PL, double dLinTol, double dAng
|
||||
|
||||
// se raggiunto il massimo livello di recursione, forzo l'accettazione del biarco
|
||||
if ( nLev >= MAX_LEV) {
|
||||
if ( IsNull( pCrv))
|
||||
return false ;
|
||||
dMaxDist = 0 ;
|
||||
// segnalo situazione per debug
|
||||
if ( GetEGkDebugLev() >= 5)
|
||||
LOG_DBG_ERR( GetEGkLogger(), "ERROR : Exceeded recursions")
|
||||
}
|
||||
|
||||
// se lunghezza abbastanza picccola, forzo l'accettazione della curva
|
||||
// se lunghezza abbastanza piccola, forzo l'accettazione della curva
|
||||
double dLen ;
|
||||
if ( PL.GetApproxLength( dLen) && dLen < 10 * EPS_SMALL)
|
||||
dMaxDist = 0 ;
|
||||
@@ -561,7 +365,7 @@ CurveByApprox::BiArcOrSplit( int nLev, PolyLine& PL, double dLinTol, double dAng
|
||||
return false ;
|
||||
}
|
||||
|
||||
// spezzo l'intervallo in due parti a metà
|
||||
// spezzo l'intervallo in due parti a metà
|
||||
double dParStart, dParEnd ;
|
||||
if ( ! PL.GetFirstU( dParStart) || ! PL.GetLastU( dParEnd))
|
||||
return false ;
|
||||
@@ -569,9 +373,9 @@ CurveByApprox::BiArcOrSplit( int nLev, PolyLine& PL, double dLinTol, double dAng
|
||||
PolyLine PL2 ;
|
||||
if ( ! PL.Split( dParMid, PL2))
|
||||
return false ;
|
||||
// prima metà
|
||||
// prima metà
|
||||
if ( ! BiArcOrSplit( nLev + 1, PL, dLinTol, dAngTolDeg, PA))
|
||||
return false ;
|
||||
// seconda metà
|
||||
// seconda metà
|
||||
return BiArcOrSplit( nLev + 1, PL2, dLinTol, dAngTolDeg, PA) ;
|
||||
}
|
||||
|
||||
+39
-230
@@ -14,10 +14,10 @@
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "CalcDerivate.h"
|
||||
#include "CurveBezier.h"
|
||||
#include "CurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkCurveByInterp.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkBiArcs.h"
|
||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
|
||||
@@ -50,7 +50,37 @@ CurveByInterp::AddPoint( const Point3d& ptP)
|
||||
ICurve*
|
||||
CurveByInterp::GetCurve( int nMethod, int nType)
|
||||
{
|
||||
// calcolo le tangenti
|
||||
// se richieste curve di Bezier cubiche (ottenute da interpolazione con Nurbs)
|
||||
if ( nType == CUBIC_BEZIERS_LONG) {
|
||||
// creo la curva composita
|
||||
PtrOwner<ICurve> pCrv ;
|
||||
//pCrv.Set( InterpolatePointSetWithBezier( m_vPnt, 50 * EPS_SMALL, 50)) ;
|
||||
//debug
|
||||
pCrv.Set( InterpolatePointSetWithBezier( m_vPnt, 0.1, 100)) ;
|
||||
if ( IsNull(pCrv) || ! pCrv->IsValid())
|
||||
return nullptr ;
|
||||
return Release( pCrv) ;
|
||||
}
|
||||
|
||||
// numero di punti
|
||||
int nSize = int( m_vPnt.size()) ;
|
||||
|
||||
// sono necessari almeno due punti
|
||||
if ( nSize < 2)
|
||||
return nullptr ;
|
||||
|
||||
// calcolo le distanze tra i punti per derivarne i parametri
|
||||
m_vPar.reserve( nSize) ;
|
||||
double dPar = 0 ;
|
||||
m_vPar.push_back( dPar) ;
|
||||
|
||||
for ( int i = 1 ; i < nSize ; ++ i) {
|
||||
double dDist = Dist( m_vPnt[i-1], m_vPnt[i]) ;
|
||||
dPar += dDist ;
|
||||
m_vPar.push_back( dPar) ;
|
||||
}
|
||||
|
||||
// calcolo le tangenti
|
||||
if ( nMethod == BESSEL) {
|
||||
if ( ! CalcBesselTangents())
|
||||
return nullptr ;
|
||||
@@ -63,7 +93,7 @@ CurveByInterp::GetCurve( int nMethod, int nType)
|
||||
// se richiesti biarchi
|
||||
if ( nType == BIARCS) {
|
||||
// creo la curva composita
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
PtrOwner<CurveComposite> pCrvCompo( CreateBasicCurveComposite()) ;
|
||||
if ( IsNull( pCrvCompo))
|
||||
return nullptr ;
|
||||
// ciclo sugli intervalli
|
||||
@@ -83,13 +113,13 @@ CurveByInterp::GetCurve( int nMethod, int nType)
|
||||
// se richieste curve di Bezier cubiche
|
||||
if ( nType == CUBIC_BEZIERS) {
|
||||
// creo la curva composita
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
PtrOwner<CurveComposite> pCrvCompo( CreateBasicCurveComposite()) ;
|
||||
if ( IsNull( pCrvCompo))
|
||||
return nullptr ;
|
||||
// ciclo sugli intervalli
|
||||
for ( int i = 1 ; i < int( m_vPnt.size()) ; ++ i) {
|
||||
// creo una curva di Bezier cubica per ogni intervallo
|
||||
PtrOwner<ICurveBezier> pCBez( CreateCurveBezier()) ;
|
||||
PtrOwner<CurveBezier> pCBez( CreateBasicCurveBezier()) ;
|
||||
if ( IsNull( pCBez))
|
||||
return nullptr ;
|
||||
pCBez->Init( 3, false) ;
|
||||
@@ -110,233 +140,12 @@ CurveByInterp::GetCurve( int nMethod, int nType)
|
||||
bool
|
||||
CurveByInterp::CalcAkimaTangents( bool bDetectCorner)
|
||||
{
|
||||
// pulisco i vettori dei parametri e delle tangenti
|
||||
m_vPar.clear() ;
|
||||
m_vPrevDer.clear() ;
|
||||
m_vNextDer.clear() ;
|
||||
|
||||
// numero di punti
|
||||
int nSize = int( m_vPnt.size()) ;
|
||||
|
||||
// sono necessari almeno due punti
|
||||
if ( nSize < 2)
|
||||
return false ;
|
||||
|
||||
// calcolo le distanze tra i punti per derivarne i parametri
|
||||
m_vPar.reserve( nSize) ;
|
||||
double dPar = 0 ;
|
||||
m_vPar.push_back( dPar) ;
|
||||
for ( int i = 1 ; i < nSize ; ++ i) {
|
||||
double dDist = Dist( m_vPnt[i-1], m_vPnt[i]) ;
|
||||
dPar += dDist ;
|
||||
m_vPar.push_back( dPar) ;
|
||||
}
|
||||
|
||||
// calcolo le derivate
|
||||
m_vPrevDer.reserve( nSize) ;
|
||||
m_vNextDer.reserve( nSize) ;
|
||||
// se ci sono solo 2 punti, le tangenti devono essere dirette lungo la linea che li unisce
|
||||
if ( nSize == 2) {
|
||||
// non esiste derivata prima del primo punto
|
||||
m_vPrevDer.emplace_back( 0, 0, 0) ;
|
||||
m_vNextDer.push_back( ( m_vPnt[1] - m_vPnt[0]) / ( m_vPar[1] - m_vPar[0])) ;
|
||||
m_vPrevDer.push_back( m_vNextDer[0]) ;
|
||||
// non esiste derivata dopo il secondo e ultimo punto
|
||||
m_vNextDer.emplace_back( 0, 0, 0) ;
|
||||
return true ;
|
||||
}
|
||||
// verifico se curva chiusa (primo e ultimo punto coincidono)
|
||||
bool bClosed = AreSamePointApprox( m_vPnt.front(), m_vPnt.back()) ;
|
||||
// calcolo le derivate
|
||||
for ( int i = 0 ; i < nSize ; ++ i) {
|
||||
Vector3d vtPrevDer ;
|
||||
Vector3d vtNextDer ;
|
||||
// primo punto
|
||||
if ( i == 0) {
|
||||
// se curva chiusa, come precedente uso il penultimo punto
|
||||
if ( bClosed) {
|
||||
// se non ci sono almeno 5 punti
|
||||
if ( nSize < 5) {
|
||||
if ( ! CalcCircleMidDer( m_vPar[nSize-2] - m_vPar[nSize-1], m_vPnt[nSize-2], m_vPar[i], m_vPnt[i],
|
||||
m_vPar[i+1], m_vPnt[i+1], vtNextDer))
|
||||
return false ;
|
||||
vtPrevDer = vtNextDer ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
if ( ! CalcAkimaMidDer( m_vPar[nSize-3] - m_vPar[nSize-1], m_vPnt[nSize-3], m_vPar[nSize-2] - m_vPar[nSize-1], m_vPnt[nSize-2],
|
||||
m_vPar[i], m_vPnt[i], m_vPar[i+1], m_vPnt[i+1],
|
||||
m_vPar[i+2], m_vPnt[i+2], bDetectCorner,
|
||||
vtPrevDer, vtNextDer))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti, uso arco sui primi tre punti
|
||||
else {
|
||||
if ( ! CalcCircleStartDer( m_vPar[i], m_vPnt[i], m_vPar[i+1], m_vPnt[i+1],
|
||||
m_vPar[i+2], m_vPnt[i+2], vtNextDer))
|
||||
return false ;
|
||||
vtPrevDer = Vector3d( 0, 0, 0) ;
|
||||
}
|
||||
}
|
||||
// ultimo punto
|
||||
else if ( i == nSize - 1) {
|
||||
// se curva chiusa, le tg devono coincidere con quelle del primo
|
||||
if ( bClosed) {
|
||||
vtPrevDer = m_vPrevDer[0] ;
|
||||
vtNextDer = m_vNextDer[0] ;
|
||||
}
|
||||
// altrimenti, uso arco sugli ultimi tre punti
|
||||
else {
|
||||
if ( ! CalcCircleEndDer( m_vPar[i-2], m_vPnt[i-2], m_vPar[i-1], m_vPnt[i-1],
|
||||
m_vPar[i], m_vPnt[i], vtPrevDer))
|
||||
return false ;
|
||||
vtNextDer = Vector3d( 0, 0, 0) ;
|
||||
}
|
||||
}
|
||||
// punti intermedi
|
||||
else {
|
||||
// se secondo punto
|
||||
if ( i == 1) {
|
||||
// se curva aperta o non ci sono almeno 5 punti
|
||||
if ( ! bClosed || nSize < 5) {
|
||||
if ( ! CalcCircleMidDer( m_vPar[i-1], m_vPnt[i-1], m_vPar[i], m_vPnt[i],
|
||||
m_vPar[i+1], m_vPnt[i+1], vtPrevDer))
|
||||
return false ;
|
||||
vtNextDer = vtPrevDer ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
if ( ! CalcAkimaMidDer( m_vPar[nSize-2] - m_vPar[nSize-1], m_vPnt[nSize-2], m_vPar[i-1], m_vPnt[i-1],
|
||||
m_vPar[i], m_vPnt[i], m_vPar[i+1], m_vPnt[i+1],
|
||||
m_vPar[i+2], m_vPnt[i+2], bDetectCorner,
|
||||
vtPrevDer, vtNextDer))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// se penultimo punto
|
||||
else if ( i == nSize - 2) {
|
||||
// se curva aperta o non ci sono almeno 5 punti
|
||||
if ( ! bClosed || nSize < 5) {
|
||||
if ( ! CalcCircleMidDer( m_vPar[i-1], m_vPnt[i-1], m_vPar[i], m_vPnt[i],
|
||||
m_vPar[i+1], m_vPnt[i+1], vtPrevDer))
|
||||
return false ;
|
||||
vtNextDer = vtPrevDer ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
if ( ! CalcAkimaMidDer( m_vPar[i-2], m_vPnt[i-2], m_vPar[i-1], m_vPnt[i-1],
|
||||
m_vPar[i], m_vPnt[i], m_vPar[i+1], m_vPnt[i+1],
|
||||
m_vPar[1] + m_vPar[i+1], m_vPnt[1], bDetectCorner,
|
||||
vtPrevDer, vtNextDer))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
if ( ! CalcAkimaMidDer( m_vPar[i-2], m_vPnt[i-2], m_vPar[i-1], m_vPnt[i-1],
|
||||
m_vPar[i], m_vPnt[i], m_vPar[i+1], m_vPnt[i+1],
|
||||
m_vPar[i+2], m_vPnt[i+2], bDetectCorner,
|
||||
vtPrevDer, vtNextDer))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// salvo la derivata
|
||||
m_vPrevDer.push_back( vtPrevDer) ;
|
||||
m_vNextDer.push_back( vtNextDer) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
return ComputeAkimaTangents( bDetectCorner, m_vPar, m_vPnt, m_vPrevDer, m_vNextDer) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveByInterp::CalcBesselTangents( void)
|
||||
{
|
||||
// pulisco i vettori dei parametri e delle tangenti
|
||||
m_vPar.clear() ;
|
||||
m_vPrevDer.clear() ;
|
||||
m_vNextDer.clear() ;
|
||||
|
||||
// numero di punti
|
||||
int nSize = int( m_vPnt.size()) ;
|
||||
|
||||
// sono necessari almeno due punti
|
||||
if ( nSize < 2)
|
||||
return false ;
|
||||
|
||||
// calcolo le distanze tra i punti per derivarne i parametri
|
||||
m_vPar.reserve( nSize) ;
|
||||
double dPar = 0 ;
|
||||
m_vPar.push_back( dPar) ;
|
||||
for ( int i = 1 ; i < nSize ; ++ i) {
|
||||
double dDist = Dist( m_vPnt[i-1], m_vPnt[i]) ;
|
||||
dPar += dDist ;
|
||||
m_vPar.push_back( dPar) ;
|
||||
}
|
||||
|
||||
// calcolo le derivate
|
||||
m_vPrevDer.reserve( nSize) ;
|
||||
m_vNextDer.reserve( nSize) ;
|
||||
// se ci sono solo 2 punti, le tangenti devono essere dirette lungo la linea che li unisce
|
||||
if ( nSize == 2) {
|
||||
// non esiste derivata prima del primo punto
|
||||
m_vPrevDer.emplace_back( 0, 0, 0) ;
|
||||
m_vNextDer.push_back( ( m_vPnt[1] - m_vPnt[0]) / ( m_vPar[1] - m_vPar[0])) ;
|
||||
m_vPrevDer.push_back( m_vNextDer[0]) ;
|
||||
// non esiste derivata dopo il secondo e ultimo punto
|
||||
m_vNextDer.emplace_back( 0, 0, 0) ;
|
||||
return true ;
|
||||
}
|
||||
// verifico se curva chiusa (primo e ultimo punto coincidono)
|
||||
bool bClosed = AreSamePointApprox( m_vPnt.front(), m_vPnt.back()) ;
|
||||
// calcolo le derivate
|
||||
for ( int i = 0 ; i < nSize ; ++ i) {
|
||||
Vector3d vtPrevDer ;
|
||||
Vector3d vtNextDer ;
|
||||
// primo punto
|
||||
if ( i == 0) {
|
||||
// se curva chiusa, come precedente uso il penultimo punto
|
||||
if ( bClosed) {
|
||||
if ( ! CalcBesselMidDer( m_vPar[nSize-2] - m_vPar[nSize-1], m_vPnt[nSize-2], m_vPar[i], m_vPnt[i],
|
||||
m_vPar[i+1], m_vPnt[i+1], vtNextDer))
|
||||
return false ;
|
||||
vtPrevDer = vtNextDer ;
|
||||
}
|
||||
// altrimenti, uso i primi tre punti
|
||||
else {
|
||||
if ( ! CalcBesselStartDer( m_vPar[i], m_vPnt[i], m_vPar[i+1], m_vPnt[i+1],
|
||||
m_vPar[i+2], m_vPnt[i+2], vtNextDer))
|
||||
return false ;
|
||||
vtPrevDer = Vector3d( 0, 0, 0) ;
|
||||
}
|
||||
}
|
||||
// ultimo punto
|
||||
else if ( i == nSize - 1) {
|
||||
// se curva chiusa, le tg devono coincidere con quelle del primo
|
||||
if ( bClosed) {
|
||||
vtPrevDer = m_vPrevDer[0] ;
|
||||
vtNextDer = m_vNextDer[0] ;
|
||||
}
|
||||
// altrimenti, uso gli ultimi tre punti
|
||||
else {
|
||||
if ( ! CalcBesselEndDer( m_vPar[i-2], m_vPnt[i-2], m_vPar[i-1], m_vPnt[i-1],
|
||||
m_vPar[i], m_vPnt[i], vtPrevDer))
|
||||
return false ;
|
||||
vtNextDer = Vector3d( 0, 0, 0) ;
|
||||
}
|
||||
}
|
||||
// punti intermedi
|
||||
else {
|
||||
if ( ! CalcBesselMidDer( m_vPar[i-1], m_vPnt[i-1], m_vPar[i], m_vPnt[i],
|
||||
m_vPar[i+1], m_vPnt[i+1], vtPrevDer))
|
||||
return false ;
|
||||
vtNextDer = vtPrevDer ;
|
||||
}
|
||||
// salvo la derivata
|
||||
m_vPrevDer.push_back( vtPrevDer) ;
|
||||
m_vNextDer.push_back( vtNextDer) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
return ComputeBesselTangents( m_vPar, m_vPnt, m_vPrevDer, m_vNextDer) ;
|
||||
}
|
||||
+638
-195
File diff suppressed because it is too large
Load Diff
+51
-20
@@ -21,9 +21,14 @@
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include <deque>
|
||||
|
||||
class Voronoi ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class CurveComposite : public ICurveComposite, public IGeoObjRW
|
||||
{
|
||||
public :
|
||||
enum DeletedCurve { NONE = 0, PREV = 1, NEXT = 2 } ;
|
||||
|
||||
public : // IGeoObj
|
||||
~CurveComposite( void) override ;
|
||||
CurveComposite* Clone( void) const override ;
|
||||
@@ -53,9 +58,14 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
||||
{ return m_OGrMgr.GetObjGraphics() ; }
|
||||
void SetTempProp( int nProp, int nPropInd = 0) override
|
||||
{ if ( nPropInd >= 0 && nPropInd < 2)
|
||||
m_nTempProp[nPropInd] = nProp ; }
|
||||
m_nTempProp[nPropInd] = nProp ; }
|
||||
int GetTempProp( int nPropInd = 0) const override
|
||||
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
||||
void SetTempParam( double dParam, int nParamInd = 0) override
|
||||
{ if ( nParamInd >= 0 && nParamInd < 2)
|
||||
m_dTempParam[nParamInd] = dParam ; }
|
||||
double GetTempParam( int nParamInd = 0) const override
|
||||
{ return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; }
|
||||
|
||||
public : // ICurve
|
||||
bool IsSimple( void) const override
|
||||
@@ -106,7 +116,7 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
||||
bool ApproxWithArcsEx( double dLinTol, double dAngTolDeg, double dLinFea, PolyArc& PA) const override ;
|
||||
ICurve* CopyParamRange( double dUStart, double dUEnd) const override ;
|
||||
bool Invert( void) override ;
|
||||
bool SimpleOffset( double dDist, int nType = OFF_FILLET) override ;
|
||||
bool SimpleOffset( double dDist, int nType = OFF_FILLET, double dMaxAngExt = ANG_RIGHT) override ;
|
||||
bool ModifyStart( const Point3d& ptNewStart) override ;
|
||||
bool ModifyEnd( const Point3d& ptNewEnd) override ;
|
||||
bool SetExtrusion( const Vector3d& vtExtr) override
|
||||
@@ -143,13 +153,15 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
||||
bool IsParamAtJoint( double dU) const override ;
|
||||
ICurve* RemoveFirstOrLastCurve( bool bLast = true) override ;
|
||||
bool ChangeStartPoint( double dU) override ;
|
||||
bool AddPoint( const Point3d& ptStart) override ;
|
||||
bool AddPoint( const Point3d& ptStart) override ; // funzione per aggiungere il ptStart prima di usare la funzione AddLine
|
||||
bool AddLine( const Point3d& ptNew, bool bEndOrStart = true) override ;
|
||||
bool AddLineTg( double dLen, bool bEndOrStart = true) override ;
|
||||
bool AddArc2P( const Point3d& ptOther, const Point3d& ptNew, bool bEndOrStart = true) override ;
|
||||
bool AddArcTg( const Point3d& ptNew, bool bEndOrStart = true) override ;
|
||||
bool AddJoint( double dU) override ;
|
||||
bool ModifyJoint( int nU, const Point3d& ptNewJoint) override ;
|
||||
bool ModifyJoint( int nU, const Point3d& ptNewJoint) override
|
||||
{ return ModifyJoint( nU, ptNewJoint, nullptr) ; }
|
||||
bool ModifyJoint( int nU, const Point3d& ptNewJoint, double dTol) override ; // verifico se le curve interessate sono in tolleranza con la versione prima della modifica
|
||||
bool RemoveJoint( int nU) override ;
|
||||
bool MoveCurve( int nCrv, const Vector3d& vtMove) override ;
|
||||
bool ModifyCurveToArc( int nCrv, const Point3d& ptMid) override ;
|
||||
@@ -158,6 +170,7 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
||||
bool ArcsBezierCurvesToArcsPerpExtr( double dLinTol, double dAngTolDeg) override ;
|
||||
bool StraightArcsToLines( double dLinTol, double dAngTolDeg) override ;
|
||||
bool MergeCurves( double dLinTol, double dAngTolDeg, bool bStartEnd = true, bool bNeedSameProp = false) override ;
|
||||
bool RemoveSmallParts( double dLinTol, double dAngTolDeg) override ;
|
||||
bool RemoveSmallDefects( double dLinTol, double dAngTolDeg, bool bAlsoSpikes = false) override ;
|
||||
bool RemoveUndercutOnY( double dLinTol, double dAngTolDeg) override ;
|
||||
bool IsAPoint( void) const override ;
|
||||
@@ -165,17 +178,24 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
||||
bool IsACircle( double dLinTol, Point3d& ptCen, Vector3d& vtN, double& dRad, bool& bCCW) const override ;
|
||||
bool IsARectangle( double dLinTol, Point3d& ptP, Vector3d& vtL1, Vector3d& vtL2) const override ;
|
||||
bool IsATrapezoid( double dLinTol, Point3d& ptP, Vector3d& vtB1, Vector3d& vtL1, Vector3d& vtB2) const override ;
|
||||
bool SetCurveTempProp( int nCrv, int nProp, int nPropNum = 0) override ;
|
||||
bool GetCurveTempProp( int nCrv, int& nProp, int nPropNum = 0) const override ;
|
||||
|
||||
bool SetCurveTempProp( int nCrv, int nProp, int nPropInd = 0) override ;
|
||||
bool GetCurveTempProp( int nCrv, int& nProp, int nPropInd = 0) const override ;
|
||||
bool SetCurveTempParam( int nCrv, double dParam, int nParamInd = 0) override ;
|
||||
bool GetCurveTempParam( int nCrv, double& dParam, int nParamInd = 0) const override ;
|
||||
bool GetOnlyPoint( Point3d& ptStart) const override ;
|
||||
bool ReplaceSingleCurve( int nSubCrv, ICurve* pNewCurve, double dTolStartEnd, double dTolAlong = INFINITO) override ;
|
||||
|
||||
public : // IGeoObjRW
|
||||
int GetNgeId( void) const override ;
|
||||
bool Save( NgeWriter& ngeOut) const override ;
|
||||
bool PreSave( GdbGeo& Wrapper) const override { return true ; }
|
||||
bool PostSave( GdbGeo& Wrapper) const override { return true ; }
|
||||
bool Load( NgeReader& ngeIn) override ;
|
||||
bool PostLoad( GdbGeo& Wrapper) override { return true ; }
|
||||
|
||||
public :
|
||||
CurveComposite( void) ;
|
||||
CurveComposite( const CurveComposite& ccSrc)
|
||||
CurveComposite( const CurveComposite& ccSrc) : m_pVoronoiObj( nullptr)
|
||||
{ if ( ! CopyFrom( ccSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "CurveComposite : copy constructor error") }
|
||||
CurveComposite& operator =( const CurveComposite& ccSrc)
|
||||
@@ -184,6 +204,9 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
||||
return *this ; }
|
||||
bool RelocateFrom( CurveComposite& ccSrc) ;
|
||||
bool GetApproxLength( double& dLen) const ;
|
||||
bool TestClosure( double dLinTol = EPS_SMALL) ;
|
||||
Voronoi* GetVoronoiObject( void) const ;
|
||||
void ResetVoronoiObject( void) const ;
|
||||
|
||||
private :
|
||||
bool CopyFrom( const CurveComposite& ccSrc) ;
|
||||
@@ -191,26 +214,29 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
||||
bool AddCurveByRelocate( CurveComposite& ccSrc, bool bEndOrStart = true, double dLinTol = EPS_SMALL) ;
|
||||
bool AddSimpleCurve( ICurve* pSmplCrv, bool bEndOrStart = true, double dLinTol = EPS_SMALL) ;
|
||||
bool GetIndSCurveAndLocPar( double dU, Side nS, int& nSCrv, double& dLocU) const ;
|
||||
bool SimpleOffsetXY( double dDist, int nType = OFF_FILLET) ;
|
||||
bool IsOneCircle( Point3d& ptCen, Vector3d& vtN, double& dRad, bool& bCCW) const ;
|
||||
bool SimpleOffsetXY( double dDist, int nType = OFF_FILLET, double dMaxAngExt = ANG_RIGHT) ;
|
||||
bool IsOneCircle( Point3d& ptCen, Vector3d& vtN, double& dRad, bool& bCCW) const ;
|
||||
bool CalcVoronoiObject( void) const ;
|
||||
bool ModifyJoint( int nU, const Point3d& ptNewJoint, int* pnFlagDel) ;
|
||||
|
||||
private :
|
||||
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
|
||||
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2, IS_A_POINT = 3} ;
|
||||
|
||||
private :
|
||||
typedef std::deque<ICurve*> PCRVSMPL_DEQUE ;
|
||||
typedef PCRVSMPL_DEQUE::iterator PCSD_ITER ;
|
||||
typedef PCRVSMPL_DEQUE::const_iterator PCSD_CONST_ITER ;
|
||||
|
||||
private :
|
||||
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
||||
Status m_nStatus ; // stato
|
||||
PCRVSMPL_DEQUE m_CrvSmplS ; // deque di curve semplici
|
||||
Vector3d m_VtExtr ; // vettore estrusione (normalmente coincide con m_VtN)
|
||||
double m_dThick ; // spessore
|
||||
Point3d m_ptStart ; // punto iniziale per composita vuota per Add di linee o archi
|
||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||
mutable PCSD_CONST_ITER m_Iter ; // iteratore
|
||||
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
||||
Status m_nStatus ; // stato
|
||||
PCRVSMPL_DEQUE m_CrvSmplS ; // deque di curve semplici
|
||||
Vector3d m_VtExtr ; // vettore estrusione (normalmente coincide con m_VtN)
|
||||
double m_dThick ; // spessore
|
||||
Point3d m_ptStart ; // punto iniziale per composita vuota per Add di linee o archi
|
||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||
mutable Voronoi* m_pVoronoiObj ; // Voronoi
|
||||
mutable PCSD_CONST_ITER m_Iter ; // iteratore
|
||||
} ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -250,6 +276,11 @@ inline CurveComposite* ConvertCurveToBasicComposite( IGeoObj* pGObj)
|
||||
if ( nProp != 0)
|
||||
pCrvCo->SetTempProp( nProp, i) ;
|
||||
}
|
||||
for ( int i = 0 ; i < 2 ; ++ i) {
|
||||
double dParam = pCrv->GetTempParam( i) ;
|
||||
if ( abs( dParam) > EPS_SMALL)
|
||||
pCrvCo->SetTempParam( dParam, i) ;
|
||||
}
|
||||
pCrvCo->AddCurve( pCrv) ;
|
||||
return pCrvCo ;
|
||||
}
|
||||
|
||||
+14
-10
@@ -19,6 +19,7 @@
|
||||
#include "GeoConst.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
#include "/EgtDev/Include/EGkIntersCurves.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
@@ -30,14 +31,14 @@ static const int TP_IS_VERT_LINE = 1 ;
|
||||
static bool IsVerticalLine( const ICurve* pCrv, double* pdLenZ) ;
|
||||
static bool VerifyAndAdjustSamePoint( ICurve* pCrv1, ICurve* pCrv2, CurveComposite& ccAux) ;
|
||||
static bool VerifyAndAdjustInternalAngle( ICurve* pCrv1, ICurve* pCrv2, CurveComposite& ccAux) ;
|
||||
static bool VerifyAndAdjustExternalAngle( ICurve* pCrv1, ICurve* pCrv2, double dDist, int nType,
|
||||
static bool VerifyAndAdjustExternalAngle( ICurve* pCrv1, ICurve* pCrv2, double dDist, int nType, double dMaxAngExt,
|
||||
CurveComposite& ccAux) ;
|
||||
static bool AddFirstLastVerticalLines( CurveComposite& ccOffs, double dLenVertFirst, double dLenVertLast) ;
|
||||
static bool MediaInternalAngleDeltaZ( CurveComposite& ccOffs) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::SimpleOffsetXY( double dDist, int nType)
|
||||
CurveComposite::SimpleOffsetXY( double dDist, int nType, double dMaxAngExt)
|
||||
{
|
||||
// creo una copia formata solo da rette e archi che giacciono nel piano XY (VtExtr è Z+)
|
||||
CurveComposite ccCopy ;
|
||||
@@ -98,7 +99,7 @@ CurveComposite::SimpleOffsetXY( double dDist, int nType)
|
||||
CurveComposite ccTemp ;
|
||||
if ( VerifyAndAdjustSamePoint( pCrvPrev, pCrv2, ccTemp) ||
|
||||
VerifyAndAdjustInternalAngle( pCrvPrev, pCrv2, ccTemp) ||
|
||||
VerifyAndAdjustExternalAngle( pCrvPrev, pCrv2, dDist, nType, ccTemp)) {
|
||||
VerifyAndAdjustExternalAngle( pCrvPrev, pCrv2, dDist, nType, dMaxAngExt, ccTemp)) {
|
||||
if ( ccTemp.GetCurveCount() > 0 && ! ccOffs.AddCurveByRelocate( ccTemp))
|
||||
return false ;
|
||||
}
|
||||
@@ -122,7 +123,7 @@ CurveComposite::SimpleOffsetXY( double dDist, int nType)
|
||||
CurveComposite ccTemp ;
|
||||
if ( VerifyAndAdjustSamePoint( pCrvPrev, pCrvNext, ccTemp) ||
|
||||
VerifyAndAdjustInternalAngle( pCrvPrev, pCrvNext, ccTemp) ||
|
||||
VerifyAndAdjustExternalAngle( pCrvPrev, pCrvNext, dDist, nType, ccTemp)) {
|
||||
VerifyAndAdjustExternalAngle( pCrvPrev, pCrvNext, dDist, nType, dMaxAngExt, ccTemp)) {
|
||||
int nCrvCount = ccTemp.GetCurveCount() ;
|
||||
if ( nCrvCount > 0 && ! ccOffs.AddCurveByRelocate( ccTemp))
|
||||
return false ;
|
||||
@@ -174,7 +175,7 @@ bool
|
||||
VerifyAndAdjustSamePoint( ICurve* pCrv1, ICurve* pCrv2, CurveComposite& ccAux)
|
||||
{
|
||||
// verifica dei puntatori
|
||||
if ( pCrv1 == nullptr || pCrv2 == nullptr || &ccAux == nullptr)
|
||||
if ( pCrv1 == nullptr || pCrv2 == nullptr)
|
||||
return false ;
|
||||
|
||||
// pulisco la curva ausiliaria
|
||||
@@ -218,7 +219,7 @@ bool
|
||||
VerifyAndAdjustInternalAngle( ICurve* pCrv1, ICurve* pCrv2, CurveComposite& ccAux)
|
||||
{
|
||||
// verifica dei puntatori
|
||||
if ( pCrv1 == nullptr || pCrv2 == nullptr || &ccAux == nullptr)
|
||||
if ( pCrv1 == nullptr || pCrv2 == nullptr)
|
||||
return false ;
|
||||
|
||||
// pulisco la curva ausiliaria
|
||||
@@ -259,11 +260,11 @@ VerifyAndAdjustInternalAngle( ICurve* pCrv1, ICurve* pCrv2, CurveComposite& ccAu
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VerifyAndAdjustExternalAngle( ICurve* pCrv1, ICurve* pCrv2, double dDist, int nType,
|
||||
VerifyAndAdjustExternalAngle( ICurve* pCrv1, ICurve* pCrv2, double dDist, int nType, double dMaxAngExt,
|
||||
CurveComposite& ccAux)
|
||||
{
|
||||
// verifica dei puntatori
|
||||
if ( pCrv1 == nullptr || pCrv2 == nullptr || &ccAux == nullptr)
|
||||
if ( pCrv1 == nullptr || pCrv2 == nullptr)
|
||||
return false ;
|
||||
|
||||
// pulisco la curva ausiliaria
|
||||
@@ -272,6 +273,9 @@ VerifyAndAdjustExternalAngle( ICurve* pCrv1, ICurve* pCrv2, double dDist, int nT
|
||||
// elimino dal tipo le parti estranee all'angolo esterno
|
||||
nType &= ( ICurve::OFF_FILLET | ICurve::OFF_CHAMFER | ICurve::OFF_EXTEND) ;
|
||||
|
||||
// porto il massimo angolo per tipo Extend in limiti accettabili (90° - 150°)
|
||||
dMaxAngExt = Clamp( dMaxAngExt, ANG_RIGHT, 1.667 * ANG_RIGHT) ;
|
||||
|
||||
// calcolo direzioni tangenti sull'estremo in comune
|
||||
Vector3d vtDir1, vtDir2 ;
|
||||
if ( ! pCrv1->GetEndDir( vtDir1) || ! pCrv2->GetStartDir( vtDir2))
|
||||
@@ -319,8 +323,8 @@ VerifyAndAdjustExternalAngle( ICurve* pCrv1, ICurve* pCrv2, double dDist, int nT
|
||||
( dDist > 0 && dAngDeg < 0)))
|
||||
return false ;
|
||||
|
||||
// se l'angolo esterno supera il retto, offset extend diventa offset chamfer
|
||||
if ( nType == ICurve::OFF_EXTEND && abs( dAngDeg) > ANG_RIGHT + EPS_ANG_SMALL)
|
||||
// se l'angolo esterno supera il limite, offset extend diventa offset chamfer
|
||||
if ( nType == ICurve::OFF_EXTEND && abs( dAngDeg) > dMaxAngExt + EPS_ANG_SMALL)
|
||||
nType = ICurve::OFF_CHAMFER ;
|
||||
|
||||
// se angolo esterno molto piccolo, semplifico tutto
|
||||
|
||||
+111
-21
@@ -14,10 +14,11 @@
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "CurveLine.h"
|
||||
#include "DistPointLine.h"
|
||||
#include "GeoObjFactory.h"
|
||||
#include "NgeWriter.h"
|
||||
#include "NgeReader.h"
|
||||
#include "Voronoi.h"
|
||||
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
@@ -30,15 +31,15 @@ GEOOBJ_REGISTER( CRV_LINE, NGE_C_LIN, CurveLine) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
CurveLine::CurveLine( void)
|
||||
: m_nStatus( TO_VERIFY), m_PtStart(), m_PtEnd(), m_VtExtr(), m_dThick()
|
||||
: m_nStatus( TO_VERIFY), m_PtStart(), m_PtEnd(), m_VtExtr(), m_dThick(),
|
||||
m_nTempProp{0,0}, m_dTempParam{0.0,0.0}, m_pVoronoiObj( nullptr)
|
||||
{
|
||||
m_nTempProp[0] = 0 ;
|
||||
m_nTempProp[1] = 0 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
CurveLine::~CurveLine( void)
|
||||
{
|
||||
ResetVoronoiObject() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -50,6 +51,8 @@ CurveLine::Set( const Point3d& ptStart, const Point3d& ptEnd)
|
||||
m_PtEnd = ptEnd ;
|
||||
m_nStatus = TO_VERIFY ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -69,6 +72,8 @@ CurveLine::SetPVL( const Point3d& ptStart, const Vector3d& vtDir, double dLen)
|
||||
m_PtEnd = ptStart + vtDelta ;
|
||||
m_nStatus = TO_VERIFY ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -86,6 +91,8 @@ CurveLine::SetPDL( const Point3d& ptStart, double dDirAngDeg, double dLen)
|
||||
m_PtEnd = ptStart + vtDelta ;
|
||||
m_nStatus = TO_VERIFY ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -128,6 +135,8 @@ CurveLine::CopyFrom( const CurveLine& clSrc)
|
||||
m_dThick = clSrc.m_dThick ;
|
||||
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
|
||||
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
|
||||
m_dTempParam[0] = clSrc.m_dTempParam[0] ;
|
||||
m_dTempParam[1] = clSrc.m_dTempParam[1] ;
|
||||
return Set( clSrc.m_PtStart, clSrc.m_PtEnd) ;
|
||||
}
|
||||
|
||||
@@ -153,7 +162,7 @@ CurveLine::Dump( string& sOut, bool bMM, const char* szNewLine) const
|
||||
// dati generali di una curva
|
||||
if ( ! CurveDump( *this, sOut, bMM, szNewLine))
|
||||
return false ;
|
||||
// parametri : sono già compresi nei dati generali (PS e PE)
|
||||
// parametri : sono già compresi nei dati generali (PS e PE)
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -214,7 +223,7 @@ CurveLine::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
|
||||
return false ;
|
||||
// assegno il box in locale
|
||||
b3Loc.Set( m_PtStart, m_PtEnd) ;
|
||||
// se c'è estrusione, devo tenerne conto
|
||||
// se c'è estrusione, devo tenerne conto
|
||||
if ( ! m_VtExtr.IsSmall() && abs( m_dThick) > EPS_SMALL) {
|
||||
Point3d ptMinExtr = b3Loc.GetMin() + m_VtExtr * m_dThick ;
|
||||
Point3d ptMaxExtr = b3Loc.GetMax() + m_VtExtr * m_dThick ;
|
||||
@@ -232,7 +241,7 @@ CurveLine::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità del frame
|
||||
// verifico validità del frame
|
||||
if ( frRef.GetType() == Frame3d::ERR)
|
||||
return false ;
|
||||
// porto gli estremi nel riferimento passato
|
||||
@@ -242,7 +251,7 @@ CurveLine::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
||||
ptFrEnd.ToGlob( frRef) ;
|
||||
// assegno il box nel riferimento
|
||||
b3Ref.Set( ptFrStart, ptFrEnd) ;
|
||||
// se c'è estrusione, devo tenerne conto
|
||||
// se c'è estrusione, devo tenerne conto
|
||||
if ( ! m_VtExtr.IsSmall() && abs( m_dThick) > EPS_SMALL) {
|
||||
Vector3d vtFrExtr = m_VtExtr ;
|
||||
vtFrExtr.ToGlob( frRef) ;
|
||||
@@ -381,7 +390,7 @@ CurveLine::GetLength( double& dLen) const
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// la lunghezza è la distanza tra gli estremi
|
||||
// la lunghezza è la distanza tra gli estremi
|
||||
dLen = Dist( m_PtStart, m_PtEnd) ;
|
||||
|
||||
return ( dLen > EPS_SMALL) ;
|
||||
@@ -407,7 +416,7 @@ CurveLine::GetLengthAtParam( double dU, double& dLen) const
|
||||
return true ;
|
||||
}
|
||||
|
||||
// la lunghezza totale è la distanza tra gli estremi
|
||||
// la lunghezza totale è la distanza tra gli estremi
|
||||
double dTotLen = Dist( m_PtStart, m_PtEnd) ;
|
||||
|
||||
// fine
|
||||
@@ -439,7 +448,7 @@ CurveLine::GetParamAtLength( double dLen, double& dU) const
|
||||
return true ;
|
||||
}
|
||||
|
||||
// la lunghezza totale è la distanza tra gli estremi
|
||||
// la lunghezza totale è la distanza tra gli estremi
|
||||
double dTotLen = Dist( m_PtStart, m_PtEnd) ;
|
||||
|
||||
// se dopo fine, errore
|
||||
@@ -558,6 +567,8 @@ CurveLine::Invert( void)
|
||||
// inverto i punti estremi
|
||||
swap( m_PtStart, m_PtEnd) ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -566,7 +577,7 @@ CurveLine::Invert( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveLine::SimpleOffset( double dDist, int nType)
|
||||
CurveLine::SimpleOffset( double dDist, int nType, double dMaxAngExt)
|
||||
{
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK)
|
||||
@@ -589,6 +600,8 @@ CurveLine::SimpleOffset( double dDist, int nType)
|
||||
m_PtStart += vtDir * dDist ;
|
||||
m_PtEnd += vtDir * dDist ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -609,6 +622,8 @@ CurveLine::ModifyStart( const Point3d& ptNewStart)
|
||||
// assegno il nuovo inizio
|
||||
m_PtStart = ptNewStart ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -629,6 +644,8 @@ CurveLine::ModifyEnd( const Point3d& ptNewEnd)
|
||||
// assegno la nuova fine
|
||||
m_PtEnd = ptNewEnd ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -704,6 +721,8 @@ CurveLine::TrimStartAtLen( double dLenTrim)
|
||||
if ( dLenTrim > EPS_ZERO)
|
||||
m_PtStart = Media( m_PtStart, m_PtEnd, ( dLenTrim / dLen)) ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -728,6 +747,8 @@ CurveLine::TrimEndAtLen( double dLenTrim)
|
||||
if ( ( dLen - dLenTrim) > EPS_ZERO)
|
||||
m_PtEnd = Media( m_PtStart, m_PtEnd, ( dLenTrim / dLen)) ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -750,6 +771,8 @@ CurveLine::ExtendStartByLen( double dLenExt)
|
||||
// sposto il punto iniziale
|
||||
m_PtStart -= vtDir * dLenExt ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -772,6 +795,8 @@ CurveLine::ExtendEndByLen( double dLenExt)
|
||||
// sposto il punto finale
|
||||
m_PtEnd += vtDir * dLenExt ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -786,6 +811,10 @@ CurveLine::Translate( const Vector3d& vtMove)
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// traslo Voronoi
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
m_pVoronoiObj->Translate( vtMove) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -803,10 +832,14 @@ CurveLine::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, do
|
||||
// la curva deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità dell'asse di rotazione
|
||||
// verifico validità dell'asse di rotazione
|
||||
if ( vtAx.IsSmall())
|
||||
return false ;
|
||||
|
||||
// ruoto Voronoi
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
m_pVoronoiObj->Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -838,6 +871,8 @@ CurveLine::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double d
|
||||
if ( AreSamePointApprox( ptNewStart, ptNewEnd))
|
||||
return false ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -863,10 +898,12 @@ CurveLine::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
// la curva deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità del piano di specchiatura
|
||||
// verifico validità del piano di specchiatura
|
||||
if ( vtNorm.IsSmall())
|
||||
return false ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -886,10 +923,12 @@ CurveLine::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& v
|
||||
// la curva deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità dei parametri
|
||||
// verifico validità dei parametri
|
||||
if ( vtNorm.IsSmall() || vtDir.IsSmall())
|
||||
return false ;
|
||||
|
||||
// imposto ricalcolo di Voronoi
|
||||
ResetVoronoiObject() ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -914,14 +953,18 @@ CurveLine::ToGlob( const Frame3d& frRef)
|
||||
// la curva deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità del frame
|
||||
// verifico validità del frame
|
||||
if ( frRef.GetType() == Frame3d::ERR)
|
||||
return false ;
|
||||
|
||||
// se frame identità, non devo fare alcunché
|
||||
// se frame identità, non devo fare alcunché
|
||||
if ( IsGlobFrame( frRef))
|
||||
return true ;
|
||||
|
||||
// trasformo Voronoi
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
m_pVoronoiObj->ToGlob( frRef) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -936,14 +979,18 @@ CurveLine::ToLoc( const Frame3d& frRef)
|
||||
// la curva deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità del frame
|
||||
// verifico validità del frame
|
||||
if ( frRef.GetType() == Frame3d::ERR)
|
||||
return false ;
|
||||
|
||||
// se frame identità, non devo fare alcunché
|
||||
// se frame identità, non devo fare alcunché
|
||||
if ( IsGlobFrame( frRef))
|
||||
return true ;
|
||||
|
||||
// trasformo Voronoi
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
m_pVoronoiObj->ToLoc( frRef) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -958,14 +1005,18 @@ CurveLine::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
||||
// la curva deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// verifico validità dei frame
|
||||
// verifico validità dei frame
|
||||
if ( frOri.GetType() == Frame3d::ERR || frDest.GetType() == Frame3d::ERR)
|
||||
return false ;
|
||||
|
||||
// se i due riferimenti coincidono, non devo fare alcunché
|
||||
// se i due riferimenti coincidono, non devo fare alcunché
|
||||
if ( AreSameFrame( frOri, frDest))
|
||||
return true ;
|
||||
|
||||
// trasformo Voronoi
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
m_pVoronoiObj->LocToLoc( frOri, frDest) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
@@ -1001,3 +1052,42 @@ CurveLine::CalcPointParamPosiz( const Point3d& ptP, bool bOnXY, double& dU, int&
|
||||
nPos = ICurve::PP_MID ; // nell'interno
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveLine::CalcVoronoiObject() const
|
||||
{
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
|
||||
// creo oggetto vroni con la curva
|
||||
m_pVoronoiObj = new( std::nothrow) Voronoi( this, false) ;
|
||||
if ( m_pVoronoiObj == nullptr)
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Voronoi*
|
||||
CurveLine::GetVoronoiObject() const
|
||||
{
|
||||
if ( m_nStatus != OK)
|
||||
return nullptr ;
|
||||
|
||||
// se non è stato calcolato, lo calcolo
|
||||
if ( m_pVoronoiObj == nullptr)
|
||||
CalcVoronoiObject() ;
|
||||
|
||||
// restituisco Voronoi
|
||||
return m_pVoronoiObj ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
CurveLine::ResetVoronoiObject() const
|
||||
{
|
||||
if ( m_pVoronoiObj != nullptr)
|
||||
delete m_pVoronoiObj ;
|
||||
m_pVoronoiObj = nullptr ;
|
||||
}
|
||||
|
||||
+25
-10
@@ -19,6 +19,8 @@
|
||||
#include "GeoObjRW.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
|
||||
class Voronoi ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class CurveLine : public ICurveLine, public IGeoObjRW
|
||||
{
|
||||
@@ -54,6 +56,11 @@ class CurveLine : public ICurveLine, public IGeoObjRW
|
||||
m_nTempProp[nPropInd] = nProp ; }
|
||||
int GetTempProp( int nPropInd = 0) const override
|
||||
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
||||
void SetTempParam( double dParam, int nParamInd = 0) override
|
||||
{ if ( nParamInd >= 0 && nParamInd < 2)
|
||||
m_dTempParam[nParamInd] = dParam ; }
|
||||
double GetTempParam( int nParamInd = 0) const override
|
||||
{ return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; }
|
||||
|
||||
public : // ICurve
|
||||
bool IsSimple( void) const override
|
||||
@@ -110,7 +117,7 @@ class CurveLine : public ICurveLine, public IGeoObjRW
|
||||
{ return ApproxWithArcs( dLinTol, dAngTolDeg, PA) ; }
|
||||
ICurve* CopyParamRange( double dUStart, double dUEnd) const override ;
|
||||
bool Invert( void) override ;
|
||||
bool SimpleOffset( double dDist, int nType = OFF_FILLET) override ;
|
||||
bool SimpleOffset( double dDist, int nType = OFF_FILLET, double dMaxAngExt = ANG_RIGHT) override ;
|
||||
bool ModifyStart( const Point3d& ptNewStart) override ;
|
||||
bool ModifyEnd( const Point3d& ptNewEnd) override ;
|
||||
bool SetExtrusion( const Vector3d& vtExtr) override
|
||||
@@ -139,33 +146,41 @@ class CurveLine : public ICurveLine, public IGeoObjRW
|
||||
public : // IGeoObjRW
|
||||
int GetNgeId( void) const override ;
|
||||
bool Save( NgeWriter& ngeOut) const override ;
|
||||
bool PreSave( GdbGeo& Wrapper) const override { return true ; }
|
||||
bool PostSave( GdbGeo& Wrapper) const override { return true ; }
|
||||
bool Load( NgeReader& ngeIn) override ;
|
||||
bool PostLoad( GdbGeo& Wrapper) override { return true ; }
|
||||
|
||||
public :
|
||||
CurveLine( void) ;
|
||||
CurveLine( const CurveLine& clSrc)
|
||||
CurveLine( const CurveLine& clSrc) : m_pVoronoiObj( nullptr)
|
||||
{ if ( ! CopyFrom( clSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "CurveLine : copy constructor error") }
|
||||
CurveLine& operator =( const CurveLine& clSrc)
|
||||
{ if ( ! CopyFrom( clSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "CurveLine : copy error")
|
||||
return *this ; }
|
||||
Voronoi* GetVoronoiObject( void) const ;
|
||||
void ResetVoronoiObject( void) const ;
|
||||
|
||||
private :
|
||||
bool CopyFrom( const CurveLine& clSrc) ;
|
||||
bool Validate( void) ;
|
||||
bool Validate( void) ;
|
||||
bool CalcVoronoiObject( void) const ;
|
||||
|
||||
private :
|
||||
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
|
||||
|
||||
private :
|
||||
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
||||
Status m_nStatus ; // stato
|
||||
Point3d m_PtStart ; // punto iniziale
|
||||
Point3d m_PtEnd ; // punto finale
|
||||
Vector3d m_VtExtr ; // vettore estrusione
|
||||
double m_dThick ; // spessore
|
||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
||||
Status m_nStatus ; // stato
|
||||
Point3d m_PtStart ; // punto iniziale
|
||||
Point3d m_PtEnd ; // punto finale
|
||||
Vector3d m_VtExtr ; // vettore estrusione
|
||||
double m_dThick ; // spessore
|
||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||
mutable Voronoi* m_pVoronoiObj ; // Voronoi
|
||||
} ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
+7
-8
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2020-2022
|
||||
// EgalTech 2020-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DistLineLine.h Data : 12.08.22 Versione : 2.4h1
|
||||
// File : DistLineLine.cpp Data : 10.05.24 Versione : 2.6e3
|
||||
// Contenuto : Implementazione della classe distanza fra elementi lineari.
|
||||
//
|
||||
//
|
||||
@@ -12,11 +12,10 @@
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "DistLineLine.h"
|
||||
#include "/EgtDev/Include/EGkDistLineLine.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EGkGeoCollection.h"
|
||||
#include "/EgtDev/Include/EGkGeoConst.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -59,7 +58,7 @@ DistLineLine::DistLineLine( const Point3d& ptSt1, const Vector3d& vtD1, double d
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistLineLine::GetSqDist( double& dSqDist)
|
||||
DistLineLine::GetSqDist( double& dSqDist) const
|
||||
{
|
||||
if ( m_dSqDist < 0)
|
||||
return false ;
|
||||
@@ -70,7 +69,7 @@ DistLineLine::GetSqDist( double& dSqDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistLineLine::GetDist( double& dDist)
|
||||
DistLineLine::GetDist( double& dDist) const
|
||||
{
|
||||
if ( m_dSqDist < 0)
|
||||
return false ;
|
||||
@@ -83,7 +82,7 @@ DistLineLine::GetDist( double& dDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistLineLine::GetMinDistPoints( Point3d& ptMinDist1, Point3d& ptMinDist2)
|
||||
DistLineLine::GetMinDistPoints( Point3d& ptMinDist1, Point3d& ptMinDist2) const
|
||||
{
|
||||
if ( m_dSqDist < 0)
|
||||
return false ;
|
||||
@@ -94,7 +93,7 @@ DistLineLine::GetMinDistPoints( Point3d& ptMinDist1, Point3d& ptMinDist2)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistLineLine::GetPositionsAtMinDistPoints( double& dPos1, double& dPos2)
|
||||
DistLineLine::GetPositionsAtMinDistPoints( double& dPos1, double& dPos2) const
|
||||
{
|
||||
if ( m_dSqDist < 0)
|
||||
return false ;
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2020-2020
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DistLineLine.h Data : 06.11.20 Versione : 2.2k1
|
||||
// Contenuto : Dichiarazione della classe distanza fra elementi lineari.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 06.11.20 LM Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EGkVector3d.h"
|
||||
#include "/EgtDev/Include/EGkPoint3d.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class DistLineLine
|
||||
{
|
||||
public :
|
||||
DistLineLine( const Point3d& ptSt1, const Point3d& ptEn1,
|
||||
const Point3d& ptSt2, const Point3d& ptEn2,
|
||||
bool bIsSegment1 = true, bool bIsSegment2 = true) ;
|
||||
DistLineLine( const Point3d& ptSt1, const Vector3d& vtD1, double dLen1,
|
||||
const Point3d& ptSt2, const Vector3d& vtD2, double dLen2,
|
||||
bool bIsSegment1 = true, bool bIsSegment2 = true) ;
|
||||
|
||||
public :
|
||||
bool GetSqDist( double& dSqDist) ;
|
||||
bool GetDist( double& dDist) ;
|
||||
bool IsEpsilon( double dTol) {
|
||||
double dSqDist ;
|
||||
return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ;
|
||||
}
|
||||
bool IsSmall( void) { return IsEpsilon( EPS_SMALL) ; }
|
||||
bool IsZero( void) { return IsEpsilon( EPS_ZERO) ; }
|
||||
bool GetMinDistPoints( Point3d& ptMinDist1, Point3d& ptMinDist2) ;
|
||||
bool GetPositionsAtMinDistPoints( double& dPos1, double& dPos2) ;
|
||||
|
||||
private :
|
||||
void Calculate( const Point3d& ptSt1, const Vector3d& vtD1, double dLen1,
|
||||
const Point3d& ptSt2, const Vector3d& vtD2, double dLen2,
|
||||
bool bIsSegment1, bool bIsSegment2) ;
|
||||
private:
|
||||
double m_dSqDist ;
|
||||
double m_dDist ;
|
||||
double m_dPos1 ;
|
||||
double m_dPos2 ;
|
||||
Point3d m_ptMinDist1 ;
|
||||
Point3d m_ptMinDist2 ;
|
||||
} ;
|
||||
+5
-6
@@ -122,14 +122,13 @@ DistPointArc::DistPointHelix( const Point3d& ptP, const ICurveArc& arArc)
|
||||
|
||||
// cerco la minima distanza per la polilinea
|
||||
MDCVECTOR vApproxMin ;
|
||||
MDCVECTOR::iterator Iter ;
|
||||
if ( ! CalcMinDistPointPolyLine( ptP, PL, dLinTol, vApproxMin))
|
||||
return ;
|
||||
|
||||
// raffino i punti trovati
|
||||
double dPolishedPar ;
|
||||
Point3d ptPolishedQ ;
|
||||
for ( Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
||||
for ( auto Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
||||
// eseguo raffinamento
|
||||
if ( PolishMinDistPointCurve( ptP, arArc, *Iter, dPolishedPar, ptPolishedQ)) {
|
||||
(*Iter).dDist = Dist( ptP, ptPolishedQ) ;
|
||||
@@ -148,7 +147,7 @@ DistPointArc::DistPointHelix( const Point3d& ptP, const ICurveArc& arArc)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointArc::GetSqDist( double& dSqDist)
|
||||
DistPointArc::GetSqDist( double& dSqDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -159,7 +158,7 @@ DistPointArc::GetSqDist( double& dSqDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointArc::GetDist( double& dDist)
|
||||
DistPointArc::GetDist( double& dDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -170,7 +169,7 @@ DistPointArc::GetDist( double& dDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointArc::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
||||
DistPointArc::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -185,7 +184,7 @@ DistPointArc::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointArc::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag)
|
||||
DistPointArc::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
|
||||
+9
-8
@@ -27,17 +27,18 @@ class DistPointArc
|
||||
DistPointArc( const Point3d& ptP, const ICurveArc& arArc) ;
|
||||
|
||||
public :
|
||||
bool GetSqDist( double& dSqDist) ;
|
||||
bool GetDist( double& dDist) ;
|
||||
bool IsEpsilon( double dTol)
|
||||
bool GetSqDist( double& dSqDist) const ;
|
||||
bool GetDist( double& dDist) const ;
|
||||
bool IsEpsilon( double dTol) const
|
||||
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
|
||||
bool IsSmall( void)
|
||||
bool IsSmall( void) const
|
||||
{ return IsEpsilon( EPS_SMALL) ; }
|
||||
bool IsZero( void)
|
||||
bool IsZero( void) const
|
||||
{ return IsEpsilon( EPS_ZERO) ; }
|
||||
int GetNbrMinDist( void) { return (int) m_Info.size() ; }
|
||||
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) ;
|
||||
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) ;
|
||||
int GetNbrMinDist( void) const
|
||||
{ return (int) m_Info.size() ; }
|
||||
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const ;
|
||||
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const ;
|
||||
|
||||
private :
|
||||
DistPointArc( void) ;
|
||||
|
||||
+18
-8
@@ -14,9 +14,9 @@
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "DllMain.h"
|
||||
#include "DistPointCrvAux.h"
|
||||
#include "DistPointLine.h"
|
||||
#include "GeoConst.h"
|
||||
#include "DistPointCrvAux.h"
|
||||
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -116,6 +116,7 @@ PolishMinDistPointCurve( const Point3d& ptP, const ICurve& cCurve,
|
||||
vtDiff = ptQ - ptP ;
|
||||
// angolo tra vettore e tangente
|
||||
dTemp = vtDer1 * vtDiff ;
|
||||
bool bEquiverse = dTemp > 0 ;
|
||||
if ( abs( dTemp) > EPS_ZERO)
|
||||
dSqCosA = dTemp * dTemp / ( vtDer1.SqLen() * vtDiff.SqLen()) ;
|
||||
else
|
||||
@@ -123,8 +124,20 @@ PolishMinDistPointCurve( const Point3d& ptP, const ICurve& cCurve,
|
||||
// stima prossimo valore del parametro (Newton : Unext = U - F(U) / F'(U))
|
||||
dPrevPar = dPar ;
|
||||
dTemp = vtDer2 * vtDiff + vtDer1.SqLen() ;
|
||||
if ( abs( dTemp) > EPS_ZERO)
|
||||
dPar = dPrevPar - ( vtDer1 * vtDiff) / dTemp ;
|
||||
|
||||
// se il coseno tra questi due vettori è troppo grande potrei aver avuto una cattiva stima iniziale
|
||||
// provo quindi ad aggiustare a mano, anziché usare il segno suggerito da newton, che con queste premesse potrebbe divergere
|
||||
double dCos75 = 0.2588 ;
|
||||
if ( abs( dTemp) > EPS_ZERO) {
|
||||
double dDelta = ( vtDer1 * vtDiff) / dTemp ;
|
||||
if ( dSqCosA > dCos75) {
|
||||
if ( ( bEquiverse && dDelta > 0) || ( ! bEquiverse && dDelta < 0))
|
||||
dDelta *= -1 ;
|
||||
dPar = dPrevPar + dDelta ;
|
||||
}
|
||||
else
|
||||
dPar = dPrevPar - dDelta ;
|
||||
}
|
||||
// clipping parametro
|
||||
if ( dPar < approxMin.dParMin) {
|
||||
if ( approxMin.bParMinSing && ! bClampedFromSing) {
|
||||
@@ -156,13 +169,10 @@ bool
|
||||
FilterMinDistPointCurve( const Point3d& ptP, const ICurve& cCurve,
|
||||
const MDCVECTOR& vApproxMin, double& dMinDist, MDPCIVECTOR& Info)
|
||||
{
|
||||
MDCVECTOR::const_iterator Iter ;
|
||||
|
||||
|
||||
// determino i minimi raffinati da tenere
|
||||
bool bFound = false ;
|
||||
bool bLastOnEnd = false ; // flag per ultimo punto su fine del suo intervallo
|
||||
for ( Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
||||
for ( auto Iter = vApproxMin.cbegin() ; Iter != vApproxMin.cend() ; ++Iter) {
|
||||
// altro punto con la stessa minima distanza
|
||||
if ( bFound && abs( (*Iter).dDist - dMinDist) < EPS_SMALL) {
|
||||
// se abbastanza lontano e non su bordi intervallino lo aggiungo
|
||||
|
||||
+18
-8
@@ -26,7 +26,7 @@ DistPointCrvBezier::DistPointCrvBezier( const Point3d& ptP, const ICurveBezier&
|
||||
// distanza non calcolata
|
||||
m_dDist = - 1 ;
|
||||
|
||||
if ( &CrvBez == nullptr || ! CrvBez.IsValid())
|
||||
if ( ! CrvBez.IsValid())
|
||||
return ;
|
||||
|
||||
// determino tolleranza di approssimazione in base a ingombro curva
|
||||
@@ -42,9 +42,19 @@ DistPointCrvBezier::DistPointCrvBezier( const Point3d& ptP, const ICurveBezier&
|
||||
if ( ! CrvBez.ApproxWithLines( dLinTol, ANG_TOL_APPROX_DEG, ICurve::APL_STD, PL))
|
||||
return ;
|
||||
|
||||
int nDeg = CrvBez.GetDegree() ;
|
||||
if ( PL.GetPointNbr() < nDeg + 1) {
|
||||
// costruisco una polilinea con un numero di curve scelto in base al grado della curva
|
||||
PL.Clear() ;
|
||||
for ( int i = 0 ; i <= nDeg + 1 ; ++i) {
|
||||
double dU = double(i) / (nDeg + 1) ;
|
||||
Point3d ptBez ;
|
||||
CrvBez.GetPointD1D2( dU, ICurve::Side::FROM_MINUS, ptBez) ;
|
||||
PL.AddUPoint( dU, ptBez) ;
|
||||
}
|
||||
}
|
||||
// cerco la minima distanza per la polilinea
|
||||
MDCVECTOR vApproxMin ;
|
||||
MDCVECTOR::iterator Iter ;
|
||||
if ( ! CalcMinDistPointPolyLine( ptP, PL, dLinTol, vApproxMin))
|
||||
return ;
|
||||
|
||||
@@ -52,7 +62,7 @@ DistPointCrvBezier::DistPointCrvBezier( const Point3d& ptP, const ICurveBezier&
|
||||
double dSingP ;
|
||||
if ( CrvBez.GetSingularParam( dSingP) == 0)
|
||||
dSingP = - 1 ;
|
||||
for ( Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
||||
for ( auto Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
||||
// imposto flag per singolarità agli estremi
|
||||
(*Iter).bParMinSing = abs( (*Iter).dParMin - dSingP) < EPS_SMALL ;
|
||||
(*Iter).bParMaxSing = abs( (*Iter).dParMax - dSingP) < EPS_SMALL ;
|
||||
@@ -61,7 +71,7 @@ DistPointCrvBezier::DistPointCrvBezier( const Point3d& ptP, const ICurveBezier&
|
||||
// raffino i punti trovati
|
||||
double dPolishedPar ;
|
||||
Point3d ptPolishedQ ;
|
||||
for ( Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
||||
for ( auto Iter = vApproxMin.begin() ; Iter != vApproxMin.end() ; ++Iter) {
|
||||
// eseguo raffinamento
|
||||
if ( PolishMinDistPointCurve( ptP, CrvBez, *Iter, dPolishedPar, ptPolishedQ)) {
|
||||
(*Iter).dDist = Dist( ptP, ptPolishedQ) ;
|
||||
@@ -80,7 +90,7 @@ DistPointCrvBezier::DistPointCrvBezier( const Point3d& ptP, const ICurveBezier&
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCrvBezier::GetSqDist( double& dSqDist)
|
||||
DistPointCrvBezier::GetSqDist( double& dSqDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -91,7 +101,7 @@ DistPointCrvBezier::GetSqDist( double& dSqDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCrvBezier::GetDist( double& dDist)
|
||||
DistPointCrvBezier::GetDist( double& dDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -102,7 +112,7 @@ DistPointCrvBezier::GetDist( double& dDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCrvBezier::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
||||
DistPointCrvBezier::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -117,7 +127,7 @@ DistPointCrvBezier::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCrvBezier::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag)
|
||||
DistPointCrvBezier::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
|
||||
@@ -27,17 +27,18 @@ class DistPointCrvBezier
|
||||
DistPointCrvBezier( const Point3d& ptP, const ICurveBezier& CrvBez) ;
|
||||
|
||||
public :
|
||||
bool GetSqDist( double& dSqDist) ;
|
||||
bool GetDist( double& dDist) ;
|
||||
bool IsEpsilon( double dTol)
|
||||
bool GetSqDist( double& dSqDist) const ;
|
||||
bool GetDist( double& dDist) const ;
|
||||
bool IsEpsilon( double dTol) const
|
||||
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
|
||||
bool IsSmall( void)
|
||||
bool IsSmall( void) const
|
||||
{ return IsEpsilon( EPS_SMALL) ; }
|
||||
bool IsZero( void)
|
||||
bool IsZero( void) const
|
||||
{ return IsEpsilon( EPS_ZERO) ; }
|
||||
int GetNbrMinDist( void) { return (int) m_Info.size() ; }
|
||||
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) ;
|
||||
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) ;
|
||||
int GetNbrMinDist( void) const
|
||||
{ return (int) m_Info.size() ; }
|
||||
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const ;
|
||||
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const ;
|
||||
|
||||
private :
|
||||
DistPointCrvBezier( void) ;
|
||||
|
||||
@@ -50,7 +50,7 @@ DistPointCrvComposite::DistPointCrvComposite( const Point3d& ptP, const ICurveCo
|
||||
}
|
||||
// altrimenti, per curve successive
|
||||
else {
|
||||
// verifico se la distanza minima dal box è superiore al minimo già trovato
|
||||
// verifico se la distanza minima dal box è superiore al minimo già trovato
|
||||
BBox3d b3B ;
|
||||
if ( pCrvSmpl->GetLocalBBox( b3B) &&
|
||||
b3B.SqDistFromPoint( ptP) <= m_dDist * m_dDist) {
|
||||
@@ -105,7 +105,7 @@ DistPointCrvComposite::DistPointCrvComposite( const Point3d& ptP, const ICurveCo
|
||||
++ i ;
|
||||
}
|
||||
}
|
||||
// con minima distanza più bassa
|
||||
// con minima distanza più bassa
|
||||
else if ( dCurrDist < m_dDist) {
|
||||
// aggiorno i minimi
|
||||
m_dDist = dCurrDist ;
|
||||
@@ -129,7 +129,7 @@ DistPointCrvComposite::DistPointCrvComposite( const Point3d& ptP, const ICurveCo
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCrvComposite::GetSqDist( double& dSqDist)
|
||||
DistPointCrvComposite::GetSqDist( double& dSqDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -140,7 +140,7 @@ DistPointCrvComposite::GetSqDist( double& dSqDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCrvComposite::GetDist( double& dDist)
|
||||
DistPointCrvComposite::GetDist( double& dDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -151,7 +151,7 @@ DistPointCrvComposite::GetDist( double& dDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCrvComposite::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
||||
DistPointCrvComposite::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -166,7 +166,7 @@ DistPointCrvComposite::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCrvComposite::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag)
|
||||
DistPointCrvComposite::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
|
||||
@@ -26,17 +26,18 @@ class DistPointCrvComposite
|
||||
DistPointCrvComposite( const Point3d& ptP, const ICurveComposite& CrvCompo) ;
|
||||
|
||||
public :
|
||||
bool GetSqDist( double& dSqDist) ;
|
||||
bool GetDist( double& dDist) ;
|
||||
bool IsEpsilon( double dTol)
|
||||
bool GetSqDist( double& dSqDist) const ;
|
||||
bool GetDist( double& dDist) const ;
|
||||
bool IsEpsilon( double dTol) const
|
||||
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
|
||||
bool IsSmall( void)
|
||||
bool IsSmall( void) const
|
||||
{ return IsEpsilon( EPS_SMALL) ; }
|
||||
bool IsZero( void)
|
||||
bool IsZero( void) const
|
||||
{ return IsEpsilon( EPS_ZERO) ; }
|
||||
int GetNbrMinDist( void) { return (int) m_Info.size() ; }
|
||||
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) ;
|
||||
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) ;
|
||||
int GetNbrMinDist( void) const
|
||||
{ return (int) m_Info.size() ; }
|
||||
bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const ;
|
||||
bool GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const ;
|
||||
|
||||
private :
|
||||
DistPointCrvComposite( void) ;
|
||||
|
||||
+32
-19
@@ -13,10 +13,10 @@
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "DistPointLine.h"
|
||||
#include "DistPointArc.h"
|
||||
#include "DistPointCrvBezier.h"
|
||||
#include "DistPointCrvComposite.h"
|
||||
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ DistPointCurve::DistPointCurve( const Point3d& ptP, const ICurve& Curve, bool bI
|
||||
case CRV_COMPO :
|
||||
CrvCompositeCalculate( ptP, Curve) ;
|
||||
break ;
|
||||
default :
|
||||
break ;
|
||||
}
|
||||
// salvo il punto
|
||||
m_ptP = ptP ;
|
||||
@@ -98,7 +100,7 @@ DistPointCurve::CrvCompositeCalculate( const Point3d& ptP, const ICurve& Curve)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetSqDist( double& dSqDist)
|
||||
DistPointCurve::GetSqDist( double& dSqDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -109,7 +111,7 @@ DistPointCurve::GetSqDist( double& dSqDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetDist( double& dDist)
|
||||
DistPointCurve::GetDist( double& dDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
@@ -120,7 +122,7 @@ DistPointCurve::GetDist( double& dDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
||||
DistPointCurve::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||
return false ;
|
||||
@@ -132,7 +134,7 @@ DistPointCurve::GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetMinDistPoint( double dNearParam, Point3d& ptMinDist, int& nFlag)
|
||||
DistPointCurve::GetMinDistPoint( double dNearParam, Point3d& ptMinDist, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0 || m_Info.empty())
|
||||
return false ;
|
||||
@@ -150,7 +152,7 @@ DistPointCurve::GetMinDistPoint( double dNearParam, Point3d& ptMinDist, int& nFl
|
||||
}
|
||||
}
|
||||
|
||||
// cerco punto discreto più vicino (anche estremi di zone continue)
|
||||
// cerco punto discreto più vicino (anche estremi di zone continue)
|
||||
double dParam ;
|
||||
for ( int i = 0 ; i < (int) m_Info.size() ; ++ i) {
|
||||
if ( i == 0 ||
|
||||
@@ -166,7 +168,7 @@ DistPointCurve::GetMinDistPoint( double dNearParam, Point3d& ptMinDist, int& nFl
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag)
|
||||
DistPointCurve::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||
return false ;
|
||||
@@ -178,7 +180,7 @@ DistPointCurve::GetParamAtMinDistPoint( int nInd, double& dParam, int& nFlag)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetParamAtMinDistPoint( double dNearParam, double& dParam, int& nFlag)
|
||||
DistPointCurve::GetParamAtMinDistPoint( double dNearParam, double& dParam, int& nFlag) const
|
||||
{
|
||||
if ( m_dDist < 0 || m_Info.empty())
|
||||
return false ;
|
||||
@@ -195,7 +197,7 @@ DistPointCurve::GetParamAtMinDistPoint( double dNearParam, double& dParam, int&
|
||||
}
|
||||
}
|
||||
|
||||
// cerco punto discreto più vicino (anche estremi di zone continue)
|
||||
// cerco punto discreto più vicino (anche estremi di zone continue)
|
||||
for ( int i = 0 ; i < (int) m_Info.size() ; ++ i) {
|
||||
if ( i == 0 ||
|
||||
abs( m_Info[i].dPar - dNearParam) < abs( dParam - dNearParam)) {
|
||||
@@ -209,13 +211,13 @@ DistPointCurve::GetParamAtMinDistPoint( double dNearParam, double& dParam, int&
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetSideAtMinDistPoint( int nInd, const Vector3d& vtN, int& nSide)
|
||||
DistPointCurve::GetSideAtMinDistPoint( int nInd, const Vector3d& vtN, int& nSide, double dTol) const
|
||||
{
|
||||
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||
return false ;
|
||||
|
||||
// se distanza nulla, il punto giace sulla curva
|
||||
if ( m_dDist <= EPS_SMALL) {
|
||||
if ( m_dDist <= dTol) {
|
||||
nSide = MDS_ON ;
|
||||
return true ;
|
||||
}
|
||||
@@ -230,9 +232,20 @@ DistPointCurve::GetSideAtMinDistPoint( int nInd, const Vector3d& vtN, int& nSide
|
||||
Vector3d vtTg = 0.5 * ( vtPreTg + vtPostTg) ;
|
||||
// se tangenti opposte, si deve ricalcolare spostandosi un poco
|
||||
if ( ! vtTg.Normalize()) {
|
||||
double dDeltaU = 1000 * EPS_PARAM ;
|
||||
if ( ! m_pCurve->GetPointTang( m_Info[nInd].dPar - dDeltaU, ICurve::FROM_MINUS, ptQ, vtPreTg) ||
|
||||
! m_pCurve->GetPointTang( m_Info[nInd].dPar + dDeltaU, ICurve::FROM_PLUS, ptQ, vtPostTg))
|
||||
double dDeltaU = 1000 * EPS_PARAM ;
|
||||
double dParPre = m_Info[nInd].dPar - dDeltaU ;
|
||||
double dParPost = m_Info[nInd].dPar + dDeltaU ;
|
||||
// verifico se il parametro deve essere modificato per adattarsi a curva chiusa
|
||||
if ( m_pCurve->IsClosed()) {
|
||||
double dParS, dParE ;
|
||||
m_pCurve->GetDomain( dParS, dParE) ;
|
||||
if ( dParPre < dParS)
|
||||
dParPre = dParE - dDeltaU ;
|
||||
if ( dParPost > dParE)
|
||||
dParPost = dParS + dDeltaU ;
|
||||
}
|
||||
if ( ! m_pCurve->GetPointTang( dParPre, ICurve::FROM_MINUS, ptQ, vtPreTg) ||
|
||||
! m_pCurve->GetPointTang( dParPost, ICurve::FROM_PLUS, ptQ, vtPostTg))
|
||||
return false ;
|
||||
vtTg = 0.5 * ( vtPreTg + vtPostTg) ;
|
||||
if ( ! vtTg.Normalize( EPS_ZERO))
|
||||
@@ -246,7 +259,7 @@ DistPointCurve::GetSideAtMinDistPoint( int nInd, const Vector3d& vtN, int& nSide
|
||||
|
||||
// determino il lato di giacitura del punto
|
||||
double dSide = vtRef * ( m_ptP - ptQ) ;
|
||||
if ( abs( dSide) < EPS_SMALL)
|
||||
if ( abs( dSide) < dTol)
|
||||
nSide = MDS_ON ;
|
||||
else if ( dSide > 0)
|
||||
nSide = MDS_LEFT ;
|
||||
@@ -257,12 +270,12 @@ DistPointCurve::GetSideAtMinDistPoint( int nInd, const Vector3d& vtN, int& nSide
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetSideAtMinDistPoint( double dNearParam, const Vector3d& vtN, int& nSide)
|
||||
DistPointCurve::GetSideAtMinDistPoint( double dNearParam, const Vector3d& vtN, int& nSide, double dTol) const
|
||||
{
|
||||
if ( m_dDist < 0 || m_Info.empty())
|
||||
return false ;
|
||||
|
||||
// cerco punto discreto più vicino (anche estremi di zone continue)
|
||||
// cerco punto discreto più vicino (anche estremi di zone continue)
|
||||
int nInd ;
|
||||
double dParam ;
|
||||
for ( int i = 0 ; i < (int) m_Info.size() ; ++ i) {
|
||||
@@ -273,12 +286,12 @@ DistPointCurve::GetSideAtMinDistPoint( double dNearParam, const Vector3d& vtN, i
|
||||
}
|
||||
}
|
||||
// mi sono ricondotto al caso precedente
|
||||
return GetSideAtMinDistPoint( nInd, vtN, nSide) ;
|
||||
return GetSideAtMinDistPoint( nInd, vtN, nSide, dTol) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointCurve::GetMinDistInfo( int nInd, MinDistPCInfo& aInfo)
|
||||
DistPointCurve::GetMinDistInfo( int nInd, MinDistPCInfo& aInfo) const
|
||||
{
|
||||
if ( m_dDist < 0 || nInd < 0 || nInd >= (int) m_Info.size())
|
||||
return false ;
|
||||
|
||||
+8
-8
@@ -1,19 +1,19 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2013-2013
|
||||
// EgalTech 2013-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DistPointLine.cpp Data : 17.12.13 Versione : 1.4l1
|
||||
// File : DistPointLine.cpp Data : 20.05.24 Versione : 2.6e5
|
||||
// Contenuto : Implementazione della classe distanza punto da linea/segmento.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 17.12.13 DS Creazione modulo.
|
||||
//
|
||||
// 20.05.24 DS Reso pubblico in Include.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "DistPointLine.h"
|
||||
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -95,7 +95,7 @@ DistPointLine::Calculate( const Point3d& ptP,
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointLine::GetSqDist( double& dSqDist)
|
||||
DistPointLine::GetSqDist( double& dSqDist) const
|
||||
{
|
||||
if ( m_dSqDist < 0)
|
||||
return false ;
|
||||
@@ -106,7 +106,7 @@ DistPointLine::GetSqDist( double& dSqDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointLine::GetDist( double& dDist)
|
||||
DistPointLine::GetDist( double& dDist) const
|
||||
{
|
||||
if ( m_dSqDist < 0)
|
||||
return false ;
|
||||
@@ -119,7 +119,7 @@ DistPointLine::GetDist( double& dDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointLine::GetMinDistPoint( Point3d& ptMinDist)
|
||||
DistPointLine::GetMinDistPoint( Point3d& ptMinDist) const
|
||||
{
|
||||
if ( m_dSqDist < 0)
|
||||
return false ;
|
||||
@@ -130,7 +130,7 @@ DistPointLine::GetMinDistPoint( Point3d& ptMinDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointLine::GetParamAtMinDistPoint( double& dParam)
|
||||
DistPointLine::GetParamAtMinDistPoint( double& dParam) const
|
||||
{
|
||||
if ( m_dSqDist < 0)
|
||||
return false ;
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2013-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DistPointLine.h Data : 02.01.14 Versione : 1.5a1
|
||||
// Contenuto : Dichiarazione della classe distanza punto da linea/segmento.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 30.12.12 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EGkPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
class DistPointLine
|
||||
{
|
||||
friend class DistPointCurve ;
|
||||
|
||||
public :
|
||||
DistPointLine( const Point3d& ptP,
|
||||
const ICurveLine& crvLine, bool bIsSegment = true) ;
|
||||
DistPointLine( const Point3d& ptP,
|
||||
const Point3d& ptIni, const Point3d& ptFin, bool bIsSegment = true) ;
|
||||
DistPointLine( const Point3d& ptP,
|
||||
const Point3d& ptIni, const Vector3d& vtDir, double dLen, bool bIsSegment = true) ;
|
||||
|
||||
public :
|
||||
bool GetSqDist( double& dSqDist) ;
|
||||
bool GetDist( double& dDist) ;
|
||||
bool IsEpsilon( double dTol)
|
||||
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
|
||||
bool IsSmall( void)
|
||||
{ return IsEpsilon( EPS_SMALL) ; }
|
||||
bool IsZero( void)
|
||||
{ return IsEpsilon( EPS_ZERO) ; }
|
||||
int GetNbrMinDist( void)
|
||||
{ return (( m_dSqDist < 0) ? 0 : 1) ; }
|
||||
bool GetMinDistPoint( Point3d& ptMinDist) ;
|
||||
bool GetParamAtMinDistPoint( double& dParam) ;
|
||||
|
||||
private :
|
||||
DistPointLine( void) ;
|
||||
void Calculate( const Point3d& ptP,
|
||||
const Point3d& ptIni, const Vector3d& vtDir, double dLen, bool bIsSegment) ;
|
||||
|
||||
private :
|
||||
double m_dSqDist ;
|
||||
double m_dDist ;
|
||||
double m_dParam ;
|
||||
Point3d m_ptMinDist ;
|
||||
} ;
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DistPointSurfBz.cpp Data : 29.10.25 Versione : 2.7j3
|
||||
// Contenuto : Implementazione della classe distanza Punto da superficie Bezier.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 29.10.25 DB Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "SurfTriMesh.h"
|
||||
#include "SurfBezier.h"
|
||||
#include "/EgtDev/Include/EGkDistPointTria.h"
|
||||
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkDistPointSurfBz.h"
|
||||
#include "/EgtDev/Include/EGkIntersLineTria.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
DistPointSurfBz::DistPointSurfBz( const Point3d& ptP, const ISurfBezier& pSrfBz)
|
||||
: m_dDist( -1), m_bIsInside( false), m_bIsSurfClosed( false)
|
||||
{
|
||||
// Bezier non valida
|
||||
if ( ! pSrfBz.IsValid())
|
||||
return ;
|
||||
// Calcolo la distanza
|
||||
Calculate( ptP, pSrfBz) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
DistPointSurfBz::Calculate( const Point3d& ptP, const ISurfBezier& srfBz)
|
||||
{
|
||||
// Inizializzo distanza non calcolata
|
||||
m_dDist = -1 ;
|
||||
|
||||
// Controllo se la superficie è chiusa
|
||||
m_bIsSurfClosed = srfBz.IsClosed() ;
|
||||
|
||||
// Lavoro con l'oggetto superficie trimesh di base
|
||||
const ISurfTriMesh* pStmRef = srfBz.GetAuxSurfRefined() ;
|
||||
if ( pStmRef == nullptr)
|
||||
return ;
|
||||
|
||||
DistPointSurfTm dpst( ptP, *pStmRef) ;
|
||||
|
||||
// recupero il punto a distanza minima sulla trimesh e lo raffino, prima di restituire distanza e punto minimo
|
||||
Point3d ptMinTm ; dpst.GetMinDistPoint( ptMinTm) ;
|
||||
int nT ; dpst.GetMinDistTriaIndex( nT) ;
|
||||
// salvo il punto corrispondente nel parametrico
|
||||
srfBz.UnprojectPointFromStm( nT, ptMinTm, m_ptParam) ;
|
||||
// salvo il punto a minima distanza sulla superficie e la normale alla superficie in quel punto
|
||||
srfBz.GetPointNrmD1D2( m_ptParam.x, m_ptParam.y, ISurfBezier::FROM_MINUS, ISurfBezier::FROM_MINUS, m_ptMinDistPoint, m_vtN) ;
|
||||
|
||||
// salvo la distanza minima
|
||||
m_dDist = Dist( ptP, m_ptMinDistPoint) ;
|
||||
// se il punto è sulla superficie
|
||||
if ( m_dDist < EPS_SMALL) {
|
||||
m_bIsInside = false ;
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
m_bIsInside = ( ( ptP - m_ptMinDistPoint) * m_vtN < - EPS_SMALL) ;
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointSurfBz::GetDist( double& dDist) const
|
||||
{
|
||||
// Distanza non valida
|
||||
if ( m_dDist < -EPS_ZERO)
|
||||
return false ;
|
||||
// Distanza valida
|
||||
dDist = m_dDist ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointSurfBz::GetMinDistPoint( Point3d& ptMinDistPoint) const
|
||||
{
|
||||
// Distanza non valida
|
||||
if ( m_dDist < -EPS_ZERO)
|
||||
return false ;
|
||||
// Distanza valida
|
||||
ptMinDistPoint = m_ptMinDistPoint ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointSurfBz::GetParamsAtMinDistPoint( double& dU, double& dV) const
|
||||
{
|
||||
// Distanza non valida
|
||||
if ( m_dDist < -EPS_ZERO)
|
||||
return false ;
|
||||
// Distanza valida
|
||||
dU = m_ptParam.x ;
|
||||
dV = m_ptParam.y ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointSurfBz::GetNorm( Vector3d& vtN) const
|
||||
{
|
||||
// Distanza non valida
|
||||
if ( m_dDist < -EPS_ZERO)
|
||||
return false ;
|
||||
// Distanza valida
|
||||
vtN = m_vtN ;
|
||||
return true ;
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2018-2020
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DistPointSurfTm.cpp Data : 19.12.20 Versione : 2.2l3
|
||||
// Contenuto : Implementazione della classe distanza Punto da Trimesh.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 07.12.18 LM Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "SurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EGkDistPointSurfFr.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
DistPointSurfFr::DistPointSurfFr( const Point3d& ptP, const ISurfFlatRegion& frSurf)
|
||||
: m_dDist( -1)
|
||||
{
|
||||
// FlatRegion non valida
|
||||
if ( &frSurf == nullptr || ! frSurf.IsValid())
|
||||
return ;
|
||||
// Calcolo la distanza
|
||||
Calculate( ptP, frSurf) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
DistPointSurfFr::Calculate( const Point3d& ptP, const ISurfFlatRegion& frSurf)
|
||||
{
|
||||
// Inizializzo distanza non calcolata
|
||||
m_dDist = -1 ;
|
||||
|
||||
// Converto regione in classe base
|
||||
const SurfFlatRegion* pSfr = GetBasicSurfFlatRegion( &frSurf) ;
|
||||
if ( pSfr == nullptr)
|
||||
return ;
|
||||
|
||||
// ciclo sulle parti della regione
|
||||
for ( int nC = 0 ; nC < pSfr->GetChunkCount() ; nC ++) {
|
||||
// ciclo sui loop della parte di regione
|
||||
for ( int nL = 0 ; nL < pSfr->GetLoopCount( nC) ; nL ++) {
|
||||
PtrOwner<ICurve> pLoop( pSfr->GetLoop( nC, nL)) ;
|
||||
if ( IsNull( pLoop)) {
|
||||
m_dDist = -1 ;
|
||||
return ;
|
||||
}
|
||||
DistPointCurve DPL( ptP, *pLoop) ;
|
||||
double dDist ;
|
||||
if ( DPL.GetDist( dDist) && ( m_dDist < -EPS_SMALL || dDist < m_dDist)) {
|
||||
m_dDist = dDist ;
|
||||
int nFlag ;
|
||||
m_nMinChunk = nC ;
|
||||
m_nMinLoop = nL ;
|
||||
DPL.GetParamAtMinDistPoint( 0, m_dMinPar, nFlag) ;
|
||||
DPL.GetMinDistPoint( 0, m_ptMinDistPoint, nFlag) ;
|
||||
DPL.GetSideAtMinDistPoint( 0, pSfr->GetNormVersor(), m_nSide) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// se trovata, aggiorno minima distanza sul piano
|
||||
if ( m_dDist > - EPS_SMALL) {
|
||||
Point3d ptOn = ptP - ( ptP - pSfr->GetPlanePoint()) * pSfr->GetNormVersor() * pSfr->GetNormVersor() ;
|
||||
m_dDistOnPlane = min( Dist( ptOn, m_ptMinDistPoint), m_dDist) ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointSurfFr::GetDist( double& dDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
dDist = m_dDist ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointSurfFr::GetDistOnRegionPlane( double& dDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
dDist = m_dDistOnPlane ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointSurfFr::GetPointAtMinDist( Point3d& ptMinDist) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
ptMinDist = m_ptMinDistPoint ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointSurfFr::GetParamAtMinDist( int& nMinChunk, int& nMinLoop, double& dMinPar) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
nMinChunk = m_nMinChunk ;
|
||||
nMinLoop = m_nMinLoop ;
|
||||
dMinPar = m_dMinPar ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointSurfFr::GetSideAtMinDist( int& nSide) const
|
||||
{
|
||||
if ( m_dDist < 0)
|
||||
return false ;
|
||||
nSide = m_nSide ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
IsPointInsideSurfFr( const Point3d& ptP, const ISurfFlatRegion* pSfr, double dMinDist, bool& bInside, int& nChunk)
|
||||
{
|
||||
// default non include
|
||||
bInside = false ;
|
||||
nChunk = -1 ;
|
||||
// verifica regione
|
||||
if ( pSfr == nullptr || ! pSfr->IsValid())
|
||||
return false ;
|
||||
// verifico se la proiezione del punto sul piano della regione sta nel suo box
|
||||
Point3d ptOn = ptP - ( ptP - pSfr->GetPlanePoint()) * pSfr->GetNormVersor() * pSfr->GetNormVersor() ;
|
||||
BBox3d b3Box ;
|
||||
pSfr->GetLocalBBox( b3Box) ;
|
||||
b3Box.Expand( dMinDist) ;
|
||||
if ( ! b3Box.Encloses( ptOn))
|
||||
return true ;
|
||||
// determino dove sta il punto
|
||||
DistPointSurfFr DPR( ptP, *pSfr) ;
|
||||
double dDist ; int nMinCh, nMinL; double dMinPar ; int nSide ;
|
||||
if ( DPR.GetDistOnRegionPlane( dDist) && DPR.GetParamAtMinDist( nMinCh, nMinL, dMinPar) && DPR.GetSideAtMinDist( nSide)) {
|
||||
if ( abs( dMinDist) < EPS_SMALL)
|
||||
bInside = ( nSide != PRS_OUT) ;
|
||||
else if ( dMinDist < 0)
|
||||
bInside = ( nSide == PRS_IN && dDist > abs( dMinDist) - EPS_SMALL) ;
|
||||
else
|
||||
bInside = ( nSide != PRS_OUT || dDist < dMinDist + EPS_SMALL) ;
|
||||
if ( bInside)
|
||||
nChunk = nMinCh ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
+120
-33
@@ -15,15 +15,16 @@
|
||||
#include "SurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkDistPointTria.h"
|
||||
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkIntersLineTria.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Calcola la differenza fra i bounding-box A e B.
|
||||
// L'insieme differenza non è un bounding-box, ma è esprimibile come unione di al più sei bounding-box.
|
||||
// L'insieme differenza non è un bounding-box, ma è esprimibile come unione di al più sei bounding-box.
|
||||
// Se l'insieme differenza fra i box non ha misura nulla viene restituito true, false altrimenti.
|
||||
// I casi in cui non vengono trovati box di misura positiva sono quelli in cui o il box A è contenuto
|
||||
// nel box B; uno di questi si verifica se il box A è vuoto.
|
||||
// I casi in cui non vengono trovati box di misura positiva sono quelli in cui o il box A è contenuto
|
||||
// nel box B; uno di questi si verifica se il box A è vuoto.
|
||||
// Nel vettore vBoxDiff vengono restituiti i box la cui unione costituisce la differenza fra A e B.
|
||||
static bool
|
||||
BoundingBoxDifference( const BBox3d& boxA, const BBox3d& boxB, BOXVECTOR& vBoxDiff)
|
||||
@@ -33,7 +34,7 @@ BoundingBoxDifference( const BBox3d& boxA, const BBox3d& boxB, BOXVECTOR& vBoxDi
|
||||
// Se box A vuoto, risultato vuoto
|
||||
if ( boxA.IsEmpty())
|
||||
return false ;
|
||||
// Se box B vuoto o i box non si intersecano, risultato è ancora A
|
||||
// Se box B vuoto o i box non si intersecano, risultato è ancora A
|
||||
BBox3d boxInt ;
|
||||
if ( boxB.IsSmall() || ! boxA.FindIntersection( boxB, boxInt)) {
|
||||
vBoxDiff.emplace_back( boxA) ;
|
||||
@@ -93,6 +94,10 @@ DistPointSurfTm::Calculate( const Point3d& ptP, const ISurfTriMesh& tmSurf)
|
||||
{
|
||||
// Inizializzo distanza non calcolata
|
||||
m_dDist = - 1. ;
|
||||
// Vettore di indici dei triangoli più vicini inizialmente vuoto
|
||||
m_vnMinDistTriaIndex.clear() ;
|
||||
// Controllo se la superficie è chiusa
|
||||
m_bIsSurfClosed = tmSurf.IsClosed() ;
|
||||
|
||||
// Lavoro con l'oggetto superficie trimesh di base
|
||||
const SurfTriMesh* pStm = GetBasicSurfTriMesh( &tmSurf) ;
|
||||
@@ -104,8 +109,8 @@ DistPointSurfTm::Calculate( const Point3d& ptP, const ISurfTriMesh& tmSurf)
|
||||
if ( b3Stm.IsEmpty())
|
||||
return ;
|
||||
|
||||
// Cerco triangoli in box centrati sul punto dato di ampiezza crescente ed escludendo le parti già verificate.
|
||||
// Termino quando non trovo più triangoli che possano soddisfare la richiesta.
|
||||
// Cerco triangoli in box centrati sul punto dato di ampiezza crescente ed escludendo le parti già verificate.
|
||||
// Termino quando non trovo più triangoli che possano soddisfare la richiesta.
|
||||
Point3d ptMin, ptMax ; b3Stm.GetMinMax( ptMin, ptMax) ;
|
||||
double dDeltaLen = max( min( min( b3Stm.GetDimX(), b3Stm.GetDimY()), b3Stm.GetDimZ()) / 40., 20.) ;
|
||||
double dBoxHalfLenX = max( max( ptMin.x - ptP.x, ptP.x - ptMax.x), 0.) + dDeltaLen ;
|
||||
@@ -115,14 +120,17 @@ DistPointSurfTm::Calculate( const Point3d& ptP, const ISurfTriMesh& tmSurf)
|
||||
BBox3d boxPPrev( ptP) ;
|
||||
BBox3d boxP( ptP, dBoxHalfLenX, dBoxHalfLenY, dBoxHalfLenZ) ;
|
||||
// Variabili distanza minima, indice del triangolo di distanza minima, punto di distanza minima
|
||||
double dMinSqDist = DBL_MAX ;
|
||||
double dMinDist = DBL_MAX ;
|
||||
int nMinDistTriaIndex = SVT_NULL ;
|
||||
Point3d ptMinDistPoint ;
|
||||
// Finché non si verifica la condizione di terminazione ingrandisco il box.
|
||||
// Finché non si verifica la condizione di terminazione ingrandisco il box.
|
||||
pStm->ResetTempInts() ;
|
||||
bool bContinue = true ;
|
||||
|
||||
// creazione del vettore dei triangoli più vicini a ptP
|
||||
vector<pair<int, Triangle3d>> vTria ; // <indice triangolo, Triangolo>
|
||||
while ( bContinue) {
|
||||
// Calcolo il box differenza con il precedente per non esplorare parti già considerate
|
||||
// Calcolo il box differenza con il precedente per non esplorare parti già considerate
|
||||
BOXVECTOR vBox ;
|
||||
BoundingBoxDifference( boxP, boxPPrev, vBox) ;
|
||||
// Ciclo sui box differenza
|
||||
@@ -130,12 +138,12 @@ DistPointSurfTm::Calculate( const Point3d& ptP, const ISurfTriMesh& tmSurf)
|
||||
for ( const auto& b3Box : vBox) {
|
||||
// interseco il box con quello della superficie e ne verifico la distanza minima dal punto
|
||||
BBox3d b3Int ;
|
||||
if ( ! b3Box.FindIntersection( b3Stm, b3Int) || b3Int.SqDistFromPoint( ptP) > dMinSqDist)
|
||||
if ( ! b3Box.FindIntersection( b3Stm, b3Int) || b3Int.DistFromPoint( ptP) > dMinDist)
|
||||
continue ;
|
||||
// ricerca sui triangoli nel box
|
||||
bCollide = true ;
|
||||
INTVECTOR vnIds ;
|
||||
if ( pStm->GetAllTriaOverlapBox( b3Int, vnIds)) {
|
||||
INTVECTOR vnIds ;
|
||||
if ( pStm->GetAllTriaOverlapBox( b3Int, vnIds)) {
|
||||
// Ciclo sui triangoli del sotto-box corrente
|
||||
for ( auto nT : vnIds) {
|
||||
int nTriaTemp ;
|
||||
@@ -143,19 +151,30 @@ DistPointSurfTm::Calculate( const Point3d& ptP, const ISurfTriMesh& tmSurf)
|
||||
if ( pStm->GetTempInt( nT, nTriaTemp) && nTriaTemp == 0 && pStm->GetTriangle( nT, trCurTria)) {
|
||||
pStm->SetTempInt( nT, 1) ;
|
||||
DistPointTriangle distPT( ptP, trCurTria) ;
|
||||
double dCurSqDist ;
|
||||
// Se la distanza del triangolo è valida e minore di quella attuale aggiorno
|
||||
if ( distPT.GetSqDist( dCurSqDist) && dCurSqDist < dMinSqDist) {
|
||||
dMinSqDist = dCurSqDist ;
|
||||
nMinDistTriaIndex = nT ;
|
||||
distPT.GetMinDistPoint( ptMinDistPoint) ;
|
||||
double dCurrDist ;
|
||||
// Se la distanza del triangolo è valida e minore di quella attuale aggiorno
|
||||
if ( distPT.GetDist( dCurrDist)) {
|
||||
// se distanze uguali...
|
||||
if ( abs( dCurrDist - dMinDist) < EPS_SMALL)
|
||||
// aggiungo il triangolo
|
||||
vTria.emplace_back( make_pair( nT, trCurTria)) ;
|
||||
// se minore...
|
||||
else if ( dCurrDist < dMinDist) {
|
||||
// pulisco il vettore
|
||||
vTria.clear() ;
|
||||
dMinDist = dCurrDist ;
|
||||
nMinDistTriaIndex = nT ;
|
||||
distPT.GetMinDistPoint( ptMinDistPoint) ;
|
||||
// aggiungo il triangolo
|
||||
vTria.emplace_back( make_pair( nT, trCurTria)) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Se si verifica la condizione di terminazione arresto il ciclo altrimenti aggiorno i box
|
||||
if ( ! bCollide || dMinSqDist < EPS_SMALL * EPS_SMALL)
|
||||
if ( ! bCollide || dMinDist < EPS_SMALL)
|
||||
bContinue = false ;
|
||||
else {
|
||||
boxPPrev = boxP ;
|
||||
@@ -163,20 +182,76 @@ DistPointSurfTm::Calculate( const Point3d& ptP, const ISurfTriMesh& tmSurf)
|
||||
}
|
||||
}
|
||||
|
||||
if ( nMinDistTriaIndex != SVT_NULL) {
|
||||
m_dDist = sqrt( max( dMinSqDist, 0.)) ;
|
||||
// se non ho trovato nessun triangolo, esco
|
||||
if ( nMinDistTriaIndex == SVT_NULL)
|
||||
return ;
|
||||
|
||||
// Inizializzo il vettore dei triangoli a minima distanza
|
||||
for ( auto& Tria : vTria)
|
||||
m_vnMinDistTriaIndex.emplace_back( Tria.first) ;
|
||||
|
||||
// salvo la distanza minima
|
||||
m_dDist = dMinDist ;
|
||||
// salvo il punto a distanza minima
|
||||
m_ptMinDistPoint = ptMinDistPoint ;
|
||||
// se il punto è sulla TriMesh...
|
||||
if ( m_dDist < EPS_SMALL) {
|
||||
m_nMinDistTriaIndex = nMinDistTriaIndex ;
|
||||
m_ptMinDistPoint = ptMinDistPoint ;
|
||||
Triangle3d trMinDistTria ;
|
||||
pStm->GetTriangle( m_nMinDistTriaIndex, trMinDistTria) ;
|
||||
trMinDistTria.Validate() ;
|
||||
m_bIsInside = ( ( ptP - m_ptMinDistPoint) * trMinDistTria.GetN() < - EPS_SMALL) && pStm->IsClosed() ;
|
||||
m_bIsInside = false ;
|
||||
return ;
|
||||
}
|
||||
// se ho un solo triangolo, allora deduco le informazioni da lui
|
||||
else if ( int( vTria.size()) == 1) {
|
||||
m_nMinDistTriaIndex = vTria.back().first ;
|
||||
m_bIsInside = ( ( ptP - m_ptMinDistPoint) * vTria.back().second.GetN() < - EPS_SMALL) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
// controllo se tutti i triangoli a minima distanza forniscono la stessa informazione
|
||||
// ( il punto potrebbe essere esterno a tutti, interno a tutti o indefinito )
|
||||
bool bInside = false ;
|
||||
bool bOutside = false ;
|
||||
for ( int i = 0 ; i < int( vTria.size()) ; ++ i) { // scorro i triangoli a minima distanza
|
||||
if ( ( ptP - vTria[i].second.GetP( 0)) * vTria[i].second.GetN() < - EPS_SMALL)
|
||||
bInside = true ;
|
||||
else
|
||||
bOutside = true ;
|
||||
}
|
||||
|
||||
// inizializzo le variabili membro
|
||||
m_nMinDistTriaIndex = nMinDistTriaIndex ;
|
||||
m_bIsInside = false ;
|
||||
|
||||
// se le informazioni non sono coerenti, allora :
|
||||
// 1) calcolo i centroidi dei triangoli in questione
|
||||
// 2) ottengo il punto medio di questi centroidi
|
||||
// 3) controllo quale triangolo interseca il segmento che parte da ptP e arriva a tale punto
|
||||
// 4) userò questo triangolo per classificare ptP
|
||||
if ( bOutside == bInside) {
|
||||
// calcolo il baricentro complessivo
|
||||
Point3d ptBar_tot ;
|
||||
for ( auto& Tria : vTria)
|
||||
ptBar_tot += Tria.second.GetCentroid() ;
|
||||
ptBar_tot /= int( vTria.size()) ;
|
||||
// per ogni triangolo, cerco quello che interseca il segmento
|
||||
for ( auto& Tria : vTria) {
|
||||
Point3d ptInters1, ptInters2 ;
|
||||
int nType = IntersLineTria( ptP, ptBar_tot, Tria.second, ptInters1, ptInters2) ;
|
||||
if ( nType == ILTT_IN) { // se intersezione ho finito
|
||||
DistPointTriangle( ptP, Tria.second).GetMinDistPoint( m_ptMinDistPoint) ;
|
||||
m_bIsInside = ( ( ptP - m_ptMinDistPoint) * Tria.second.GetN() < - EPS_SMALL) ;
|
||||
m_nMinDistTriaIndex = Tria.first ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // se informazioni coerenti
|
||||
m_bIsInside = bInside ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointSurfTm::GetDist( double& dDist)
|
||||
DistPointSurfTm::GetDist( double& dDist) const
|
||||
{
|
||||
// Distanza non valida
|
||||
if ( m_dDist < -EPS_ZERO)
|
||||
@@ -188,7 +263,7 @@ DistPointSurfTm::GetDist( double& dDist)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointSurfTm::GetMinDistPoint( Point3d& ptMinDistPoint)
|
||||
DistPointSurfTm::GetMinDistPoint( Point3d& ptMinDistPoint) const
|
||||
{
|
||||
// Distanza non valida
|
||||
if ( m_dDist < -EPS_ZERO)
|
||||
@@ -200,7 +275,7 @@ DistPointSurfTm::GetMinDistPoint( Point3d& ptMinDistPoint)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointSurfTm::GetMinDistTriaIndex( int& nMinDistIndex)
|
||||
DistPointSurfTm::GetMinDistTriaIndex( int& nMinDistIndex) const
|
||||
{
|
||||
// Distanza non valida
|
||||
if ( m_dDist < -EPS_ZERO)
|
||||
@@ -210,6 +285,18 @@ DistPointSurfTm::GetMinDistTriaIndex( int& nMinDistIndex)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
DistPointSurfTm::GetMinDistTriaIndices( INTVECTOR& vMinDistTriaIndex) const
|
||||
{
|
||||
// Distanza non valida
|
||||
if ( m_dDist < - EPS_ZERO)
|
||||
return false ;
|
||||
// Distanza valida
|
||||
vMinDistTriaIndex = m_vnMinDistTriaIndex ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
GetSurfTmNearestVertex( const Point3d& ptP, const ISurfTriMesh& tmSurf)
|
||||
@@ -224,8 +311,8 @@ GetSurfTmNearestVertex( const Point3d& ptP, const ISurfTriMesh& tmSurf)
|
||||
if ( b3Stm.IsEmpty())
|
||||
return SVT_NULL ;
|
||||
|
||||
// Cerco triangoli in box centrati sul punto dato di ampiezza crescente ed escludendo le parti già verificate.
|
||||
// Termino quando non trovo più triangoli che possano soddisfare la richiesta.
|
||||
// Cerco triangoli in box centrati sul punto dato di ampiezza crescente ed escludendo le parti già verificate.
|
||||
// Termino quando non trovo più triangoli che possano soddisfare la richiesta.
|
||||
Point3d ptMin, ptMax ; b3Stm.GetMinMax( ptMin, ptMax) ;
|
||||
double dDeltaLen = max( min( min( b3Stm.GetDimX(), b3Stm.GetDimY()), b3Stm.GetDimZ()) / 40., 20.) ;
|
||||
double dBoxHalfLenX = max( max( ptMin.x - ptP.x, ptP.x - ptMax.x), 0.) + dDeltaLen ;
|
||||
@@ -237,11 +324,11 @@ GetSurfTmNearestVertex( const Point3d& ptP, const ISurfTriMesh& tmSurf)
|
||||
// Variabili distanza minima
|
||||
int nVert = SVT_NULL ;
|
||||
double dMinSqDist = DBL_MAX ;
|
||||
// Finché non si verifica la condizione di terminazione ingrandisco il box.
|
||||
// Finché non si verifica la condizione di terminazione ingrandisco il box.
|
||||
pStm->ResetTempInts() ;
|
||||
bool bContinue = true ;
|
||||
while ( bContinue) {
|
||||
// Calcolo il box differenza con il precedente per non esplorare parti già considerate
|
||||
// Calcolo il box differenza con il precedente per non esplorare parti già considerate
|
||||
BOXVECTOR vBox ;
|
||||
BoundingBoxDifference( boxP, boxPPrev, vBox) ;
|
||||
// Ciclo sui box differenza
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "ProjPlane.h"
|
||||
#include "DistPointLine.h"
|
||||
#include "/EgtDev/Include/EGkDistPointLine.h"
|
||||
#include "/EgtDev/Include/EGkDistPointTria.h"
|
||||
|
||||
|
||||
|
||||
+12
-3
@@ -159,11 +159,20 @@ InitFontManager( const string& sNfeFontDir, const string& sDefaultFont)
|
||||
{
|
||||
// recupero il font manager
|
||||
FontManager& fntMgr = FontManager::GetFontManager() ;
|
||||
|
||||
// lo inizializzo
|
||||
fntMgr.Init( sNfeFontDir, sDefaultFont) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
SetDefaultFont( const string& sDefaultFont)
|
||||
{
|
||||
// recupero il font manager
|
||||
FontManager& fntMgr = FontManager::GetFontManager() ;
|
||||
// imposto il dato
|
||||
fntMgr.SetDefaultFont( sDefaultFont) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const string&
|
||||
GetNfeFontDir( void)
|
||||
@@ -185,11 +194,11 @@ GetDefaultFont( void)
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static pfProcEvents s_pFunProcEvents = nullptr ;
|
||||
static psfProcEvents s_pFunProcEvents = nullptr ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
SetEGkProcessEvents( pfProcEvents pFun)
|
||||
SetEGkProcessEvents( psfProcEvents pFun)
|
||||
{
|
||||
s_pFunProcEvents = pFun ;
|
||||
return ( pFun != nullptr) ;
|
||||
|
||||
Binary file not shown.
+56
-10
@@ -22,7 +22,7 @@
|
||||
<ProjectGuid>{9A98A202-2853-454A-84CA-DCD1714176C9}</ProjectGuid>
|
||||
<RootNamespace>EgtGeomKernel</RootNamespace>
|
||||
<Keyword>MFCDLLProj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
@@ -30,7 +30,7 @@
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@@ -46,7 +46,7 @@
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@@ -116,7 +116,7 @@
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -151,7 +151,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@@ -199,7 +199,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -238,14 +238,14 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||
<IntelJCCErratum>true</IntelJCCErratum>
|
||||
</ClCompile>
|
||||
@@ -280,7 +280,11 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="Attribs.cpp" />
|
||||
<ClCompile Include="BBox3d.cpp" />
|
||||
<ClCompile Include="BiArcs.cpp" />
|
||||
<ClCompile Include="CalcPocketing.cpp" />
|
||||
<ClCompile Include="CalcDerivate.cpp" />
|
||||
<ClCompile Include="CAvSilhouetteSurfTm.cpp" />
|
||||
<ClCompile Include="CAvSimpleSurfFrMove.cpp" />
|
||||
<ClCompile Include="CAvSurfFrMove.cpp" />
|
||||
<ClCompile Include="CAvToolSurfTm.cpp" />
|
||||
<ClCompile Include="CAvToolTriangle.cpp" />
|
||||
<ClCompile Include="CDeBoxClosedSurfTm.cpp" />
|
||||
@@ -308,12 +312,49 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="CurveByApprox.cpp" />
|
||||
<ClCompile Include="CurveByInterp.cpp" />
|
||||
<ClCompile Include="CurveCompositeOffset.cpp" />
|
||||
<ClCompile Include="DistPointSurfBz.cpp" />
|
||||
<ClCompile Include="DistPointSurfFr.cpp" />
|
||||
<ClCompile Include="IntersCurvePlane.cpp" />
|
||||
<ClCompile Include="IntersCurveSurfTm.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IntersLineVolZmap.cpp" />
|
||||
<ClCompile Include="IntersPlaneVolZmap.cpp" />
|
||||
<ClCompile Include="IntersLineSurfBez.cpp" />
|
||||
<ClCompile Include="Trimming.cpp" />
|
||||
<ClCompile Include="MultiGeomDB.cpp" />
|
||||
<ClCompile Include="SurfTriMeshOffset.cpp" />
|
||||
<ClCompile Include="VolZmapOffset.cpp" />
|
||||
<ClCompile Include="PolygonElevation.cpp" />
|
||||
<ClCompile Include="Quaternion.cpp" />
|
||||
<ClCompile Include="RotationMinimizingFrame.cpp" />
|
||||
<ClCompile Include="RotationXplaneFrame.cpp" />
|
||||
<ClCompile Include="SbzFromCurves.cpp" />
|
||||
<ClCompile Include="SbzStandard.cpp" />
|
||||
<ClCompile Include="Voronoi.cpp" />
|
||||
<ClInclude Include="..\Include\EGkCDeClosedSurfTmClosedSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkCDeConeFrustumClosedSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkCDeConvexTorusClosedSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkCDeRectPrismoidClosedSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkDistLineLine.h" />
|
||||
<ClInclude Include="..\Include\EGkDistPointLine.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersCurveSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersLineBox.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersLineVolZmap.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersPlaneBox.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersPlaneVolZmap.h" />
|
||||
<ClInclude Include="..\Include\EGkMultiGeomDB.h" />
|
||||
<ClInclude Include="..\Include\EGkPolygonElevation.h" />
|
||||
<ClInclude Include="..\Include\EGkQuaternion.h" />
|
||||
<ClInclude Include="..\Include\EGkRotationMinimizingFrame.h" />
|
||||
<ClInclude Include="..\Include\EGkRotationXplaneFrame.h" />
|
||||
<ClInclude Include="..\Include\EGkSubtractProjectedFacesOnStmFace.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfTriMeshAux.h" />
|
||||
<ClInclude Include="CAvSilhouetteSurfTm.h" />
|
||||
<ClInclude Include="CAvSurfFrMove.h" />
|
||||
<ClInclude Include="CDeBoxTria.h" />
|
||||
<ClInclude Include="CDeCapsTria.h" />
|
||||
<ClInclude Include="CDeConeFrustumTria.h" />
|
||||
@@ -342,6 +383,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="IntersPlaneTria.cpp" />
|
||||
<ClCompile Include="IntersSurfTmSurfTm.cpp" />
|
||||
<ClCompile Include="IntersTriaTria.cpp" />
|
||||
<ClCompile Include="OffsetAux.cpp" />
|
||||
<ClCompile Include="Tree.cpp" />
|
||||
<ClCompile Include="MedialAxis.cpp" />
|
||||
<ClCompile Include="OffsetCurve.cpp" />
|
||||
<ClCompile Include="DistPointArc.cpp" />
|
||||
@@ -397,9 +440,11 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="OffsetCurveOnX.cpp" />
|
||||
<ClCompile Include="Polygon3d.cpp" />
|
||||
<ClCompile Include="AdjustLoops.cpp" />
|
||||
<ClCompile Include="ProjectCurveSurf.cpp" />
|
||||
<ClCompile Include="RemoveCurveDefects.cpp" />
|
||||
<ClCompile Include="SelfIntersCurve.cpp" />
|
||||
<ClCompile Include="SfrCreate.cpp" />
|
||||
<ClCompile Include="SubtractProjectedFacesOnStmFace.cpp" />
|
||||
<ClCompile Include="SurfAux.cpp" />
|
||||
<ClCompile Include="SurfBezier.cpp" />
|
||||
<ClCompile Include="SurfFlatRegion.cpp" />
|
||||
@@ -440,6 +485,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="VolZmapGraphics.cpp" />
|
||||
<ClCompile Include="VolZmapVolume.cpp" />
|
||||
<ClCompile Include="VolZmap.cpp" />
|
||||
<ClInclude Include="Voronoi.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Include\EGkAngle.h" />
|
||||
@@ -566,12 +612,10 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="CAvSimpleSurfFrMove.h" />
|
||||
<ClInclude Include="CAvToolSurfTm.h" />
|
||||
<ClInclude Include="CreateCurveAux.h" />
|
||||
<ClInclude Include="DistLineLine.h" />
|
||||
<ClInclude Include="DistPointArc.h" />
|
||||
<ClInclude Include="DistPointCrvAux.h" />
|
||||
<ClInclude Include="DistPointCrvBezier.h" />
|
||||
<ClInclude Include="DistPointCrvComposite.h" />
|
||||
<ClInclude Include="DistPointLine.h" />
|
||||
<ClInclude Include="DllMain.h" />
|
||||
<ClInclude Include="earcut.hpp" />
|
||||
<ClInclude Include="ExtDimension.h" />
|
||||
@@ -610,6 +654,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="IntersLineSurfStd.h" />
|
||||
<ClInclude Include="IntersLineTria.h" />
|
||||
<ClInclude Include="IterManager.h" />
|
||||
<ClInclude Include="OffsetAux.h" />
|
||||
<ClInclude Include="Tree.h" />
|
||||
<ClInclude Include="Material.h" />
|
||||
<ClInclude Include="FontNfe.h" />
|
||||
<ClInclude Include="MC_Tables.h" />
|
||||
|
||||
+171
-33
@@ -43,9 +43,21 @@
|
||||
<Filter Include="File di origine\GeoOffset">
|
||||
<UniqueIdentifier>{f07670fd-9429-4b7e-ac6d-1c0022e756fb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="File di origine\GeoCollision">
|
||||
<Filter Include="File di origine\GeoProject">
|
||||
<UniqueIdentifier>{d96752da-1884-4a73-ba1b-5b20b606e469}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="File di origine\GeoElevation">
|
||||
<UniqueIdentifier>{4c6a9dc5-8fac-4ecd-bde6-3e37e056712e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="File di origine\GeoCollisionAvoid">
|
||||
<UniqueIdentifier>{ae52e402-3063-45e3-b9f7-1710035a1f56}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="File di origine\GeoCollisionDetection">
|
||||
<UniqueIdentifier>{865b76ee-b10d-41fc-861c-b48ce52fa277}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="File di origine\GeoStriping">
|
||||
<UniqueIdentifier>{54901321-08f6-4428-80c7-a1f859136a32}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Vector3d.cpp">
|
||||
@@ -267,6 +279,9 @@
|
||||
<ClCompile Include="IntersLineSurfTm.cpp">
|
||||
<Filter>File di origine\GeoInters</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IntersLineSurfBez.cpp">
|
||||
<Filter>File di origine\GeoInters</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CircleCenTgCurve.cpp">
|
||||
<Filter>File di origine\GeoCreate</Filter>
|
||||
</ClCompile>
|
||||
@@ -366,17 +381,8 @@
|
||||
<ClCompile Include="IntersLineSurfStd.cpp">
|
||||
<Filter>File di origine\GeoInters</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CAvToolTriangle.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CAvToolSurfTm.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeBoxTria.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CAvSimpleSurfFrMove.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IntersSurfTmSurfTm.cpp">
|
||||
<Filter>File di origine\GeoInters</Filter>
|
||||
@@ -394,19 +400,19 @@
|
||||
<Filter>File di origine\Geo</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeCylTria.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeBoxClosedSurfTm.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeCylClosedSurfTm.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeSpheTria.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeSpheClosedSurfTm.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SurfBezier.cpp">
|
||||
<Filter>File di origine\Geo</Filter>
|
||||
@@ -424,34 +430,34 @@
|
||||
<Filter>File di origine\GeoDist</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeTriaTria.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeConeTria.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeUtility.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeClosedSurfTmClosedSurfTm.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeConeFrustumClosedSurfTm.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeConeFrustumTria.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeConvexTorusClosedSurfTm.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeConvexTorusTria.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeRectPrismoidClosedSurfTm.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeRectPrismoidTria.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SurfTriMeshUtilities.cpp">
|
||||
<Filter>File di origine\Geo</Filter>
|
||||
@@ -463,7 +469,7 @@
|
||||
<Filter>File di origine\Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDeCapsTria.cpp">
|
||||
<Filter>File di origine\GeoCollision</Filter>
|
||||
<Filter>File di origine\GeoCollisionDetection</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Circle2P.cpp">
|
||||
<Filter>File di origine\GeoCreate</Filter>
|
||||
@@ -471,6 +477,9 @@
|
||||
<ClCompile Include="MedialAxis.cpp">
|
||||
<Filter>File di origine\GeoOffset</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Tree.cpp">
|
||||
<Filter>File di origine\Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IntersLineCyl.cpp">
|
||||
<Filter>File di origine\GeoInters</Filter>
|
||||
</ClCompile>
|
||||
@@ -480,9 +489,93 @@
|
||||
<ClCompile Include="IntersLineCaps.cpp">
|
||||
<Filter>File di origine\GeoInters</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ProjectCurveSurf.cpp">
|
||||
<Filter>File di origine\GeoProject</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SubtractProjectedFacesOnStmFace.cpp">
|
||||
<Filter>File di origine\GeoProject</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SurfAux.cpp">
|
||||
<Filter>File di origine\Geo</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CalcPocketing.cpp">
|
||||
<Filter>File di origine\GeoOffset</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OffsetAux.cpp">
|
||||
<Filter>File di origine\GeoOffset</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Voronoi.cpp">
|
||||
<Filter>File di origine\Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PolygonElevation.cpp">
|
||||
<Filter>File di origine\GeoElevation</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IntersCurveSurfTm.cpp">
|
||||
<Filter>File di origine\GeoInters</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CAvSimpleSurfFrMove.cpp">
|
||||
<Filter>File di origine\GeoCollisionAvoid</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CAvToolSurfTm.cpp">
|
||||
<Filter>File di origine\GeoCollisionAvoid</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CAvToolTriangle.cpp">
|
||||
<Filter>File di origine\GeoCollisionAvoid</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IntersLineVolZmap.cpp">
|
||||
<Filter>File di origine\GeoInters</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IntersPlaneVolZmap.cpp">
|
||||
<Filter>File di origine\GeoInters</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SbzStandard.cpp">
|
||||
<Filter>File di origine\GeoCreate</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RotationMinimizingFrame.cpp">
|
||||
<Filter>File di origine\Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RotationXplaneFrame.cpp">
|
||||
<Filter>File di origine\Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Quaternion.cpp">
|
||||
<Filter>File di origine\Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CAvSilhouetteSurfTm.cpp">
|
||||
<Filter>File di origine\GeoCollisionAvoid</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SbzFromCurves.cpp">
|
||||
<Filter>File di origine\GeoCreate</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DistPointSurfFr.cpp">
|
||||
<Filter>File di origine\GeoDist</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VolZmapOffset.cpp">
|
||||
<Filter>File di origine\Geo</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SurfTriMeshOffset.cpp">
|
||||
<Filter>File di origine\GeoOffset</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MultiGeomDB.cpp">
|
||||
<Filter>File di origine\Gdb</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DistPointSurfBz.cpp">
|
||||
<Filter>File di origine\GeoDist</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IntersCurvePlane.cpp">
|
||||
<Filter>File di origine\GeoInters</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Trimming.cpp">
|
||||
<Filter>File di origine\GeoStriping</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CalcDerivate.cpp">
|
||||
<Filter>File di origine\Geo</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CAvSurfFrMove.cpp">
|
||||
<Filter>File di origine\GeoCollisionAvoid</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Trimming.cpp">
|
||||
<Filter>File di origine\GeoStriping</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
@@ -539,9 +632,6 @@
|
||||
<ClInclude Include="DistPointArc.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DistPointLine.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DistPointCrvBezier.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
@@ -1064,9 +1154,6 @@
|
||||
<ClInclude Include="..\Include\EGkIntersPlaneBox.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DistLineLine.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CDeUtility.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
@@ -1115,6 +1202,9 @@
|
||||
<ClInclude Include="CDeCapsTria.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Tree.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IntersLineCyl.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
@@ -1127,6 +1217,54 @@
|
||||
<ClInclude Include="SurfAux.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OffsetAux.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkPolygonElevation.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkSubtractProjectedFacesOnStmFace.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Voronoi.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkIntersCurveSurfTm.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkIntersPlaneVolZmap.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkIntersLineVolZmap.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkRotationMinimizingFrame.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkRotationXplaneFrame.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkQuaternion.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkDistLineLine.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkDistPointLine.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CAvSilhouetteSurfTm.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkSurfTriMeshAux.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkMultiGeomDB.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CAvSurfFrMove.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtGeomKernel.rc">
|
||||
|
||||
+410
-308
File diff suppressed because it is too large
Load Diff
+18
-6
@@ -28,7 +28,7 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
|
||||
ExtDimension* Clone( void) const override ;
|
||||
GeoObjType GetType( void) const override ;
|
||||
bool IsValid( void) const override
|
||||
{ return ( m_nType != DT_NONE) ; }
|
||||
{ return ( m_nType != DT_NONE) ; }
|
||||
const std::string& GetTitle( void) const override ;
|
||||
bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
|
||||
bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const override ;
|
||||
@@ -55,6 +55,11 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
|
||||
m_nTempProp[nPropInd] = nProp ; }
|
||||
int GetTempProp( int nPropInd = 0) const override
|
||||
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
||||
void SetTempParam( double dParam, int nParamInd = 0) override
|
||||
{ if ( nParamInd >= 0 && nParamInd < 2)
|
||||
m_dTempParam[nParamInd] = dParam ; }
|
||||
double GetTempParam( int nParamInd = 0) const override
|
||||
{ return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; }
|
||||
|
||||
public : // IExtDimension
|
||||
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
||||
@@ -66,8 +71,11 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
|
||||
const Vector3d& vtN, const std::string& sText) override ;
|
||||
bool SetDiametral( const Point3d& ptCen, const Point3d& ptPos,
|
||||
const Vector3d& vtN, const std::string& sText) override ;
|
||||
bool SetAngular( const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptV, const Point3d& ptPos,
|
||||
bool SetAngular( const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptPos,
|
||||
const Vector3d& vtN, const std::string& sText) override ;
|
||||
bool SetAngularEx( const Point3d& ptV1, const Point3d& ptP1,
|
||||
const Point3d& ptV2, const Point3d& ptP2, const Point3d& ptPos,
|
||||
const Vector3d& vtN, const std::string& sText) override ;
|
||||
const Vector3d& GetNormVersor( void) const override
|
||||
{ return m_vtN ; }
|
||||
const Vector3d& GetDirVersor( void) const override
|
||||
@@ -100,12 +108,16 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
|
||||
{ return m_dTextHeight ; }
|
||||
bool GetMidPoint( Point3d& ptMid) const override ;
|
||||
bool GetCenterPoint( Point3d& ptCen) const override ;
|
||||
const std::string& GetSubType( void) const override ;
|
||||
bool ApproxWithLines( double dLinTol, double dAngTolDeg, POLYLINELIST& lstPL) const override ;
|
||||
|
||||
public : // IGeoObjRW
|
||||
int GetNgeId( void) const override ;
|
||||
bool Save( NgeWriter& ngeOut) const override ;
|
||||
bool PreSave( GdbGeo& Wrapper) const override { return true ; }
|
||||
bool PostSave( GdbGeo& Wrapper) const override { return true ; }
|
||||
bool Load( NgeReader& ngeIn) override ;
|
||||
bool PostLoad( GdbGeo& Wrapper) override { return true ; }
|
||||
|
||||
public :
|
||||
ExtDimension( void) ;
|
||||
@@ -119,9 +131,8 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
|
||||
|
||||
private :
|
||||
bool CopyFrom( const ExtDimension& gpSrc) ;
|
||||
const std::string& GetSubType( void) const ;
|
||||
bool Update( void) const ;
|
||||
double GetTextHalfDist( const Point3d& ptText) const ;
|
||||
double GetTextHalfDist( const Point3d& ptText, bool bUseRot = true) const ;
|
||||
bool GetArrowHead( const Point3d& ptTip, const Vector3d& vtDir, PolyLine& PL) const ;
|
||||
bool SetCurrFont( FontManager& fntMgr) const ;
|
||||
bool ApproxTextWithLines( double dLinTol, double dAngTolDeg, POLYLINELIST& lstPL) const ;
|
||||
@@ -140,7 +151,7 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
|
||||
Point3d m_ptP3 ; // terzo punto
|
||||
Point3d m_ptP4 ; // quarto punto
|
||||
Point3d m_ptP5 ; // quinto punto
|
||||
Point3d m_ptP6 ; // sesto punto
|
||||
Point3d m_ptP6 ; // sesto punto; nel caso delle quotature angolari � il centro
|
||||
Point3d m_ptPos ; // posizione ricevuta della quota
|
||||
std::string m_sText ; // testo della quota
|
||||
mutable bool m_bToCalc ; // flag dati effettivi da ricalcolare
|
||||
@@ -157,7 +168,8 @@ class ExtDimension : public IExtDimension, public IGeoObjRW
|
||||
int m_nDecDigit ; // numero di cifre decimali
|
||||
std::string m_sFont ; // font del testo
|
||||
double m_dTextHeight ; // altezza del testo
|
||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||
int m_nTempProp[2] ; // vettore propriet� temporanee
|
||||
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||
} ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
+6
-5
@@ -35,10 +35,9 @@ GEOOBJ_REGISTER( EXT_TEXT, NGE_E_TXT, ExtText) ;
|
||||
//----------------------------------------------------------------------------
|
||||
ExtText::ExtText( void)
|
||||
: m_pSTM( nullptr), m_bNoSTM( false), m_ptP(), m_vtN( 0, 0, 1), m_vtD( 1, 0, 0), m_sFont(),
|
||||
m_nWeight( 400), m_bItalic( false), m_dHeight( 10), m_dRatio( 1), m_dAddAdvance( 0)
|
||||
{
|
||||
m_nTempProp[0] = 0 ;
|
||||
m_nTempProp[1] = 0 ;
|
||||
m_nWeight( 400), m_bItalic( false), m_dHeight( 10), m_dRatio( 1), m_dAddAdvance( 0),
|
||||
m_nTempProp{0,0}, m_dTempParam{0.0,0.0}
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -188,6 +187,8 @@ ExtText::CopyFrom( const ExtText& clSrc)
|
||||
m_nInsPos = clSrc.m_nInsPos ;
|
||||
m_nTempProp[0] = clSrc.m_nTempProp[0] ;
|
||||
m_nTempProp[1] = clSrc.m_nTempProp[1] ;
|
||||
m_dTempParam[0] = clSrc.m_dTempParam[0] ;
|
||||
m_dTempParam[1] = clSrc.m_dTempParam[1] ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -883,7 +884,7 @@ ExtText::GetAuxSurf( void) const
|
||||
// per ogni regione richiedo la superficie ausiliaria e la aggiungo a quella generale
|
||||
for ( const auto& pSfr : lstSfr) {
|
||||
// recupero la superficie trimesh
|
||||
PtrOwner<ISurfTriMesh> pStm( GetBasicSurfFlatRegion( pSfr)->CalcAuxSurf( LIN_TOL_STD, ANG_TOL_STD_DEG)) ;
|
||||
PtrOwner<SurfTriMesh> pStm( GetBasicSurfFlatRegion( pSfr)->CalcAuxSurf( LIN_TOL_STD, ANG_TOL_STD_DEG)) ;
|
||||
if ( pStm != nullptr) {
|
||||
Triangle3d Tria ;
|
||||
int nT = pStm->GetFirstTriangle( Tria) ;
|
||||
|
||||
@@ -55,6 +55,11 @@ class ExtText : public IExtText, public IGeoObjRW
|
||||
m_nTempProp[nPropInd] = nProp ; }
|
||||
int GetTempProp( int nPropInd = 0) const override
|
||||
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
||||
void SetTempParam( double dParam, int nParamInd = 0) override
|
||||
{ if ( nParamInd >= 0 && nParamInd < 2)
|
||||
m_dTempParam[nParamInd] = dParam ; }
|
||||
double GetTempParam( int nParamInd = 0) const override
|
||||
{ return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; }
|
||||
|
||||
public : // IExtText
|
||||
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
||||
@@ -108,7 +113,10 @@ class ExtText : public IExtText, public IGeoObjRW
|
||||
public : // IGeoObjRW
|
||||
int GetNgeId( void) const override ;
|
||||
bool Save( NgeWriter& ngeOut) const override ;
|
||||
bool PreSave( GdbGeo& Wrapper) const override { return true ; }
|
||||
bool PostSave( GdbGeo& Wrapper) const override { return true ; }
|
||||
bool Load( NgeReader& ngeIn) override ;
|
||||
bool PostLoad( GdbGeo& Wrapper) override { return true ; }
|
||||
|
||||
public :
|
||||
ExtText( void) ;
|
||||
@@ -144,7 +152,8 @@ class ExtText : public IExtText, public IGeoObjRW
|
||||
double m_dRatio ; // rapporto tra larghezza e altezza
|
||||
double m_dAddAdvance ; // avanzamento addizionale tra caratteri
|
||||
int m_nInsPos ; // posizione del punto di inserimento rispetto al testo
|
||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||
} ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
+62
-13
@@ -18,6 +18,7 @@
|
||||
#include "/EgtDev/Include/EGkFilletChamfer.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EGkIntersCurves.h"
|
||||
#include "/EgtDev/Include/EgkOffsetCurve.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
@@ -40,13 +41,21 @@ CalcForFillet( const ICurve& cCrv1, const Point3d& ptNear1,
|
||||
if ( ! dPC1.GetSideAtMinDistPoint( 0, vtNorm, nSide1))
|
||||
return false ;
|
||||
double dOffs1 = ( nSide1 == MDS_RIGHT ? dRadius : - dRadius) ;
|
||||
// calcolo l'offset nel piano locale e dal lato opportuno di una copia della curva 1
|
||||
// calcolo gli offset nel piano locale e dal lato opportuno di una copia della curva 1
|
||||
PtrOwner<ICurve> pCopy1( cCrv1.Clone()) ;
|
||||
if ( IsNull( pCopy1))
|
||||
return false ;
|
||||
pCopy1->ToLoc( frIntr) ;
|
||||
pCopy1->SetExtrusion( Z_AX) ;
|
||||
if ( ! pCopy1->SimpleOffset( dOffs1, ICurve::OFF_FILLET))
|
||||
OffsetCurve OffsCrv1 ;
|
||||
OffsCrv1.Make( pCopy1, dOffs1, ICurve::OFF_FILLET) ;
|
||||
ICURVEPOVECTOR vOffs1 ;
|
||||
ICurve* pCrv = OffsCrv1.GetLongerCurve() ;
|
||||
while ( pCrv != nullptr) {
|
||||
vOffs1.emplace_back( pCrv) ;
|
||||
pCrv = OffsCrv1.GetLongerCurve() ;
|
||||
}
|
||||
if ( vOffs1.empty())
|
||||
return false ;
|
||||
|
||||
// determino il lato di offset della curva 2
|
||||
@@ -54,23 +63,50 @@ CalcForFillet( const ICurve& cCrv1, const Point3d& ptNear1,
|
||||
if ( ! dPC2.GetSideAtMinDistPoint( 0, vtNorm, nSide2))
|
||||
return false ;
|
||||
double dOffs2 = ( nSide2 == MDS_RIGHT ? dRadius : - dRadius) ;
|
||||
// calcolo l'offset nel piano locale e dal lato opportuno di una copia della curva 2
|
||||
// calcolo gli offset nel piano locale e dal lato opportuno di una copia della curva 2
|
||||
PtrOwner<ICurve> pCopy2( cCrv2.Clone()) ;
|
||||
if ( IsNull( pCopy2))
|
||||
return false ;
|
||||
pCopy2->ToLoc( frIntr) ;
|
||||
pCopy2->SetExtrusion( Z_AX) ;
|
||||
if ( ! pCopy2->SimpleOffset( dOffs2, ICurve::OFF_FILLET))
|
||||
OffsetCurve OffsCrv2 ;
|
||||
OffsCrv2.Make( pCopy2, dOffs2, ICurve::OFF_FILLET) ;
|
||||
ICURVEPOVECTOR vOffs2 ;
|
||||
pCrv = OffsCrv2.GetLongerCurve() ;
|
||||
while ( pCrv != nullptr) {
|
||||
vOffs2.emplace_back( pCrv) ;
|
||||
pCrv = OffsCrv2.GetLongerCurve() ;
|
||||
}
|
||||
if ( vOffs2.empty())
|
||||
return false ;
|
||||
|
||||
// calcolo l'intersezione tra le due curve
|
||||
Point3d ptInt1, ptInt2 ;
|
||||
// calcolo le intersezioni tra tutte le curve di offset e seleziono quella più vicina ai punti passati
|
||||
Point3d ptInt1 = P_INVALID, ptInt2 = P_INVALID ;
|
||||
Point3d ptNearI = Media( ptNear1, ptNear2) ;
|
||||
ptNearI.ToLoc( frIntr) ;
|
||||
IntersCurveCurve intCC( *pCopy1, *pCopy2) ;
|
||||
if ( ! intCC.GetIntersPointNearTo( 0, ptNearI, ptInt1) ||
|
||||
! intCC.GetIntersPointNearTo( 1, ptNearI, ptInt2))
|
||||
return false ;
|
||||
double dMinDist = INFINITO ;
|
||||
for ( int i = 0 ; i < int( vOffs1.size()) ; i++) {
|
||||
for ( int j = 0 ; j < int( vOffs2.size()) ; j ++) {
|
||||
IntersCurveCurve intCC( *vOffs1[i], *vOffs2[j]) ;
|
||||
if ( intCC.GetIntersCount() == 0)
|
||||
continue ;
|
||||
Point3d ptInt1Curr, ptInt2Curr ;
|
||||
if ( ! intCC.GetIntersPointNearTo( 0, ptNearI, ptInt1Curr) ||
|
||||
! intCC.GetIntersPointNearTo( 1, ptNearI, ptInt2Curr))
|
||||
return false ;
|
||||
Point3d ptCenCurr = Media( ptInt1Curr, ptInt2Curr) ;
|
||||
double dDist = Dist( ptNearI, ptCenCurr) ;
|
||||
if ( dDist < dMinDist - EPS_SMALL) {
|
||||
dMinDist = dDist ;
|
||||
ptInt1 = ptInt1Curr ;
|
||||
ptInt2 = ptInt2Curr ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// se non sono state trovate intersezioni esco
|
||||
if ( ! ptInt1.IsValid() || ! ptInt2.IsValid())
|
||||
return false ;
|
||||
|
||||
ptInt1.ToGlob( frIntr) ;
|
||||
ptInt2.ToGlob( frIntr) ;
|
||||
ptCen = Media( ptInt1, ptInt2) ;
|
||||
@@ -105,12 +141,16 @@ CreateFillet( const ICurve& cCrv1, const Point3d& ptNear1,
|
||||
const ICurve& cCrv2, const Point3d& ptNear2,
|
||||
const Vector3d& vtNorm, double dRadius, double& dPar1, double& dPar2)
|
||||
{
|
||||
// verifico validità parametri ricevuti
|
||||
// verifico validità parametri ricevuti
|
||||
if ( &cCrv1 == nullptr || &ptNear1 == nullptr ||
|
||||
&cCrv2 == nullptr || &ptNear2 == nullptr ||
|
||||
&vtNorm == nullptr || &dPar1 == nullptr || &dPar2 == nullptr)
|
||||
return nullptr ;
|
||||
|
||||
// verifico il minimo raggio
|
||||
if ( dRadius < 10 * EPS_SMALL)
|
||||
return nullptr ;
|
||||
|
||||
// eseguo calcoli
|
||||
Point3d ptCen, ptTg1, ptTg2 ;
|
||||
int nSide1, nSide2 ;
|
||||
@@ -119,7 +159,7 @@ CreateFillet( const ICurve& cCrv1, const Point3d& ptNear1,
|
||||
ptCen, ptTg1, ptTg2, nSide1, nSide2, dSinA, dTgPar1, dTgPar2))
|
||||
return nullptr ;
|
||||
|
||||
// se tangenti parallele al contatto con fillet, ricalcolo con raggio più piccolo
|
||||
// se tangenti parallele al contatto con fillet, ricalcolo con raggio più piccolo
|
||||
bool bParallel = ( abs( dSinA) < EPS_SMALL) ;
|
||||
if ( bParallel) {
|
||||
Point3d ptQQQ, ptQQ1, ptQQ2 ;
|
||||
@@ -129,6 +169,11 @@ CreateFillet( const ICurve& cCrv1, const Point3d& ptNear1,
|
||||
return nullptr ;
|
||||
}
|
||||
|
||||
// verifico dimensione minima
|
||||
double dLen = Dist( ptTg1, ptTg2) ;
|
||||
if ( dLen < 2 * EPS_SMALL)
|
||||
return nullptr ;
|
||||
|
||||
// orientamento tra le curve
|
||||
bool bCCW = ( dSinA > 0) ;
|
||||
|
||||
@@ -165,12 +210,16 @@ CreateChamfer( const ICurve& cCrv1, const Point3d& ptNear1,
|
||||
const ICurve& cCrv2, const Point3d& ptNear2,
|
||||
const Vector3d& vtNorm, double dDist, double& dPar1, double& dPar2)
|
||||
{
|
||||
// verifico validità parametri ricevuti
|
||||
// verifico validità parametri ricevuti
|
||||
if ( &cCrv1 == nullptr || &ptNear1 == nullptr ||
|
||||
&cCrv2 == nullptr || &ptNear2 == nullptr ||
|
||||
&vtNorm == nullptr || &dPar1 == nullptr || &dPar2 == nullptr)
|
||||
return nullptr ;
|
||||
|
||||
// verifico lo smusso minimo
|
||||
if ( dDist < 10 * EPS_SMALL)
|
||||
return nullptr ;
|
||||
|
||||
// calcolo un riferimento sul piano perpendicolare alla normale
|
||||
Frame3d frIntr ;
|
||||
if ( ! frIntr.Set( ORIG, vtNorm))
|
||||
|
||||
+3
-1
@@ -29,6 +29,8 @@ class FontManager
|
||||
|
||||
public :
|
||||
bool Init( const std::string& sNfeFontDir, const std::string& sDefaultFont) ;
|
||||
bool SetDefaultFont( const std::string& sDefaultFont)
|
||||
{ m_sDefaultFont = sDefaultFont ; return true ; }
|
||||
bool SetCurrFont( const std::string& sFont, int nWeight, bool bItalic,
|
||||
double dHeight, double dRatio, double dAddAdvance) ;
|
||||
const std::string& GetNfeFontDir( void) const
|
||||
@@ -54,7 +56,7 @@ class FontManager
|
||||
OsFont m_OsFont ;
|
||||
|
||||
private :
|
||||
FontManager( void) {}
|
||||
FontManager( void) : m_bCurrNfeFont( false) {}
|
||||
FontManager( FontManager const& copy) = delete ;
|
||||
FontManager& operator=( FontManager const& copy) = delete ;
|
||||
} ;
|
||||
|
||||
+24
-42
@@ -16,8 +16,8 @@
|
||||
#include "FontNfe.h"
|
||||
#include "FontAux.h"
|
||||
#include "FontConst.h"
|
||||
#include "GdbIterator.h"
|
||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
#include "/EgtDev/Include/EGkCurveAux.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
@@ -81,21 +81,19 @@ NfeFont::SetCurrFont( const string& sFont, int nWeight, bool bItalic,
|
||||
if ( ! m_pGDB->Load( sFont))
|
||||
return false ;
|
||||
// recupero i parametri generali del font (devono essere nel gruppo 1)
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
GdbIterator iIter( m_pGDB) ;
|
||||
if ( ! iIter.GoTo( 1))
|
||||
return false ;
|
||||
if ( ! pIter->GoTo( 1))
|
||||
return false ;
|
||||
if ( ! pIter->GetInfo( NFE_H, m_dH) ||
|
||||
! pIter->GetInfo( NFE_HCAP, m_dHCap) ||
|
||||
! pIter->GetInfo( NFE_HX, m_dHx) ||
|
||||
! pIter->GetInfo( NFE_ASC, m_dAsc) ||
|
||||
! pIter->GetInfo( NFE_DESC, m_dDesc) ||
|
||||
! pIter->GetInfo( NFE_ADV, m_dAdv))
|
||||
if ( ! iIter.GetInfo( NFE_H, m_dH) ||
|
||||
! iIter.GetInfo( NFE_HCAP, m_dHCap) ||
|
||||
! iIter.GetInfo( NFE_HX, m_dHx) ||
|
||||
! iIter.GetInfo( NFE_ASC, m_dAsc) ||
|
||||
! iIter.GetInfo( NFE_DESC, m_dDesc) ||
|
||||
! iIter.GetInfo( NFE_ADV, m_dAdv))
|
||||
return false ;
|
||||
if ( m_dH < EPS_SMALL || m_dHCap < EPS_SMALL || m_dHx < EPS_SMALL)
|
||||
return false ;
|
||||
if ( ! pIter->GetInfo( NFE_ITALIC, m_dItalicShearCoeff))
|
||||
if ( ! iIter.GetInfo( NFE_ITALIC, m_dItalicShearCoeff))
|
||||
m_dItalicShearCoeff = NFE_ITALIC_STD_SHEAR_COEFF ;
|
||||
// aggiorno la path del font
|
||||
m_sFont = sFontUp ;
|
||||
@@ -161,11 +159,6 @@ NfeFont::GetXBox( const string& sText, int nInsPos, bool bCapOrBound, BBox3d& b3
|
||||
if ( m_pGDB == nullptr || m_sFont.empty())
|
||||
return false ;
|
||||
|
||||
// creo un iteratore
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
|
||||
// calcolo i fattori di scala
|
||||
double dScaY = m_dHeight / m_dHCap ;
|
||||
double dScaX = dScaY * m_dRatio ;
|
||||
@@ -229,9 +222,7 @@ NfeFont::GetOutline( const string& sText, int nInsPos, ICURVEPLIST& lstPC) const
|
||||
return false ;
|
||||
|
||||
// creo un iteratore
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
GdbIterator iIter( m_pGDB) ;
|
||||
|
||||
// calcolo i fattori di scala
|
||||
double dScaY = m_dHeight / m_dHCap ;
|
||||
@@ -265,9 +256,9 @@ NfeFont::GetOutline( const string& sText, int nInsPos, ICURVEPLIST& lstPC) const
|
||||
if ( nGroup < NFE_MIN_CHAR || m_pGDB->GetGdbType( nGroup) != GDB_TY_GROUP)
|
||||
nGroup = NFE_ERR_CHAR ;
|
||||
// ciclo sulle entità geometriche del carattere
|
||||
bool bIter = pIter->GoToFirstInGroup( nGroup) ;
|
||||
bool bIter = iIter.GoToFirstInGroup( nGroup) ;
|
||||
while ( bIter) {
|
||||
const ICurve* pCrv = GetCurve( pIter->GetGeoObj()) ;
|
||||
const ICurve* pCrv = GetCurve( iIter.GetGeoObj()) ;
|
||||
if ( pCrv != nullptr) {
|
||||
// copio la curva (trasformando eventuali archi in CurveBezier)
|
||||
ICurve* pCrvNew = CurveToNoArcsCurve( pCrv) ;
|
||||
@@ -281,7 +272,7 @@ NfeFont::GetOutline( const string& sText, int nInsPos, ICURVEPLIST& lstPC) const
|
||||
// inserisco in lista la nuova curva
|
||||
lstPC.push_back( pCrvNew) ;
|
||||
}
|
||||
bIter = pIter->GoToNext() ;
|
||||
bIter = iIter.GoToNext() ;
|
||||
}
|
||||
// recupero lo spostamento per il prossimo carattere
|
||||
double dAdvance ;
|
||||
@@ -314,9 +305,7 @@ NfeFont::ApproxWithLines( const string& sText, int nInsPos, double dLinTol, doub
|
||||
return false ;
|
||||
|
||||
// creo un iteratore
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
GdbIterator iIter( m_pGDB) ;
|
||||
|
||||
// controllo valore tolleranza lineare
|
||||
if ( dLinTol > FNT_MAX_LINTOL_TO_H * m_dHeight)
|
||||
@@ -354,9 +343,9 @@ NfeFont::ApproxWithLines( const string& sText, int nInsPos, double dLinTol, doub
|
||||
if ( nGroup < NFE_MIN_CHAR || m_pGDB->GetGdbType( nGroup) != GDB_TY_GROUP)
|
||||
nGroup = NFE_ERR_CHAR ;
|
||||
// ciclo sulle entità geometriche del carattere
|
||||
bool bIter = pIter->GoToFirstInGroup( nGroup) ;
|
||||
bool bIter = iIter.GoToFirstInGroup( nGroup) ;
|
||||
while ( bIter) {
|
||||
const ICurve* pCrv = GetCurve( pIter->GetGeoObj()) ;
|
||||
const ICurve* pCrv = GetCurve( iIter.GetGeoObj()) ;
|
||||
if ( pCrv != nullptr) {
|
||||
// copia temporanea della curva (trasformando eventuali archi in CurveBezier)
|
||||
PtrOwner<ICurve> pCrvNew( CurveToNoArcsCurve( pCrv)) ;
|
||||
@@ -371,7 +360,7 @@ NfeFont::ApproxWithLines( const string& sText, int nInsPos, double dLinTol, doub
|
||||
lstPL.emplace_back() ;
|
||||
pCrvNew->ApproxWithLines( dLinTol, dAngTolDeg, ICurve::APL_STD, lstPL.back()) ;
|
||||
}
|
||||
bIter = pIter->GoToNext() ;
|
||||
bIter = iIter.GoToNext() ;
|
||||
}
|
||||
// recupero lo spostamento per il prossimo carattere
|
||||
double dAdvance ;
|
||||
@@ -400,9 +389,7 @@ NfeFont::ApproxWithArcs( const string& sText, int nInsPos, double dLinTol, doubl
|
||||
return false ;
|
||||
|
||||
// creo un iteratore
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
GdbIterator iIter( m_pGDB) ;
|
||||
|
||||
// controllo valore tolleranza lineare
|
||||
if ( dLinTol > FNT_MAX_LINTOL_TO_H * m_dHeight)
|
||||
@@ -440,9 +427,9 @@ NfeFont::ApproxWithArcs( const string& sText, int nInsPos, double dLinTol, doubl
|
||||
if ( nGroup < NFE_MIN_CHAR || m_pGDB->GetGdbType( nGroup) != GDB_TY_GROUP)
|
||||
nGroup = NFE_ERR_CHAR ;
|
||||
// ciclo sulle entità geometriche del carattere
|
||||
bool bIter = pIter->GoToFirstInGroup( nGroup) ;
|
||||
bool bIter = iIter.GoToFirstInGroup( nGroup) ;
|
||||
while ( bIter) {
|
||||
const ICurve* pCrv = GetCurve( pIter->GetGeoObj()) ;
|
||||
const ICurve* pCrv = GetCurve( iIter.GetGeoObj()) ;
|
||||
if ( pCrv != nullptr) {
|
||||
// copia temporanea della curva (trasformando eventuali archi in CurveBezier)
|
||||
PtrOwner<ICurve> pCrvNew( CurveToNoArcsCurve( pCrv)) ;
|
||||
@@ -457,7 +444,7 @@ NfeFont::ApproxWithArcs( const string& sText, int nInsPos, double dLinTol, doubl
|
||||
lstPA.emplace_back() ;
|
||||
pCrv->ApproxWithArcs( dLinTol, dAngTolDeg, lstPA.back()) ;
|
||||
}
|
||||
bIter = pIter->GoToNext() ;
|
||||
bIter = iIter.GoToNext() ;
|
||||
}
|
||||
// recupero lo spostamento per il prossimo carattere
|
||||
double dAdvance ;
|
||||
@@ -484,11 +471,6 @@ NfeFont::GetTextLines( const string& sText, int nInsPos, PNTVECTOR& vPt, STRVECT
|
||||
if ( m_pGDB == nullptr || m_sFont.empty())
|
||||
return false ;
|
||||
|
||||
// creo un iteratore
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
|
||||
// calcolo i fattori di scala
|
||||
double dScaY = m_dHeight / m_dHCap ;
|
||||
double dScaX = dScaY * m_dRatio ;
|
||||
@@ -511,7 +493,7 @@ NfeFont::GetTextLines( const string& sText, int nInsPos, PNTVECTOR& vPt, STRVECT
|
||||
int nLbLen ;
|
||||
if ( IsLineBreak( vCode, i, nLbLen)) {
|
||||
// salvo la linea, se contiene qualcosa
|
||||
if ( vTmpCode.size() > 0) {
|
||||
if ( ! vTmpCode.empty()) {
|
||||
string sLine ;
|
||||
SetCodePoints( vTmpCode, sLine) ;
|
||||
vLine.push_back( sLine) ;
|
||||
@@ -541,7 +523,7 @@ NfeFont::GetTextLines( const string& sText, int nInsPos, PNTVECTOR& vPt, STRVECT
|
||||
dMaxW = vtMove.x ;
|
||||
}
|
||||
// salvo eventuale ultima linea
|
||||
if ( vTmpCode.size() > 0) {
|
||||
if ( ! vTmpCode.empty()) {
|
||||
string sLine ;
|
||||
SetCodePoints( vTmpCode, sLine) ;
|
||||
vLine.push_back( sLine) ;
|
||||
|
||||
+13
-16
@@ -16,15 +16,15 @@
|
||||
#include "FontOs.h"
|
||||
#include "FontAux.h"
|
||||
#include "FontConst.h"
|
||||
#include "CurveLine.h"
|
||||
#include "CurveBezier.h"
|
||||
#include "CurveComposite.h"
|
||||
#include "SurfFlatRegion.h"
|
||||
#include "GeoConst.h"
|
||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
#include "/EgtDev/Include/EGkCurveAux.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
@@ -298,8 +298,7 @@ OsFont::GetOutline( const string& sText, int nInsPos, ICURVEPLIST& lstPC) const
|
||||
if ( ! GetCharOutline( vCode[i], dAdvance, lstTmpPC))
|
||||
return false ;
|
||||
// lo trasformo opportunamente
|
||||
ICURVEPLIST::iterator iIter ;
|
||||
for ( iIter = lstTmpPC.begin() ; iIter != lstTmpPC.end() ; ++ iIter) {
|
||||
for ( auto iIter = lstTmpPC.begin() ; iIter != lstTmpPC.end() ; ++ iIter) {
|
||||
// trasformazioni
|
||||
(*iIter)->Scale( GLOB_FRM, dScaX, dScaY, dScaZ) ;
|
||||
(*iIter)->Translate( vtMove) ;
|
||||
@@ -464,8 +463,7 @@ OsFont::ApproxWithLines( const string& sText, int nInsPos, double dLinTol, doubl
|
||||
if ( ! GetCharOutline( vCode[i], dAdvance, lstPC))
|
||||
return false ;
|
||||
// lo approssimo con segmenti di retta
|
||||
ICURVEPLIST::iterator iIter ;
|
||||
for ( iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter) {
|
||||
for ( auto iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter) {
|
||||
// trasformazioni
|
||||
(*iIter)->Scale( GLOB_FRM, dScaX, dScaY, dScaZ) ;
|
||||
(*iIter)->Translate( vtMove) ;
|
||||
@@ -478,7 +476,7 @@ OsFont::ApproxWithLines( const string& sText, int nInsPos, double dLinTol, doubl
|
||||
if ( vtMove.x > dMaxW)
|
||||
dMaxW = vtMove.x ;
|
||||
// ciclo di pulizia
|
||||
for ( iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter)
|
||||
for ( auto iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter)
|
||||
delete (*iIter) ;
|
||||
lstPC.clear() ;
|
||||
}
|
||||
@@ -549,8 +547,7 @@ OsFont::ApproxWithArcs( const string& sText, int nInsPos, double dLinTol, double
|
||||
if ( ! GetCharOutline( vCode[i], dAdvance, lstPC))
|
||||
return false ;
|
||||
// lo approssimo con segmenti di arco e retta
|
||||
ICURVEPLIST::iterator iIter ;
|
||||
for ( iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter) {
|
||||
for ( auto iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter) {
|
||||
// trasformazioni
|
||||
(*iIter)->Scale( GLOB_FRM, dScaX, dScaY, dScaZ) ;
|
||||
(*iIter)->Translate( vtMove) ;
|
||||
@@ -563,7 +560,7 @@ OsFont::ApproxWithArcs( const string& sText, int nInsPos, double dLinTol, double
|
||||
if ( vtMove.x > dMaxW)
|
||||
dMaxW = vtMove.x ;
|
||||
// ciclo di pulizia
|
||||
for ( iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter)
|
||||
for ( auto iIter = lstPC.begin() ; iIter != lstPC.end() ; ++ iIter)
|
||||
delete (*iIter) ;
|
||||
lstPC.clear() ;
|
||||
}
|
||||
@@ -622,7 +619,7 @@ OsFont::GetTextLines( const string& sText, int nInsPos, PNTVECTOR& vPt, STRVECTO
|
||||
int nLbLen ;
|
||||
if ( IsLineBreak( vCode, i, nLbLen)) {
|
||||
// salvo la linea, se contiene qualcosa
|
||||
if ( vTmpCode.size() > 0) {
|
||||
if ( ! vTmpCode.empty()) {
|
||||
string sLine ;
|
||||
SetCodePoints( vTmpCode, sLine) ;
|
||||
vLine.push_back( sLine) ;
|
||||
@@ -649,7 +646,7 @@ OsFont::GetTextLines( const string& sText, int nInsPos, PNTVECTOR& vPt, STRVECTO
|
||||
dMaxW = vtMove.x ;
|
||||
}
|
||||
// salvo eventuale ultima linea
|
||||
if ( vTmpCode.size() > 0) {
|
||||
if ( ! vTmpCode.empty()) {
|
||||
string sLine ;
|
||||
SetCodePoints( vTmpCode, sLine) ;
|
||||
vLine.push_back( sLine) ;
|
||||
@@ -730,7 +727,7 @@ OsFont::GetCharOutline( unsigned int nChar, double& dAdvance, ICURVEPLIST& lstPC
|
||||
if ( pHeader->dwType == TT_POLYGON_TYPE) {
|
||||
|
||||
// creo curva composita
|
||||
PtrOwner<ICurveComposite> pCCompo( CreateCurveComposite()) ;
|
||||
PtrOwner<CurveComposite> pCCompo( CreateBasicCurveComposite()) ;
|
||||
if ( IsNull( pCCompo))
|
||||
return false ;
|
||||
|
||||
@@ -823,7 +820,7 @@ OsFont::AddLineToCompo( ICurveComposite* pCCompo, const Point3d& ptStart, const
|
||||
return false ;
|
||||
|
||||
// creo retta, la imposto e la inserisco nella curva composita
|
||||
PtrOwner<ICurveLine> pCLine( CreateCurveLine()) ;
|
||||
PtrOwner<CurveLine> pCLine( CreateBasicCurveLine()) ;
|
||||
if ( IsNull( pCLine))
|
||||
return false ;
|
||||
if ( ! pCLine->Set( ptStart, ptEnd))
|
||||
@@ -844,7 +841,7 @@ OsFont::AddCBezierQuadToCompo( ICurveComposite* pCCompo,
|
||||
return false ;
|
||||
|
||||
// creo curva di Bezier quadratica, la imposto e la inserisco nella curva composita
|
||||
PtrOwner<ICurveBezier> pCBezier( CreateCurveBezier()) ;
|
||||
PtrOwner<CurveBezier> pCBezier( CreateBasicCurveBezier()) ;
|
||||
if ( IsNull( pCBezier))
|
||||
return false ;
|
||||
if ( ! pCBezier->Init( 2, false) ||
|
||||
|
||||
+17
@@ -37,6 +37,23 @@ Frame3d::Set( const Point3d& ptOrig, const Vector3d& vtDirX,
|
||||
! m_vtVersZ.Normalize())
|
||||
return false ;
|
||||
|
||||
// se ci sono errori molto piccoli di ortogonalità, li correggo
|
||||
double dOrtXZ = m_vtVersX * m_vtVersZ ;
|
||||
if ( dOrtXZ > EPS_ZERO && dOrtXZ < 10 * EPS_ZERO) {
|
||||
m_vtVersX = OrthoCompo( m_vtVersX, m_vtVersZ) ;
|
||||
m_vtVersX.Normalize() ;
|
||||
}
|
||||
double dOrtYX = m_vtVersY * m_vtVersX ;
|
||||
if ( dOrtYX > EPS_ZERO && dOrtYX < 10 * EPS_ZERO) {
|
||||
m_vtVersY = OrthoCompo( m_vtVersY, m_vtVersX) ;
|
||||
m_vtVersY.Normalize() ;
|
||||
}
|
||||
double dOrtYZ = m_vtVersY * m_vtVersZ ;
|
||||
if ( dOrtYZ > EPS_ZERO && dOrtYZ < 10 * EPS_ZERO) {
|
||||
m_vtVersY = OrthoCompo( m_vtVersY, m_vtVersZ) ;
|
||||
m_vtVersY.Normalize() ;
|
||||
}
|
||||
|
||||
// verifica della ortogonalità dei versori e del senso destrorso
|
||||
if ( ! Verify())
|
||||
return false ;
|
||||
|
||||
+61
-111
@@ -1423,8 +1423,7 @@ GdbExecutor::CurveArcChangeRadius( const STRVECTOR& vsParams)
|
||||
if ( ! GetLengthParam( vsParams[1], dNewRad))
|
||||
return false ;
|
||||
// esecuzione
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero l'arco
|
||||
ICurveArc* pCrvArc = GetCurveArc( m_pGDB->GetGeoObj( *Iter)) ;
|
||||
if ( pCrvArc == nullptr)
|
||||
@@ -1452,8 +1451,7 @@ GdbExecutor::CurveArcChangeDeltaN( const STRVECTOR& vsParams)
|
||||
if ( ! GetLengthParam( vsParams[1], dNewDeltaN))
|
||||
return false ;
|
||||
// esecuzione
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero l'arco
|
||||
ICurveArc* pCrvArc = GetCurveArc( m_pGDB->GetGeoObj( *Iter)) ;
|
||||
if ( pCrvArc == nullptr)
|
||||
@@ -1686,8 +1684,7 @@ GdbExecutor::CurveCompoMake( const STRVECTOR& vsParams)
|
||||
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frDest))
|
||||
return false ;
|
||||
// esecuzione
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero la curva
|
||||
int nIdCrv = *Iter ;
|
||||
const ICurve* pCrv = GetCurve( m_pGDB->GetGeoObj( nIdCrv)) ;
|
||||
@@ -1722,7 +1719,7 @@ GdbExecutor::CurveCompoMake( const STRVECTOR& vsParams)
|
||||
if ( AddGeoObj( vsParams[0], vsParams[1], Release( pCrvCompo))) {
|
||||
// se richiesto, cancello le curve originali
|
||||
if ( bErase) {
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->Erase( *Iter))
|
||||
return false ;
|
||||
}
|
||||
@@ -2270,7 +2267,7 @@ bool
|
||||
GdbExecutor::SurfTriMeshEnd( const STRVECTOR& vsParams)
|
||||
{
|
||||
// nessun parametro
|
||||
if ( vsParams.size() != 0)
|
||||
if ( ! vsParams.empty())
|
||||
return false ;
|
||||
// recupero la superficie
|
||||
ISurfTriMesh* pSTM = GetSurfTriMesh( m_pGeoObj) ;
|
||||
@@ -2309,8 +2306,7 @@ GdbExecutor::SurfTriMeshByTriangleSoup( const STRVECTOR& vsParams)
|
||||
if ( ! StmFts.Start())
|
||||
return false ;
|
||||
// Recupero tutti i triangoli delle superfici sorgenti e li inserisco nella nuova
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero la superficie sorgente
|
||||
const ISurfTriMesh* pStmS = GetSurfTriMesh( m_pGDB->GetGeoObj( *Iter)) ;
|
||||
if ( pStmS == nullptr)
|
||||
@@ -2340,7 +2336,7 @@ GdbExecutor::SurfTriMeshByTriangleSoup( const STRVECTOR& vsParams)
|
||||
if ( AddGeoObj( vsParams[0], vsParams[1], pSTM)) {
|
||||
// se richiesto, cancello le curve originali
|
||||
if ( bErase) {
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->Erase( *Iter))
|
||||
return false ;
|
||||
}
|
||||
@@ -2534,8 +2530,7 @@ GdbExecutor::SurfTriMeshDoCompacting( const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// opero sui diversi oggetti
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero la superficie
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( m_pGDB->GetGeoObj( *Iter)) ;
|
||||
if ( pStm == nullptr)
|
||||
@@ -2572,8 +2567,7 @@ GdbExecutor::SurfTriMeshDoSewing( const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[1], vnNames))
|
||||
return false ;
|
||||
// esecuzione
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero la superficie da cucire
|
||||
const ISurfTriMesh* pStmS = GetSurfTriMesh( m_pGDB->GetGeoObj( *Iter)) ;
|
||||
if ( pStmS == nullptr)
|
||||
@@ -2590,7 +2584,7 @@ GdbExecutor::SurfTriMeshDoSewing( const STRVECTOR& vsParams)
|
||||
}
|
||||
// se richiesto, cancello le superfici cucite alla prima
|
||||
if ( bErase) {
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter)
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter)
|
||||
m_pGDB->Erase( *Iter) ;
|
||||
}
|
||||
return true ;
|
||||
@@ -3079,7 +3073,7 @@ GdbExecutor::VolZmapBBoxZmapIntersection( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
bool bInt ;
|
||||
|
||||
bInt = ! pZmap->AvoidBox( frBBoxFrame, ptEnd - ORIG) ;
|
||||
bInt = pZmap->CDeBox( frBBoxFrame, ptEnd - ORIG) ;
|
||||
|
||||
return true ;
|
||||
}*/
|
||||
@@ -5432,8 +5426,7 @@ GdbExecutor::TextOutline( const STRVECTOR& vsParams)
|
||||
pTXT->GetOutline( lstPCRV) ;
|
||||
// inserisco le curve nel gruppo destinazione dopo aver sistemato il cambio di riferimento
|
||||
bool bOk = true ;
|
||||
ICURVEPLIST::iterator iIter ;
|
||||
for ( iIter = lstPCRV.begin() ; iIter != lstPCRV.end() ; ++ iIter) {
|
||||
for ( auto iIter = lstPCRV.begin() ; iIter != lstPCRV.end() ; ++ iIter) {
|
||||
(*iIter)->LocToLoc( frTXT, frDest) ;
|
||||
if ( m_pGDB->AddGeoObj( GDB_ID_NULL, nIdDest, (*iIter)) == GDB_ID_NULL) {
|
||||
delete (*iIter) ;
|
||||
@@ -5510,8 +5503,7 @@ GdbExecutor::GetNamesParam( const string& sParam, INTVECTOR& vnNames)
|
||||
// converto in interi
|
||||
vnNames.clear() ;
|
||||
vnNames.reserve( vsNames.size()) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsNames.begin() ; Iter != vsNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vsNames.begin() ; Iter != vsNames.end() ; ++Iter) {
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
int nId = GetIdParam( *Iter) ;
|
||||
if ( nId != GDB_ID_SEL) {
|
||||
@@ -5538,8 +5530,7 @@ GdbExecutor::GetVectorParam( const string& sParam, const Frame3d& frVect, Vector
|
||||
// divido in parti
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam, ",", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
// se 2 parti, allora Z = 0
|
||||
if ( vsParams.size() == 2) {
|
||||
@@ -5594,8 +5585,7 @@ GdbExecutor::GetVectorParam( const string& sParam, const Frame3d& frVect, Vector
|
||||
// recupero i parametri associati
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam.substr( 3, sParam.length()-4), ",", "(", ")", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
// ci deve essere almeno un parametro
|
||||
if ( vsParams.size() < 1)
|
||||
@@ -5747,8 +5737,7 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
|
||||
// divido in parti
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam, ",", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
// se 2 parti, allora Z = 0
|
||||
if ( vsParams.size() == 2) {
|
||||
@@ -5778,8 +5767,7 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
|
||||
// recupero i parametri associati
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam.substr( 3, sParam.length()-4), ",", "(", ")", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
// ci deve essere almeno un parametro
|
||||
if ( vsParams.size() < 1)
|
||||
@@ -5962,8 +5950,7 @@ GdbExecutor::GetPointsParam( const string& sParam, const Frame3d& frPnt, PolyLin
|
||||
Tokenize( sParam.substr( 1, sParam.length()-2), ",", "(", ")", vsPoints) ;
|
||||
// converto in punti
|
||||
PL.Clear() ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsPoints.begin() ; Iter != vsPoints.end() ; ++Iter) {
|
||||
for ( auto Iter = vsPoints.begin() ; Iter != vsPoints.end() ; ++Iter) {
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
if ( GetIdParam( *Iter) == GDB_ID_SEL) {
|
||||
int nId = m_pGDB->GetFirstSelectedObj() ;
|
||||
@@ -5997,8 +5984,7 @@ GdbExecutor::GetPointWParam( const string& sParam, const Frame3d& frPnt, Point3d
|
||||
// divido in parti
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam.substr( 1, sParam.length()-2), ",", "(", ")", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
|
||||
// se 4 parti, sono 3 coordinate e un peso
|
||||
@@ -6037,8 +6023,7 @@ GdbExecutor::GetPointWsParam( const string& sParam, const Frame3d& frPnt, PolyAr
|
||||
Tokenize( sParam.substr( 1, sParam.length()-2), ",", "(", ")", vsPointWs) ;
|
||||
// converto in punti
|
||||
PA.Clear() ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsPointWs.begin() ; Iter != vsPointWs.end() ; ++Iter) {
|
||||
for ( auto Iter = vsPointWs.begin() ; Iter != vsPointWs.end() ; ++Iter) {
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
Point3d ptP ;
|
||||
double dBulge ;
|
||||
@@ -6059,8 +6044,7 @@ GdbExecutor::GetLengthParam( const string& sParam, double& dLen)
|
||||
// recupero i parametri associati
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam.substr( 1), ",", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
// ci deve essere almeno un parametro
|
||||
if ( vsParams.size() < 1)
|
||||
@@ -6082,8 +6066,7 @@ GdbExecutor::GetLengthParam( const string& sParam, double& dLen)
|
||||
// recupero i parametri associati
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam.substr( 1), ",", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
// ci deve essere almeno un parametro
|
||||
if ( vsParams.size() < 1)
|
||||
@@ -6118,8 +6101,7 @@ GdbExecutor::GetDirParam( const string& sParam, const Frame3d& frDir, double& dD
|
||||
// recupero i parametri associati
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam.substr( 3, sParam.length()-4), ",", "(", ")", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
// ci deve essere almeno un parametro
|
||||
if ( vsParams.size() < 1)
|
||||
@@ -6263,8 +6245,7 @@ GdbExecutor::GetFrameParam( const string& sParam, const Frame3d& frRef, Frame3d&
|
||||
// divido in parti ed elimino spazi iniziali/finali
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sTmp, ",", "(", ")", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
// verifico siano 4 parti e le converto
|
||||
if ( vsParams.size() != 4)
|
||||
@@ -6291,8 +6272,7 @@ GdbExecutor::GetFrameParam( const string& sParam, const Frame3d& frRef, Frame3d&
|
||||
// divido in parti ed elimino spazi iniziali/finali
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sTmp, ",", "(", ")", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
// se c'è un parametro è l'origine
|
||||
Point3d ptOrig ;
|
||||
@@ -6358,8 +6338,7 @@ GdbExecutor::GetColorParam( const string& sParam, bool& bByParent, Color& cCol)
|
||||
// divido in parti
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam, ",", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
// devono essere 3 o 4 parametri ( Red, Green, Blue [, Alpha])
|
||||
if ( vsParams.size() != 3 && vsParams.size() != 4)
|
||||
@@ -6387,8 +6366,7 @@ GdbExecutor::GetColorParam( const string& sParam, bool& bByParent, Color& cCol)
|
||||
// recupero i parametri associati
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam.substr( 1), ",", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
// ci deve essere un parametro
|
||||
if ( vsParams.size() != 1)
|
||||
@@ -6421,8 +6399,7 @@ GdbExecutor::GetMaterialParam( const string& sParam, bool& bByParent, int& nMat)
|
||||
// recupero i parametri associati
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam.substr( 1), ",", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
for ( auto Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
// ci deve essere un parametro
|
||||
if ( vsParams.size() != 1)
|
||||
@@ -6479,8 +6456,7 @@ GdbExecutor::ExecuteLevel( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
else
|
||||
return false ;
|
||||
// esecuzione impostazione livello
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->SetLevel( *Iter, nLevel))
|
||||
return false ;
|
||||
}
|
||||
@@ -6511,8 +6487,7 @@ GdbExecutor::ExecuteMode( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
else
|
||||
return false ;
|
||||
// esecuzione impostazione modo
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->SetMode( *Iter, nMode))
|
||||
return false ;
|
||||
}
|
||||
@@ -6543,8 +6518,7 @@ GdbExecutor::ExecuteStatus( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
else
|
||||
return false ;
|
||||
// esecuzione impostazione stato
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->SetStatus( *Iter, nStat))
|
||||
return false ;
|
||||
}
|
||||
@@ -6565,8 +6539,7 @@ GdbExecutor::ExecuteSelect( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// esecuzione selezione
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->SelectObj( *Iter))
|
||||
return false ;
|
||||
}
|
||||
@@ -6610,8 +6583,7 @@ GdbExecutor::ExecuteSelect( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
nFilter = EXT_TEXT ;
|
||||
}
|
||||
// esecuzione selezione di tutti gli oggetti di ogni gruppo
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->SelectGroupObjs( *Iter, nFilter))
|
||||
return false ;
|
||||
}
|
||||
@@ -6635,8 +6607,7 @@ GdbExecutor::ExecuteDeselect( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// esecuzione deselezione
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->DeselectObj( *Iter))
|
||||
return false ;
|
||||
}
|
||||
@@ -6652,8 +6623,7 @@ GdbExecutor::ExecuteDeselect( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// esecuzione deselezione di tutti gli oggetti di ogni gruppo
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->DeselectGroupObjs( *Iter))
|
||||
return false ;
|
||||
}
|
||||
@@ -6662,7 +6632,7 @@ GdbExecutor::ExecuteDeselect( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
// deselezione di tutto
|
||||
else if ( sCmd2 == "ALL") {
|
||||
// nessun parametro
|
||||
if ( vsParams.size() != 0)
|
||||
if ( ! vsParams.empty())
|
||||
return false ;
|
||||
// cancello selezione oggetti
|
||||
if ( ! m_pGDB->ClearSelection())
|
||||
@@ -6710,8 +6680,7 @@ GdbExecutor::MaterialColor( const STRVECTOR& vsParams)
|
||||
if ( ! GetColorParam( vsParams[1], bByParent, cCol))
|
||||
return false ;
|
||||
// esecuzione impostazione colore
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( bByParent) {
|
||||
if ( ! m_pGDB->SetMaterial( *Iter, GDB_MT_PARENT))
|
||||
return false ;
|
||||
@@ -6741,8 +6710,7 @@ GdbExecutor::MaterialMaterial( const STRVECTOR& vsParams)
|
||||
if ( ! GetMaterialParam( vsParams[1], bByParent, nMat))
|
||||
return false ;
|
||||
// esecuzione impostazione colore
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( bByParent) {
|
||||
if ( ! m_pGDB->SetMaterial( *Iter, GDB_MT_PARENT))
|
||||
return false ;
|
||||
@@ -6789,8 +6757,7 @@ GdbExecutor::ExecuteName( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetStringParam( vsParams[1], sName))
|
||||
return false ;
|
||||
// eseguo assegnazione nome
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->SetName( *Iter, sName))
|
||||
return false ;
|
||||
}
|
||||
@@ -6806,8 +6773,7 @@ GdbExecutor::ExecuteName( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// eseguo rimozione nome
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->RemoveName( *Iter))
|
||||
return false ;
|
||||
}
|
||||
@@ -6839,8 +6805,7 @@ GdbExecutor::ExecuteInfo( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetStringParam( vsParams[2], sInfo))
|
||||
return false ;
|
||||
// eseguo assegnazione Info di data Key
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->SetInfo( *Iter, sKey, sInfo))
|
||||
return false ;
|
||||
}
|
||||
@@ -6860,8 +6825,7 @@ GdbExecutor::ExecuteInfo( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetStringParam( vsParams[1], sKey))
|
||||
return false ;
|
||||
// eseguo rimozione nome Info di data Key
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->RemoveInfo( *Iter, sKey))
|
||||
return false ;
|
||||
}
|
||||
@@ -7010,8 +6974,7 @@ GdbExecutor::ExecuteRelocate( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
// recupero flag per globale
|
||||
bool bGlob = ( sCmd2 == "GLOB" || sCmd2 == "G") ;
|
||||
// esecuzione rilocazioni
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( bGlob) {
|
||||
if ( ! m_pGDB->RelocateGlob( *Iter, GetIdParam( vsParams[1]), nSonBeforeAfter))
|
||||
return false ;
|
||||
@@ -7036,8 +6999,7 @@ GdbExecutor::ExecuteErase( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// esecuzione cancellazioni
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
if ( ! m_pGDB->Erase( *Iter))
|
||||
return false ;
|
||||
}
|
||||
@@ -7079,8 +7041,7 @@ GdbExecutor::ExecuteTranslate( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetVectorParam( vsParams[1], frRef, vtVN))
|
||||
return false ;
|
||||
// esecuzione traslazioni
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
switch ( nTraType) {
|
||||
case TRA_LOC :
|
||||
if ( ! m_pGDB->Translate( *Iter, vtVN))
|
||||
@@ -7144,8 +7105,7 @@ GdbExecutor::ExecuteRotate( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! FromString( vsParams[3], dAngDeg))
|
||||
return false ;
|
||||
// esecuzione rotazioni
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
switch ( nRotType) {
|
||||
case ROT_LOC :
|
||||
if ( ! m_pGDB->Rotate( *Iter, ptPC, vtVN, dAngDeg))
|
||||
@@ -7214,8 +7174,7 @@ GdbExecutor::ExecuteScale( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
! FromString( vsParams[4], dCoeffZ))
|
||||
return false ;
|
||||
// esecuzione scalature
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
switch ( nScaType) {
|
||||
case SCA_LOC :
|
||||
if ( ! m_pGDB->Scale( *Iter, frFrame, dCoeffX, dCoeffY, dCoeffZ))
|
||||
@@ -7273,8 +7232,7 @@ GdbExecutor::ExecuteMirror( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetVectorParam( vsParams[2], frRef, vtVN))
|
||||
return false ;
|
||||
// esecuzione specchiature
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
switch ( nMirType) {
|
||||
case MIR_LOC :
|
||||
if ( ! m_pGDB->Mirror( *Iter, ptPC, vtVN))
|
||||
@@ -7340,8 +7298,7 @@ GdbExecutor::ExecuteShear( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! FromString( vsParams[4], dCoeff))
|
||||
return false ;
|
||||
// esecuzione scorrimenti
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
switch ( nMirType) {
|
||||
case MIR_LOC :
|
||||
if ( ! m_pGDB->Shear( *Iter, ptPC, vtNorm, vtDir, dCoeff))
|
||||
@@ -7400,8 +7357,7 @@ GdbExecutor::CurveModifyInvert( const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// esecuzione inversione curve
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
ICurve* pCurve = GetCurve( m_pGDB->GetGeoObj( *Iter)) ;
|
||||
if ( pCurve == nullptr || ! pCurve->Invert())
|
||||
return false ;
|
||||
@@ -7518,8 +7474,7 @@ GdbExecutor::CurveModifyTrim( const STRVECTOR& vsParams, int nTrimType)
|
||||
if ( ! FromString( vsParams[1], dPar))
|
||||
return false ;
|
||||
// esecuzione trim
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
ICurve* pCurve ;
|
||||
if ( ( pCurve = GetCurve( m_pGDB->GetGeoObj( *Iter))) != nullptr) {
|
||||
switch ( nTrimType) {
|
||||
@@ -7718,8 +7673,7 @@ GdbExecutor::CurveCopyByChain( const STRVECTOR& vsParams)
|
||||
// preparo i dati per il concatenamento
|
||||
ChainCurves chainC ;
|
||||
chainC.Init( bAllowInvert, dToler, int( vnNames.size())) ;
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero la curva e il suo riferimento
|
||||
ICurve* pCrv = GetCurve( m_pGDB->GetGeoObj( *Iter)) ;
|
||||
if ( pCrv == nullptr)
|
||||
@@ -7748,10 +7702,9 @@ GdbExecutor::CurveCopyByChain( const STRVECTOR& vsParams)
|
||||
if ( IsNull( pCrvCompo))
|
||||
return false ;
|
||||
// recupero le curve semplici e le inserisco nella curva composita
|
||||
INTVECTOR::iterator Iter2 ;
|
||||
for ( Iter2 = vIds.begin() ; Iter2 != vIds.end() ; ++Iter2) {
|
||||
int nId = abs( *Iter2) ;
|
||||
bool bInvert = ( *Iter2 < 0) ;
|
||||
for ( auto Iter = vIds.cbegin() ; Iter != vIds.cend() ; ++Iter) {
|
||||
int nId = abs( *Iter) ;
|
||||
bool bInvert = ( *Iter < 0) ;
|
||||
// recupero la curva e il suo riferimento
|
||||
ICurve* pCrv = GetCurve( m_pGDB->GetGeoObj( nId)) ;
|
||||
if ( pCrv == nullptr)
|
||||
@@ -7806,8 +7759,7 @@ GdbExecutor::SurfModifyInvert( const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// esecuzione inversione normale superficie
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
ISurf* pSurf = GetSurf( m_pGDB->GetGeoObj( *Iter)) ;
|
||||
if ( pSurf == nullptr || ! pSurf->Invert())
|
||||
return false ;
|
||||
@@ -7821,7 +7773,7 @@ bool
|
||||
GdbExecutor::ExecuteNew( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
{
|
||||
// nessun parametro
|
||||
if ( vsParams.size() != 0)
|
||||
if ( ! vsParams.empty())
|
||||
return false ;
|
||||
// pulizia e reinizializzazione del DB geometrico
|
||||
m_pGDB->Clear() ;
|
||||
@@ -7994,7 +7946,7 @@ GdbExecutor::ExecuteOutTsc( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
// chiudo il file di uscita Tsc
|
||||
else if ( sCmd2 == "CLOSE") {
|
||||
// nessun parametro
|
||||
if ( vsParams.size() != 0)
|
||||
if ( ! vsParams.empty())
|
||||
return false ;
|
||||
// scrivo terminazioni e chiudo il file
|
||||
return m_OutTsc.Close() ;
|
||||
@@ -8017,7 +7969,7 @@ GdbExecutor::ExecuteOutTsc( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
else if ( sCmd2 == "SETGR") {
|
||||
Frame3d frF ;
|
||||
// nessun parametro
|
||||
if ( vsParams.size() == 0)
|
||||
if ( vsParams.empty())
|
||||
frF.Reset() ;
|
||||
// un parametro ( Id del gruppo)
|
||||
else if ( vsParams.size() == 1) {
|
||||
@@ -8049,8 +8001,7 @@ GdbExecutor::ExecuteOutTsc( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// esecuzione
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero l'oggetto ed eseguo l'output
|
||||
if ( ! OutGroupTsc( *Iter, nFlag))
|
||||
return false ;
|
||||
@@ -8073,8 +8024,7 @@ GdbExecutor::ExecuteOutTsc( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// esecuzione
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
for ( auto Iter = vnNames.cbegin() ; Iter != vnNames.cend() ; ++Iter) {
|
||||
// recupero l'oggetto ed eseguo l'output
|
||||
if ( ! m_OutTsc.PutGeoObj( m_pGDB->GetGeoObj( *Iter), nFlag))
|
||||
return false ;
|
||||
|
||||
+12
-4
@@ -101,6 +101,10 @@ GdbGeo::Save( int nBaseId, NgeWriter& ngeOut, INTUNORDSET* pSavedIds) const
|
||||
if ( pGObjRW == nullptr)
|
||||
return false ;
|
||||
|
||||
// eventuali modifiche prima del salvataggio
|
||||
if ( ! pGObjRW->PreSave( * const_cast<GdbGeo*>( this)))
|
||||
return false ;
|
||||
|
||||
// tipo entità e identificativi
|
||||
if ( ! ngeOut.WriteKey( pGObjRW->GetNgeId()))
|
||||
return false ;
|
||||
@@ -124,7 +128,11 @@ GdbGeo::Save( int nBaseId, NgeWriter& ngeOut, INTUNORDSET* pSavedIds) const
|
||||
// parametri geometrici
|
||||
if ( ! ngeOut.WriteKey( NGE_G))
|
||||
return false ;
|
||||
return pGObjRW->Save( ngeOut) ;
|
||||
if ( ! pGObjRW->Save( ngeOut))
|
||||
return false ;
|
||||
|
||||
// eventuali ripristini dopo il salvataggio
|
||||
return pGObjRW->PostSave( * const_cast<GdbGeo*>( this)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -181,7 +189,7 @@ GdbGeo::Load( int nNgeId, NgeReader& ngeIn, int nBaseGdbId, int& nParentId)
|
||||
|
||||
// parametri geometrici
|
||||
IGeoObjRW* pGObjRW = dynamic_cast<IGeoObjRW*>( m_pGeoObj) ;
|
||||
return ( pGObjRW != nullptr && pGObjRW->Load( ngeIn)) ;
|
||||
return ( pGObjRW != nullptr && pGObjRW->Load( ngeIn) && pGObjRW->PostLoad( *this)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -328,7 +336,7 @@ GdbGeo::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoe
|
||||
// curva originale
|
||||
ICurve* pCrv = GetCurve( m_pGeoObj) ;
|
||||
// trasformo in curva di Bezier (semplice o composta)
|
||||
ICurve* pCrvNew = ArcToBezierCurve( pCrv) ;
|
||||
ICurve* pCrvNew = ArcToBezierCurve( GetCurveArc( pCrv)) ;
|
||||
if ( pCrvNew == nullptr)
|
||||
return false ;
|
||||
// assegno alla nuova curva estrusione e spessore di quella originale
|
||||
@@ -381,7 +389,7 @@ GdbGeo::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDi
|
||||
if ( ! pArc->IsPlane() ||
|
||||
! AreSameOrOppositeVectorExact( pArc->GetNormVersor(), vtNorm)) {
|
||||
// trasformo in curva di Bezier (semplice o composta)
|
||||
ICurve* pCrvNew = ArcToBezierCurve( GetCurve( m_pGeoObj)) ;
|
||||
ICurve* pCrvNew = ArcToBezierCurve( GetCurveArc( m_pGeoObj)) ;
|
||||
if ( pCrvNew == nullptr)
|
||||
return false ;
|
||||
// assegno alla nuova curva estrusione e spessore di quella originale
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ GdbGroup::~GdbGroup( void)
|
||||
// nel sorgente aggiorno lista dei riferimenti
|
||||
INTVECTOR vnList ;
|
||||
pGdbObj->GetInfo( GDB_SI_LIST, vnList) ;
|
||||
INTVECTOR::const_iterator iFind = find( vnList.begin(), vnList.end(), m_nId) ;
|
||||
const auto iFind = find( vnList.begin(), vnList.end(), m_nId) ;
|
||||
if ( iFind != vnList.end())
|
||||
vnList.erase( iFind) ;
|
||||
if ( vnList.empty())
|
||||
|
||||
+4
-3
@@ -1254,13 +1254,13 @@ GdbIterator::GetCalcStatus( int& nStat) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbIterator::SetMark( void)
|
||||
GdbIterator::SetMark( int nMark)
|
||||
{
|
||||
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
||||
return false ;
|
||||
|
||||
// imposto la marcatura
|
||||
return m_pCurrObj->SetMark() ;
|
||||
return m_pCurrObj->SetMark( nMark) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1468,7 +1468,8 @@ GdbIterator::SetInfo( const string& sKey, int nInfo)
|
||||
bool
|
||||
GdbIterator::SetInfo( const string& sKey, double dInfo)
|
||||
{
|
||||
return SetInfo( sKey, ToString( dInfo)) ;
|
||||
int nErr ;
|
||||
return ( SetInfo( sKey, ToString( dInfo, 6, &nErr)) && nErr == 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ class GdbIterator : public IGdbIterator
|
||||
bool RevertStatus( void) override ;
|
||||
bool GetStatus( int& nStat) const override ;
|
||||
bool GetCalcStatus( int& nStat) const override ;
|
||||
bool SetMark( void) override ;
|
||||
bool SetMark( int nMark = GDB_MK_ON) override ;
|
||||
bool ResetMark( void) override ;
|
||||
bool GetMark( int& nMark) const override ;
|
||||
bool GetCalcMark( int& nMark) const override ;
|
||||
|
||||
+20
-5
@@ -101,6 +101,20 @@ GdbObj::CopyFrom( const GdbObj* pSou)
|
||||
return ( CopyAttribsFrom( pSou) && CopyTextureDataFrom( pSou) && CopyUserObjFrom( pSou)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::CopyStippleDataFrom( const GdbObj* pSou)
|
||||
{
|
||||
// se l'oggetto sorgente non esiste
|
||||
if ( pSou == nullptr)
|
||||
return false ;
|
||||
// copio stipple
|
||||
m_nStpFactor = pSou->m_nStpFactor ;
|
||||
m_nStpPattern = pSou->m_nStpPattern ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::CopyAttribsFrom( const GdbObj* pSou)
|
||||
@@ -612,14 +626,14 @@ GdbObj::GetCalcStatus( int& nStat, int nLev) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::SetMark( void)
|
||||
GdbObj::SetMark( int nMark)
|
||||
{
|
||||
// verifico esistenza (con eventuale creazione) degli attributi
|
||||
if ( GetSafeAttribs() == nullptr)
|
||||
return false ;
|
||||
|
||||
// assegno la marcatura
|
||||
m_pAttribs->SetMark() ;
|
||||
m_pAttribs->SetMark( nMark) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -659,8 +673,8 @@ GdbObj::GetCalcMark( int& nMark) const
|
||||
nObjMark = m_pAttribs->GetMark() ;
|
||||
|
||||
// se la marcatura è ON, non ho bisogno di sapere altro
|
||||
if ( nObjMark == GDB_MK_ON) {
|
||||
nMark = GDB_MK_ON ;
|
||||
if ( nObjMark == GDB_MK_ON || nObjMark == GDB_MK_ON_2) {
|
||||
nMark = nObjMark ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -862,7 +876,8 @@ GdbObj::SetInfo( const string& sKey, int nInfo)
|
||||
bool
|
||||
GdbObj::SetInfo( const string& sKey, double dInfo)
|
||||
{
|
||||
return SetInfo( sKey, ToString( dInfo)) ;
|
||||
int nErr ;
|
||||
return ( SetInfo( sKey, ToString( dInfo, 6, &nErr)) && nErr == 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -57,6 +57,7 @@ class GdbObj
|
||||
GdbObj( void) ;
|
||||
bool CopyFrom( const GdbObj* pSou) ;
|
||||
bool CopyAttribsFrom( const GdbObj* pSou) ;
|
||||
bool CopyStippleDataFrom( const GdbObj* pSou) ;
|
||||
bool CopyTextureDataFrom( const GdbObj* pSou) ;
|
||||
bool CopyUserObjFrom( const GdbObj* pSou) ;
|
||||
|
||||
@@ -81,7 +82,7 @@ class GdbObj
|
||||
bool IsSelected( void) const ;
|
||||
bool GetStatus( int& nStat) const ;
|
||||
bool GetCalcStatus( int& nStat, int nLev = 0) const ;
|
||||
bool SetMark( void) ;
|
||||
bool SetMark( int nMark) ;
|
||||
bool ResetMark( void) ;
|
||||
bool GetMark( int& nMark) const ;
|
||||
bool GetCalcMark( int& nMark) const ;
|
||||
|
||||
+3
-3
@@ -29,10 +29,8 @@ GEOOBJ_REGISTER( GEO_FRAME3D, NGE_G_FRM, GeoFrame3d) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
GeoFrame3d::GeoFrame3d( void)
|
||||
: m_frF()
|
||||
: m_frF(), m_nTempProp{0,0}, m_dTempParam{0.0,0.0}
|
||||
{
|
||||
m_nTempProp[0] = 0 ;
|
||||
m_nTempProp[1] = 0 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -118,6 +116,8 @@ GeoFrame3d::CopyFrom( const GeoFrame3d& gfSrc)
|
||||
return true ;
|
||||
m_nTempProp[0] = gfSrc.m_nTempProp[0] ;
|
||||
m_nTempProp[1] = gfSrc.m_nTempProp[1] ;
|
||||
m_dTempParam[0] = gfSrc.m_dTempParam[0] ;
|
||||
m_dTempParam[1] = gfSrc.m_dTempParam[1] ;
|
||||
return Set( gfSrc.m_frF) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,11 @@ class GeoFrame3d : public IGeoFrame3d, public IGeoObjRW
|
||||
m_nTempProp[nPropInd] = nProp ; }
|
||||
int GetTempProp( int nPropInd = 0) const override
|
||||
{ return (( nPropInd >= 0 && nPropInd < 2) ? m_nTempProp[nPropInd] : 0) ; }
|
||||
void SetTempParam( double dParam, int nParamInd = 0) override
|
||||
{ if ( nParamInd >= 0 && nParamInd < 2)
|
||||
m_dTempParam[nParamInd] = dParam ; }
|
||||
double GetTempParam( int nParamInd = 0) const override
|
||||
{ return (( nParamInd >= 0 && nParamInd < 2) ? m_dTempParam[nParamInd] : 0.0) ; }
|
||||
|
||||
public : // IGeoFrame3d
|
||||
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
||||
@@ -78,7 +83,10 @@ class GeoFrame3d : public IGeoFrame3d, public IGeoObjRW
|
||||
public : // IGeoObjRW
|
||||
int GetNgeId( void) const override ;
|
||||
bool Save( NgeWriter& ngeOut) const override ;
|
||||
bool PreSave( GdbGeo& Wrapper) const override { return true ; }
|
||||
bool PostSave( GdbGeo& Wrapper) const override { return true ; }
|
||||
bool Load( NgeReader& ngeIn) override ;
|
||||
bool PostLoad( GdbGeo& Wrapper) override { return true ; }
|
||||
|
||||
public :
|
||||
GeoFrame3d( void) ;
|
||||
@@ -97,6 +105,7 @@ class GeoFrame3d : public IGeoFrame3d, public IGeoObjRW
|
||||
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
||||
Frame3d m_frF ; // oggetto
|
||||
int m_nTempProp[2] ; // vettore proprietà temporanee
|
||||
double m_dTempParam[2] ; // vettore parametri temporanei
|
||||
} ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
+35
-35
@@ -28,41 +28,6 @@
|
||||
#define GEOOBJ_NGEIDTOTYPE( nNgeId) GeoObjFactory::NgeIdToType( nNgeId)
|
||||
#define GEOOBJ_CREATE( nKey) GeoObjFactory::Create( nKey)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template <class T>
|
||||
class GeoObjRegister
|
||||
{
|
||||
public :
|
||||
static bool DoRegister( int nKey, int nNgeId)
|
||||
{ if ( ! GeoObjFactory::Register( nKey, NgeAscKeyW[nNgeId], nNgeId, Create))
|
||||
return false ;
|
||||
GetTypePrivate() = nKey ;
|
||||
GetKeyPrivate() = NgeAscKeyW[nNgeId] ;
|
||||
GetNgeIdPrivate() = nNgeId ;
|
||||
return true ; }
|
||||
static IGeoObj* Create( void)
|
||||
{ return new( std::nothrow) T ; }
|
||||
static int GetType( void)
|
||||
{ return GetTypePrivate() ; }
|
||||
static const std::string& GetKey( void)
|
||||
{ return GetKeyPrivate() ; }
|
||||
static int GetNgeId( void)
|
||||
{ return GetNgeIdPrivate() ; }
|
||||
|
||||
private :
|
||||
GeoObjRegister( void) {}
|
||||
~GeoObjRegister( void) {}
|
||||
static int& GetTypePrivate( void)
|
||||
{ static int s_nType ;
|
||||
return s_nType ; }
|
||||
static std::string& GetKeyPrivate( void)
|
||||
{ static std::string s_sKey ;
|
||||
return s_sKey ; }
|
||||
static int& GetNgeIdPrivate( void)
|
||||
{ static int s_nNgeId ;
|
||||
return s_nNgeId ; }
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class GeoObjFactory
|
||||
{
|
||||
@@ -117,3 +82,38 @@ class GeoObjFactory
|
||||
{ static CreatorMap s_CreatorMap ;
|
||||
return s_CreatorMap ; }
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template <class T>
|
||||
class GeoObjRegister
|
||||
{
|
||||
public :
|
||||
static bool DoRegister( int nKey, int nNgeId)
|
||||
{ if ( ! GeoObjFactory::Register( nKey, NgeAscKeyW[nNgeId], nNgeId, Create))
|
||||
return false ;
|
||||
GetTypePrivate() = nKey ;
|
||||
GetKeyPrivate() = NgeAscKeyW[nNgeId] ;
|
||||
GetNgeIdPrivate() = nNgeId ;
|
||||
return true ; }
|
||||
static IGeoObj* Create( void)
|
||||
{ return new( std::nothrow) T ; }
|
||||
static int GetType( void)
|
||||
{ return GetTypePrivate() ; }
|
||||
static const std::string& GetKey( void)
|
||||
{ return GetKeyPrivate() ; }
|
||||
static int GetNgeId( void)
|
||||
{ return GetNgeIdPrivate() ; }
|
||||
|
||||
private :
|
||||
GeoObjRegister( void) {}
|
||||
~GeoObjRegister( void) {}
|
||||
static int& GetTypePrivate( void)
|
||||
{ static int s_nType ;
|
||||
return s_nType ; }
|
||||
static std::string& GetKeyPrivate( void)
|
||||
{ static std::string s_sKey ;
|
||||
return s_sKey ; }
|
||||
static int& GetNgeIdPrivate( void)
|
||||
{ static int s_nNgeId ;
|
||||
return s_nNgeId ; }
|
||||
} ;
|
||||
|
||||
+7
-3
@@ -1,13 +1,13 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
// EgalTech 2014-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : GeoObjRW.h Data : 14.03.14 Versione : 1.5d5
|
||||
// File : GeoObjRW.h Data : 08.03.24 Versione : 2.6c2
|
||||
// Contenuto : Dichiarazione della interfaccia IGeoObjRW.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 20.11.13 DS Creazione modulo.
|
||||
//
|
||||
// 08.03.24 DS Aggiunte PreSave, PostSave, PreLoad e PostLoad.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
class NgeWriter ;
|
||||
class NgeReader ;
|
||||
class GdbGeo ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
class __declspec( novtable) IGeoObjRW
|
||||
@@ -22,5 +23,8 @@ class __declspec( novtable) IGeoObjRW
|
||||
public :
|
||||
virtual int GetNgeId( void) const = 0 ;
|
||||
virtual bool Save( NgeWriter& ngeOut) const = 0 ;
|
||||
virtual bool PreSave( GdbGeo& Wrapper) const = 0 ;
|
||||
virtual bool PostSave( GdbGeo& Wrapper) const = 0 ;
|
||||
virtual bool Load( NgeReader& ngeIn) = 0 ;
|
||||
virtual bool PostLoad( GdbGeo& Wrapper) = 0 ;
|
||||
} ;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user