27 BREP_SHELL_LIST::iterator ishell;
28 for (ishell=shells.begin(); ishell!=shells.end(); ishell++){
30 BREP_FACET_LIST::iterator ifacet;
31 for (ifacet =(*ishell)->facets.begin(); ifacet!=(*ishell)->facets.end(); ifacet++){
32 if ((*ifacet)->deletable && !(*ifacet)->notdelete) {
34 ifacet = (*ishell)->facets.erase(ifacet);
40 BREP_CONTOUR_LIST::iterator icon;
41 for (icon=(*ifacet)->outer_contours.begin(); icon!=(*ifacet)->outer_contours.end(); icon++) {
42 (*ifacet)->deletable =
false;
62 BREP_CONTOUR_LIST::iterator icon;
70 solid->
wings.push_back(wing);
89 BREP_CONTOUR_LIST::iterator icon;
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);
149 BREP_CONTOUR_LIST::iterator icon;
152 if ((*icon)->dup_edge==3) (*icon)->facet->deletable =
true;
153 if (counter!=NULL) counter->
StepIt();
167 if ((*icon)->dup_edge==2) (*icon)->facet->deletable =
true;
168 if (counter!=NULL) counter->
StepIt();
182 if ((*icon)->dup_edge==1) (*icon)->facet->deletable =
true;
183 if (counter!=NULL) counter->
StepIt();
219 BREP_WING_LIST::iterator wing1;
222 vert[0] = (*wing1)->vertex;
223 BREP_WING_LIST::iterator wing2;
226 vert[1] = (*wing2)->vertex;
231 if (counter!=NULL) counter->
StepIt();
259 BREP_WING_LIST::iterator iwing;
261 if ((*iwing)->contour!=NULL) (*iwing)->contour->facet->deletable =
true;
264 if (counter!=NULL) counter->
StepIt();
274#define JBXL_BREP_MAX_LOOPCNT 20
300 if (counter!=NULL) counter->
SetMax(wmax);
341 BREP_WING_LIST::iterator wing1;
346 vert[0] = (*wing1)->vertex;
347 BREP_WING_LIST::iterator wing2;
350 vert[1] = (*wing2)->vertex;
365#define JBXL_BREP_MAX_QUEUESIZE 1
388 BREP_WING_LIST::iterator wing1;
392 vert[0] = (*wing1)->vertex;
397 BREP_WING_LIST::iterator wing2;
401 if (vrtx!=vert[0] && vrtx!=vert[1]) {
420 BREP_VERTEX_LIST::iterator ivert;
421 for (ivert=vertex_list.begin(); ivert!=vertex_list.end(); ivert++){
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);
455 if (ivert==list->end()) list->push_back(vrtx);
467 BREP_WING_LIST::iterator iwing;
469 if ((*iwing)->contour==NULL) {
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;
508 if (counter!=NULL) counter->
StepIt();
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++){
539 if ((*ifacet)->deletable && !(*ifacet)->notdelete) {
544 BREP_CONTOUR_LIST::iterator icon;
545 for (icon=(*ifacet)->outer_contours.begin(); icon!=(*ifacet)->outer_contours.end(); icon++) {
547 for (
int i=0; i<3; i++) {
555 ifacet = (*ishell)->facets.erase(ifacet);
597 BREP_WING_LIST::iterator iwing;
602 delete (wingA->
edge);
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;
614 if ((*iedge)->wing1->contour!=NULL) wingB = (*iedge)->wing1;
615 else if ((*iedge)->wing2->contour!=NULL) wingB = (*iedge)->wing2;
662 }
while(next!=first);
693 for (
int i=0; i<3; i++) {
695 vertex[i]->
point = vect[i];
698 vertex[i]->
normal = nrml[i];
701 vertex[i]->
uvmap = uvmp[i];
710 if (vertex[0]==vertex[1] || vertex[1]==vertex[2] || vertex[0]==vertex[2])
return NULL;
715 for (
int i=0; i<3; i++) {
717 if (vert!=vertex[i]) {
738 if (vertex[0]==vertex[1] || vertex[1]==vertex[2] || vertex[0]==vertex[2])
return NULL;
745 if (wing!=NULL) wing = contour->
CreateWing(vertex[1], vertex[2]);
746 if (wing!=NULL) wing = contour->
CreateWing(vertex[2], vertex[0]);
770 BREP_EDGE_LIST::iterator iedge;
772 if ((*iedge)->complete)
return true;
789 if (facet==NULL)
return;
790 if (facet->
shell!=NULL) {
797 BREP_CONTOUR_LIST::iterator contour = facet->
outer_contours.begin();
819 BREP_EDGE_LIST::iterator iedge;
821 if ((*iedge)->wing1->contour!=NULL) {
822 (*iedge)->wing1->contour->facet->deletable =
true;
824 if ((*iedge)->wing2->contour!=NULL) {
825 (*iedge)->wing2->contour->facet->deletable =
true;
859 vect1 = vect1 - vect;
865 if (th>1.-tt) mode = 1;
869 if (th>1.-tt) mode = 2;
873 if (th>1.-tt) mode = 3;
913 if (mode==0)
return false;
934 BREP_CONTOUR_LIST::iterator icon;
937 if (!(*icon)->facet->deletable || (*icon)->facet->notdelete) {
965 if (lineno==1)
continue;
993 double tc, uc, vc, tm, um, ut, vt, tt, tmt, umt;
1004 for (
int i=0; i<3; i++) {
1008 for (
int j=0; j<2; j++) {
1010 if (j==0) directB = directN - point;
1012 directQB = directQ^directB;
1014 um = directRS*directB;
1015 tm = directQB*directS;
1021 tc = -directQB*directR;
1022 vc = directRS*directQ;
1033 directT = directR + tc*directS;
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) {
1055 double uc, vc, tm, um, ut, vt, tmt, umt;
1061 wing = contour1->
wing;
1062 for (
int i=0; i<3; i++) {
1069 tm = directQB*directS;
1070 um = directRS*directB;
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) {
1091 directBR = directB^directS;
1092 directQR = (directQ+directR)^directS;
1093 directQB = (directQ+directR)^directB;
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) {
1108 directBR = directB^directT;
1109 directQR = directQ^directT;
1110 directQB = directQ^directB;
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) {
1134 double tc, uc, tt, ut;
1140 for (
int i=0; i<3; i++) {
1141 for (
int j=0; j<2; j++) {
1150 directT = contour2->
directR + tc*directS;
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) {
1169 double um, umt, tm, tmt;
1174 for (
int i=0; i<3; i++) {
1186 if (lineno>=2)
return true;
1197 for (
int i=0; i<3; i++) {
1198 bool common =
false;
1200 for (
int j=0; j<3; j++) {
1206 wing2 = wing2->
next;
1208 if (!common) vertex_list.push_back(wing1->
vertex);
1209 wing1 = wing1->
next;
1238 if (solid==NULL || stldata==NULL)
return -1;
1239 if (solid->
octree==NULL)
return -1;
1247 if (counter!=NULL) {
1250 intvl =
Max(1, fno/100);
1255 for (
int i=0; i<fno; i++) {
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];
1264 if (contour!=NULL) {
1280 solid->
contours.push_back(contour);
1286 if (counter!=NULL && i%intvl==0) {
1294 if (counter!=NULL) counter->
PutFill();
1329 if (solid==NULL || vect==NULL)
return -1;
1330 if (solid->
octree==NULL)
return -1;
1338 if (counter!=NULL) {
1341 intvl =
Max(1, fno/100);
1350 for (
int i=0; i<fno; i++) {
1352 if (nrml!=NULL) normal = nrml + i*3;
1353 if (uvmp!=NULL) uvmap = uvmp + i*3;
1354 if (wght!=NULL) weight = wght + i*3;
1357 if (contour!=NULL) {
1373 solid->
contours.push_back(contour);
1379 if (counter!=NULL && i%intvl==0) {
1387 if (counter!=NULL) counter->
PutFill();
1417 if (solid==NULL || shell==NULL || vect==NULL)
return;
1418 if (solid->
octree==NULL)
return;
1422 if (contour!=NULL) {
1438 solid->
contours.push_back(contour);
1461 if (solid==NULL)
return -1;
1485 return (
int)solid->
contours.size();
#define JBXL_BREP_MAX_LOOPCNT
#define JBXL_BREP_MAX_QUEUESIZE
三角Contour(Facet)用ライブラリ ヘッダ for BREP
void dup(ArrayParam< T > a, bool del=true)
TVector< double > directRS
BREP_WING * CreateWing(BREP_VERTEX *vertex1, BREP_VERTEX *vertex2)
TVector< double > directS
TVector< double > directR
△QRS 三角Contour衝突検出用
BREP_EDGE_LIST * edge_list
多重エッジのリストへのポインタ
bool complete
完全なエッジ.2つの Wingは共に使用されている.
BREP_CONTOUR_LIST outer_contours
BREP_CONTOUR_LIST contours
Contours リスト
CVCounter * counter
仮想計量カウンタ
BREP_WING_LIST wings
Wings リスト
BREP_WING_LIST shortage_wings
不足 Wings リスト
BREP_CONTOUR_LIST surplus_contours
過剰 Contours リスト
bool calc_normal
normal を計算するか? しない場合は入力値を使用する.
Vector< double > point
頂点の座標.
Vector< double > normal
法線ベクトル.周りの Contour の法線ベクトルの平均.
ArrayParam< int > weight
頂点の重み.要正規化.
BREP_VERTEX_LIST * forbidden_list
お互いに Edgeを張ることを禁止された Vertexの List
UVMap< double > uvmap
曲面のUV座標
BREP_VERTEX * vertex
Start of Vertex.
virtual void StepIt(int n=1)
カウンタのメモリを増やす
virtual void SetMax(int m)
カウンタの最大値(最終目標)を設定
virtual void DeleteChildCounter()
子カウンタの削除(有効領域の無効化)
virtual void ResetRate(int n, int m)
nの目盛り幅を mで読み替える.ここでの定義はあまり意味は無い.
virtual CVCounter * GetUsableCounter()
現在使用可能な目盛りの有効領域を確保
virtual CVCounter * MakeChildCounter(int n)
子カウンタの作成(有効領域を再定義)
virtual void PutFill()
取り敢えずの目標(最短目標)までカウンタを進める.
virtual bool isCanceled()
カウンタがオペレータにより,キャンセルされたか
DllExport BREP_WING * GetWingOtherSide(BREP_WING *wing)
DllExport BREP_EDGE * FindEdge(BREP_VERTEX *vertex1, BREP_VERTEX *vertex2)
DllExport void CreateSurplusContoursList(BREP_SOLID *solid)
bool disJunctBounds(RBound< T > b1, RBound< T > b2)
double Collision_Tolerance
衝突判定用トレランス
double ProportionVector(TVector< T > v1, TVector< T > v2, T &t)
DllExport int IsAtLine(BREP_VERTEX **v)
T TVectorMultiTolerance(TVector< T > a, TVector< T > b)
内積の誤差
DllExport void CreateShortageWingsList(BREP_SOLID *solid)
std::list< BREP_EDGE * > BREP_EDGE_LIST
DllExport TVector< double > Vertex2TVector(BREP_VERTEX *v)
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)
DllExport bool PatchupContour(BREP_SHELL *shell, BREP_VERTEX **vert, bool mode)
DllExport int FillShortageWings_Next(BREP_SOLID *solid, bool mode)
double Zero_Eps
1に対して 0とするトレランス
DllExport void DeleteShortageWings(BREP_SOLID *solid)
DllExport void FastDeleteFacet(BREP_FACET *facet)
DllExport int CloseTriSolid(BREP_SOLID *solid, bool check=true, CVCounter *counter=NULL)
class DllExport BREP_CONTOUR
std::list< BREP_VERTEX * > BREP_VERTEX_LIST
DllExport bool SamePlaneContour(BREP_CONTOUR *contour1, BREP_CONTOUR *contour2, int &lineno)
DllExport void CreateWingsList(BREP_SOLID *solid)
DllExport int DupEdgeNumber(BREP_CONTOUR *contour)
class DllExport BREP_FACET
class DllExport BREP_SHELL
DllExport bool IsCollisionContours(BREP_SOLID *solid, BREP_CONTOUR *contour, BREP_CONTOUR **collision)
DllExport void DeleteStraightEdges(BREP_SOLID *solid)
DllExport void SetDeletableContoursByEdge(BREP_EDGE *edge)
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)
DllExport void ReverseContours(BREP_SOLID *solid)
std::list< BREP_SHELL * > BREP_SHELL_LIST
DllExport void FillShortageWings(BREP_SOLID *solid, int method, bool mode)
DllExport void CreateContoursList(BREP_SOLID *solid)
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)
DllExport bool IsInTriangle(BREP_CONTOUR *contour1, BREP_CONTOUR *contour2)
DllExport int FillShortageWings_Near(BREP_SOLID *solid, bool mode)
DllExport void SetMinVertex(BREP_VERTEX_LIST *list, BREP_VERTEX *vrtx)
DllExport bool CollisionTriContour2D(BREP_CONTOUR *contour1, BREP_CONTOUR *contour2)
DllExport void JoinShortageWings(BREP_SOLID *solid)
DllExport bool IsConnectEdges(BREP_WING *wing1, BREP_WING *wing2)
DllExport int CommonVertex(BREP_CONTOUR *contour1, BREP_CONTOUR *contour2)
DllExport bool IsIncludeCompleteEdge(BREP_WING *wing)
DllExport BREP_VERTEX * FindConnectEdgeVertex(BREP_VERTEX *vert)
DllExport BREP_CONTOUR * CreateContourByVertex(BREP_FACET *facet, BREP_VERTEX **vtx)
DllExport BREP_VERTEX * AddVertex2Octree(BREP_VERTEX *vertex, OctreeNode *octree, bool dupli=false)
DllExport bool IsForbiddenEdge(BREP_VERTEX **vert)
DllExport int CreateTriSolidFromSTL(BREP_SOLID *solid, STLData *stldata, int fno, bool check=true)
DllExport bool CollisionTriContour3D(BREP_CONTOUR *contour1, BREP_CONTOUR *contour2)
class DllExport BREP_VERTEX
DllExport void DeleteSurplusContours(BREP_SOLID *solid)