JunkBox_Lib++ (for Windows) 1.10.1
Loading...
Searching...
No Matches
TriBrep.cpp
Go to the documentation of this file.
1
10#include "TriBrep.h"
11
12
13using namespace jbxl;
14
15
23{
24 solid->contours.clear();
25
26 BREP_SHELL_LIST shells = solid->shells;
27 BREP_SHELL_LIST::iterator ishell;
28 for (ishell=shells.begin(); ishell!=shells.end(); ishell++){
29 BREP_FACET* pbfc;
30 BREP_FACET_LIST::iterator ifacet;
31 for (ifacet =(*ishell)->facets.begin(); ifacet!=(*ishell)->facets.end(); ifacet++){
32 if ((*ifacet)->deletable && !(*ifacet)->notdelete) {
33 pbfc = *ifacet;
34 ifacet = (*ishell)->facets.erase(ifacet);
35 ifacet--;
36 pbfc->shell = NULL;
37 delete(pbfc);
38 }
39 else {
40 BREP_CONTOUR_LIST::iterator icon;
41 for (icon=(*ifacet)->outer_contours.begin(); icon!=(*ifacet)->outer_contours.end(); icon++) {
42 (*ifacet)->deletable = false;
43 solid->contours.push_back(*icon);
44 }
45 }
46 }
47 }
48 solid->facetno = (int)solid->contours.size();
49}
50
51
59{
60 solid->wings.clear();
61
62 BREP_CONTOUR_LIST::iterator icon;
63 for (icon=solid->contours.begin(); icon!=solid->contours.end(); icon++) {
64 BREP_WING* first = (*icon)->wing;
65 if (first!=NULL) {
66 BREP_WING* next = first;
67 do {
68 BREP_WING* wing = next;
69 next = wing->next;
70 solid->wings.push_back(wing);
71 if (!wing->edge->complete) solid->wings.push_back(GetWingOtherSide(wing));
72 } while(next!=first);
73 }
74 }
75}
76
77
85{
86// DEBUG_MODE PRINT_MESG("Start CreateSurplusContoursList\n");
87 solid->surplus_contours.clear();
88
89 BREP_CONTOUR_LIST::iterator icon;
90 for (icon=solid->contours.begin(); icon!=solid->contours.end(); icon++){
91 if (DupEdgeNumber(*icon)>0) {
92 solid->surplus_contours.push_back(*icon);
93 }
94 }
95// DEBUG_MODE PRINT_MESG("END CreateSurplusContoursList\n");
96}
97
98
106{
107 solid->shortage_wings.clear();
108
109 BREP_WING_LIST::iterator iwing;
110 for (iwing=solid->wings.begin(); iwing!=solid->wings.end(); iwing++){
111 if ((*iwing)->contour==NULL) solid->shortage_wings.push_back(*iwing);
112 }
113}
114
115
116
118//
119
141{
142 if (solid->surplus_contours.empty()) return;
143// DEBUG_MODE PRINT_MESG("Start DeleteSurplusContours\n");
144
145 CVCounter* counter = NULL;
146 if (solid->counter!=NULL) counter = solid->counter->GetUsableCounter();
147 if (counter!=NULL) counter->SetMax((int)solid->surplus_contours.size()*3);
148
149 BREP_CONTOUR_LIST::iterator icon;
150 // 3つの多重Edgeを持つ Facetの処理
151 for (icon=solid->surplus_contours.begin(); icon!=solid->surplus_contours.end(); icon++){
152 if ((*icon)->dup_edge==3) (*icon)->facet->deletable = true;
153 if (counter!=NULL) counter->StepIt();
154 }
155 ReverseContours(solid); // 3辺が多重Edgeの Facetを裏返す
157 JoinShortageWings(solid); // 一つにまとまるEdgeは一つにまとめる.
158
160 if (solid->surplus_contours.empty()) {
161// DEBUG_MODE PRINT_MESG("End DeleteSurplusContours\n");
162 return;
163 }
164
165 // 2つの多重Edgeを持つ Facetの処理
166 for (icon=solid->surplus_contours.begin(); icon!=solid->surplus_contours.end(); icon++){
167 if ((*icon)->dup_edge==2) (*icon)->facet->deletable = true;
168 if (counter!=NULL) counter->StepIt();
169 }
170 ReverseContours(solid); // 2辺が多重Edgeの Facetを裏返す
172 JoinShortageWings(solid);
173
175 if (solid->surplus_contours.empty()) {
176// DEBUG_MODE PRINT_MESG("End DeleteSurplusContours\n");
177 return;
178 }
179
180 // 1つの多重Edgeを持つ Facetの処理
181 for (icon=solid->surplus_contours.begin(); icon!=solid->surplus_contours.end(); icon++){
182 if ((*icon)->dup_edge==1) (*icon)->facet->deletable = true;
183 if (counter!=NULL) counter->StepIt();
184 }
185 ReverseContours(solid); // 1辺が多重Edgeの Facetを裏返す
187 JoinShortageWings(solid);
188
190 if (!solid->surplus_contours.empty()) {
191// DEBUG_MODE PRINT_MESG("EraseSurplusContour: 多重Edgeを持つ Facetデータが残っている?\n");
192 }
193// DEBUG_MODE PRINT_MESG("End DeleteSurplusContours\n");
194 return;
195}
196
197
211{
212 if (solid->shortage_wings.empty()) return;
213// DEBUG_MODE PRINT_MESG("Start DeleteStraightEdges\n");
214
215 CVCounter* counter = NULL;
216 if (solid->counter!=NULL) counter = solid->counter->GetUsableCounter();
217 if (counter!=NULL) counter->SetMax((int)solid->shortage_wings.size());
218
219 BREP_WING_LIST::iterator wing1;
220 for (wing1=solid->shortage_wings.begin(); wing1!=solid->shortage_wings.end(); wing1++){
221 BREP_VERTEX* vert[3];
222 vert[0] = (*wing1)->vertex;
223 BREP_WING_LIST::iterator wing2;
224 for (wing2=solid->shortage_wings.begin(); wing2!=solid->shortage_wings.end(); wing2++){
225 if (IsConnectEdges(*wing1, *wing2)) {
226 vert[1] = (*wing2)->vertex;
227 vert[2] = GetWingOtherSide(*wing2)->vertex;
228 IsForbiddenEdge(vert); // 直線に並んだ Vertexを禁止する.
229 }
230 }
231 if (counter!=NULL) counter->StepIt();
232 }
233 CreateContoursList(solid); // 該当Contour(Facet)を削除し,全てのContour(Facet)の Listを作り直す.
234 CreateWingsList(solid); // WingsListを作り直す.
235
236// DEBUG_MODE PRINT_MESG("End DeleteStraightEdges\n");
237 return;
238}
239
240
251{
252 if (solid->shortage_wings.empty()) return;
253// DEBUG_MODE PRINT_MESG("Start DeleteShortageWings\n");
254
255 CVCounter* counter = NULL;
256 if (solid->counter!=NULL) counter = solid->counter->GetUsableCounter();
257 if (counter!=NULL) counter->SetMax((int)solid->shortage_wings.size());
258
259 BREP_WING_LIST::iterator iwing;
260 for (iwing=solid->shortage_wings.begin(); iwing!=solid->shortage_wings.end(); iwing++){
261 if ((*iwing)->contour!=NULL) (*iwing)->contour->facet->deletable = true;
262 BREP_WING* othwing = GetWingOtherSide(*iwing);
263 if (othwing->contour!=NULL) othwing->contour->facet->deletable = true;
264 if (counter!=NULL) counter->StepIt();
265 }
266
267 CreateContoursList(solid);
268 CreateWingsList(solid);
269// DEBUG_MODE PRINT_MESG("End DeleteShortageWings\n");
270 return;
271}
272
273
274#define JBXL_BREP_MAX_LOOPCNT 20
275
276
292DllExport void jbxl::FillShortageWings(BREP_SOLID* solid, int method, bool mode)
293{
294 if (solid->shortage_wings.empty()) return;
295// DEBUG_MODE PRINT_MESG("Start FillShortageWings\n");
296
297 int wmax = (int)solid->shortage_wings.size();
298 CVCounter* counter = NULL;
299 if (solid->counter!=NULL) counter = solid->counter->GetUsableCounter();
300 if (counter!=NULL) counter->SetMax(wmax);
301
302 int lpc = 0;
303 int pno = 1;
304 while (solid->shortage_wings.size()>1 && pno!=0 && lpc<JBXL_BREP_MAX_LOOPCNT) {
305 if (method==1) pno = FillShortageWings_Next(solid, mode);
306 else if (method==2) pno = FillShortageWings_Near(solid, mode);
307 else {
308// DEBUG_MODE PRINT_MESG("FillShortageWings: 知らない手法が指定された %d\n", method);
309// DEBUG_MODE PRINT_MESG("End FillShortageWings\n");
310 return;
311 }
313 //DEBUG_MODE PRINT_MESG("FillShortageWings: 不完全Wingデータは %d/%d 個 %d\n", solid->shortage_wings.size(), wmax, pno);
314 lpc++;
315 }
316
317// DEBUG_MODE PRINT_MESG("End FillShortageWings\n");
318 return;
319}
320
321
338{
339 int patchno = 0;
340
341 BREP_WING_LIST::iterator wing1;
342 for (wing1=solid->shortage_wings.begin(); wing1!=solid->shortage_wings.end(); wing1++){
343 if (!IsIncludeCompleteEdge(*wing1)) {
344 BREP_VERTEX* vert[3];
345
346 vert[0] = (*wing1)->vertex;
347 BREP_WING_LIST::iterator wing2;
348 for (wing2=solid->shortage_wings.begin(); wing2!=solid->shortage_wings.end(); wing2++){
349 if (!IsIncludeCompleteEdge(*wing2) && IsConnectEdges(*wing1, *wing2)) {
350 vert[1] = (*wing2)->vertex;
351 vert[2] = GetWingOtherSide(*wing2)->vertex; // vert[]: Contourを貼る頂点
352 BREP_SHELL* shell = GetWingOtherSide(*wing1)->contour->facet->shell;
353 if (PatchupContour(shell, vert, mode)) patchno++;
354 }
355 }
356 }
357 }
358 CreateContoursList(solid);
359 CreateWingsList(solid);
360
361 return patchno;
362}
363
364
365#define JBXL_BREP_MAX_QUEUESIZE 1
366
367
384{
385 int patchno = 0;
386 BREP_VERTEX_LIST vertex_list;
387
388 BREP_WING_LIST::iterator wing1;
389 for (wing1=solid->shortage_wings.begin(); wing1!=solid->shortage_wings.end(); wing1++){
390 if (!IsIncludeCompleteEdge(*wing1)) {
391 BREP_VERTEX* vert[3];
392 vert[0] = (*wing1)->vertex;
393 vert[1] = GetWingOtherSide(*wing1)->vertex;
394 vert[2] = NULL;
395 vertex_list.clear();
396
397 BREP_WING_LIST::iterator wing2;
398 for (wing2=solid->shortage_wings.begin(); wing2!=solid->shortage_wings.end(); wing2++){
399 if (wing1!=wing2) {
400 BREP_VERTEX* vrtx = (*wing2)->vertex;
401 if (vrtx!=vert[0] && vrtx!=vert[1]) {
402 /* int cnt = 0;
403 BREP_VERTEX* v = vert[1];
404 do {
405 v = FindConnectEdgeVertex(v);
406 cnt++;
407 } while (v!=vert[0] && v!=vert[1] && v!=vrtx && v!=NULL && cnt<100);
408 */
409 // if (v!=vrtx) {
410 Vector<double> vect = (*wing1)->edge->center - vrtx->point;
411 vrtx->distance2 = vect.norm2();
412 SetMinVertex(&vertex_list, vrtx);
413 // }
414 }
415 }
416 }
417
418 int cnt=0;
419 BREP_SHELL* shell = GetWingOtherSide(*wing1)->contour->facet->shell;
420 BREP_VERTEX_LIST::iterator ivert;
421 for (ivert=vertex_list.begin(); ivert!=vertex_list.end(); ivert++){
422 vert[2] = *ivert;
423 if (PatchupContour(shell, vert, mode)) {
424 patchno++;
425 break;
426 }
427 cnt++;
428 if (cnt>=JBXL_BREP_MAX_QUEUESIZE) break;
429 }
430
431 }
432 }
433 CreateContoursList(solid);
434 CreateWingsList(solid);
435
436 return patchno;
437}
438
439
446{
447 BREP_VERTEX_LIST::iterator ivert;
448 for (ivert=list->begin(); ivert!=list->end(); ivert++){
449 if (vrtx==(*ivert)) return; // 既に登録済み
450 if (vrtx->distance2 < (*ivert)->distance2) {
451 list->insert(ivert, vrtx);
452 return;
453 }
454 }
455 if (ivert==list->end()) list->push_back(vrtx);
456 return;
457}
458
459
466{
467 BREP_WING_LIST::iterator iwing;
468 for (iwing=vert->wing_list.begin(); iwing!=vert->wing_list.end(); iwing++){
469 if ((*iwing)->contour==NULL) {
470 return GetWingOtherSide(*iwing)->vertex;
471 }
472 }
473 return NULL;
474}
475
476
488{
489 if (vert[0]->forbidden_list!=NULL) {
490 BREP_VERTEX_LIST::iterator vertex;
491 vertex = std::find(vert[0]->forbidden_list->begin(), vert[0]->forbidden_list->end(), vert[2]);
492 if (vertex!=vert[0]->forbidden_list->end()) return false; // 禁止Listの中に見つけた.
493 }
494
495 BREP_SOLID* solid = shell->solid;
496 CVCounter* counter = NULL;
497 if (solid->counter!=NULL) counter = solid->counter->GetUsableCounter();
498
499 BREP_FACET* facet = new BREP_FACET(shell);
500 BREP_CONTOUR* contour = CreateContourByVertex(facet, vert);
501 if (contour!=NULL) {
502 if (DupEdgeNumber(contour)==0 || mode) {
503 BREP_CONTOUR* collision;
504 facet->CloseData();
505 if (!IsCollisionContours(solid, contour, &collision)) {
506 solid->contours.push_back(contour);
507// PrintFacetAsciiSTL(contour);
508 if (counter!=NULL) counter->StepIt();
509 return true;
510 }
511 else FastDeleteFacet(facet);
512 }
513 else FastDeleteFacet(facet);
514 }
515 else FastDeleteFacet(facet);
516
517 return false;
518}
519
520
531{
532 // 全ての Facetに対して
533 BREP_SHELL_LIST shells = solid->shells;
534 BREP_SHELL_LIST::iterator ishell;
535 for (ishell=shells.begin(); ishell!=shells.end(); ishell++){
536 BREP_FACET_LIST::iterator ifacet;
537 for (ifacet =(*ishell)->facets.begin(); ifacet!=(*ishell)->facets.end(); ifacet++){
538 // 削除マークが付いているなら
539 if ((*ifacet)->deletable && !(*ifacet)->notdelete) {
540 // 逆周りで頂点を Vector vに格納
541 BREP_VERTEX* v[3];
542 BREP_FACET* pbfc;
543 BREP_CONTOUR* pbcn;
544 BREP_CONTOUR_LIST::iterator icon;
545 for (icon=(*ifacet)->outer_contours.begin(); icon!=(*ifacet)->outer_contours.end(); icon++) {
546 BREP_WING* wing = (*icon)->wing;
547 for (int i=0; i<3; i++) {
548 v[i] = wing->vertex;
549 wing = wing->prev;
550 }
551 }
552
553 // 削除マークが付いている Facetを削除
554 pbfc = *ifacet;
555 ifacet = (*ishell)->facets.erase(ifacet);
556 ifacet--;
557 pbfc->shell = NULL;
558 delete(pbfc);
559
560 // 裏返しの Contourを登録
561 pbfc = new BREP_FACET(*ishell);
562 pbcn = CreateContourByVertex(pbfc, v);
563 if (pbcn!=NULL) {
564 if (DupEdgeNumber(pbcn)==0) {
565 pbfc->CloseData();
566 }
567 else {
568 FastDeleteFacet(pbfc);
569 }
570 }
571 else {
572 FastDeleteFacet(pbfc);
573 }
574 }
575 }
576 }
577
578 CreateContoursList(solid);
579 CreateWingsList(solid);
580}
581
582
593{
594 if (solid->shortage_wings.empty()) return;
595// DEBUG_MODE PRINT_MESG("Start JoinShortageWings\n");
596
597 BREP_WING_LIST::iterator iwing;
598 for (iwing=solid->shortage_wings.begin(); iwing!=solid->shortage_wings.end(); iwing++){
599 BREP_WING* wingA = (*iwing);
600
601 if (GetWingOtherSide(wingA)->contour==NULL) { // 両方NULL
602 delete (wingA->edge);
603 continue;
604 }
605
606 if (wingA->edge->edge_list!=NULL) {
607 BREP_EDGE_LIST* edge_list = wingA->edge->edge_list;
608 BREP_EDGE_LIST::iterator iedge;
609 for (iedge=edge_list->begin(); iedge!=edge_list->end(); iedge++){
610 if (wingA==(*iedge)->wing1 || wingA==(*iedge)->wing2) continue;
611 if ((*iedge)->wing1->contour!=NULL && (*iedge)->wing2->contour!=NULL) continue;
612
613 BREP_WING* wingB;
614 if ((*iedge)->wing1->contour!=NULL) wingB = (*iedge)->wing1;
615 else if ((*iedge)->wing2->contour!=NULL) wingB = (*iedge)->wing2;
616 else continue; // 両方NULLをこちらが先に見つけた.→ 上のdeleteコードに任せる.
617
618 if (wingA->vertex==wingB->vertex) {
619 if (wingA->edge->wing1==wingA) wingA->edge->wing1 = wingB;
620 else if (wingA->edge->wing2==wingA) wingA->edge->wing2 = wingB;
621 if (wingB->edge->wing1==wingB) wingB->edge->wing1 = wingA;
622 else if (wingB->edge->wing2==wingB) wingB->edge->wing2 = wingA;
623
624 BREP_EDGE* sedge = wingB->edge;
625 wingB->edge = wingA->edge;
626 wingA->edge = sedge;
627 wingB->edge->complete = true;
628 wingA->edge->complete = false;
629 break;
630 }
631 }
632 }
633 }
634 CreateContoursList(solid);
635 CreateWingsList(solid);
636
637// DEBUG_MODE PRINT_MESG("End JoinShortageWings\n");
638 return;
639}
640
641
642
644//
645
652{
653 contour->dup_edge = 0;
654
655 BREP_WING* first = contour->wing;
656 if (first!=NULL) {
657 BREP_WING* next = first;
658 do {
659 BREP_WING* wing = next;
660 next = wing->next;
661 if (wing->edge->edge_list!=NULL) contour->dup_edge++;
662 } while(next!=first);
663 }
664 return contour->dup_edge;
665}
666
667
685{
686 BREP_SOLID* solid;
687 BREP_CONTOUR* contour;
688 BREP_VERTEX* vertex[3];
689
690 solid = facet->shell->solid;
691
692 // Vertex の生成
693 for (int i=0; i<3; i++) {
694 vertex[i] = new BREP_VERTEX();
695 vertex[i]->point = vect[i];
696 if (nrml!=NULL) {
697 vertex[i]->calc_normal = false;
698 vertex[i]->normal = nrml[i];
699 }
700 if (uvmp!=NULL) {
701 vertex[i]->uvmap = uvmp[i];
702 }
703 if (wght!=NULL) {
704 vertex[i]->weight.dup(wght[i]);
705 }
706 vertex[i]->CloseData();
707 }
708
709 // 同じ点がある.または3点が直線上にある.
710 if (vertex[0]==vertex[1] || vertex[1]==vertex[2] || vertex[0]==vertex[2]) return NULL;
711 if (IsForbiddenEdge(vertex)) return NULL;
712
713 // Vertexをソリッドの Octreeに登録
714 BREP_VERTEX* vert;
715 for (int i=0; i<3; i++) {
716 vert = AddVertex2Octree(vertex[i], solid->octree, dupli);
717 if (vert!=vertex[i]) {
718 delete vertex[i];
719 vertex[i] = vert;
720 }
721 }
722
723 contour = CreateContourByVertex(facet, vertex);
724
725 return contour;
726}
727
728
736{
737 // 同じ点がある.または3点が直線上にある.
738 if (vertex[0]==vertex[1] || vertex[1]==vertex[2] || vertex[0]==vertex[2]) return NULL;
739 if (IsForbiddenEdge(vertex)) return NULL;
740
741 BREP_CONTOUR* contour = new BREP_CONTOUR(facet);
742
743 // Wingを作る.
744 BREP_WING* wing = contour->CreateWing(vertex[0], vertex[1]);
745 if (wing!=NULL) wing = contour->CreateWing(vertex[1], vertex[2]);
746 if (wing!=NULL) wing = contour->CreateWing(vertex[2], vertex[0]);
747 if (wing!=NULL) {
748 contour->CloseData(); // 面の法線ベクトルを計算.
749 }
750 else {
751 delete(contour);
752 contour = NULL;
753 }
754
755 return contour;
756}
757
758
766{
767 BREP_EDGE* edge = wing->edge;
768 if (edge->complete) return true;
769 if (edge->edge_list!=NULL) {
770 BREP_EDGE_LIST::iterator iedge;
771 for (iedge=edge->edge_list->begin(); iedge!=edge->edge_list->end(); iedge++){
772 if ((*iedge)->complete) return true;
773 }
774 }
775 return false;
776}
777
778
788{
789 if (facet==NULL) return;
790 if (facet->shell!=NULL) {
791 facet->shell->facets.pop_back();
792 facet->shell = NULL;
793 }
794
795 // Destroy its contours
796 BREP_CONTOUR* bpcn;
797 BREP_CONTOUR_LIST::iterator contour = facet->outer_contours.begin();
798
799 while (contour!=facet->outer_contours.end()) {
800 bpcn = *contour;
801 contour = facet->outer_contours.erase(contour);
802 bpcn->facet = NULL;
803 delete (bpcn);
804 }
805 free(facet);
806
807 return;
808}
809
810
817{
818 if (edge->edge_list!=NULL) {
819 BREP_EDGE_LIST::iterator iedge;
820 for (iedge=edge->edge_list->begin(); iedge!=edge->edge_list->end(); iedge++){
821 if ((*iedge)->wing1->contour!=NULL) {
822 (*iedge)->wing1->contour->facet->deletable = true;
823 }
824 if ((*iedge)->wing2->contour!=NULL) {
825 (*iedge)->wing2->contour->facet->deletable = true;
826 }
827 }
828 }
829 else {
830 if (edge->wing1->contour!=NULL) {
831 edge->wing1->contour->facet->deletable = true;
832 }
833 if (edge->wing2->contour!=NULL) {
834 edge->wing2->contour->facet->deletable = true;
835 }
836 }
837}
838
839
840
841
843//
844
845/*
846int jbxl::IsAtLine(BREP_VERTEX** v)
847
8483点 *v[0], *v[1], *v[2] が一直線上にあるかどうかを調べる.
849
850@attention
851toleranceの計算は再考が必要か?
852*/
854{
855 TVector<double> vect = Vertex2TVector(v[0]);
856 TVector<double> vect1 = Vertex2TVector(v[1]);
857 TVector<double> vect2 = Vertex2TVector(v[2]) - vect;
858 TVector<double> vect3 = Vertex2TVector(v[2]) - vect1;
859 vect1 = vect1 - vect;
860
861 int mode = 0;
862 double tt;
863 double th = ProportionVector(vect2, vect1, tt);
864 tt = Max(tt, Zero_Eps);
865 if (th>1.-tt) mode = 1; // 0->1->2
866 else {
867 th = ProportionVector(vect1, vect2, tt);
868 tt = Max(tt, Zero_Eps);
869 if (th>1.-tt) mode = 2; // 0->2->1
870 else {
871 th = ProportionVector(vect3, vect2, tt);
872 tt = Max(tt, Zero_Eps);
873 if (th>1.-tt) mode = 3; // 1->0->2
874 }
875 }
876 return mode;
877}
878
879
887{
888 BREP_EDGE* edge = NULL;
889 int mode = IsAtLine(vert);
890 if (mode==1) { // 0->1->2
891 if (vert[0]->forbidden_list==NULL) vert[0]->forbidden_list = new BREP_VERTEX_LIST();
892 if (vert[2]->forbidden_list==NULL) vert[2]->forbidden_list = new BREP_VERTEX_LIST();
893 vert[0]->forbidden_list->push_back(vert[2]);
894 vert[2]->forbidden_list->push_back(vert[0]);
895 edge = FindEdge(vert[0], vert[2]);
896 }
897 else if (mode==2) { // 0->2->1
898 if (vert[0]->forbidden_list==NULL) vert[0]->forbidden_list = new BREP_VERTEX_LIST();
899 if (vert[1]->forbidden_list==NULL) vert[1]->forbidden_list = new BREP_VERTEX_LIST();
900 vert[0]->forbidden_list->push_back(vert[1]);
901 vert[1]->forbidden_list->push_back(vert[0]);
902 edge = FindEdge(vert[0], vert[1]);
903 }
904 else if (mode==3) { // 2->0->1
905 if (vert[1]->forbidden_list==NULL) vert[1]->forbidden_list = new BREP_VERTEX_LIST();
906 if (vert[2]->forbidden_list==NULL) vert[2]->forbidden_list = new BREP_VERTEX_LIST();
907 vert[1]->forbidden_list->push_back(vert[2]);
908 vert[2]->forbidden_list->push_back(vert[1]);
909 edge = FindEdge(vert[1], vert[2]);
910 }
911 if (edge!=NULL) SetDeletableContoursByEdge(edge);
912
913 if (mode==0) return false;
914 return true;
915}
916
917
918
920//
921
931{
932 *collision = NULL;
933
934 BREP_CONTOUR_LIST::iterator icon;
935 for (icon=solid->contours.begin(); icon!=solid->contours.end(); icon++){
936 if (!disJunctBounds(contour->facet->rbound, (*icon)->facet->rbound)) {
937 if (!(*icon)->facet->deletable || (*icon)->facet->notdelete) {
938 int svrtx = CommonVertex(*icon, contour);
939 if (svrtx==3) {
940 *collision = *icon;
941 return true;
942 }
943
944 int lineno;
945 if (SamePlaneContour(*icon, contour, lineno)) {
946 // 3角形の内部点
947 if (!contour->hasCollisionVector) contour->ComputeDirectRS();
948 if (IsInTriangle(*icon, contour)) {
949 *collision = *icon;
950 return true;
951 }
952 if (!(*icon)->hasCollisionVector) (*icon)->ComputeDirectRS();
953 if (IsInTriangle(contour, *icon)) {
954 *collision = *icon;
955 return true;
956 }
957
958 // 2D衝突検査
959 if (CollisionTriContour2D(*icon, contour)) {
960 *collision = *icon;
961 return true;
962 }
963 }
964 else {
965 if (lineno==1) continue;
966 // 3D衝突検査
967 if (!contour->hasCollisionVector) contour->ComputeDirectRS();
968 if (CollisionTriContour3D(*icon, contour)) {
969 *collision = *icon;
970 return true;
971 }
972 if (!(*icon)->hasCollisionVector) (*icon)->ComputeDirectRS();
973 if (CollisionTriContour3D(contour, *icon)) {
974 *collision = *icon;
975 return true;
976 }
977 }
978 }
979 }
980 }
981 return false;
982}
983
984
992{
993 double tc, uc, vc, tm, um, ut, vt, tt, tmt, umt;
994 BREP_WING* wing = contour1->wing;
995 TVector<double> directR = contour2->directR;
996 TVector<double> directS = contour2->directS;
997 TVector<double> directRS = contour2->directRS;
998 TVector<double> directT;
999 TVector<double> directB;
1000 TVector<double> directQB;
1001 TVector<double> directN;
1002
1003 // 各辺による衝突検出
1004 for (int i=0; i<3; i++) {
1005 TVector<double> point = Vertex2TVector(wing->vertex);
1006 TVector<double> directQ = Vertex2TVector(contour2->wing->vertex) - point;
1007
1008 for (int j=0; j<2; j++) {
1009 directN = Vertex2TVector(wing->next->vertex);
1010 if (j==0) directB = directN - point;
1011 else directB = directB + (Vertex2TVector(wing->next->next->vertex) - directN)*0.5;
1012 directQB = directQ^directB;
1013
1014 um = directRS*directB;
1015 tm = directQB*directS;
1016 umt = TVectorMultiTolerance(directRS, directB);
1017 tmt = TVectorMultiTolerance(directQB, directS);
1018
1019 if (Xabs(um)>Max(umt, Zero_Eps) && Xabs(tm)>Max(tmt, Zero_Eps)) {
1020 uc = tm;
1021 tc = -directQB*directR;
1022 vc = directRS*directQ;
1023 ut = tmt;
1024 tt = TVectorMultiTolerance(directQB, directR);
1025 vt = TVectorMultiTolerance(directRS, directQ);
1026
1027 ut = Max(Collision_Tolerance, (um*ut+umt*uc)/(um*um));
1028 tt = Max(Collision_Tolerance, (tm*tt+tmt*tc)/(tm*tm));
1029 vt = Max(Collision_Tolerance, (um*vt+umt*vc)/(um*um));
1030 uc = uc/um;
1031 tc = tc/tm;
1032 vc = vc/um;
1033 directT = directR + tc*directS;
1034
1035 if (uc>ut && 1.-uc>ut && tc>tt && 1.-tc>tt && vc>vt && 1.-vc>vt &&
1036 uc*directT.n>directT.t && (1.-uc)*directT.n>directT.t &&
1037 tc*directS.n>directS.t && (1.-tc)*directS.n>directS.t &&
1038 vc*directB.n>directB.t && (1.-vc)*directB.n>directB.t) {
1039 // DEBUG_MODE PRINT_MESG("3D衝突 %d !!!! %e %e %e\n", j+1, uc, tc, vc);
1040 // PrintFacetAsciiSTL(contour1);
1041 // PrintFacetAsciiSTL(contour2);
1042 return true;
1043 }
1044 }
1045 }
1046 wing = wing->next;
1047 }
1048
1049 return false;
1050}
1051
1052
1054{
1055 double uc, vc, tm, um, ut, vt, tmt, umt;
1056 BREP_WING* wing = contour1->wing;
1057 TVector<double> directR = contour2->directR;
1058 TVector<double> directS = contour2->directS;
1059 TVector<double> directRS = contour2->directRS;
1060
1061 wing = contour1->wing;
1062 for (int i=0; i<3; i++) {
1063 TVector<double> point = Vertex2TVector(wing->vertex);
1064 TVector<double> directB = Vertex2TVector(wing->next->vertex) - point;
1065 TVector<double> directQ = Vertex2TVector(contour2->wing->vertex) - point;
1066 TVector<double> directQB = directQ^directB;
1067 directB.norm();
1068
1069 tm = directQB*directS;
1070 um = directRS*directB;
1071 tmt = TVectorMultiTolerance(directQB, directS);
1072 umt = TVectorMultiTolerance(directRS, directB);
1073
1074 if (Xabs(tm)<=Max(tmt, Zero_Eps) || Xabs(um)<=Max(umt, Zero_Eps)) {
1075 TVector<double> directBR = directB^directR;
1076 TVector<double> directQR = directQ^directR;
1077 TVector<double> directQB = directQ^directB;
1078 uc = ProportionVector(directQB, directBR, ut);
1079 vc = ProportionVector(directQR, directBR, vt);
1080 ut = Max(ut, Collision_Tolerance);
1081 vt = Max(vt, Collision_Tolerance);
1082 if (uc>ut && 1.-uc>ut && vc>vt && 1.-vc>vt &&
1083 uc*directR.n>directR.t && (1.-uc)*directR.n>directR.t &&
1084 vc*directB.n>directB.t && (1.-vc)*directB.n>directB.t) {
1085 // DEBUG_MODE PRINT_MESG("同一平面上1 %e %e %e %e\n", uc, vc, ut, vt);
1086 // PrintFacetAsciiSTL(contour1);
1087 // PrintFacetAsciiSTL(contour2);
1088 return true;
1089 }
1090
1091 directBR = directB^directS;
1092 directQR = (directQ+directR)^directS;
1093 directQB = (directQ+directR)^directB;
1094 uc = ProportionVector(directQB, directBR, ut);
1095 vc = ProportionVector(directQR, directBR, vt);
1096 ut = Max(ut, Collision_Tolerance);
1097 vt = Max(vt, Collision_Tolerance);
1098 if (uc>ut && 1.-uc>ut && vc>vt && 1.-vc>vt &&
1099 uc*directS.n>directS.t && (1.-uc)*directS.n>directS.t &&
1100 vc*directB.n>directB.t && (1.-vc)*directB.n>directB.t) {
1101// DEBUG_MODE PRINT_MESG("同一平面上2 %e %e %e %e\n", uc, vc, ut, vt);
1102// PrintFacetAsciiSTL(contour1);
1103// PrintFacetAsciiSTL(contour2);
1104 return true;
1105 }
1106
1107 TVector<double> directT = directR + directS;
1108 directBR = directB^directT;
1109 directQR = directQ^directT;
1110 directQB = directQ^directB;
1111 uc = ProportionVector(directQB, directBR, ut);
1112 vc = ProportionVector(directQR, directBR, vt);
1113 ut = Max(ut, Collision_Tolerance);
1114 vt = Max(vt, Collision_Tolerance);
1115 if (uc>ut && 1.-uc>ut && vc>vt && 1.-vc>vt &&
1116 uc*directT.n>directT.t && (1.-uc)*directT.n>directT.t &&
1117 vc*directB.n>directB.t && (1.-vc)*directB.n>directB.t) {
1118// DEBUG_MODE PRINT_MESG("同一平面上3 %e %e %e %e\n", uc, vc, ut, vt);
1119// PrintFacetAsciiSTL(contour1);
1120// PrintFacetAsciiSTL(contour2);
1121 return true;
1122 }
1123 }
1124
1125 wing = wing->next;
1126 }
1127
1128 return false;
1129}
1130
1131
1133{
1134 double tc, uc, tt, ut;
1135 TVector<double> directS = contour2->directS;
1136 TVector<double> directRS = contour2->directRS;
1137 TVector<double> directQ, directT, directN;
1138 BREP_WING* wing = contour1->wing;
1139
1140 for (int i=0; i<3; i++) {
1141 for (int j=0; j<2; j++) {
1142 directN = Vertex2TVector(wing->vertex);
1143 if (j==0) directQ = Vertex2TVector(contour2->wing->vertex) - directN;
1144 else directQ = directQ - (Vertex2TVector(wing->next->vertex) - directN)*0.5;
1145
1146 TVector<double> directSQ = directS^directQ;
1147 TVector<double> directQR = directQ^contour2->directR;
1148 tc = ProportionVector(directQR, directSQ, tt);
1149 uc = ProportionVector(directSQ, directRS, ut);
1150 directT = contour2->directR + tc*directS;
1151 ut = Max(ut, Collision_Tolerance);
1152 tt = Max(tt, Collision_Tolerance);
1153 if (tc>tt && 1.-tc>tt && uc>ut && 1.-uc>ut &&
1154 tc*directS.n>directS.t && (1.-tc)*directS.n>directS.t &&
1155 uc*directT.n>directT.t && (1.-uc)*directT.n>directT.t) {
1156// DEBUG_MODE PRINT_MESG("三角形の内部 %d : %e %e %e %e\n", j+1, tc, uc, tt, ut);
1157 //PrintFacetAsciiSTL(contour1);
1158 //PrintFacetAsciiSTL(contour2);
1159 return true;
1160 }
1161 }
1162 }
1163 return false;
1164}
1165
1166
1167DllExport bool jbxl::SamePlaneContour(BREP_CONTOUR* contour1, BREP_CONTOUR* contour2, int& lineno)
1168{
1169 double um, umt, tm, tmt;
1170 BREP_WING* wing = contour1->wing;
1171 TVector<double> directB, directQ;
1172
1173 lineno = 0;
1174 for (int i=0; i<3; i++) {
1175 directB = Vertex2TVector(wing->next->vertex) - Vertex2TVector(wing->vertex);
1176 directQ = Vertex2TVector(contour2->wing->vertex) - Vertex2TVector(wing->vertex);
1177 um = contour2->directRS*directB;
1178 tm = contour2->directRS*directQ;
1179 umt = TVectorMultiTolerance(contour2->directRS, directB);
1180 tmt = TVectorMultiTolerance(contour2->directRS, directQ);
1181 if (Xabs(um)<Max(umt, Zero_Eps) && Xabs(tm)<Max(tmt, Zero_Eps)) {
1182 lineno++;
1183 }
1184 }
1185
1186 if (lineno>=2) return true;
1187 return false;
1188}
1189
1190
1192{
1193 BREP_VERTEX_LIST vertex_list;
1194
1195 int cnt = 0;
1196 BREP_WING* wing1 = contour1->wing;
1197 for (int i=0; i<3; i++) {
1198 bool common = false;
1199 BREP_WING* wing2 = contour2->wing;
1200 for (int j=0; j<3; j++) {
1201 if (wing1->vertex==wing2->vertex) {
1202 cnt++;
1203 common = true;
1204 break;
1205 }
1206 wing2 = wing2->next;
1207 }
1208 if (!common) vertex_list.push_back(wing1->vertex);
1209 wing1 = wing1->next;
1210 }
1211 return cnt;
1212}
1213
1214
1230DllExport int jbxl::CreateTriSolidFromSTL(BREP_SOLID* solid, STLData* stldata, int fno, bool check)
1231{
1232 BREP_SHELL* shell;
1233 BREP_FACET* facet;
1234 BREP_CONTOUR* contour;
1235 CVCounter* counter = NULL;
1236 Vector<double> v[4];
1237
1238 if (solid==NULL || stldata==NULL) return -1;
1239 if (solid->octree==NULL) return -1;
1240
1241 solid->contours.clear();
1242
1243 // カウンタ
1244 int intvl = 1;
1245 if (solid->counter!=NULL) {
1246 counter = solid->counter->GetUsableCounter();
1247 if (counter!=NULL) {
1248 counter->SetMax(100);
1249 counter->ResetRate(80, 100);
1250 intvl = Max(1, fno/100);
1251 }
1252 }
1253
1254 shell = new BREP_SHELL(solid);
1255 for (int i=0; i<fno; i++) {
1256 // 読み込んだ STLデータを作業用Vector変数に格納
1257 v[0].x = stldata[i].vect[3]; v[0].y = stldata[i].vect[4]; v[0].z = stldata[i].vect[5];
1258 v[1].x = stldata[i].vect[6]; v[1].y = stldata[i].vect[7]; v[1].z = stldata[i].vect[8];
1259 v[2].x = stldata[i].vect[9]; v[2].y = stldata[i].vect[10]; v[2].z = stldata[i].vect[11];
1260 // ここでは法線ベクトルは 再計算させる.
1261
1262 facet = new BREP_FACET(shell);
1263 contour = CreateContourByVector(facet, v, NULL, NULL, NULL, false);
1264 if (contour!=NULL) {
1265/*
1266 if (check) {
1267 // 衝突判定
1268 BREP_CONTOUR* collision;
1269 facet->CloseData();
1270 if (!IsCollisionContours(solid, contour, &collision)) {
1271 solid->contours.push_back(contour); // IsCollisionContours()用
1272 }
1273 else {
1274 collision->facet->deletable = true; // 衝突相手も消す.
1275 FastDeleteFacet(facet);
1276 }
1277 }
1278 else solid->contours.push_back(contour);
1279*/
1280 solid->contours.push_back(contour);
1281 }
1282 else {
1283 deleteNull(facet); // 中身は空
1284 }
1285
1286 if (counter!=NULL && i%intvl==0) {
1287 counter->StepIt();
1288 if (counter->isCanceled()) {
1289 deleteNull(facet);
1290 return -3;
1291 }
1292 }
1293 }
1294 if (counter!=NULL) counter->PutFill();
1295
1296 //
1297 fno = CloseTriSolid(solid, check, counter);
1298
1299 return fno;
1300}
1301
1302
1321DllExport int jbxl::CreateTriSolidFromVector(BREP_SOLID* solid, int vno, Vector<double>* vect, Vector<double>* nrml, UVMap<double>* uvmp, ArrayParam<int>* wght, bool dupli, bool check)
1322{
1323 BREP_SHELL* shell;
1324 BREP_FACET* facet;
1325 BREP_CONTOUR* contour;
1326 CVCounter* counter = NULL;
1327 int fno = vno/3;
1328
1329 if (solid==NULL || vect==NULL) return -1;
1330 if (solid->octree==NULL) return -1;
1331
1332 solid->contours.clear();
1333
1334 // カウンタ
1335 int intvl = 1;
1336 if (solid->counter!=NULL) {
1337 counter = solid->counter->GetUsableCounter();
1338 if (counter!=NULL) {
1339 counter->SetMax(100);
1340 counter->ResetRate(80, 100);
1341 intvl = Max(1, fno/100);
1342 }
1343 }
1344
1345 Vector<double>* normal = NULL;
1346 UVMap<double>* uvmap = NULL;
1347 ArrayParam<int>* weight = NULL;
1348 shell = new BREP_SHELL(solid);
1349 //
1350 for (int i=0; i<fno; i++) {
1351 facet = new BREP_FACET(shell);
1352 if (nrml!=NULL) normal = nrml + i*3;
1353 if (uvmp!=NULL) uvmap = uvmp + i*3;
1354 if (wght!=NULL) weight = wght + i*3;
1355 contour = CreateContourByVector(facet, vect + i*3, normal, uvmap, weight, dupli);
1356
1357 if (contour!=NULL) {
1358/*
1359 if (check) {
1360 // 衝突判定.
1361 BREP_CONTOUR* collision;
1362 facet->CloseData();
1363 if (!IsCollisionContours(solid, contour, &collision)) {
1364 solid->contours.push_back(contour); // IsCollisionContours()用
1365 }
1366 else {
1367 collision->facet->deletable = true; // 衝突相手も消す.
1368 FastDeleteFacet(facet);
1369 }
1370 }
1371 else solid->contours.push_back(contour);
1372*/
1373 solid->contours.push_back(contour);
1374 }
1375 else {
1376 deleteNull(facet); // 中身は空
1377 }
1378
1379 if (counter!=NULL && i%intvl==0) {
1380 counter->StepIt();
1381 if (counter->isCanceled()) {
1382 deleteNull(facet);
1383 return -3;
1384 }
1385 }
1386 }
1387 if (counter!=NULL) counter->PutFill();
1388
1389 //
1390 fno = CloseTriSolid(solid, check, counter);
1391
1392 return fno;
1393}
1394
1395
1413{
1414 BREP_FACET* facet;
1415 BREP_CONTOUR* contour;
1416
1417 if (solid==NULL || shell==NULL || vect==NULL) return;
1418 if (solid->octree==NULL) return;
1419
1420 facet = new BREP_FACET(shell);
1421 contour = CreateContourByVector(facet, vect, nrml, uvmp, wght, dupli);
1422 if (contour!=NULL) {
1423/*
1424 if (check) {
1425 // 衝突判定
1426 BREP_CONTOUR* collision;
1427 facet->CloseData();
1428 if (!IsCollisionContours(solid, contour, &collision)) {
1429 solid->contours.push_back(contour); // IsCollisionContours()用
1430 }
1431 else {
1432 collision->facet->deletable = true; // 衝突相手も消す.
1433 FastDeleteFacet(facet);
1434 }
1435 }
1436 else solid->contours.push_back(contour);
1437*/
1438 solid->contours.push_back(contour);
1439 }
1440 else {
1441 deleteNull(facet);
1442 }
1443
1444 return;
1445}
1446
1447
1459DllExport int jbxl::CloseTriSolid(BREP_SOLID* solid, bool check, CVCounter* counter)
1460{
1461 if (solid==NULL) return -1;
1462
1463 // deletableになっているContourがあるかもしれないので,CreateContoursList()で作り直し.
1464 CreateContoursList(solid);
1465 CreateWingsList(solid);
1466
1467 if (check) {
1468 // 多重Edgeの削除
1470 if (counter!=NULL) counter->MakeChildCounter(10);
1471 DeleteSurplusContours(solid);
1472 if (counter!=NULL) counter->DeleteChildCounter();
1473 // 直線に並んだ Edgeの削除
1475 if (counter!=NULL) counter->MakeChildCounter(10);
1476 DeleteStraightEdges(solid);
1477 if (counter!=NULL) counter->DeleteChildCounter();
1478 }
1479
1480 CreateSurplusContoursList(solid); // 作り直し
1482 solid->vcount = 3; // for Triangle Facet
1483 solid->CloseData(); // Close Octree
1484 //
1485 return (int)solid->contours.size();
1486}
1487
1488
1490{
1491 if (GetWingOtherSide(wing1)->vertex==wing2->vertex) return true;
1492 return false;
1493}
#define JBXL_BREP_MAX_LOOPCNT
Definition TriBrep.cpp:274
#define JBXL_BREP_MAX_QUEUESIZE
Definition TriBrep.cpp:365
三角Contour(Facet)用ライブラリ ヘッダ for BREP
void dup(ArrayParam< T > a, bool del=true)
Definition tools++.h:138
void ComputeDirectRS()
Definition Brep.cpp:479
int dup_edge
多重エッジの数.
Definition Brep.h:181
TVector< double > directRS
Definition Brep.h:179
BREP_FACET * facet
Definition Brep.h:170
BREP_WING * wing
Definition Brep.h:171
BREP_WING * CreateWing(BREP_VERTEX *vertex1, BREP_VERTEX *vertex2)
Definition Brep.cpp:387
TVector< double > directS
Definition Brep.h:178
TVector< double > directR
△QRS 三角Contour衝突検出用
Definition Brep.h:177
bool hasCollisionVector
Definition Brep.h:183
BREP_EDGE_LIST * edge_list
多重エッジのリストへのポインタ
Definition Brep.h:237
BREP_WING * wing2
Definition Brep.h:234
BREP_WING * wing1
Definition Brep.h:233
bool complete
完全なエッジ.2つの Wingは共に使用されている.
Definition Brep.h:239
BREP_SHELL * shell
Definition Brep.h:138
void CloseData()
Definition Brep.cpp:240
BREP_CONTOUR_LIST outer_contours
Definition Brep.h:139
RBound< double > rbound
Definition Brep.h:142
bool deletable
削除できる
Definition Brep.h:147
BREP_SOLID * solid
Definition Brep.h:116
BREP_FACET_LIST facets
Definition Brep.h:117
OctreeNode * octree
Definition Brep.h:80
void CloseData(void)
Definition Brep.cpp:92
BREP_CONTOUR_LIST contours
Contours リスト
Definition Brep.h:83
CVCounter * counter
仮想計量カウンタ
Definition Brep.h:90
unsigned int facetno
面の数
Definition Brep.h:74
int vcount
1面あたりの頂点数
Definition Brep.h:77
BREP_WING_LIST wings
Wings リスト
Definition Brep.h:84
BREP_WING_LIST shortage_wings
不足 Wings リスト
Definition Brep.h:87
BREP_CONTOUR_LIST surplus_contours
過剰 Contours リスト
Definition Brep.h:86
BREP_SHELL_LIST shells
Definition Brep.h:79
bool calc_normal
normal を計算するか? しない場合は入力値を使用する.
Definition Brep.h:267
void CloseData()
Definition Brep.cpp:647
Vector< double > point
頂点の座標.
Definition Brep.h:260
double distance2
Definition Brep.h:269
Vector< double > normal
法線ベクトル.周りの Contour の法線ベクトルの平均.
Definition Brep.h:261
BREP_WING_LIST wing_list
Definition Brep.h:258
ArrayParam< int > weight
頂点の重み.要正規化.
Definition Brep.h:263
BREP_VERTEX_LIST * forbidden_list
お互いに Edgeを張ることを禁止された Vertexの List
Definition Brep.h:272
UVMap< double > uvmap
曲面のUV座標
Definition Brep.h:262
BREP_CONTOUR * contour
Definition Brep.h:215
BREP_WING * next
Definition Brep.h:212
BREP_VERTEX * vertex
Start of Vertex.
Definition Brep.h:210
BREP_EDGE * edge
Definition Brep.h:214
BREP_WING * prev
Definition Brep.h:211
virtual void StepIt(int n=1)
カウンタのメモリを増やす
Definition ClassBox.h:171
virtual void SetMax(int m)
カウンタの最大値(最終目標)を設定
Definition ClassBox.h:161
virtual void DeleteChildCounter()
子カウンタの削除(有効領域の無効化)
Definition ClassBox.h:179
virtual void ResetRate(int n, int m)
nの目盛り幅を mで読み替える.ここでの定義はあまり意味は無い.
Definition ClassBox.h:174
virtual CVCounter * GetUsableCounter()
現在使用可能な目盛りの有効領域を確保
Definition ClassBox.h:177
virtual CVCounter * MakeChildCounter(int n)
子カウンタの作成(有効領域を再定義)
Definition ClassBox.h:178
virtual void PutFill()
取り敢えずの目標(最短目標)までカウンタを進める.
Definition ClassBox.h:164
virtual bool isCanceled()
カウンタがオペレータにより,キャンセルされたか
Definition ClassBox.h:173
T t
トレランス.誤差.
Definition TVector.h:29
T norm2(void)
Definition Vector.h:70
double norm(void)
Definition Vector.h:71
double n
ノルム
Definition Vector.h:62
#define Max(x, y)
Definition common.h:247
#define Xabs(x)
Definition common.h:257
#define DllExport
Definition common.h:105
Definition Brep.h:29
DllExport BREP_WING * GetWingOtherSide(BREP_WING *wing)
Definition Brep.cpp:1028
DllExport BREP_EDGE * FindEdge(BREP_VERTEX *vertex1, BREP_VERTEX *vertex2)
Definition Brep.cpp:889
DllExport void CreateSurplusContoursList(BREP_SOLID *solid)
Definition TriBrep.cpp:84
bool disJunctBounds(RBound< T > b1, RBound< T > b2)
Definition Vector.h:580
double Collision_Tolerance
衝突判定用トレランス
Definition Tolerance.cpp:22
double ProportionVector(TVector< T > v1, TVector< T > v2, T &t)
Definition TVector.h:62
DllExport int IsAtLine(BREP_VERTEX **v)
Definition TriBrep.cpp:853
T TVectorMultiTolerance(TVector< T > a, TVector< T > b)
内積の誤差
Definition TVector.h:183
DllExport void CreateShortageWingsList(BREP_SOLID *solid)
Definition TriBrep.cpp:105
std::list< BREP_EDGE * > BREP_EDGE_LIST
Definition Brep.h:45
DllExport TVector< double > Vertex2TVector(BREP_VERTEX *v)
Definition Brep.cpp:1036
DllExport void AddVector2TriSolid(BREP_SOLID *solid, BREP_SHELL *shell, Vector< double > *v, Vector< double > *n=NULL, UVMap< double > *uv=NULL, ArrayParam< int > *w=NULL, bool dupli=false)
Definition TriBrep.cpp:1412
DllExport bool PatchupContour(BREP_SHELL *shell, BREP_VERTEX **vert, bool mode)
Definition TriBrep.cpp:487
DllExport int FillShortageWings_Next(BREP_SOLID *solid, bool mode)
Definition TriBrep.cpp:337
double Zero_Eps
1に対して 0とするトレランス
Definition Tolerance.cpp:26
DllExport void DeleteShortageWings(BREP_SOLID *solid)
Definition TriBrep.cpp:250
DllExport void FastDeleteFacet(BREP_FACET *facet)
Definition TriBrep.cpp:787
DllExport int CloseTriSolid(BREP_SOLID *solid, bool check=true, CVCounter *counter=NULL)
Definition TriBrep.cpp:1459
class DllExport BREP_CONTOUR
Definition Brep.h:35
std::list< BREP_VERTEX * > BREP_VERTEX_LIST
Definition Brep.h:47
DllExport bool SamePlaneContour(BREP_CONTOUR *contour1, BREP_CONTOUR *contour2, int &lineno)
Definition TriBrep.cpp:1167
DllExport void CreateWingsList(BREP_SOLID *solid)
Definition TriBrep.cpp:58
DllExport int DupEdgeNumber(BREP_CONTOUR *contour)
Definition TriBrep.cpp:651
class DllExport BREP_FACET
Definition Brep.h:34
class DllExport BREP_SHELL
Definition Brep.h:33
DllExport bool IsCollisionContours(BREP_SOLID *solid, BREP_CONTOUR *contour, BREP_CONTOUR **collision)
Definition TriBrep.cpp:930
DllExport void DeleteStraightEdges(BREP_SOLID *solid)
Definition TriBrep.cpp:210
DllExport void SetDeletableContoursByEdge(BREP_EDGE *edge)
Definition TriBrep.cpp:816
DllExport BREP_CONTOUR * CreateContourByVector(BREP_FACET *facet, Vector< double > *v, Vector< double > *n=NULL, UVMap< double > *uv=NULL, ArrayParam< int > *w=NULL, bool dupli=false)
Definition TriBrep.cpp:684
DllExport void ReverseContours(BREP_SOLID *solid)
Definition TriBrep.cpp:530
std::list< BREP_SHELL * > BREP_SHELL_LIST
Definition Brep.h:42
DllExport void FillShortageWings(BREP_SOLID *solid, int method, bool mode)
Definition TriBrep.cpp:292
DllExport void CreateContoursList(BREP_SOLID *solid)
Definition TriBrep.cpp:22
DllExport int CreateTriSolidFromVector(BREP_SOLID *solid, int vno, Vector< double > *v, Vector< double > *n=NULL, UVMap< double > *uv=NULL, ArrayParam< int > *w=NULL, bool dupli=false, bool check=true)
Definition TriBrep.cpp:1321
DllExport bool IsInTriangle(BREP_CONTOUR *contour1, BREP_CONTOUR *contour2)
Definition TriBrep.cpp:1132
DllExport int FillShortageWings_Near(BREP_SOLID *solid, bool mode)
Definition TriBrep.cpp:383
DllExport void SetMinVertex(BREP_VERTEX_LIST *list, BREP_VERTEX *vrtx)
Definition TriBrep.cpp:445
DllExport bool CollisionTriContour2D(BREP_CONTOUR *contour1, BREP_CONTOUR *contour2)
Definition TriBrep.cpp:1053
DllExport void JoinShortageWings(BREP_SOLID *solid)
Definition TriBrep.cpp:592
DllExport bool IsConnectEdges(BREP_WING *wing1, BREP_WING *wing2)
Definition TriBrep.cpp:1489
DllExport int CommonVertex(BREP_CONTOUR *contour1, BREP_CONTOUR *contour2)
Definition TriBrep.cpp:1191
DllExport bool IsIncludeCompleteEdge(BREP_WING *wing)
Definition TriBrep.cpp:765
DllExport BREP_VERTEX * FindConnectEdgeVertex(BREP_VERTEX *vert)
Definition TriBrep.cpp:465
DllExport BREP_CONTOUR * CreateContourByVertex(BREP_FACET *facet, BREP_VERTEX **vtx)
Definition TriBrep.cpp:735
DllExport BREP_VERTEX * AddVertex2Octree(BREP_VERTEX *vertex, OctreeNode *octree, bool dupli=false)
Definition Brep.cpp:971
DllExport bool IsForbiddenEdge(BREP_VERTEX **vert)
Definition TriBrep.cpp:886
DllExport int CreateTriSolidFromSTL(BREP_SOLID *solid, STLData *stldata, int fno, bool check=true)
Definition TriBrep.cpp:1230
DllExport bool CollisionTriContour3D(BREP_CONTOUR *contour1, BREP_CONTOUR *contour2)
Definition TriBrep.cpp:991
class DllExport BREP_VERTEX
Definition Brep.h:38
DllExport void DeleteSurplusContours(BREP_SOLID *solid)
Definition TriBrep.cpp:140
void deleteNull(T &p)
Definition common++.h:39
float vect[12]
Definition STL.h:32