mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-01 10:26:12 +03:00
88 lines
2.8 KiB
Plaintext
Executable File
88 lines
2.8 KiB
Plaintext
Executable File
// Created on: 1992-10-22
|
|
// Created by: Laurent BUCHARD
|
|
// Copyright (c) 1992-1999 Matra Datavision
|
|
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
|
//
|
|
// The content of this file is subject to the Open CASCADE Technology Public
|
|
// License Version 6.5 (the "License"). You may not use the content of this file
|
|
// except in compliance with the License. Please obtain a copy of the License
|
|
// at http://www.opencascade.org and read it completely before using this file.
|
|
//
|
|
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
|
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
|
//
|
|
// The Original Code and all software distributed under the License is
|
|
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
|
// Initial Developer hereby disclaims all such warranties, including without
|
|
// limitation, any warranties of merchantability, fitness for a particular
|
|
// purpose or non-infringement. Please see the License for the specific terms
|
|
// and conditions governing the rights and limitations under the License.
|
|
|
|
|
|
|
|
|
|
#include <GeomAbs_CurveType.hxx>
|
|
#include <Handle_Geom2d_BezierCurve.hxx>
|
|
#include <Handle_Geom2d_BSplineCurve.hxx>
|
|
#include <Geom2d_BezierCurve.hxx>
|
|
#include <Geom2d_BSplineCurve.hxx>
|
|
|
|
//============================================================
|
|
Standard_Integer Geom2dInt_CurveTool::NbSamples (const IntCurveCurve& C,
|
|
const Standard_Real U0,
|
|
const Standard_Real U1) {
|
|
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) {
|
|
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);
|
|
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);
|
|
}
|
|
//============================================================
|
|
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);
|
|
}
|
|
|
|
|
|
|
|
|