// File: Primitives_Wedge.gxx // Created: Fri Sep 27 11:11:28 1991 // Author: Christophe MARION // #include #include #include #include #include #include #include #include #undef Standard_True #undef Standard_False #define Standard_True ((Standard_Boolean) 1) #define Standard_False ((Standard_Boolean) 0) #define NBFACES 6 #define NBWIRES 6 #define NBEDGES 12 #define NBVERTICES 8 static const Standard_Integer num[6] = {0,1,2,3,4,5}; static const Standard_Integer val[6] = {0,4,0,2,0,1}; static const Standard_Integer tab[6][6] = {{-1,-1, 0, 1, 8, 9}, {-1,-1, 2, 3,10,11}, { 0, 2,-1,-1, 4, 5}, { 1, 3,-1,-1, 6, 7}, { 8,10, 4, 6,-1,-1}, { 9,11, 5, 7,-1,-1}}; //======================================================================= //function : Primitives_Wedge_NumDir1 //purpose : when giving a direction return the range of the face //======================================================================= static Standard_Integer Primitives_Wedge_NumDir1 (const Primitives_Direction d1) { return num[d1]; } //======================================================================= //function : Primitives_Wedge_NumDir2 //purpose : when giving two directions return the range of the edge //======================================================================= static Standard_Integer Primitives_Wedge_NumDir2 (const Primitives_Direction d1, const Primitives_Direction d2) { Standard_Integer i1 = Primitives_Wedge_NumDir1(d1); Standard_Integer i2 = Primitives_Wedge_NumDir1(d2); if ( i1/2 == i2/2 ) Standard_DomainError::Raise(); return tab[i1][i2]; } //======================================================================= //function : Primitives_Wedge_NumDir3 //purpose : when giving three directions return the range of the vertex //======================================================================= static Standard_Integer Primitives_Wedge_NumDir3 (const Primitives_Direction d1, const Primitives_Direction d2, const Primitives_Direction d3) { Standard_Integer i1 = Primitives_Wedge_NumDir1(d1); Standard_Integer i2 = Primitives_Wedge_NumDir1(d2); Standard_Integer i3 = Primitives_Wedge_NumDir1(d3); if (( i1/2 == i2/2 ) || ( i2/2 == i3/2 ) || ( i3/2 == i1/2 )) Standard_DomainError::Raise(); return val[i1]+val[i2]+val[i3]; } //======================================================================= //function : Primitives_Wedge_Check //purpose : raise Standard_DomainError if something was built //======================================================================= static void Primitives_Wedge_Check(const Standard_Boolean V[], const Standard_Boolean E[], const Standard_Boolean W[], const Standard_Boolean F[]) { Standard_Integer i; for (i = 0; i < NBVERTICES; i++) if (V[i]) Standard_DomainError::Raise(); for (i = 0; i < NBEDGES; i++) if (E[i]) Standard_DomainError::Raise(); for (i = 0; i < NBWIRES; i++) if (W[i]) Standard_DomainError::Raise(); for (i = 0; i < NBFACES; i++) if (F[i]) Standard_DomainError::Raise(); } //======================================================================= //function : Primitives_Wedge_Init //purpose : Set arrays to Standard_False //======================================================================= static void Primitives_Wedge_Init(Standard_Boolean& S, Standard_Boolean V[], Standard_Boolean E[], Standard_Boolean W[], Standard_Boolean F[]) { Standard_Integer i; S = Standard_False; for (i = 0; i < NBVERTICES; i++) V[i] = Standard_False; for (i = 0; i < NBEDGES; i++) E[i] = Standard_False; for (i = 0; i < NBWIRES; i++) W[i] = Standard_False; for (i = 0; i < NBFACES; i++) F[i] = Standard_False; } //======================================================================= //function : Primitives_Wedge //purpose : build a box //======================================================================= Primitives_Wedge::Primitives_Wedge (const TheBuilder& B, const gp_Ax2& Axes, const Standard_Real dx, const Standard_Real dy, const Standard_Real dz) : myBuilder(B), myAxes(Axes), XMin(0), XMax(dx), YMin(0), YMax(dy), ZMin(0), ZMax(dz), Z2Min(0), Z2Max(dz), X2Min(0), X2Max(dx) { for (Standard_Integer i = 0; i < NBFACES; i++) { myInfinite[i]=Standard_False; } if ( ( dx <= Precision::Confusion() ) || ( dy <= Precision::Confusion() ) || ( dz <= Precision::Confusion() ) ) Standard_DomainError::Raise(); Primitives_Wedge_Init(ShellBuilt,VerticesBuilt,EdgesBuilt, WiresBuilt,FacesBuilt); } //======================================================================= //function : Primitives_Wedge //purpose : build a STEP wedge //======================================================================= Primitives_Wedge::Primitives_Wedge (const TheBuilder& B, const gp_Ax2& Axes, const Standard_Real dx, const Standard_Real dy, const Standard_Real dz, const Standard_Real ltx) : myBuilder(B), myAxes(Axes), XMin(0), XMax(dx), YMin(0), YMax(dy), ZMin(0), ZMax(dz), Z2Min(0), Z2Max(dz), X2Min(0), X2Max(ltx) { for (Standard_Integer i = 0; i < NBFACES; i++) { myInfinite[i]=Standard_False; } if ( ( dx <= Precision::Confusion() ) || ( dy <= Precision::Confusion() ) || ( dz <= Precision::Confusion() ) || ( ltx < 0 ) ) Standard_DomainError::Raise(); Primitives_Wedge_Init(ShellBuilt,VerticesBuilt,EdgesBuilt, WiresBuilt,FacesBuilt); } //======================================================================= //function : Primitives_Wedge //purpose : build a wedge by giving all the fields //======================================================================= Primitives_Wedge::Primitives_Wedge (const TheBuilder& B, const gp_Ax2& Axes, const Standard_Real xmin, const Standard_Real ymin, const Standard_Real zmin, const Standard_Real z2min, const Standard_Real x2min, const Standard_Real xmax, const Standard_Real ymax, const Standard_Real zmax, const Standard_Real z2max, const Standard_Real x2max) : myBuilder(B), myAxes(Axes), XMin(xmin), XMax(xmax), YMin(ymin), YMax(ymax), ZMin(zmin), ZMax(zmax), Z2Min(z2min), Z2Max(z2max), X2Min(x2min), X2Max(x2max) { for (Standard_Integer i = 0; i < NBFACES; i++) { myInfinite[i]=Standard_False; } if ( ( XMax-XMin <= Precision::Confusion() ) || ( YMax-YMin <= Precision::Confusion() ) || ( ZMax-ZMin <= Precision::Confusion() ) || ( Z2Max-Z2Min < 0 ) || ( X2Max-X2Min < 0 ) ) Standard_DomainError::Raise(); Primitives_Wedge_Init(ShellBuilt,VerticesBuilt,EdgesBuilt, WiresBuilt,FacesBuilt); } //======================================================================= //function : Axes, // GetXMin, GetYMin, GetZMin, GetZ2Min, GetX2Min // GetXMax, GetYMax, GetZMax, GetZ2Max, GetX2Max //purpose : trivial //======================================================================= gp_Ax2 Primitives_Wedge::Axes () const { return myAxes; } Standard_Real Primitives_Wedge::GetXMin () const { return XMin; } Standard_Real Primitives_Wedge::GetYMin () const { return YMin; } Standard_Real Primitives_Wedge::GetZMin () const { return ZMin; } Standard_Real Primitives_Wedge::GetZ2Min () const { return Z2Min; } Standard_Real Primitives_Wedge::GetX2Min () const { return X2Min; } Standard_Real Primitives_Wedge::GetXMax () const { return XMax; } Standard_Real Primitives_Wedge::GetYMax () const { return YMax; } Standard_Real Primitives_Wedge::GetZMax () const { return ZMax; } Standard_Real Primitives_Wedge::GetZ2Max () const { return Z2Max; } Standard_Real Primitives_Wedge::GetX2Max () const { return X2Max; } //======================================================================= //function : Open //purpose : trivial //======================================================================= void Primitives_Wedge::Open (const Primitives_Direction d1) { Primitives_Wedge_Check(VerticesBuilt,EdgesBuilt,WiresBuilt,FacesBuilt); myInfinite[Primitives_Wedge_NumDir1(d1)] = Standard_True; } //======================================================================= //function : Close //purpose : trivial //======================================================================= void Primitives_Wedge::Close (const Primitives_Direction d1) { Primitives_Wedge_Check(VerticesBuilt,EdgesBuilt,WiresBuilt,FacesBuilt); myInfinite[Primitives_Wedge_NumDir1(d1)] = Standard_False; } //======================================================================= //function : IsInfinite //purpose : true if it is open in the given direction //======================================================================= Standard_Boolean Primitives_Wedge::IsInfinite (const Primitives_Direction d1) const { return myInfinite[Primitives_Wedge_NumDir1(d1)]; } //======================================================================= //function : Shell //purpose : //======================================================================= const TheShell& Primitives_Wedge::Shell() { if (!ShellBuilt) { myBuilder.MakeShell(myShell); if (HasFace(Primitives_XMin)) myBuilder.AddShellFace(myShell,Face(Primitives_XMin)); if (HasFace(Primitives_XMax)) myBuilder.AddShellFace(myShell,Face(Primitives_XMax)); if (HasFace(Primitives_YMin)) myBuilder.AddShellFace(myShell,Face(Primitives_YMin)); if (HasFace(Primitives_YMax)) myBuilder.AddShellFace(myShell,Face(Primitives_YMax)); if (HasFace(Primitives_ZMin)) myBuilder.AddShellFace(myShell,Face(Primitives_ZMin)); if (HasFace(Primitives_ZMax)) myBuilder.AddShellFace(myShell,Face(Primitives_ZMax)); myBuilder.CompleteShell(myShell); ShellBuilt = Standard_True; } return myShell; } //======================================================================= //function : HasFace //purpose : true if the face exist in one direction //======================================================================= Standard_Boolean Primitives_Wedge::HasFace (const Primitives_Direction d1) const { Standard_Boolean state = !myInfinite[Primitives_Wedge_NumDir1(d1)]; if ( d1 == Primitives_YMax ) state = state && ( Z2Max != Z2Min ) && ( X2Max != X2Min ); return state; } //======================================================================= //function : Plane //purpose : //======================================================================= gp_Pln Primitives_Wedge::Plane(const Primitives_Direction d1) { Standard_Integer i = Primitives_Wedge_NumDir1(d1); gp_Dir D; gp_Vec VX = myAxes.XDirection(); gp_Vec VY = myAxes.YDirection(); gp_Vec VZ = myAxes.Direction(); switch (i/2) { case 0 : D = myAxes.XDirection(); break; case 1 : D = myAxes.YDirection(); break; case 2 : D = myAxes.Direction(); break; }; #ifndef DEB Standard_Real X =0., Y =0., Z =0.; #else Standard_Real X, Y, Z; #endif switch (i) { case 0 : // XMin X = XMin; Y = YMin; Z = ZMin; if ( X2Min != XMin ) D = gp_Dir((YMax-YMin)*VX+(XMin-X2Min)*VY); break; case 1 : // XMax X = XMax; Y = YMin; Z = ZMin; if ( X2Max != XMax ) D = gp_Dir((YMax-YMin)*VX+(XMax-X2Max)*VY); break; case 2 : // YMin X = XMin; Y = YMin; Z = ZMin; break; case 3 : // YMax X = XMin; Y = YMax; Z = ZMin; break; case 4 : // ZMin X = XMin; Y = YMin; Z = ZMin; if ( Z2Min != ZMin ) D = gp_Dir((YMax-YMin)*VZ+(ZMin-Z2Min)*VY); break; case 5 : // ZMax X = XMin; Y = YMin; Z = ZMax; if ( Z2Max != ZMax ) D = gp_Dir((YMax-YMin)*VZ+(ZMax-Z2Max)*VY); break; }; gp_Pnt P = myAxes.Location(); P.Translate(X*gp_Vec(myAxes.XDirection())); P.Translate(Y*gp_Vec(myAxes.YDirection())); P.Translate(Z*gp_Vec(myAxes.Direction ())); gp_Pln plane(P,D); return plane; } //======================================================================= //function : Face //purpose : the face in one direction //======================================================================= const TheFace& Primitives_Wedge::Face (const Primitives_Direction d1) { Standard_Integer i = Primitives_Wedge_NumDir1(d1); if (!FacesBuilt[i]) { gp_Pln P = Plane(d1); myBuilder.MakeFace(myFaces[i],P); if (HasWire(d1)) myBuilder.AddFaceWire(myFaces[i],Wire(d1)); if ( i%2 == 0 ) myBuilder.ReverseFace(myFaces[i]); // pcurves #ifndef DEB Primitives_Direction dd1 = Primitives_ZMin, dd2 = Primitives_YMax, dd3 = Primitives_ZMax,dd4 = Primitives_YMin; #else Primitives_Direction dd1,dd2,dd3,dd4; #endif switch (i/2) { case 0 : // XMin XMax dd1 = Primitives_ZMin; dd2 = Primitives_YMax; dd3 = Primitives_ZMax; dd4 = Primitives_YMin; break; case 1 : // YMin YMax dd1 = Primitives_XMin; dd2 = Primitives_ZMax; dd3 = Primitives_XMax; dd4 = Primitives_ZMin; break; case 2 : // ZMin ZMax dd1 = Primitives_YMin; dd2 = Primitives_XMax; dd3 = Primitives_YMax; dd4 = Primitives_XMin; break; }; gp_Lin L; gp_Dir DX = P.XAxis().Direction(); gp_Dir DY = P.YAxis().Direction(); Standard_Real U,V,DU,DV; if (HasEdge(d1,dd4)) { L = Line(d1,dd4); ElSLib::Parameters(P,L.Location(),U,V); DU = L.Direction() * DX; DV = L.Direction() * DY; myBuilder.SetPCurve(myEdges[Primitives_Wedge_NumDir2(d1,dd4)], myFaces[i], gp_Lin2d(gp_Pnt2d(U,V),gp_Dir2d(DU,DV))); } if (HasEdge(d1,dd3)) { L = Line(d1,dd3); ElSLib::Parameters(P,L.Location(),U,V); DU = L.Direction() * DX; DV = L.Direction() * DY; myBuilder.SetPCurve(myEdges[Primitives_Wedge_NumDir2(d1,dd3)], myFaces[i], gp_Lin2d(gp_Pnt2d(U,V),gp_Dir2d(DU,DV))); } if (HasEdge(d1,dd2)) { L = Line(d1,dd2); ElSLib::Parameters(P,L.Location(),U,V); DU = L.Direction() * DX; DV = L.Direction() * DY; myBuilder.SetPCurve(myEdges[Primitives_Wedge_NumDir2(d1,dd2)], myFaces[i], gp_Lin2d(gp_Pnt2d(U,V),gp_Dir2d(DU,DV))); } if (HasEdge(d1,dd1)) { L = Line(d1,dd1); ElSLib::Parameters(P,L.Location(),U,V); DU = L.Direction() * DX; DV = L.Direction() * DY; myBuilder.SetPCurve(myEdges[Primitives_Wedge_NumDir2(d1,dd1)], myFaces[i], gp_Lin2d(gp_Pnt2d(U,V),gp_Dir2d(DU,DV))); } myBuilder.CompleteFace(myFaces[i]); FacesBuilt[i] = Standard_True; } return myFaces[i]; } //======================================================================= //function : HasWire //purpose : trivial //======================================================================= Standard_Boolean Primitives_Wedge::HasWire (const Primitives_Direction d1) const { Standard_Integer i = Primitives_Wedge_NumDir1(d1); if (myInfinite[i]) return Standard_False; #ifndef DEB Primitives_Direction dd1 = Primitives_XMin,dd2 = Primitives_YMax,dd3 = Primitives_XMax ,dd4 = Primitives_ZMin; #else Primitives_Direction dd1,dd2,dd3,dd4; #endif switch (i/2) { case 0 : // XMin XMax dd1 = Primitives_ZMin; dd2 = Primitives_YMax; dd3 = Primitives_ZMax; dd4 = Primitives_YMin; break; case 1 : // YMin YMax dd1 = Primitives_XMin; dd2 = Primitives_ZMax; dd3 = Primitives_XMax; dd4 = Primitives_ZMin; break; case 2 : // ZMin ZMax dd1 = Primitives_YMin; dd2 = Primitives_XMax; dd3 = Primitives_YMax; dd4 = Primitives_XMin; break; #ifndef DEB default: break; #endif }; return HasEdge(d1,dd1)||HasEdge(d1,dd2)||HasEdge(d1,dd3)||HasEdge(d1,dd4); } //======================================================================= //function : Wire //purpose : trivial //======================================================================= const TheWire& Primitives_Wedge::Wire (const Primitives_Direction d1) { Standard_Integer i = Primitives_Wedge_NumDir1(d1); #ifndef DEB Primitives_Direction dd1 = Primitives_XMin,dd2 = Primitives_YMax,dd3 = Primitives_XMax ,dd4 = Primitives_ZMin; #else Primitives_Direction dd1,dd2,dd3,dd4; #endif if (!WiresBuilt[i]) { switch (i/2) { case 0 : // XMin XMax dd1 = Primitives_ZMin; dd2 = Primitives_YMax; dd3 = Primitives_ZMax; dd4 = Primitives_YMin; break; case 1 : // YMin YMax dd1 = Primitives_XMin; dd2 = Primitives_ZMax; dd3 = Primitives_XMax; dd4 = Primitives_ZMin; break; case 2 : // ZMin ZMax dd1 = Primitives_YMin; dd2 = Primitives_XMax; dd3 = Primitives_YMax; dd4 = Primitives_XMin; break; #ifndef DEB default: break; #endif }; myBuilder.MakeWire(myWires[i]); if (HasEdge(d1,dd4)) myBuilder.AddWireEdge(myWires[i],Edge(d1,dd4),Standard_False); if (HasEdge(d1,dd3)) myBuilder.AddWireEdge(myWires[i],Edge(d1,dd3),Standard_False); if (HasEdge(d1,dd2)) myBuilder.AddWireEdge(myWires[i],Edge(d1,dd2),Standard_True ); if (HasEdge(d1,dd1)) myBuilder.AddWireEdge(myWires[i],Edge(d1,dd1),Standard_True ); myBuilder.CompleteWire(myWires[i]); WiresBuilt[i] = Standard_True; } return myWires[i]; } //======================================================================= //function : HasEdge //purpose : trivial //======================================================================= Standard_Boolean Primitives_Wedge::HasEdge (const Primitives_Direction d1, const Primitives_Direction d2) const { Standard_Boolean state = !(myInfinite[Primitives_Wedge_NumDir1(d1)] || myInfinite[Primitives_Wedge_NumDir1(d2)]); Standard_Integer i = Primitives_Wedge_NumDir2(d1,d2); if ( i == 6 || i == 7 ) state = state && ( X2Max != X2Min ); else if ( i == 1 || i == 3 ) state = state && ( Z2Max != Z2Min ); return state; } //======================================================================= //function : Line //purpose : trivial //======================================================================= gp_Lin Primitives_Wedge::Line (const Primitives_Direction d1, const Primitives_Direction d2) { if (!HasEdge(d1,d2)) Standard_DomainError::Raise(); Standard_Integer i = Primitives_Wedge_NumDir2(d1,d2); #ifndef DEB Standard_Real X =0., Y =0., Z =0.; #else Standard_Real X, Y, Z; #endif gp_Dir D; gp_Vec VX = myAxes.XDirection(); gp_Vec VY = myAxes.YDirection(); gp_Vec VZ = myAxes.Direction(); switch (i/4) { case 0 : D = myAxes.Direction(); break; case 1 : D = myAxes.XDirection(); break; case 2 : D = myAxes.YDirection(); break; }; switch (i) { case 0 : // XMin YMin X = XMin; Y = YMin; Z = ZMin; break; case 1 : // XMin YMax X = X2Min; Y = YMax; Z = Z2Min; break; case 2 : // XMax YMin X = XMax; Y = YMin; Z = ZMin; break; case 3 : // XMax YMax X = X2Max; Y = YMax; Z = Z2Min; break; case 4 : // YMin ZMin X = XMin; Y = YMin; Z = ZMin; break; case 5 : // YMin ZMax X = XMin; Y = YMin; Z = ZMax; break; case 6 : // YMax ZMin X = X2Min; Y = YMax; Z = Z2Min; break; case 7 : // YMax ZMax X = X2Min; Y = YMax; Z = Z2Max; break; case 8 : // ZMin XMin X = XMin; Y = YMin; Z = ZMin; if ( (XMin != X2Min) || (ZMin != Z2Min) ) D = gp_Vec(gp_Pnt(XMin,YMin,ZMin),gp_Pnt(X2Min,YMax,Z2Min)); break; case 9 : // ZMax XMin X = XMin; Y = YMin; Z = ZMax; if ( (XMin != X2Min) || (ZMax != Z2Max) ) D = gp_Vec( (X2Min-XMin)*VX + (YMax-YMin)*VY + (Z2Max-ZMax)*VZ); break; case 10 : // ZMin XMax X = XMax; Y = YMin; Z = ZMin; if ( (XMax != X2Max) || (ZMin != Z2Min) ) D = gp_Vec( (X2Max-XMax)*VX + (YMax-YMin)*VY + (Z2Min-ZMin)*VZ); break; case 11 : // ZMax XMax X = XMax; Y = YMin; Z = ZMax; if ( (XMax != X2Max) || (ZMax != Z2Max) ) D = gp_Vec(gp_Pnt(XMax,YMin,ZMax),gp_Pnt(X2Max,YMax,Z2Max)); D = gp_Vec( (X2Max-XMax)*VX + (YMax-YMin)*VY + (Z2Max-ZMax)*VZ); break; } gp_Pnt P = myAxes.Location(); P.Translate(X*gp_Vec(myAxes.XDirection())); P.Translate(Y*gp_Vec(myAxes.YDirection())); P.Translate(Z*gp_Vec(myAxes.Direction ())); return gp_Lin(gp_Ax1(P,D)); } //======================================================================= //function : Edge //purpose : trivial //======================================================================= const TheEdge& Primitives_Wedge::Edge (const Primitives_Direction d1, const Primitives_Direction d2) { if (!HasEdge(d1,d2)) Standard_DomainError::Raise(); Standard_Integer i = Primitives_Wedge_NumDir2(d1,d2); if (!EdgesBuilt[i]) { #ifndef DEB Primitives_Direction dd1 = Primitives_XMin ,dd2 = Primitives_XMax; #else Primitives_Direction dd1,dd2; #endif switch (i/4) { case 0 : dd1 = Primitives_ZMin; dd2 = Primitives_ZMax; break; case 1 : dd1 = Primitives_XMin; dd2 = Primitives_XMax; break; case 2 : dd1 = Primitives_YMin; dd2 = Primitives_YMax; break; #ifndef DEB default: break; #endif }; gp_Lin L = Line(d1,d2); myBuilder.MakeEdge(myEdges[i],L); if (HasVertex(d1,d2,dd2)) { myBuilder.AddEdgeVertex(myEdges[i],Vertex(d1,d2,dd2), ElCLib::Parameter(L,Point(d1,d2,dd2)), Standard_False); } if (HasVertex(d1,d2,dd1)) { myBuilder.AddEdgeVertex(myEdges[i],Vertex(d1,d2,dd1), ElCLib::Parameter(L,Point(d1,d2,dd1)), Standard_True ); } if ( Z2Max == Z2Min ) { if ( i == 6 ) { myEdges[7] = myEdges[6]; EdgesBuilt[7] = Standard_True; } else if ( i == 7 ) { myEdges[6] = myEdges[7]; EdgesBuilt[6] = Standard_True; } } if ( X2Max == X2Min ) { if ( i == 1 ) { myEdges[3] = myEdges[1]; EdgesBuilt[3] = Standard_True; } else if ( i == 3 ) { myEdges[1] = myEdges[3]; EdgesBuilt[1] = Standard_True; } } myBuilder.CompleteEdge(myEdges[i]); EdgesBuilt[i] = Standard_True; } return myEdges[i]; } //======================================================================= //function : HasVertex //purpose : trivial //======================================================================= Standard_Boolean Primitives_Wedge::HasVertex (const Primitives_Direction d1, const Primitives_Direction d2, const Primitives_Direction d3) const { return !(myInfinite[Primitives_Wedge_NumDir1(d1)] || myInfinite[Primitives_Wedge_NumDir1(d2)] || myInfinite[Primitives_Wedge_NumDir1(d3)]); } //======================================================================= //function : Point //purpose : trivial //======================================================================= gp_Pnt Primitives_Wedge::Point (const Primitives_Direction d1, const Primitives_Direction d2, const Primitives_Direction d3) { if (!HasVertex(d1,d2,d3)) Standard_DomainError::Raise(); Standard_Integer i = Primitives_Wedge_NumDir3(d1,d2,d3); #ifndef DEB Standard_Real X =0., Y =0., Z =0.; #else Standard_Real X, Y, Z; #endif switch (i) { case 0 : X = XMin; Y = YMin; Z = ZMin; break; case 1 : X = XMin; Y = YMin; Z = ZMax; break; case 2 : X = X2Min; Y = YMax; Z = Z2Min; break; case 3 : X = X2Min; Y = YMax; Z = Z2Max; break; case 4 : X = XMax; Y = YMin; Z = ZMin; break; case 5 : X = XMax; Y = YMin; Z = ZMax; break; case 6 : X = X2Max; Y = YMax; Z = Z2Min; break; case 7 : X = X2Max; Y = YMax; Z = Z2Max; break; }; gp_Pnt P = myAxes.Location(); P.Translate(X*gp_Vec(myAxes.XDirection())); P.Translate(Y*gp_Vec(myAxes.YDirection())); P.Translate(Z*gp_Vec(myAxes.Direction ())); return P; } //======================================================================= //function : Vertex //purpose : trivial //======================================================================= const TheVertex& Primitives_Wedge::Vertex (const Primitives_Direction d1, const Primitives_Direction d2, const Primitives_Direction d3) { if (!HasVertex(d1,d2,d3)) Standard_DomainError::Raise(); Standard_Integer i = Primitives_Wedge_NumDir3(d1,d2,d3); if (!VerticesBuilt[i]) { myBuilder.MakeVertex(myVertices[i],Point(d1,d2,d3)); if ( Z2Max == Z2Min ) { if ( i == 2 || i == 6 ) { myVertices[3] = myVertices[2]; myVertices[7] = myVertices[6]; VerticesBuilt[3] = Standard_True; VerticesBuilt[7] = Standard_True; } else if ( i == 3 || i == 7 ) { myVertices[2] = myVertices[3]; myVertices[6] = myVertices[7]; VerticesBuilt[2] = Standard_True; VerticesBuilt[6] = Standard_True; } } if ( X2Max == X2Min ) { if ( i == 2 || i == 3 ) { myVertices[6] = myVertices[2]; myVertices[7] = myVertices[3]; VerticesBuilt[6] = Standard_True; VerticesBuilt[7] = Standard_True; } else if ( i == 6 || i == 7 ) { myVertices[2] = myVertices[6]; myVertices[3] = myVertices[7]; VerticesBuilt[2] = Standard_True; VerticesBuilt[3] = Standard_True; } } VerticesBuilt[i] = Standard_True; } return myVertices[i]; }