return *((Handle(Geom2d_BSplineCurve)*)&myCurve);
}
+static Standard_Integer nbPoints(const Handle(Geom2d_Curve)& theCurve)
+{
+
+ Standard_Integer nbs = 10;
+
+ if(theCurve->IsKind(STANDARD_TYPE( Geom2d_Line)) )
+ nbs = 2;
+ else if(theCurve->IsKind(STANDARD_TYPE( Geom2d_BezierCurve)))
+ {
+ nbs = 3 + (*((Handle(Geom2d_BezierCurve)*)&theCurve))->NbPoles();
+ }
+ else if(theCurve->IsKind(STANDARD_TYPE( Geom2d_BSplineCurve))) {
+ nbs = (*((Handle(Geom2d_BSplineCurve)*)&theCurve))->NbKnots();
+ nbs*= (*((Handle(Geom2d_BSplineCurve)*)&theCurve))->Degree();
+ if(nbs < 2.0) nbs=2;
+ }
+ else if (theCurve->IsKind(STANDARD_TYPE(Geom2d_OffsetCurve)))
+ {
+ Handle(Geom2d_Curve) aCurve = (*((Handle(Geom2d_OffsetCurve)*)&theCurve))->BasisCurve();
+ return Max(nbs, nbPoints(aCurve));
+ }
+
+ else if (theCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
+ {
+ Handle(Geom2d_Curve) aCurve = (*((Handle(Geom2d_TrimmedCurve)*)&theCurve))->BasisCurve();
+ return Max(nbs, nbPoints(aCurve));
+ }
+ if(nbs>300)
+ nbs = 300;
+ return nbs;
+
+}
+
+Standard_Integer Geom2dAdaptor_Curve::NbSamples() const
+{
+ return nbPoints(myCurve);
+}
//============================================================
Standard_Integer Geom2dInt_CurveTool::NbSamples (const IntCurveCurve& C,
- const Standard_Real U0,
- const Standard_Real U1) {
+ const Standard_Real U0,
+ const Standard_Real U1)
+{
GeomAbs_CurveType typC = C.GetType();
- static Standard_Real nbsOther = 10.0;
- Standard_Real nbs = nbsOther;
+ Standard_Integer nbs = C.NbSamples();
- if(typC == GeomAbs_Line)
- nbs = 2;
- else if(typC == GeomAbs_BezierCurve)
- nbs = 3 + C.NbPoles();
- else if(typC == GeomAbs_BSplineCurve) {
+ if(typC == GeomAbs_BSplineCurve) {
Standard_Real t=C.LastParameter()-C.FirstParameter();
Standard_Real t1=U1-U0;
if(t1<0.0) t1=-t1;
nbs = C.NbKnots();
nbs*= C.Degree();
- nbs*= (t1/t);
+ Standard_Real anb = t1/t * nbs;
+ nbs = (Standard_Integer)anb;
if(nbs < 4.0) nbs=4;
}
- //// modified by jgv, 20.02.02 for bug OCC165 ////
- else if (typC == GeomAbs_OtherCurve)
- nbs = 20;
- //////////////////////////////////////////////////
if(nbs>300)
nbs = 300;
- return((Standard_Integer)nbs);
+ return nbs;
+
}
//============================================================
Standard_Integer Geom2dInt_CurveTool::NbSamples (const IntCurveCurve& C) {
- GeomAbs_CurveType typC = C.GetType();
- static Standard_Real nbsOther = 10.0;
- Standard_Real nbs = nbsOther;
-
- if(typC == GeomAbs_Line)
- nbs = 2;
- else if(typC == GeomAbs_BezierCurve)
- nbs = 3 + C.NbPoles();
- else if(typC == GeomAbs_BSplineCurve) {
- nbs = C.NbKnots();
- nbs*= C.Degree();
- if(nbs < 2.0) nbs=2;
- }
- //// modified by jgv, 20.02.02 for bug OCC165 ////
- else if (typC == GeomAbs_OtherCurve)
- nbs = 20;
- //////////////////////////////////////////////////
-
- if(nbs>300)
- nbs = 300;
- return((Standard_Integer)nbs);
-}
+ return C.NbSamples();
+ }
--- /dev/null
+puts "============"
+puts "CR24800"
+puts "==========="
+puts ""
+###############################################################################
+# Point of intersection was not found for 2d offset curve.
+###############################################################################
+
+restore [locate_data_file bug24800_curve2.brep] c2
+
+set inter1 [2dintersect c2]
+
+set int1 [regexp {Intersection point 1} ${inter1}]
+
+if { ${int1} == 0 } {
+ puts "Error : Intersection is not found"
+}
+
+av2d
+2dfit
+
+xwd ${imagedir}/${test_image}.png