本文整理汇总了C++中ON_Brep::NewFace方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_Brep::NewFace方法的具体用法?C++ ON_Brep::NewFace怎么用?C++ ON_Brep::NewFace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_Brep
的用法示例。
在下文中一共展示了ON_Brep::NewFace方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeTwistedCubeFace
static void MakeTwistedCubeFace( ON_Brep& brep,
int si, // index of 3d surface
int s_dir, // orientation of surface with respect to brep
//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
)
{
ON_BrepFace& face = brep.NewFace(si);
MakeTwistedCubeTrimmingLoop( brep, face,
//vSWi, vSEi, vNEi, vNWi,
eSi, eS_dir,
eEi, eE_dir,
eNi, eN_dir,
eWi, eW_dir
);
face.m_bRev = (s_dir == -1);
}
示例2: MakeTrimmedFace
static void MakeTrimmedFace( ON_Brep& brep,
int si, // index of 3d surface
int s_dir, // orientation of surface with respect to surfce
int v0, int v1, int v2, // Indices of corner vertices
int e0, // index of first edge
int e0_dir, // orientation of edge
int e1, // index of second edge
int e1_dir, // orientation of edge
int e2, // index of third edge
int e2_dir // orientation of edge
)
{
//Add new face to brep
ON_BrepFace& face = brep.NewFace(si);
//Create loop and trims for the face
MakeTrimmingLoop( brep, face,
v0, v1, v2,
e0, e0_dir,
e1, e1_dir,
e2, e2_dir
);
//Set face direction relative to surface direction
face.m_bRev = (s_dir == -1);
}
示例3: ON_BrepExtrudeHelper_MakeCap
static
bool ON_BrepExtrudeHelper_MakeCap(
ON_Brep& brep,
int bottom_loop_index,
const ON_3dVector path_vector,
const int* side_face_index
)
{
bool bCap = true;
// make cap
if ( !ON_BrepExtrudeHelper_CheckLoop( brep, bottom_loop_index ) )
return false;
brep.m_F.Reserve(brep.m_F.Count() + 1);
brep.m_L.Reserve(brep.m_L.Count() + 1);
const ON_BrepLoop& bottom_loop = brep.m_L[bottom_loop_index];
const ON_BrepFace& bottom_face = brep.m_F[bottom_loop.m_fi];
const ON_Surface* bottom_surface = bottom_face.SurfaceOf();
ON_Surface* top_surface = bottom_surface->Duplicate();
top_surface->Translate( path_vector );
int top_surface_index = brep.AddSurface( top_surface );
ON_BrepFace& top_face = brep.NewFace( top_surface_index );
bCap = ON_BrepExtrudeHelper_MakeTopLoop( brep, top_face, bottom_loop_index, path_vector, side_face_index );
if ( bCap )
{
ON_BrepLoop& top_loop = brep.m_L[brep.m_L.Count()-1];
if ( bottom_loop.m_type == ON_BrepLoop::inner )
{
// we capped an inner boundary
// top_loop.m_type = ON_BrepLoop::outer; // done in ON_BrepExtrudeHelper_MakeTopLoop
brep.FlipLoop(top_loop);
}
else if ( bottom_loop.m_type == ON_BrepLoop::outer )
{
// we capped an outer boundary
// top_loop.m_type = ON_BrepLoop::outer; // done in ON_BrepExtrudeHelper_MakeTopLoop
brep.FlipFace(top_face);
}
}
else
{
// delete partially made cap face
brep.DeleteFace( top_face, false );
delete brep.m_S[top_surface_index];
brep.m_S[top_surface_index] = 0;
}
return bCap;
}
示例4: ON_BrepExtrudeEdge
int ON_BrepExtrudeEdge(
ON_Brep& brep,
int edge_index,
const ON_Curve& path_curve
)
{
ON_3dVector path_vector;
if ( edge_index < 0 && edge_index >= brep.m_E.Count() )
return false;
if ( !ON_BrepExtrudeHelper_CheckPathCurve(path_curve,path_vector) )
return false;
// make sides
bool bRev = false;
ON_SumSurface* sum_srf = ON_BrepExtrudeHelper_MakeSumSrf(
path_curve, brep.m_E[edge_index], bRev );
if ( !sum_srf )
return false;
int vid[4], eid[4], bRev3d[4];
vid[0] = brep.m_E[edge_index].m_vi[bRev?0:1];
vid[1] = brep.m_E[edge_index].m_vi[bRev?1:0];
vid[2] = -1;
vid[3] = -1;
eid[0] = edge_index; // "south side edge"
eid[1] = -1;
eid[2] = -1;
eid[3] = -1;
bRev3d[0] = bRev?0:1;
bRev3d[1] = 0;
bRev3d[2] = 0;
bRev3d[3] = 0;
return brep.NewFace( sum_srf, vid, eid, bRev3d ) ? true : false;
}
示例5: MakeTwistedCubeTrimmingLoop
void
MakeTwistedCubeFace(ON_Brep& brep,
int surf,
int orientation,
int v0, int v1, int v2, int v3, // the indices of corner vertices
int e0, int eo0, // edge index + orientation
int e1, int eo1,
int e2, int eo2,
int e3, int eo3)
{
ON_BrepFace& face = brep.NewFace(surf);
MakeTwistedCubeTrimmingLoop(brep,
face,
v0, v1, v2, v3,
e0, eo0,
e1, eo1,
e2, eo2,
e3, eo3);
// should the normal be reversed?
face.m_bRev = (orientation == -1);
}
示例6: UNUSED
/* TODO - Need to find a more compact, efficient way to
* do this - shouldn't need 24 3d curves... */
ON_Brep *
Cobb_Sphere(double UNUSED(radius), ON_3dPoint *UNUSED(origin))
{
ON_Brep *b = ON_Brep::New();
// Patch 1 of 6
ON_BezierSurface *b1 = ON_CobbSphereFace(0, 0);
ON_NurbsSurface *p1_nurb = ON_NurbsSurface::New();
b1->GetNurbForm(*p1_nurb);
b->NewFace(*p1_nurb);
// Patch 2 of 6
ON_BezierSurface *b2 = ON_CobbSphereFace(90, 0);
ON_NurbsSurface *p2_nurb = ON_NurbsSurface::New();
b2->GetNurbForm(*p2_nurb);
b->NewFace(*p2_nurb);
// Patch 3 of 6
ON_BezierSurface *b3 = ON_CobbSphereFace(180, 0);
ON_NurbsSurface *p3_nurb = ON_NurbsSurface::New();
b3->GetNurbForm(*p3_nurb);
b->NewFace(*p3_nurb);
// Patch 4 of 6
ON_BezierSurface *b4 = ON_CobbSphereFace(270, 0);
ON_NurbsSurface *p4_nurb = ON_NurbsSurface::New();
b4->GetNurbForm(*p4_nurb);
b->NewFace(*p4_nurb);
// Patch 5 of 6
ON_BezierSurface *b5 = ON_CobbSphereFace(90, 90);
ON_NurbsSurface *p5_nurb = ON_NurbsSurface::New();
b5->GetNurbForm(*p5_nurb);
b->NewFace(*p5_nurb);
// Patch 6 of 6
ON_BezierSurface *b6 = ON_CobbSphereFace(90, 270);
ON_NurbsSurface *p6_nurb = ON_NurbsSurface::New();
b6->GetNurbForm(*p6_nurb);
b->NewFace(*p6_nurb);
b->Standardize();
b->Compact();
return b;
}
示例7: ON_BrepConeEdge
int ON_BrepConeEdge(
ON_Brep& brep,
int edge_index,
ON_3dPoint apex_point
)
{
//ON_3dVector path_vector;
if ( edge_index < 0 && edge_index >= brep.m_E.Count() )
return false;
// make sides
ON_NurbsSurface* cone_srf = ON_BrepExtrudeHelper_MakeConeSrf(
apex_point, brep.m_E[edge_index], false );
if ( !cone_srf )
return false;
int vid[4], eid[4], bRev3d[4];
vid[0] = brep.m_E[edge_index].m_vi[0];
vid[1] = brep.m_E[edge_index].m_vi[1];
vid[2] = -1;
vid[3] = -1;
eid[0] = edge_index;
eid[1] = -1;
eid[2] = -1;
eid[3] = -1;
bRev3d[0] = 0;
bRev3d[1] = 0;
bRev3d[2] = 0;
bRev3d[3] = 0;
return brep.NewFace( cone_srf, vid, eid, bRev3d ) ? true : false;
}
示例8:
//.........这里部分代码省略.........
ON_Curve* trimcurve30 = new ON_LineCurve(ON_2dPoint(0, 1), ON_2dPoint(0, 0));
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;
示例9: ON_BrepExtrude
//.........这里部分代码省略.........
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;
}
}
}
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);
}
示例10: ON_BrepConeLoop
bool ON_BrepConeLoop(
ON_Brep& brep,
int loop_index,
ON_3dPoint apex_point
)
{
if ( loop_index < 0 && loop_index >= brep.m_L.Count() )
return false;
int lti, ti, i, vid[4], eid[4], bRev3d[4];
// indices of new faces appended to the side_face_index[] array
// (1 face index for each trim, -1 is used for singular trims)
// count number of new objects so we can grow arrays
// efficiently and use refs to dynamic array elements.
const int loop_trim_count = brep.m_L[loop_index].m_ti.Count();
if ( loop_trim_count == 0 )
return false;
// save input trim and edge counts for use below
const int trim_count0 = brep.m_T.Count();
const int edge_count0 = brep.m_E.Count();
ON_BrepExtrudeHelper_ReserveSpace( brep, loop_trim_count, 0 );
int prev_face_index = -1;
int first_face_east_trim_index = -1;
ON_BrepVertex& apex_vertex = brep.NewVertex( apex_point, 0.0 );
for ( lti = 0; lti < loop_trim_count; lti++ )
{
ON_NurbsSurface* cone_srf = 0;
ti = brep.m_L[loop_index].m_ti[lti];
if ( ti < 0 || ti >= trim_count0 )
continue;
for ( i = 0; i < 4; i++ )
{
vid[i] = -1;
eid[i] = -1;
}
bRev3d[0] = false;
bRev3d[1] = false;
bRev3d[2] = false;
bRev3d[3] = false;
// get side surface for new face
// get side surface for new face
{
ON_BrepTrim& trim = brep.m_T[ti];
if ( trim.m_ei >= 0 && trim.m_ei < edge_count0 )
{
const ON_BrepEdge& base_edge = brep.m_E[trim.m_ei];
// connect new face to existing topology on trim
vid[0] = trim.m_vi[1];
vid[1] = trim.m_vi[0];
eid[0] = base_edge.m_edge_index;
bRev3d[0] = (trim.m_bRev3d?false:true);
cone_srf = ON_BrepExtrudeHelper_MakeConeSrf( apex_point, base_edge, bRev3d[0] );
}
}
if ( !cone_srf )
continue;
vid[2] = apex_vertex.m_vertex_index;
vid[3] = apex_vertex.m_vertex_index;
if ( prev_face_index >= 0 )
{
const ON_BrepTrim& prev_west_trim = brep.m_T[ brep.m_L[ brep.m_F[prev_face_index].m_li[0]].m_ti[3] ];
vid[2] = prev_west_trim.m_vi[0];
eid[1] = prev_west_trim.m_ei;
bRev3d[1] = (prev_west_trim.m_bRev3d?false:true);
}
if ( first_face_east_trim_index >= 0 && brep.m_T[first_face_east_trim_index].m_vi[0] == vid[0] )
{
const ON_BrepTrim& first_face_east_trim = brep.m_T[first_face_east_trim_index];
vid[3] = first_face_east_trim.m_vi[1];
eid[3] = first_face_east_trim.m_ei;
bRev3d[3] = (first_face_east_trim.m_bRev3d?false:true);
}
const ON_BrepFace* side_face = brep.NewFace(cone_srf,vid,eid,bRev3d);
if ( side_face )
{
prev_face_index = side_face->m_face_index;
if ( first_face_east_trim_index < 0 )
first_face_east_trim_index = brep.m_L[ side_face->m_li[0] ].m_ti[1];
}
}
return true;
}
示例11: ON_BrepExtrudeHelper_MakeSides
static
ON_BOOL32 ON_BrepExtrudeHelper_MakeSides(
ON_Brep& brep,
int loop_index,
const ON_Curve& path_curve,
ON_BOOL32 bCap,
ON_SimpleArray<int>& side_face_index
)
{
int lti, ti, i, vid[4], eid[4], bRev3d[4];
// indices of new faces appended to the side_face_index[] array
// (1 face index for each trim, -1 is used for singular trims)
// count number of new objects so we can grow arrays
// efficiently and use refs to dynamic array elements.
const int loop_trim_count = brep.m_L[loop_index].m_ti.Count();
if ( loop_trim_count == 0 )
return false;
// save input trim and edge counts for use below
const int trim_count0 = brep.m_T.Count();
const int edge_count0 = brep.m_E.Count();
ON_BrepExtrudeHelper_ReserveSpace( brep, loop_trim_count, bCap?1:0 );
side_face_index.Reserve( side_face_index.Count() + loop_trim_count); // index of new face above brep.m_L[loop_index].m_ti[lti]
int prev_face_index = -1;
int first_face_east_trim_index = -1;
for ( lti = 0; lti < loop_trim_count; lti++ )
{
ON_SumSurface* sum_srf = 0;
side_face_index.Append(-1);
ti = brep.m_L[loop_index].m_ti[lti];
if ( ti < 0 || ti >= trim_count0 )
continue;
for ( i = 0; i < 4; i++ )
{
vid[i] = -1;
eid[i] = -1;
}
bRev3d[0] = false;
bRev3d[1] = false;
bRev3d[2] = false;
bRev3d[3] = false;
// get side surface for new face
{
ON_BrepTrim& trim = brep.m_T[ti];
if ( trim.m_ei >= 0 && trim.m_ei < edge_count0 )
{
const ON_BrepEdge& base_edge = brep.m_E[trim.m_ei];
// 5 September, 2003 Dale Lear
// do not extrude seams - fixes rectangle slabe bug
if ( trim.m_type == ON_BrepTrim::seam )
{
prev_face_index = -1;
continue;
}
// connect new face to existing topology on trim
vid[0] = trim.m_vi[1];
vid[1] = trim.m_vi[0];
eid[0] = base_edge.m_edge_index;
bRev3d[0] = (trim.m_bRev3d?false:true);
sum_srf = ON_BrepExtrudeHelper_MakeSumSrf( path_curve, base_edge, trim.m_bRev3d );
}
}
if ( !sum_srf )
continue;
if ( prev_face_index >= 0 )
{
const ON_BrepTrim& prev_west_trim = brep.m_T[ brep.m_L[ brep.m_F[prev_face_index].m_li[0]].m_ti[3] ];
vid[2] = prev_west_trim.m_vi[0];
eid[1] = prev_west_trim.m_ei;
bRev3d[1] = (prev_west_trim.m_bRev3d?false:true);
}
if ( first_face_east_trim_index >= 0 && brep.m_T[first_face_east_trim_index].m_vi[0] == vid[0] )
{
const ON_BrepTrim& first_face_east_trim = brep.m_T[first_face_east_trim_index];
vid[3] = first_face_east_trim.m_vi[1];
eid[3] = first_face_east_trim.m_ei;
bRev3d[3] = (first_face_east_trim.m_bRev3d?false:true);
}
const ON_BrepFace* side_face = brep.NewFace(sum_srf,vid,eid,bRev3d);
if ( side_face )
{
*side_face_index.Last() = side_face->m_face_index;
prev_face_index = side_face->m_face_index;
if ( first_face_east_trim_index < 0 )
first_face_east_trim_index = brep.m_L[ side_face->m_li[0] ].m_ti[1];
}
}
return true;
}