D0 (C, firstu, P);
parameters.Append (firstu);
points .Append (P);
- if (minNbPnts > 2) {
+ if (minNbPnts > 2)
+ {
Standard_Real Du = (lastu - firstu) / minNbPnts;
Standard_Real U = firstu + Du;
- for (Standard_Integer i = 2; i <= minNbPnts; i++) {
+ for (Standard_Integer i = 2; i < minNbPnts; i++)
+ {
D0 (C, U, P);
parameters.Append (U);
points .Append (P);
//-- On rajoute des points aux milieux des segments si le nombre
//-- mini de points n'est pas atteint
//--
- Standard_Integer Nbp = points.Length();
- Standard_Integer MinNb= (9*minNbPnts)/10;
- //if(MinNb<4) MinNb=4;
-
- //-- if(Nbp < MinNb) { cout<<"\n*"; } else { cout<<"\n."; }
- while(Nbp < MinNb) {
- //-- cout<<" \nGCPnts TangentialDeflection : Ajout de Points ("<<Nbp<<" "<<minNbPnts<<" )"<<endl;
- for (i = 2; i <= Nbp; i += 2) {
+ Standard_Integer Nbp = points.Length();
+
+ //std::cout << "GCPnts_TangentialDeflection: Number of Points (" << Nbp << " " << minNbPnts << " )" << std::endl;
+
+ while(Nbp < minNbPnts)
+ {
+ for (i = 2; i <= Nbp; i += 2)
+ {
MiddleU = (parameters.Value(i-1)+parameters.Value(i))*0.5;
D0 (C, MiddleU, MiddlePoint);
parameters.InsertBefore(i,MiddleU);
static Standard_Integer crvtpoints (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
- Standard_Integer i, nbp;
+ Standard_Integer i, nbp, aMinPntsNb = 2;
Standard_Real defl, angle = Precision::Angular();
Handle(Adaptor3d_HCurve) aHCurve;
}
defl = Draw::Atof(a[3]);
- if(n > 3)
+ if(n > 4)
angle = Draw::Atof(a[4]);
- GCPnts_TangentialDeflection PntGen(aHCurve->Curve(), angle, defl, 2);
+ if(n > 5)
+ aMinPntsNb = Draw::Atoi (a[5]);
+
+ GCPnts_TangentialDeflection PntGen(aHCurve->Curve(), angle, defl, aMinPntsNb);
nbp = PntGen.NbPoints();
di << "Nb points : " << nbp << "\n";
--- /dev/null
+puts "============="
+puts "0031043: GCPnts_TangentialDeflection generates points which number is inconsistent with MinimumOfPoints parameter"
+puts "============="
+
+restore [locate_data_file bug28500_shape_mesh_artifact.brep] result
+
+tclean result
+explode result f
+explode result_7 e
+
+mkcurve c result_7_1
+
+set log [crvtpoints r c 0.01 1.57 1]
+regexp {Nb points : ([0-9]+)} $log full pnts
+
+if { $pnts < 2 } {
+ puts "Error : Incorrect number of points $pnts"
+}
+
+
+set log [crvtpoints r c 0.01 1.57 2]
+regexp {Nb points : ([0-9]+)} $log full pnts
+
+if { $pnts < 2 } {
+ puts "Error : Incorrect number of points $pnts"
+}
+
+set log [crvtpoints r c 0.01 1.57 3]
+regexp {Nb points : ([0-9]+)} $log full pnts
+
+if { $pnts < 3 } {
+ puts "Error : Incorrect number of points $pnts"
+}
+
+set log [crvtpoints r c 0.01 1.57 4]
+regexp {Nb points : ([0-9]+)} $log full pnts
+
+if { $pnts < 4 } {
+ puts "Error : Incorrect number of points $pnts"
+}
+
+set log [crvtpoints r c 0.01 1.57 5]
+regexp {Nb points : ([0-9]+)} $log full pnts
+
+if { $pnts < 5 } {
+ puts "Error : Incorrect number of points $pnts"
+}
+
+set log [crvtpoints r c 0.01 1.57 6]
+regexp {Nb points : ([0-9]+)} $log full pnts
+
+if { $pnts < 6 } {
+ puts "Error : Incorrect number of points $pnts"
+}