}
-void Adaptor3d_TopolTool::ComputeSamplePoints() {
+void Adaptor3d_TopolTool::ComputeSamplePoints()
+{
+ const Standard_Integer aMaxNbSample = 50;
+
Standard_Real uinf,usup,vinf,vsup;
uinf = myS->FirstUParameter(); usup = myS->LastUParameter();
vinf = myS->FirstVParameter(); vsup = myS->LastVParameter();
//--
if(nbsu<6) nbsu=6;
- if(nbsv<6) nbsv=6;
-
- myNbSamplesU = nbsu;
- myNbSamplesV = nbsv;
+ if(nbsv<6) nbsv=6;
- if(nbsu>8 || nbsv>8) {
- if(typS == GeomAbs_BSplineSurface) {
+ if (typS == GeomAbs_BSplineSurface) {
+ if (nbsu > 8 || nbsv>8) {
const Handle(Geom_BSplineSurface)& Bspl = myS->BSpline();
Standard_Integer nbup = Bspl->NbUPoles();
Standard_Integer nbvp = Bspl->NbVPoles();
- TColgp_Array2OfPnt array2(1,nbup,1,nbvp);
+ TColgp_Array2OfPnt array2(1, nbup, 1, nbvp);
Bspl->Poles(array2);
- Analyse(array2,nbup,nbvp,myNbSamplesU,myNbSamplesV);
+ Analyse(array2, nbup, nbvp, nbsu, nbsv);
+ }
+ // Check anisotropy
+ Standard_Real anULen = (usup - uinf) / myS->UResolution(1.);
+ Standard_Real anVLen = (vsup - vinf) / myS->VResolution(1.);
+ Standard_Real aRatio = anULen / anVLen;
+ if (aRatio >= 10.)
+ {
+ nbsu *= 2;
+ nbsu = Min(nbsu, aMaxNbSample);
}
- else if(typS == GeomAbs_BezierSurface) {
+ else if (aRatio <= 0.1)
+ {
+ nbsv *= 2;
+ nbsv = Min(nbsv, aMaxNbSample);
+ }
+ }
+ else if (typS == GeomAbs_BezierSurface) {
+ if (nbsu > 8 || nbsv > 8) {
const Handle(Geom_BezierSurface)& Bez = myS->Bezier();
Standard_Integer nbup = Bez->NbUPoles();
Standard_Integer nbvp = Bez->NbVPoles();
- TColgp_Array2OfPnt array2(1,nbup,1,nbvp);
+ TColgp_Array2OfPnt array2(1, nbup, 1, nbvp);
Bez->Poles(array2);
- Analyse(array2,nbup,nbvp,myNbSamplesU,myNbSamplesV);
+ Analyse(array2, nbup, nbvp, nbsu, nbsv);
}
}
+
+ myNbSamplesU = nbsu;
+ myNbSamplesV = nbsv;
+
}
+
Standard_Integer Adaptor3d_TopolTool::NbSamplesU()
{
if(myNbSamplesU <0) {