本文整理汇总了C++中ON_Brep::NewLoop方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_Brep::NewLoop方法的具体用法?C++ ON_Brep::NewLoop怎么用?C++ ON_Brep::NewLoop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_Brep
的用法示例。
在下文中一共展示了ON_Brep::NewLoop方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeTrimmingLoop
static int MakeTrimmingLoop( ON_Brep& brep, // returns index of loop
ON_BrepFace& face, // face loop is on
int v0, int v1, int v2, // Indices of corner vertices listed in A,B,C order
int e0, // index of first edge
int e0_dir, // orientation of edge
int e1, // index second edgee
int e1_dir, // orientation of edge
int e2, // index third edge
int e2_dir // orientation of edge
)
{
const ON_Surface& srf = *brep.m_S[face.m_si];
//Create new loop
ON_BrepLoop& loop = brep.NewLoop( ON_BrepLoop::outer, face );
// Create trimming curves running counter clockwise.
// Note that trims of outer loops run counter clockwise while trims of inner loops (holes) run clockwise.
// Also note that when trims locate on surface N,S,E or W ends, then trim_iso becomes N_iso, S_iso, E_iso and W_iso respectfully.
// While if trim is parallel to surface N,S or E,W, then trim is becomes y_iso and x_iso respectfully, the rest are not_iso.
// Start at the south side
ON_Curve* c2;
int c2i, ei=0, bRev3d=0;
ON_Surface::ISO iso = ON_Surface::not_iso;
for ( int side = 0; side < 3; side++ ) {
c2 = CreateTrimmingCurve( srf, side );
//Add trimming curve to brep trmming curves array
c2i = brep.m_C2.Count();
brep.m_C2.Append(c2);
switch ( side ) {
case 0: // south
ei = e0;
bRev3d = (e0_dir == -1);
iso = ON_Surface::S_iso;
break;
case 1: // diagonal
ei = e1;
bRev3d = (e1_dir == -1);
iso = ON_Surface::not_iso;
break;
case 2: // diagonal
ei = e2;
bRev3d = (e2_dir == -1);
iso = ON_Surface::not_iso;
break;
}
//Create new trim topology that references edge, direction reletive to edge, loop and trim curve geometry
ON_BrepTrim& trim = brep.NewTrim( brep.m_E[ei], bRev3d, loop, c2i );
trim.m_iso = iso;
trim.m_type = ON_BrepTrim::boundary; // This one b-rep face, so all trims are boundary ones.
trim.m_tolerance[0] = 0.0; // This simple example is exact - for models with non-exact
trim.m_tolerance[1] = 0.0; // data, set tolerance as explained in definition of ON_BrepTrim.
}
return loop.m_loop_index;
}
示例2:
//.........这里部分代码省略.........
trimcurve30->SetDomain(0.0, 1.0);
brep->m_C2.Append(trimcurve30); /* 3 */
// EDGES
/* C3 curve */
// left face edges
brep->NewEdge(brep->m_V[0], brep->m_V[1], 0, NULL, SMALL_FASTF); /* 0 */
brep->NewEdge(brep->m_V[1], brep->m_V[2], 1, NULL, SMALL_FASTF); /* 1 */
brep->NewEdge(brep->m_V[2], brep->m_V[3], 2, NULL, SMALL_FASTF); /* 2 */
brep->NewEdge(brep->m_V[3], brep->m_V[0], 3, NULL, SMALL_FASTF); /* 3 */
// right face edges
brep->NewEdge(brep->m_V[5], brep->m_V[4], 4, NULL, SMALL_FASTF); /* 4 */
brep->NewEdge(brep->m_V[6], brep->m_V[5], 5, NULL, SMALL_FASTF); /* 5 */
brep->NewEdge(brep->m_V[7], brep->m_V[6], 6, NULL, SMALL_FASTF); /* 6 */
brep->NewEdge(brep->m_V[4], brep->m_V[7], 7, NULL, SMALL_FASTF); /* 7 */
// horizontal face edges
brep->NewEdge(brep->m_V[0], brep->m_V[4], 8, NULL, SMALL_FASTF); /* 8 */
brep->NewEdge(brep->m_V[5], brep->m_V[1], 9, NULL, SMALL_FASTF); /* 9 */
brep->NewEdge(brep->m_V[2], brep->m_V[6], 10, NULL, SMALL_FASTF); /* 10 */
brep->NewEdge(brep->m_V[7], brep->m_V[3], 11, NULL, SMALL_FASTF); /* 11 */
// XXX
brep->NewEdge(brep->m_V[8], brep->m_V[9], 12, NULL, SMALL_FASTF); /* 12 */
brep->NewEdge(brep->m_V[9], brep->m_V[10], 13, NULL, SMALL_FASTF); /* 13 */
brep->NewEdge(brep->m_V[10], brep->m_V[11], 14, NULL, SMALL_FASTF); /* 14 */
brep->NewEdge(brep->m_V[11], brep->m_V[8], 15, NULL, SMALL_FASTF); /* 15 */
// FACES
ON_BrepFace& face0123 = brep->NewFace(0);
ON_BrepLoop& loop0123 = brep->NewLoop(ON_BrepLoop::outer, face0123); /* 0 */
ON_BrepTrim& trim01 = brep->NewTrim(brep->m_E[0], false, loop0123, 0 /* trim */); /* m_T[0] */
trim01.m_iso = ON_Surface::S_iso;
trim01.m_type = ON_BrepTrim::mated;
trim01.m_tolerance[0] = SMALL_FASTF;
trim01.m_tolerance[1] = SMALL_FASTF;
ON_BrepTrim& trim12 = brep->NewTrim(brep->m_E[1], false, loop0123, 1 /* trim */); /* 1 */
trim12.m_iso = ON_Surface::E_iso;
trim12.m_type = ON_BrepTrim::mated;
trim12.m_tolerance[0] = SMALL_FASTF;
trim12.m_tolerance[1] = SMALL_FASTF;
ON_BrepTrim& trim23 = brep->NewTrim(brep->m_E[2], false, loop0123, 2 /* trim */); /* 2 */
trim23.m_iso = ON_Surface::N_iso;
trim23.m_type = ON_BrepTrim::mated;
trim23.m_tolerance[0] = SMALL_FASTF;
trim23.m_tolerance[1] = SMALL_FASTF;
ON_BrepTrim& trim30 = brep->NewTrim(brep->m_E[3], false, loop0123, 3 /* trim */); /* 3 */
trim30.m_iso = ON_Surface::W_iso;
trim30.m_type = ON_BrepTrim::mated;
trim30.m_tolerance[0] = SMALL_FASTF;
trim30.m_tolerance[1] = SMALL_FASTF;
ON_BrepFace& face4765 = brep->NewFace(1 /* surfaceID */);
ON_BrepLoop& loop4765 = brep->NewLoop(ON_BrepLoop::outer, face4765); /* 1 */
ON_BrepTrim& trim47 = brep->NewTrim(brep->m_E[7], false, loop4765, 0 /* trim */); /* 4 */
trim47.m_iso = ON_Surface::S_iso;
trim47.m_type = ON_BrepTrim::mated;
trim47.m_tolerance[0] = SMALL_FASTF;
trim47.m_tolerance[1] = SMALL_FASTF;
ON_BrepTrim& trim76 = brep->NewTrim(brep->m_E[6], false, loop4765, 1 /* trim */); /* 5 */
trim76.m_iso = ON_Surface::E_iso;
trim76.m_type = ON_BrepTrim::mated;
trim76.m_tolerance[0] = SMALL_FASTF;
示例3: TwistedCubeTrimmingCurve
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;
}
示例4: MakeTwistedCubeTrimmingLoop
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;
}
示例5: ON_BrepExtrude
//.........这里部分代码省略.........
{
ON_3dVector D = bottomv.point - PathStart;
c3->Translate(D);
int c3i = brep.AddEdgeCurve(c3);
const ON_BrepEdge& e = brep.NewEdge(bottomv,topv,c3i,0,0.0);
sideveimap[vi] = e.m_edge_index;
}
break;
}
}
}
if ( bOK && bCap )
{
// build top faces
for (fi = 0; fi < fcount0; fi++ )
{
const ON_BrepFace& bottomf = brep.m_F[fi];
ON_Surface* srf = bottomf.DuplicateSurface();
if ( !srf )
{
bOK = false;
break;
}
srf->Transform(tr);
int si = brep.AddSurface(srf);
ON_BrepFace& topf = brep.NewFace(si);
topf.m_bRev = !bottomf.m_bRev;
const int loop_count = bottomf.m_li.Count();
topf.m_li.Reserve(loop_count);
for ( int fli = 0; fli < loop_count; fli++ )
{
const ON_BrepLoop& bottoml = brep.m_L[bottomf.m_li[fli]];
ON_BrepLoop& topl = brep.NewLoop(bottoml.m_type,topf);
const int loop_trim_count = bottoml.m_ti.Count();
topl.m_ti.Reserve(loop_trim_count);
for ( int lti = 0; lti < loop_trim_count; lti++ )
{
const ON_BrepTrim& bottomt = brep.m_T[bottoml.m_ti[lti]];
ON_NurbsCurve* c2 = ON_NurbsCurve::New();
if ( !bottomt.GetNurbForm(*c2) )
{
delete c2;
bOK = false;
break;
}
int c2i = brep.AddTrimCurve(c2);
ON_BrepTrim* topt = 0;
if ( bottomt.m_ei >= 0 )
{
ON_BrepEdge& tope = brep.m_E[topeimap[bottomt.m_ei]];
topt = &brep.NewTrim(tope,bottomt.m_bRev3d,topl,c2i);
}
else
{
// singular trim
ON_BrepVertex& topv = brep.m_V[topvimap[bottomt.m_vi[0]]];
topt = &brep.NewSingularTrim(topv,topl,bottomt.m_iso,c2i);
}
topt->m_tolerance[0] = bottomt.m_tolerance[0];
topt->m_tolerance[1] = bottomt.m_tolerance[1];
topt->m_pbox = bottomt.m_pbox;
topt->m_type = bottomt.m_type;
topt->m_iso = bottomt.m_iso;
}
topl.m_pbox = bottoml.m_pbox;
示例6: ON_BrepExtrudeHelper_MakeTopLoop
static
bool ON_BrepExtrudeHelper_MakeTopLoop(
ON_Brep& brep,
ON_BrepFace& top_face,
int bottom_loop_index,
const ON_3dVector path_vector,
const int* side_face_index // array of brep.m_L[bottom_loop_index].m_ti.Count() face indices
)
{
bool rc = true;
int lti, top_trim_index, i;
if ( bottom_loop_index < 0 || bottom_loop_index >= brep.m_L.Count() )
return false;
ON_BrepLoop::TYPE loop_type = brep.m_L[bottom_loop_index].m_type;
if ( loop_type != ON_BrepLoop::inner )
loop_type = ON_BrepLoop::outer;
ON_BrepLoop& top_loop = brep.NewLoop( loop_type, top_face );
const ON_BrepLoop& bottom_loop = brep.m_L[bottom_loop_index];
const int loop_trim_count = bottom_loop.m_ti.Count();
brep.m_T.Reserve( brep.m_T.Count() + loop_trim_count );
// Set top_vertex_index[lti] = index of vertex above
// vertex brep.m_V[brep.m_T[bottom_loop.m_ti[lti]].m_vi[0]].
// Set top_vertex_index[lti] = index of edge above
// edge of brep.m_T[bottom_loop.m_ti[lti]].
// This informtion is needed for singular and seam trims.
ON_SimpleArray<int> top_vertex_index(loop_trim_count);
ON_SimpleArray<int> top_edge_index(loop_trim_count);
ON_SimpleArray<bool> top_trim_bRev3d(loop_trim_count);
for ( lti = 0; lti < loop_trim_count; lti++ )
{
top_vertex_index.Append(-1);
top_edge_index.Append(-1);
top_trim_bRev3d.Append(false);
}
// some (often all of) of the "top" vertices are already on
// the side faces
for ( lti = 0; lti < loop_trim_count; lti++ )
{
if ( side_face_index[lti] >= 0 )
{
const ON_BrepFace& side_face = brep.m_F[side_face_index[lti]];
const ON_BrepLoop& side_loop = brep.m_L[side_face.m_li[0]];
const ON_BrepTrim& side_north_trim = brep.m_T[side_loop.m_ti[2]];
top_vertex_index[lti] = side_north_trim.m_vi[0];
top_vertex_index[(lti+1)%loop_trim_count] = side_north_trim.m_vi[1];
top_edge_index[lti] = side_north_trim.m_ei;
}
else
{
// fix for RR 20423
int lti_prev = (lti+loop_trim_count-1)%loop_trim_count;
int lti_next = (lti+1)%loop_trim_count;
if ( side_face_index[lti_prev] < 0
&& side_face_index[lti_next] < 0
&& top_vertex_index[lti] < 0
&& top_vertex_index[lti_next] < 0
)
{
int bottom_ti_prev = bottom_loop.m_ti[lti_prev];
int bottom_ti = bottom_loop.m_ti[lti];
int bottom_ti_next = bottom_loop.m_ti[lti_next];
if ( bottom_ti >= 0 && bottom_ti < brep.m_T.Count()
&& bottom_ti_prev >= 0 && bottom_ti_prev < brep.m_T.Count()
&& bottom_ti_next >= 0 && bottom_ti_next < brep.m_T.Count()
)
{
const ON_BrepTrim& bottom_trim_prev = brep.m_T[bottom_ti_prev];
const ON_BrepTrim& bottom_trim = brep.m_T[bottom_ti];
const ON_BrepTrim& bottom_trim_next = brep.m_T[bottom_ti_next];
if ( ON_BrepTrim::seam == bottom_trim_prev.m_type
&& ON_BrepTrim::singular == bottom_trim.m_type
&& ON_BrepTrim::seam == bottom_trim_next.m_type
&& bottom_trim.m_vi[0] == bottom_trim.m_vi[1]
)
{
int vi = bottom_trim.m_vi[0];
if ( vi >= 0 && vi < brep.m_V.Count() )
{
ON_BrepVertex& top_vertex = brep.NewVertex(brep.m_V[vi].point+path_vector,0.0);
top_vertex_index[lti] = top_vertex.m_vertex_index;
top_vertex_index[lti_next] = top_vertex_index[lti];
}
}
}
}
}
}
// Fill in the missing "top" vertices that
// are associated with singular and trim edges by looking
// at their neighbors.
{
bool bKeepChecking = true;
while( bKeepChecking )
{
// set back to true if we make a change. This handles the
// (very rare) cases of multiple adjacent singular trims.
//.........这里部分代码省略.........