- if (sameUV)
- {
- // 1. est-ce vraiment sameUV sans etre denegere
- gp_Pnt2d uvF, uvL;
- C2d->D0(first, uvF);
- C2d->D0(last, uvL);
- if (!uvFirst.IsEqual(uvF, Precision::PConfusion())) {
- uvFirst = uvF;
- }
- if (!uvLast.IsEqual(uvL, Precision::PConfusion())) {
- uvLast = uvL;
- }
- }
-
- const TColgp_Array1OfPnt& Nodes = T->Nodes();
- const TColStd_Array1OfInteger& Indices = Poly->Nodes();
- Handle(TColStd_HArray1OfReal) Param = Poly->Parameters();
-
- const Standard_Integer nbnodes = Indices.Length();
- TColStd_Array1OfInteger NewNodes(1, nbnodes);
- TColStd_Array1OfInteger NewNodInStruct(1, nbnodes);
-
- gp_Pnt P3d;
- gp_XY theUV;
-
- // Process first vertex
- Standard_Integer ipf;
- if (vertices.IsBound(pBegin))
- {
- ipf = vertices.Find(pBegin);
- }
- else
- {
- if (sameUV && vertices.IsBound(pEnd))
- {
- ipf = vertices.Find(pEnd);
- }
- else
- {
- P3d = Nodes(Indices(1));
- if (!l.IsIdentity())
- P3d.Transform(l.Transformation());
- nbLocat++;
- Location3d.Bind(nbLocat,P3d);
- ipf = nbLocat;
- }
- vertices.Bind(pBegin,ipf);
- }
- NewNodInStruct(1) = ipf;
- theUV = FindUV(pBegin, uvFirst, ipf, gFace, mindist);
- BRepMesh_Vertex vf(theUV,ipf,MeshDS_Frontier);
- iv1 = structure->AddNode(vf);
- isv1 = myvemap.FindIndex(iv1);
- if (isv1 == 0) isv1 = myvemap.Add(iv1);
- NewNodes(1) = isv1;
-
- // Process last vertex
- Standard_Integer ipl;
- if (pEnd.IsSame(pBegin))
- {
- ipl = ipf;
- }
- else
- {
- if (vertices.IsBound(pEnd))
- {
- ipl = vertices.Find(pEnd);
- }
- else
- {
- if (sameUV)
- {
- ipl = ipf;
- ivl = iv1;
- isv1 = isv1;
- }
- else
- {
- nbLocat++;
- Location3d.Bind(nbLocat,Nodes(Indices(nbnodes)).Transformed(l.Transformation()));
- ipl = nbLocat;
- }
- vertices.Bind(pEnd,ipl);
- }
- }
- NewNodInStruct(nbnodes) = ipl;
- theUV = FindUV(pEnd, uvLast, ipl, gFace, mindist);
- BRepMesh_Vertex vl(theUV,ipl,MeshDS_Frontier);
-
- ivl = structure->AddNode(vl);
- isvl = myvemap.FindIndex(ivl);
- if (isvl == 0) isvl = myvemap.Add(ivl);
-
- NewNodes(nbnodes) = isvl;
-
- gp_Pnt2d uv;
- BRepMesh_Vertex v;
-
- if (BRep_Tool::SameParameter(edge))
- {
- for (i = 2; i < Indices.Length(); i++)
- {
- // Record 3d point
- P3d = Nodes(Indices(i));
- if (!l.IsIdentity())
- P3d.Transform(l.Transformation());
- nbLocat++;
- Location3d.Bind(nbLocat, P3d);
- NewNodInStruct(i) = nbLocat;
- // Record 2d point
- uv = C2d->Value(Param->Value(i));
- v.Initialize(uv.Coord(), nbLocat, MeshDS_Frontier);
- iv2 = structure->AddNode(v);
- isv = myvemap.FindIndex(iv2);
- if (isv == 0) isv = myvemap.Add(iv2);
- NewNodes(i) = isv;
-
- //add links
- if (orEdge == TopAbs_FORWARD)
- structure->AddLink(BRepMesh_Edge(iv1,iv2,MeshDS_Frontier));
- else if (orEdge == TopAbs_REVERSED)
- structure->AddLink(BRepMesh_Edge(iv2,iv1,MeshDS_Frontier));
- else if (orEdge == TopAbs_INTERNAL)
- structure->AddLink(BRepMesh_Edge(iv1,iv2,MeshDS_Fixed));
- iv1 = iv2;
- }
-
- // last point
- if (iv1 != ivl) {
- if (orEdge == TopAbs_FORWARD)
- structure->AddLink(BRepMesh_Edge(iv1,ivl,MeshDS_Frontier));
- else if (orEdge == TopAbs_REVERSED)
- structure->AddLink(BRepMesh_Edge(ivl,iv1,MeshDS_Frontier));
- else if (orEdge == TopAbs_INTERNAL)
- structure->AddLink(BRepMesh_Edge(iv1,ivl,MeshDS_Fixed));
- }