int // return value not used? MakeTwistedCubeTrimmingLoop(ON_Brep& brep, ON_BrepFace& face, int v0, int v1, int v2, int v3, // indices of corner vertices int e0, int eo0, // edge index + orientation w.r.t surface trim int e1, int eo1, int e2, int eo2, int e3, int eo3) { // get a reference to the surface const ON_Surface& srf = *brep.m_S[face.m_si]; ON_BrepLoop& loop = brep.NewLoop(ON_BrepLoop::outer, face); // create the trimming curves running counter-clockwise around the // surface's domain, start at the south side ON_Curve* c2; int c2i, ei = 0, bRev3d = 0; ON_2dPoint q; // flags for isoparametric curves ON_Surface::ISO iso = ON_Surface::not_iso; for (int side = 0; side < 4; side++) { // side: 0=south, 1=east, 2=north, 3=west c2 = TwistedCubeTrimmingCurve( srf, side ); c2i = brep.m_C2.Count(); brep.m_C2.Append(c2); switch (side) { case 0: ei = e0; bRev3d = (eo0 == -1); iso = ON_Surface::S_iso; break; case 1: ei = e1; bRev3d = (eo1 == -1); iso = ON_Surface::E_iso; break; case 2: ei = e2; bRev3d = (eo2 == -1); iso = ON_Surface::N_iso; break; case 3: ei = e3; bRev3d = (eo3 == -1); iso = ON_Surface::W_iso; break; } ON_BrepTrim& trim = brep.NewTrim(brep.m_E[ei], bRev3d, loop, c2i); trim.m_iso = iso; // the type gives metadata on the trim type in this case, "mated" // means the trim is connected to an edge, is part of an // outer/inner/slit loop, no other trim from the same edge is // connected to the edge, and at least one trim from a different // loop is connected to the edge trim.m_type = ON_BrepTrim::mated; // i.e. this b-rep is closed, so // all trims have mates // not convinced these shouldn't be set with a member function trim.m_tolerance[0] = 0.0; // exact trim.m_tolerance[1] = 0.0; // } return loop.m_loop_index; }
static int MakeTwistedCubeTrimmingLoop( ON_Brep& brep, // returns index of loop ON_BrepFace& face, // face loop is on //int vSWi, int vSEi, int vNEi, int vNWi, // Indices of corner vertices listed in SW,SE,NW,NE order int eSi, // index of edge on south side of surface int eS_dir, // orientation of edge with respect to surface trim int eEi, // index of edge on south side of surface int eE_dir, // orientation of edge with respect to surface trim int eNi, // index of edge on south side of surface int eN_dir, // orientation of edge with respect to surface trim int eWi, // index of edge on south side of surface int eW_dir // orientation of edge with respect to surface trim ) { const ON_Surface& srf = *brep.m_S[face.m_si]; ON_BrepLoop& loop = brep.NewLoop( ON_BrepLoop::outer, face ); // Create trimming curves running counter clockwise around the surface's domain. // Start at the south side ON_Curve* c2; int c2i, ei=0, bRev3d=0; ON_2dPoint q; ON_Surface::ISO iso = ON_Surface::not_iso; for ( int side = 0; side < 4; side++ ) { // side: 0=south, 1=east, 2=north, 3=west c2 = TwistedCubeTrimmingCurve( srf, side ); c2i = brep.m_C2.Count(); brep.m_C2.Append(c2); switch ( side ) { case 0: // south ei = eSi; bRev3d = (eS_dir == -1); iso = ON_Surface::S_iso; break; case 1: // east ei = eEi; bRev3d = (eE_dir == -1); iso = ON_Surface::E_iso; break; case 2: // north ei = eNi; bRev3d = (eN_dir == -1); iso = ON_Surface::N_iso; break; case 3: // west ei = eWi; bRev3d = (eW_dir == -1); iso = ON_Surface::W_iso; break; } ON_BrepTrim& trim = brep.NewTrim( brep.m_E[ei], bRev3d, loop, c2i ); q = c2->PointAtStart(); //trim.m_P[0] = srf.PointAt( q.x, q.y ); q = c2->PointAtEnd(); //trim.m_P[1] = srf.PointAt( q.x, q.y ); trim.m_iso = iso; trim.m_type = ON_BrepTrim::mated; // This b-rep is closed, so all trims // have mates. trim.m_tolerance[0] = 0.0; // This simple example is exact - for models with trim.m_tolerance[1] = 0.0; // non-exact data, set tolerance as explained in // definition of ON_BrepTrim. } return loop.m_loop_index; }