本文整理汇总了C++中BRep_Builder::UpdateVertex方法的典型用法代码示例。如果您正苦于以下问题:C++ BRep_Builder::UpdateVertex方法的具体用法?C++ BRep_Builder::UpdateVertex怎么用?C++ BRep_Builder::UpdateVertex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BRep_Builder
的用法示例。
在下文中一共展示了BRep_Builder::UpdateVertex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTolerance
PyObject* TopoShapeVertexPy::setTolerance(PyObject *args)
{
double tol;
if (!PyArg_ParseTuple(args, "d", &tol))
return 0;
BRep_Builder aBuilder;
const TopoDS_Vertex& v = TopoDS::Vertex(getTopoShapePtr()->getShape());
aBuilder.UpdateVertex(v, tol);
Py_Return;
}
示例2: MergeEdges
//=======================================================================
//function : MergeEdges
//purpose : auxilary
//=======================================================================
static Standard_Boolean MergeEdges(const TopTools_SequenceOfShape& SeqEdges,
const TopoDS_Face& aFace,
const Standard_Real Tol,
TopoDS_Edge& anEdge)
{
// make chain for union
BRep_Builder B;
ShapeAnalysis_Edge sae;
TopoDS_Edge FirstE = TopoDS::Edge(SeqEdges.Value(1));
TopoDS_Edge LastE = FirstE;
TopoDS_Vertex VF = sae.FirstVertex(FirstE);
TopoDS_Vertex VL = sae.LastVertex(LastE);
TopTools_SequenceOfShape aChain;
aChain.Append(FirstE);
TColStd_MapOfInteger IndUsedEdges;
IndUsedEdges.Add(1);
Standard_Integer j;
for(j=2; j<=SeqEdges.Length(); j++) {
for(Standard_Integer k=2; k<=SeqEdges.Length(); k++) {
if(IndUsedEdges.Contains(k)) continue;
TopoDS_Edge edge = TopoDS::Edge(SeqEdges.Value(k));
TopoDS_Vertex VF2 = sae.FirstVertex(edge);
TopoDS_Vertex VL2 = sae.LastVertex(edge);
if(sae.FirstVertex(edge).IsSame(VL)) {
aChain.Append(edge);
LastE = edge;
VL = sae.LastVertex(LastE);
IndUsedEdges.Add(k);
}
else if(sae.LastVertex(edge).IsSame(VF)) {
aChain.Prepend(edge);
FirstE = edge;
VF = sae.FirstVertex(FirstE);
IndUsedEdges.Add(k);
}
}
}
if(aChain.Length()<SeqEdges.Length()) {
MESSAGE ("can not create correct chain...");
return Standard_False;
}
// union edges in chain
// first step: union lines and circles
TopLoc_Location Loc;
Standard_Real fp1,lp1,fp2,lp2;
for(j=1; j<aChain.Length(); j++) {
TopoDS_Edge edge1 = TopoDS::Edge(aChain.Value(j));
Handle(Geom_Curve) c3d1 = BRep_Tool::Curve(edge1,Loc,fp1,lp1);
if(c3d1.IsNull()) break;
while(c3d1->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
Handle(Geom_TrimmedCurve) tc =
Handle(Geom_TrimmedCurve)::DownCast(c3d1);
c3d1 = tc->BasisCurve();
}
TopoDS_Edge edge2 = TopoDS::Edge(aChain.Value(j+1));
Handle(Geom_Curve) c3d2 = BRep_Tool::Curve(edge2,Loc,fp2,lp2);
if(c3d2.IsNull()) break;
while(c3d2->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
Handle(Geom_TrimmedCurve) tc =
Handle(Geom_TrimmedCurve)::DownCast(c3d2);
c3d2 = tc->BasisCurve();
}
if( c3d1->IsKind(STANDARD_TYPE(Geom_Line)) && c3d2->IsKind(STANDARD_TYPE(Geom_Line)) ) {
// union lines
Handle(Geom_Line) L1 = Handle(Geom_Line)::DownCast(c3d1);
Handle(Geom_Line) L2 = Handle(Geom_Line)::DownCast(c3d2);
gp_Dir Dir1 = L1->Position().Direction();
gp_Dir Dir2 = L2->Position().Direction();
//if(!Dir1.IsEqual(Dir2,Precision::Angular())) {
//if(!Dir1.IsParallel(Dir2,Precision::Angular())) {
if(!Dir1.IsParallel(Dir2,Tol)) {
continue;
}
// can union lines => create new edge
TopoDS_Vertex V1 = sae.FirstVertex(edge1);
gp_Pnt PV1 = BRep_Tool::Pnt(V1);
TopoDS_Vertex V2 = sae.LastVertex(edge2);
gp_Pnt PV2 = BRep_Tool::Pnt(V2);
gp_Vec Vec(PV1,PV2);
Handle(Geom_Line) L = new Geom_Line(gp_Ax1(PV1,Vec));
Standard_Real dist = PV1.Distance(PV2);
Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(L,0.0,dist);
TopoDS_Edge E;
B.MakeEdge (E,tc,Precision::Confusion());
B.Add (E,V1); B.Add (E,V2);
B.UpdateVertex(V1, 0., E, 0.);
B.UpdateVertex(V2, dist, E, 0.);
//ShapeFix_Edge sfe;
//sfe.FixAddPCurve(E,aFace,Standard_False);
//sfe.FixSameParameter(E);
aChain.Remove(j);
aChain.SetValue(j,E);
j--;
}
if( c3d1->IsKind(STANDARD_TYPE(Geom_Circle)) && c3d2->IsKind(STANDARD_TYPE(Geom_Circle)) ) {
// union circles
//.........这里部分代码省略.........
示例3: PerformVE
//=======================================================================
// function: PerformVE
// purpose:
//=======================================================================
void NMTTools_PaveFiller::PerformVE()
{
myIsDone=Standard_False;
//
Standard_Boolean bJustAdd;
Standard_Integer n1, n2, anIndexIn, aFlag, aWhat;
Standard_Integer aWith, aNbVEs, aBlockLength, iSDV, nV1;
Standard_Real aT;
#if OCC_VERSION_LARGE > 0x06030008
// In OCCT6.3.0sp9 is changed a signature of IntTools_Context::ComputeVE() method
Standard_Boolean bToUpdateVertex;
Standard_Real aDist;
#endif
TopoDS_Vertex aV1;
TopoDS_Edge aE2;
BOPTools_IndexedMapOfCoupleOfInteger aSnareMap;
BOPTools_CoupleOfInteger aCouple;
//
BOPTools_CArray1OfVEInterference& aVEs=myIP->VEInterferences();
//
myDSIt->Initialize (TopAbs_VERTEX, TopAbs_EDGE);
//
// BlockLength correction
aNbVEs=myDSIt->BlockLength();
aBlockLength=aVEs.BlockLength();
if (aNbVEs > aBlockLength) {
aVEs.SetBlockLength(aNbVEs);
}
//
for (; myDSIt->More(); myDSIt->Next()) {
myDSIt->Current(n1, n2, bJustAdd);
if (!IsSuccessorsComputed(n1, n2)) {
anIndexIn=0;
aWhat=n1; // Vertex
aWith=n2; // Edge
if (myDS->GetShapeType(n1)==TopAbs_EDGE) {
aWhat=n2;
aWith=n1;
}
//
if(bJustAdd) {
continue;
}
// Edge
aE2=TopoDS::Edge(myDS->Shape(aWith));
if (BRep_Tool::Degenerated(aE2)){
continue;
}
// Vertex
nV1=aWhat;
aV1=TopoDS::Vertex(myDS->Shape(aWhat));
//
iSDV=FindSDVertex(aWhat);
if (iSDV) {
nV1=iSDV;
aV1=TopoDS::Vertex(myDS->Shape(nV1));
// Modified to find same domain vertex Thu Sep 14 14:35:18 2006
// Contribution of Samtech www.samcef.com BEGIN
Standard_Integer nVE, iSDVE, iRet;
//
BooleanOperations_OnceExplorer aExp(*myDS);
iRet=0;
aExp.Init(aWith, TopAbs_VERTEX);
for (; aExp.More(); aExp.Next()) {
nVE=aExp.Current();
iSDVE=FindSDVertex(nVE);
if (iSDVE==iSDV) {
iRet=1;
break;
}
}
if (iRet) {
continue;
}
}
else {
if (Contains(aE2, aV1)) {
continue;
}
// Contribution of Samtech www.samcef.com END
}
//
//modified by NIZNHY-PKV Mon Dec 28 08:58:05 2009f
#if OCC_VERSION_LARGE > 0x06030008
// In OCCT6.3.0sp9 is changed a signature of IntTools_Context::ComputeVE() method
aFlag = myContext->ComputeVE (aV1, aE2, aT, bToUpdateVertex, aDist);
#else
aFlag = myContext->ComputeVE (aV1, aE2, aT);
#endif
//modified by NIZNHY-PKV Mon Dec 28 08:58:13 2009t
//
if (!aFlag) {
// Add Interference to the Pool
BOPTools_VEInterference anInterf (aWhat, aWith, aT);
anIndexIn=aVEs.Append(anInterf);
//
//.........这里部分代码省略.........