本文整理汇总了C++中TopoDS_Edge::IsSame方法的典型用法代码示例。如果您正苦于以下问题:C++ TopoDS_Edge::IsSame方法的具体用法?C++ TopoDS_Edge::IsSame怎么用?C++ TopoDS_Edge::IsSame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TopoDS_Edge
的用法示例。
在下文中一共展示了TopoDS_Edge::IsSame方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PerformEdges
bool Edgecluster::PerformEdges(gp_Pnt& point)
{
tMapPntEdge::iterator iter = m_vertices.find(point);
if ( iter == m_vertices.end() )
return false;
tEdgeVector& edges = iter->second;
tEdgeVector::iterator edgeIt = edges.begin();
//no more edges. pb
if ( edgeIt == edges.end() )
{
//Delete also the current vertex
m_vertices.erase(iter);
return false;
}
TopoDS_Edge theEdge = *edgeIt;
//we are storing the edge, so remove it from the vertex association
edges.erase(edgeIt);
//if no more edges, remove the vertex
if ( edges.empty() )
m_vertices.erase(iter);
TopoDS_Vertex V1,V2;
TopExp::Vertices(theEdge,V1,V2);
gp_Pnt P1 = BRep_Tool::Pnt(V1);
gp_Pnt P2 = BRep_Tool::Pnt(V2);
if ( theEdge.Orientation() == TopAbs_REVERSED )
{
//switch the points
gp_Pnt tmpP = P1;
P1 = P2;
P2 = tmpP;
}
gp_Pnt nextPoint;
if ( P2.IsEqual(point,0.2) )
{
//need to reverse the edge
theEdge.Reverse();
nextPoint = P1;
}
else
{
nextPoint = P2;
}
//need to erase the edge from the second point
iter = m_vertices.find(nextPoint);
if ( iter != m_vertices.end() )
{
tEdgeVector& nextEdges = iter->second;
for ( edgeIt = nextEdges.begin() ; edgeIt != nextEdges.end(); ++edgeIt )
{
if ( theEdge.IsSame(*edgeIt) )
{
nextEdges.erase(edgeIt);
break;
}
}
}
//put the edge at the end of the list
m_edges.push_back(theEdge);
//Update the point for the next do-while loop
point = nextPoint;
return true;
}
示例2: LoadNodeColumns
bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap & theParam2ColumnMap,
const TopoDS_Face& theFace,
const TopoDS_Edge& theBaseEdge,
SMESHDS_Mesh* theMesh)
{
// get vertices of theBaseEdge
TopoDS_Vertex vfb, vlb, vft; // first and last, bottom and top vertices
TopoDS_Edge eFrw = TopoDS::Edge( theBaseEdge.Oriented( TopAbs_FORWARD ));
TopExp::Vertices( eFrw, vfb, vlb );
// find the other edges of theFace and orientation of e1
TopoDS_Edge e1, e2, eTop;
bool rev1, CumOri = false;
TopExp_Explorer exp( theFace, TopAbs_EDGE );
int nbEdges = 0;
for ( ; exp.More(); exp.Next() ) {
if ( ++nbEdges > 4 ) {
return false; // more than 4 edges in theFace
}
TopoDS_Edge e = TopoDS::Edge( exp.Current() );
if ( theBaseEdge.IsSame( e ))
continue;
TopoDS_Vertex vCommon;
if ( !TopExp::CommonVertex( theBaseEdge, e, vCommon ))
eTop = e;
else if ( vCommon.IsSame( vfb )) {
e1 = e;
vft = TopExp::LastVertex( e1, CumOri );
rev1 = vfb.IsSame( vft );
if ( rev1 )
vft = TopExp::FirstVertex( e1, CumOri );
}
else
e2 = e;
}
if ( nbEdges < 4 ) {
return false; // less than 4 edges in theFace
}
if ( e2.IsNull() && vfb.IsSame( vlb ))
e2 = e1;
// submeshes corresponding to shapes
SMESHDS_SubMesh* smFace = theMesh->MeshElements( theFace );
SMESHDS_SubMesh* smb = theMesh->MeshElements( theBaseEdge );
SMESHDS_SubMesh* smt = theMesh->MeshElements( eTop );
SMESHDS_SubMesh* sm1 = theMesh->MeshElements( e1 );
SMESHDS_SubMesh* sm2 = theMesh->MeshElements( e2 );
SMESHDS_SubMesh* smVfb = theMesh->MeshElements( vfb );
SMESHDS_SubMesh* smVlb = theMesh->MeshElements( vlb );
SMESHDS_SubMesh* smVft = theMesh->MeshElements( vft );
if (!smFace || !smb || !smt || !sm1 || !sm2 || !smVfb || !smVlb || !smVft ) {
RETURN_BAD_RESULT( "NULL submesh " <<smFace<<" "<<smb<<" "<<smt<<" "<<
sm1<<" "<<sm2<<" "<<smVfb<<" "<<smVlb<<" "<<smVft);
}
if ( smb->NbNodes() != smt->NbNodes() || sm1->NbNodes() != sm2->NbNodes() ) {
RETURN_BAD_RESULT(" Diff nb of nodes on opposite edges" );
}
if (smVfb->NbNodes() != 1 || smVlb->NbNodes() != 1 || smVft->NbNodes() != 1) {
RETURN_BAD_RESULT("Empty submesh of vertex");
}
// define whether mesh is quadratic
bool isQuadraticMesh = false;
SMDS_ElemIteratorPtr eIt = smFace->GetElements();
if ( !eIt->more() ) {
RETURN_BAD_RESULT("No elements on the face");
}
const SMDS_MeshElement* e = eIt->next();
isQuadraticMesh = e->IsQuadratic();
if ( sm1->NbNodes() * smb->NbNodes() != smFace->NbNodes() ) {
// check quadratic case
if ( isQuadraticMesh ) {
// what if there are quadrangles and triangles mixed?
// int n1 = sm1->NbNodes()/2;
// int n2 = smb->NbNodes()/2;
// int n3 = sm1->NbNodes() - n1;
// int n4 = smb->NbNodes() - n2;
// int nf = sm1->NbNodes()*smb->NbNodes() - n3*n4;
// if( nf != smFace->NbNodes() ) {
// MESSAGE( "Wrong nb face nodes: " <<
// sm1->NbNodes()<<" "<<smb->NbNodes()<<" "<<smFace->NbNodes());
// return false;
// }
}
else {
RETURN_BAD_RESULT( "Wrong nb face nodes: " <<
sm1->NbNodes()<<" "<<smb->NbNodes()<<" "<<smFace->NbNodes());
}
}
// IJ size
int vsize = sm1->NbNodes() + 2;
int hsize = smb->NbNodes() + 2;
if(isQuadraticMesh) {
vsize = vsize - sm1->NbNodes()/2 -1;
hsize = hsize - smb->NbNodes()/2 -1;
}
// load nodes from theBaseEdge
std::set<const SMDS_MeshNode*> loadedNodes;
//.........这里部分代码省略.........
示例3: update_OCC_entity
//----------------------------------------------------------------
// Function: TopoDS_Shape level function to update the core Surface
// for any movement or Boolean operation of the body.
// Author: Jane Hu
//----------------------------------------------------------------
CubitStatus OCCSurface::update_OCC_entity(TopoDS_Face& old_surface,
TopoDS_Shape& new_surface,
BRepBuilderAPI_MakeShape *op,
TopoDS_Vertex* removed_vertex,
LocOpe_SplitShape* sp)
{
//set the Wires
TopTools_IndexedMapOfShape M, M2;
TopoDS_Shape shape, shape2, shape_edge, shape_vertex;
TopExp::MapShapes(old_surface, TopAbs_WIRE, M);
TopTools_ListOfShape shapes;
BRepFilletAPI_MakeFillet2d* test_op = NULL;
for (int ii=1; ii<=M.Extent(); ii++)
{
TopoDS_Wire wire = TopoDS::Wire(M(ii));
TopTools_ListOfShape shapes;
if(op)
{
test_op = dynamic_cast<BRepFilletAPI_MakeFillet2d*>(op);
if(!test_op)
shapes.Assign(op->Modified(wire));
if(shapes.Extent() == 0)
shapes.Assign(op->Generated(wire));
if(!new_surface.IsNull())
TopExp::MapShapes(new_surface,TopAbs_WIRE, M2);
}
else if(sp)
shapes.Assign(sp->DescendantShapes(wire));
if (shapes.Extent() == 1)
{
shape = shapes.First();
if(M2.Extent() == 1)
{
shape2 = TopoDS::Wire(M2(1));
if(!shape.IsSame(shape2))
shape = shape2;
}
else if(M2.Extent() > 1)
shape.Nullify();
}
else if(shapes.Extent() > 1)
shape.Nullify();
else if(op->IsDeleted(wire) || shapes.Extent() == 0)
{
TopTools_IndexedMapOfShape M_new;
TopExp::MapShapes(new_surface, TopAbs_WIRE, M_new);
if (M_new.Extent()== 1)
shape = M_new(1);
else
shape.Nullify();
}
else
{
shape = wire;
continue;
}
//set curves
BRepTools_WireExplorer Ex;
for(Ex.Init(wire); Ex.More();Ex.Next())
{
TopoDS_Edge edge = Ex.Current();
if(op && !test_op)
{
shapes.Assign(op->Modified(edge));
if(shapes.Extent() == 0)
shapes.Assign(op->Generated(edge));
}
else if(sp)
shapes.Assign(sp->DescendantShapes(edge));
if (shapes.Extent() == 1)
{
//in fillet creating mothod, one edge could generated a face, so check
//it here.
TopAbs_ShapeEnum type = shapes.First().TShape()->ShapeType();
if(type != TopAbs_EDGE)
shape_edge.Nullify();
else
shape_edge = shapes.First();
}
else if (shapes.Extent() > 1)
{
//update all attributes first.
TopTools_ListIteratorOfListOfShape it;
it.Initialize(shapes);
for(; it.More(); it.Next())
{
shape_edge = it.Value();
OCCQueryEngine::instance()->copy_attributes(edge, shape_edge);
//.........这里部分代码省略.........