本文整理汇总了C++中ON_Brep::AddEdgeCurve方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_Brep::AddEdgeCurve方法的具体用法?C++ ON_Brep::AddEdgeCurve怎么用?C++ ON_Brep::AddEdgeCurve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_Brep
的用法示例。
在下文中一共展示了ON_Brep::AddEdgeCurve方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ON_BrepExtrudeVertex
int ON_BrepExtrudeVertex(
ON_Brep& brep,
int vertex_index,
const ON_Curve& path_curve
)
{
ON_3dVector path_vector;
if ( vertex_index < 0 && vertex_index >= brep.m_V.Count() )
return false;
if ( !ON_BrepExtrudeHelper_CheckPathCurve(path_curve,path_vector) )
return false;
ON_Curve* c3 = path_curve.Duplicate();
brep.m_V.Reserve( brep.m_V.Count() + 1 );
ON_BrepVertex& v0 = brep.m_V[vertex_index];
ON_BrepVertex& v1 = brep.NewVertex( v0.point + path_vector, 0.0 );
c3->Translate( v0.point - c3->PointAtStart() );
int c3i = brep.AddEdgeCurve( c3 );
ON_BrepEdge& edge = brep.NewEdge( v0, v1, c3i );
edge.m_tolerance = 0.0;
return true;
}
示例2: SplitSeam
static
bool SplitSeam( ON_Brep& brep,
ON_BrepTrim& trimA, ON_BrepTrim& trimB,
ON_BrepTrim& prevtrimB,
ON_BrepTrim& nexttrimB,
int vcount0 // number of verts before singular fixups
)
{
if ( trimA.m_trim_index == trimB.m_trim_index )
return false;
if ( trimA.m_trim_index == prevtrimB.m_trim_index )
return false;
if ( trimA.m_trim_index == nexttrimB.m_trim_index )
return false;
if ( trimB.m_trim_index == prevtrimB.m_trim_index )
return false;
if ( trimB.m_trim_index == nexttrimB.m_trim_index )
return false;
if ( prevtrimB.m_trim_index == nexttrimB.m_trim_index )
return false;
if ( trimA.m_type != ON_BrepTrim::seam )
return false;
if ( trimB.m_type != ON_BrepTrim::seam )
return false;
if ( trimA.m_ei != trimB.m_ei )
return false;
if ( trimA.m_vi[0] != trimB.m_vi[1]
&& trimA.m_vi[0] < vcount0
&& trimB.m_vi[1] < vcount0 )
return false;
if ( trimA.m_vi[1] != trimB.m_vi[0]
&& trimA.m_vi[1] < vcount0
&& trimB.m_vi[0] < vcount0 )
return false;
if ( prevtrimB.m_vi[1] != trimB.m_vi[0]
&& prevtrimB.m_vi[1] < vcount0
&& trimB.m_vi[0] < vcount0 )
return false;
if ( nexttrimB.m_vi[0] != trimB.m_vi[1]
&& prevtrimB.m_vi[0] < vcount0
&& trimB.m_vi[1] < vcount0 )
return false;
if ( trimA.m_li != trimB.m_li )
return false;
if ( trimA.m_li != prevtrimB.m_li )
return false;
if ( trimA.m_li != nexttrimB.m_li )
return false;
if ( trimA.m_bRev3d == trimB.m_bRev3d )
return false;
const ON_Surface* srf = trimA.SurfaceOf();
if ( 0 == srf )
return false;
ON_BrepEdge* edgeA = brep.Edge(trimA.m_ei);
if ( 0 == edgeA )
return false;
if ( edgeA->m_ti.Count() != 2 )
return false;
if ( edgeA->m_ti[0] != trimA.m_trim_index && edgeA->m_ti[1] != trimA.m_trim_index )
return false;
if ( edgeA->m_ti[0] != trimB.m_trim_index && edgeA->m_ti[1] != trimB.m_trim_index )
return false;
// reserve space now so the vA0 and vA1 pointers
// will be valid if m_V[] is grown.
brep.m_V.Reserve( brep.m_V.Count()+2 );
ON_BrepVertex* vA0 = brep.Vertex(trimA.m_vi[0]);
if ( 0 == vA0 )
return false;
ON_BrepVertex* vA1 = brep.Vertex(trimA.m_vi[1]);
if ( 0 == vA1 )
return false;
// looks like we have a valid seam to blow apart
// get a new 3d curve for trimB
ON_Curve* cB3 = PushUpIsoTrim( brep, trimB );
if ( 0 == cB3 )
return false;
int c3i = brep.AddEdgeCurve(cB3);
vA0->m_tolerance = ON_UNSET_VALUE;
vA1->m_tolerance = ON_UNSET_VALUE;
// make new vertices for trimB
ON_BrepVertex* vB0 = 0;
ON_BrepVertex* vB1 = 0;
ON_3dPoint PA, PB;
bool bSame = false;
if (brep.GetTrim3dStart(trimB.m_trim_index, PB) && brep.GetTrim3dEnd(trimA.m_trim_index, PA))
bSame = PB.DistanceTo(PA) < ON_ZERO_TOLERANCE;
if (bSame || trimB.m_vi[0] != trimA.m_vi[1] )
{
// sing fixups have already blown apart this end
vB0 = brep.Vertex( trimB.m_vi[0] );
}
//.........这里部分代码省略.........
示例3: ChangeTrimSingToBdry
static
bool ChangeTrimSingToBdry( ON_Brep& brep, ON_BrepTrim& trim, ON_BrepTrim* nexttrim )
{
if ( trim.m_vi[0] != trim.m_vi[1] )
return false;
if ( trim.m_type != ON_BrepTrim::singular )
return false;
if ( trim.m_ei >= 0 )
return false;
const ON_Surface* srf = trim.SurfaceOf();
if ( 0 == srf )
return false;
brep.m_V.Reserve( brep.m_V.Count() + 1 );
ON_BrepVertex* v0 = brep.Vertex(trim.m_vi[0]);
if ( 0 == v0 )
return false;
// get new 3d curve
ON_Curve* c3 = PushUpIsoTrim( brep, trim );
if ( 0 == c3 )
return false;
// valid singular trim can be changed to non-singular trim
// create new vertex for end of this trim
v0->m_tolerance = ON_UNSET_VALUE;
ON_BrepVertex* v1 = 0;
if ( c3->IsClosed() )
{
// 3d edge is closed so start and end vertex are still the same.
v1 = v0;
}
else
{
// new 3d edge is not closed, so the single singular vertex
// needs to be "split" into two vertices.
brep.NewVertex();
v1 = brep.m_V.Last();
}
trim.m_vi[1] = v1->m_vertex_index;
// update the start of the next trim to use new vertex
if ( nexttrim && nexttrim->m_trim_index != trim.m_trim_index )
{
ChangeTrimVertex( brep, *nexttrim, 0, v0->m_vertex_index, v1->m_vertex_index, true, true );
}
// make a new edge
int ci = brep.AddEdgeCurve(c3);
c3 = 0;
ON_BrepEdge& edge = brep.NewEdge(*v0,*v1,ci);
edge.m_tolerance = 0.0;
// hook trim to new edge
trim.m_type = ON_BrepTrim::boundary;
trim.m_bRev3d = false;
trim.m_ei = edge.m_edge_index;
edge.m_ti.Append(trim.m_trim_index);
return true;
}
示例4: ON_BrepExtrude
//.........这里部分代码省略.........
if ( !topvimap[bottomvi0] )
{
const ON_BrepVertex& bottomv = brep.m_V[bottomvi0];
ON_BrepVertex& topv = brep.NewVertex(bottomv.point+height,bottomv.m_tolerance);
topvimap[bottomvi0] = topv.m_vertex_index;
}
if ( !topvimap[bottomvi1] )
{
const ON_BrepVertex& bottomv = brep.m_V[bottomvi1];
ON_BrepVertex& topv = brep.NewVertex(bottomv.point+height,bottomv.m_tolerance);
topvimap[bottomvi1] = topv.m_vertex_index;
}
}
}
}
// build top edges
int* topeimap = ws.GetIntMemory(ecount0);
memset(topeimap,0,ecount0*sizeof(topeimap[0]));
if ( bOK ) for ( ei = 0; ei < ecount0; ei++ )
{
if ( bCap || bSideEdge[ei] )
{
const ON_BrepEdge& bottome = brep.m_E[ei];
ON_BrepVertex& topv0 = brep.m_V[topvimap[bottome.m_vi[0]]];
ON_BrepVertex& topv1 = brep.m_V[topvimap[bottome.m_vi[1]]];
ON_Curve* c3 = bottome.DuplicateCurve();
if ( !c3 )
{
bOK = false;
break;
}
c3->Transform(tr);
int c3i = brep.AddEdgeCurve(c3);
ON_BrepEdge& tope = brep.NewEdge(topv0,topv1,c3i,0,bottome.m_tolerance);
topeimap[ei] = tope.m_edge_index;
}
}
// build side edges
int* sideveimap = ws.GetIntMemory(vcount0);
memset(sideveimap,0,vcount0*sizeof(sideveimap[0]));
if ( bOK ) for ( vi = 0; vi < vcount0; vi++ )
{
ON_BrepVertex& bottomv = brep.m_V[vi];
for ( int vei = 0; vei < bottomv.m_ei.Count(); vei++ )
{
if ( bSideEdge[bottomv.m_ei[vei]] && topvimap[vi] )
{
ON_BrepVertex& topv = brep.m_V[topvimap[vi]];
ON_Curve* c3 = path_curve.DuplicateCurve();
if ( !c3 )
{
bOK = false;
}
else
{
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;
}
}
示例5: ON_BrepExtrudeHelper_MakeTopLoop
//.........这里部分代码省略.........
break;
}
}
}
}
}
}
// Fill in missing edges of "seam" trims.
for ( lti = 0; lti < loop_trim_count; lti++ )
{
if ( -1 != top_edge_index[lti] )
continue;
int bottom_ti = bottom_loop.m_ti[lti];
if ( bottom_ti < 0 || bottom_ti >= brep.m_T.Count() )
continue;
const ON_BrepTrim& bottom_trim = brep.m_T[bottom_ti];
if ( ON_BrepTrim::seam != bottom_trim.m_type )
continue;
if ( bottom_trim.m_ei < 0 )
continue;
if ( bottom_trim.m_ei >= brep.m_E.Count() )
continue;
// duplicate bottom edge curve
const ON_BrepEdge& bottom_edge = brep.m_E[bottom_trim.m_ei];
ON_Curve* top_c3 = bottom_edge.DuplicateCurve();
if ( 0 == top_c3 )
continue;
// move new edge curve to top location
top_c3->Translate(path_vector);
ON_3dPoint P0 = top_c3->PointAtStart();
ON_3dPoint P1 = top_c3->PointAtEnd();
int top_c3i = brep.AddEdgeCurve(top_c3);
top_c3 = 0;
// get vertices at start/end of the new edge
int e_vi0 = top_vertex_index[lti];
int e_vi1 = top_vertex_index[(lti+1)%loop_trim_count];
if ( bottom_trim.m_bRev3d )
{
// put points in trim order
ON_3dPoint tmp_P = P0; P0 = P1; P1 = tmp_P;
}
if ( e_vi0 < 0 )
{
e_vi0 = brep.NewVertex(P0).m_vertex_index;
top_vertex_index[lti] = e_vi0;
}
if ( e_vi1 < 0 )
{
e_vi1 = brep.NewVertex(P1).m_vertex_index;
top_vertex_index[(lti+1)%loop_trim_count] = e_vi1;
}
if ( bottom_trim.m_bRev3d )
{
// put edge vertex indices in edge order
int tmp_i = e_vi0; e_vi0 = e_vi1; e_vi1 = tmp_i;
}
ON_BrepEdge& top_edge = brep.NewEdge(brep.m_V[e_vi0],brep.m_V[e_vi1],top_c3i);
top_edge.m_tolerance = bottom_edge.m_tolerance;
top_edge_index[lti] = top_edge.m_edge_index;
top_trim_bRev3d[lti] = bottom_trim.m_bRev3d?true:false;
// find seam mate and set it's
// top_edge_index[] to top_edge.m_edge_index.
int mate_lti;