1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0022818: Wrong triangulation of Revolution surface with slice angle <= 180 degree

Take face attributes into account to calculate 2d tolerance
Adding test cases for this fix
Correction according additional bug CR23832
This commit is contained in:
oan
2013-03-22 17:44:31 +04:00
parent 32d878f538
commit b62b93ac30
7 changed files with 189 additions and 18 deletions

View File

@@ -905,7 +905,12 @@ void BRepMesh_FastDiscret::Add( const TopoDS_Edge& theEdge,
}
myVertices.Bind(pBegin, ipf);
}
theUV = BRepMesh_FastDiscretFace::FindUV(pBegin, uvFirst, ipf, theGFace, mindist, myLocation2d);
Handle(BRepMesh_FaceAttribute) aFaceAttribute;
GetFaceAttribute ( theFace, aFaceAttribute );
theUV = BRepMesh_FastDiscretFace::FindUV(pBegin, uvFirst,
ipf, theGFace, mindist, aFaceAttribute, myLocation2d);
BRepMesh_Vertex vf(theUV, ipf, BRepMesh_Frontier);
Standard_Integer ivf = myStructure->AddNode(vf);
@@ -936,7 +941,10 @@ void BRepMesh_FastDiscret::Add( const TopoDS_Edge& theEdge,
myVertices.Bind(pEnd,ipl);
}
}
theUV = BRepMesh_FastDiscretFace::FindUV(pEnd, uvLast, ipl, theGFace, mindist, myLocation2d);
theUV = BRepMesh_FastDiscretFace::FindUV(pEnd, uvLast, ipl,
theGFace, mindist, aFaceAttribute, myLocation2d);
BRepMesh_Vertex vl(theUV, ipl, BRepMesh_Frontier);
Standard_Integer ivl= myStructure->AddNode(vl);
@@ -1395,7 +1403,12 @@ Standard_Boolean BRepMesh_FastDiscret::Update(const TopoDS_Edge& theEdg
myVertices.Bind(pBegin,ipf);
}
NewNodInStruct(1) = ipf;
theUV = BRepMesh_FastDiscretFace::FindUV(pBegin, uvFirst, ipf, gFace, mindist, myLocation2d);
Handle(BRepMesh_FaceAttribute) aFaceAttribute;
GetFaceAttribute ( theFace, aFaceAttribute );
theUV = BRepMesh_FastDiscretFace::FindUV(pBegin, uvFirst, ipf,
gFace, mindist, aFaceAttribute, myLocation2d);
BRepMesh_Vertex vf(theUV,ipf,BRepMesh_Frontier);
iv1 = myStructure->AddNode(vf);
isv1 = myVemap.FindIndex(iv1);
@@ -1432,7 +1445,9 @@ Standard_Boolean BRepMesh_FastDiscret::Update(const TopoDS_Edge& theEdg
}
}
NewNodInStruct(nbnodes) = ipl;
theUV = BRepMesh_FastDiscretFace::FindUV(pEnd, uvLast, ipl, gFace, mindist, myLocation2d);
theUV = BRepMesh_FastDiscretFace::FindUV(pEnd, uvLast, ipl,
gFace, mindist, aFaceAttribute, myLocation2d);
BRepMesh_Vertex vl(theUV,ipl,BRepMesh_Frontier);
ivl = myStructure->AddNode(vl);

View File

@@ -112,7 +112,8 @@ is
theXY : Pnt2d from gp;
theIp : Integer from Standard;
theSFace : HSurface from BRepAdaptor;
theMinDist : Real from Standard;
theMinDist : Real from Standard;
theFaceAttribute: FaceAttribute from BRepMesh;
theLocation2dMap: in out DataMapOfIntegerListOfXY from BRepMesh)
returns XY from gp;

View File

@@ -421,7 +421,7 @@ Standard_Boolean BRepMesh_FastDiscretFace::RestoreStructureFromTriangulation
if (mindist < BRep_Tool::Tolerance(pBegin) ||
mindist < BRep_Tool::Tolerance(pEnd) ) mindist = theDefEdge;
anUV = FindUV(pBegin, uvFirst, ipf, theSurf, mindist, myLocation2d);
anUV = FindUV(pBegin, uvFirst, ipf, theSurf, mindist, myAttrib, myLocation2d);
Standard_Integer iv1, isv1;
BRepMesh_Vertex vf(anUV, ipf, BRepMesh_Frontier);
iv1 = myStructure->AddNode(vf);
@@ -462,7 +462,7 @@ Standard_Boolean BRepMesh_FastDiscretFace::RestoreStructureFromTriangulation
}
}
anUV = FindUV(pEnd, uvLast, ipl, theSurf, mindist, myLocation2d);
anUV = FindUV(pEnd, uvLast, ipl, theSurf, mindist, myAttrib, myLocation2d);
BRepMesh_Vertex vl(anUV, ipl, BRepMesh_Frontier);
Standard_Integer isvl;
@@ -1710,12 +1710,13 @@ const gp_Pnt& BRepMesh_FastDiscretFace::Pnt(const Standard_Integer Index) const
//purpose :
//=======================================================================
gp_XY BRepMesh_FastDiscretFace::FindUV(const TopoDS_Vertex& theV,
const gp_Pnt2d& theXY,
const Standard_Integer theIp,
const Handle(BRepAdaptor_HSurface)& theSFace,
const Standard_Real theMinDist,
BRepMesh_DataMapOfIntegerListOfXY& theLocation2dMap)
gp_XY BRepMesh_FastDiscretFace::FindUV(const TopoDS_Vertex& theV,
const gp_Pnt2d& theXY,
const Standard_Integer theIp,
const Handle(BRepAdaptor_HSurface)& theSFace,
const Standard_Real theMinDist,
const Handle(BRepMesh_FaceAttribute)& theFaceAttribute,
BRepMesh_DataMapOfIntegerListOfXY& theLocation2dMap)
{
gp_XY anUV;
if (theLocation2dMap.IsBound(theIp))
@@ -1740,8 +1741,21 @@ gp_XY BRepMesh_FastDiscretFace::FindUV(const TopoDS_Vertex& theV
const Standard_Real tol = Min(2. * BRep_Tool::Tolerance(theV), theMinDist);
const Standard_Real Utol2d = .5 * (theSFace->LastUParameter() - theSFace->FirstUParameter());
const Standard_Real Vtol2d = .5 * (theSFace->LastVParameter() - theSFace->FirstVParameter());
Standard_Real aDiffU, aDiffV;
if ( theFaceAttribute.IsNull() )
{
aDiffU = theSFace->LastUParameter() - theSFace->FirstUParameter();
aDiffV = theSFace->LastVParameter() - theSFace->FirstVParameter();
}
else
{
aDiffU = theFaceAttribute->GetUMax() - theFaceAttribute->GetUMin();
aDiffV = theFaceAttribute->GetVMax() - theFaceAttribute->GetVMin();
}
const Standard_Real Utol2d = .5 * aDiffU;
const Standard_Real Vtol2d = .5 * aDiffV;
const gp_Pnt p1 = theSFace->Value(anUV.X(), anUV.Y());
const gp_Pnt p2 = theSFace->Value(theXY.X(), theXY.Y());
@@ -1811,7 +1825,7 @@ void BRepMesh_FastDiscretFace::Add(const TopoDS_Vertex& theVert,
}
Standard_Real mindist = BRep_Tool::Tolerance(theVert);
// gp_Pnt2d uvXY = BRep_Tool::Parameters(theVert,theFace);
gp_XY anUV = FindUV(theVert, uvXY, indVert, thegFace, mindist, myLocation2d);
gp_XY anUV = FindUV(theVert, uvXY, indVert, thegFace, mindist, myAttrib, myLocation2d);
BRepMesh_Vertex vf(anUV, indVert, BRepMesh_Fixed);
Standard_Integer ivff = myStructure->AddNode(vf);
Standard_Integer isvf = myVemap.FindIndex(ivff);