mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
Coding - Refactor IntCurveSurface to remove gxx files #219
Refactor IntCurveSurface: Remove unused HCurveTool files
This commit is contained in:
parent
a90cf73afd
commit
5c0ad5d8ea
@ -1,5 +1,3 @@
|
||||
IntCurveSurface_HCurveTool.gxx
|
||||
IntCurveSurface_HCurveTool.lxx
|
||||
IntCurveSurface_HInter.hxx
|
||||
IntCurveSurface_HInter_0.cxx
|
||||
IntCurveSurface_Inter.gxx
|
||||
@ -26,7 +24,7 @@ IntCurveSurface_TheCSFunctionOfHInter_0.cxx
|
||||
IntCurveSurface_TheExactHInter.hxx
|
||||
IntCurveSurface_TheExactHInter_0.cxx
|
||||
IntCurveSurface_TheHCurveTool.hxx
|
||||
IntCurveSurface_TheHCurveTool_0.cxx
|
||||
IntCurveSurface_TheHCurveTool.cxx
|
||||
IntCurveSurface_TheInterferenceOfHInter.hxx
|
||||
IntCurveSurface_TheInterferenceOfHInter_0.cxx
|
||||
IntCurveSurface_ThePolygonOfHInter.hxx
|
||||
|
@ -1,244 +0,0 @@
|
||||
// Created on: 1995-07-17
|
||||
// Created by: Modelistation
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include CurveGen_hxx
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_Array1OfBoolean.hxx>
|
||||
#include <gce_MakeLin.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
|
||||
#define myMinPnts 5
|
||||
//============================================================
|
||||
Standard_Integer IntCurveSurface_HCurveTool::NbSamples (const CurveGen& C,
|
||||
const Standard_Real U0,
|
||||
const Standard_Real U1) {
|
||||
GeomAbs_CurveType typC = C->GetType();
|
||||
const 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();
|
||||
nbs*= C->LastParameter()- C->FirstParameter();
|
||||
nbs/= U1-U0;
|
||||
if(nbs < 2.0) nbs=2;
|
||||
}
|
||||
if(nbs>50)
|
||||
nbs = 50;
|
||||
return((Standard_Integer)nbs);
|
||||
}
|
||||
//============================================================
|
||||
void IntCurveSurface_HCurveTool::SamplePars (const CurveGen& C,
|
||||
const Standard_Real U0,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real Defl,
|
||||
const Standard_Integer NbMin,
|
||||
Handle(TColStd_HArray1OfReal)& Pars) {
|
||||
GeomAbs_CurveType typC = C->GetType();
|
||||
const Standard_Real nbsOther = 10.0;
|
||||
Standard_Real nbs = nbsOther;
|
||||
|
||||
if(typC == GeomAbs_Line)
|
||||
nbs = 2;
|
||||
else if(typC == GeomAbs_BezierCurve) {
|
||||
nbs = 3 + C->NbPoles();
|
||||
}
|
||||
|
||||
if(typC != GeomAbs_BSplineCurve) {
|
||||
if(nbs>50)
|
||||
nbs = 50;
|
||||
Standard_Integer nnbs = (Standard_Integer)nbs;
|
||||
|
||||
Pars = new TColStd_HArray1OfReal(1, nnbs);
|
||||
Standard_Real du = (U1-U0)/(nnbs - 1);
|
||||
|
||||
Pars->SetValue(1, U0);
|
||||
Pars->SetValue(nnbs, U1);
|
||||
Standard_Integer i;
|
||||
Standard_Real u;
|
||||
for(i = 2, u = U0+du; i < nnbs; ++i, u += du) {
|
||||
Pars->SetValue(i, u);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const Handle(Geom_BSplineCurve)& aBC = C->BSpline();
|
||||
|
||||
Standard_Integer i, j, k, nbi;
|
||||
Standard_Real t1, t2, dt;
|
||||
Standard_Integer ui1 = aBC->FirstUKnotIndex();
|
||||
Standard_Integer ui2 = aBC->LastUKnotIndex();
|
||||
|
||||
for(i = ui1; i < ui2; ++i) {
|
||||
if(U0 >= aBC->Knot(i) && U0 < aBC->Knot(i+1)) {
|
||||
ui1 = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(i = ui2; i > ui1; --i) {
|
||||
if(U1 <= aBC->Knot(i) && U1 > aBC->Knot(i-1)) {
|
||||
ui2 = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer nbsu = ui2-ui1+1; nbsu += (nbsu - 1) * (aBC->Degree()-1);
|
||||
Standard_Boolean bUniform = Standard_False;
|
||||
if(nbsu < NbMin) {
|
||||
nbsu = NbMin;
|
||||
bUniform = Standard_True;
|
||||
}
|
||||
|
||||
TColStd_Array1OfReal aPars(1, nbsu);
|
||||
TColStd_Array1OfBoolean aFlg(1, nbsu);
|
||||
//Filling of sample parameters
|
||||
if(bUniform) {
|
||||
t1 = U0;
|
||||
t2 = U1;
|
||||
dt = (t2 - t1)/(nbsu - 1);
|
||||
aPars(1) = t1;
|
||||
aFlg(1) = Standard_False;
|
||||
aPars(nbsu) = t2;
|
||||
aFlg(nbsu) = Standard_False;
|
||||
for(i = 2, t1 += dt; i < nbsu; ++i, t1 += dt) {
|
||||
aPars(i) = t1;
|
||||
aFlg(i) = Standard_False;
|
||||
}
|
||||
}
|
||||
else {
|
||||
nbi = aBC->Degree();
|
||||
k = 0;
|
||||
t1 = U0;
|
||||
for(i = ui1+1; i <= ui2; ++i) {
|
||||
if(i == ui2) t2 = U1;
|
||||
else t2 = aBC->Knot(i);
|
||||
dt = (t2 - t1)/nbi;
|
||||
j = 1;
|
||||
do {
|
||||
++k;
|
||||
aPars(k) = t1;
|
||||
aFlg(k) = Standard_False;
|
||||
t1 += dt;
|
||||
}
|
||||
while (++j <= nbi);
|
||||
t1 = t2;
|
||||
}
|
||||
++k;
|
||||
aPars(k) = t1;
|
||||
}
|
||||
//Analysis of deflection
|
||||
|
||||
|
||||
Standard_Real aDefl2 = Max(Defl*Defl, 1.e-9);
|
||||
Standard_Real tol = Max(0.01*aDefl2, 1.e-9);
|
||||
Standard_Integer l;
|
||||
|
||||
Standard_Integer NbSamples = 2;
|
||||
aFlg(1) = Standard_True;
|
||||
aFlg(nbsu) = Standard_True;
|
||||
j = 1;
|
||||
Standard_Boolean bCont = Standard_True;
|
||||
while (j < nbsu-1 && bCont) {
|
||||
|
||||
if(aFlg(j+1)) {
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
|
||||
t2 = aPars(j);
|
||||
gp_Pnt p1 = aBC->Value(t2);
|
||||
for(k = j+2; k <= nbsu; ++k) {
|
||||
t2 = aPars(k);
|
||||
gp_Pnt p2 = aBC->Value(t2);
|
||||
|
||||
if(p1.SquareDistance(p2) <= tol) continue;
|
||||
|
||||
gce_MakeLin MkLin(p1, p2);
|
||||
const gp_Lin& lin = MkLin.Value();
|
||||
Standard_Boolean ok = Standard_True;
|
||||
for(l = j+1; l < k; ++l) {
|
||||
|
||||
if(aFlg(l)) {
|
||||
ok = Standard_False;
|
||||
break;
|
||||
}
|
||||
|
||||
gp_Pnt pp = aBC->Value(aPars(l));
|
||||
Standard_Real d = lin.SquareDistance(pp);
|
||||
|
||||
if(d <= aDefl2) continue;
|
||||
|
||||
ok = Standard_False;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!ok) {
|
||||
j = k - 1;
|
||||
aFlg(j) = Standard_True;
|
||||
++NbSamples;
|
||||
break;
|
||||
}
|
||||
|
||||
if(aFlg(k)) {
|
||||
j = k;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(k >= nbsu) bCont = Standard_False;
|
||||
|
||||
}
|
||||
|
||||
if(NbSamples < myMinPnts) {
|
||||
//uniform distribution
|
||||
NbSamples = myMinPnts;
|
||||
Pars = new TColStd_HArray1OfReal(1, NbSamples);
|
||||
t1 = U0;
|
||||
t2 = U1;
|
||||
dt = (t2 - t1)/(NbSamples - 1);
|
||||
Pars->SetValue(1, t1);
|
||||
Pars->SetValue(NbSamples, t2);
|
||||
for(i = 2, t1 += dt; i < NbSamples; ++i, t1 += dt) {
|
||||
Pars->SetValue(i, t1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Pars = new TColStd_HArray1OfReal(1, NbSamples);
|
||||
j = 0;
|
||||
for(i = 1; i <= nbsu; ++i) {
|
||||
if(aFlg(i)) {
|
||||
++j;
|
||||
Pars->SetValue(j,aPars(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,164 +0,0 @@
|
||||
// Created on: 1992-10-22
|
||||
// Created by: Laurent BUCHARD
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include CurveGen_hxx
|
||||
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Elips.hxx>
|
||||
#include <gp_Parab.hxx>
|
||||
#include <gp_Hypr.hxx>
|
||||
|
||||
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
//============================================================
|
||||
inline Standard_Real IntCurveSurface_HCurveTool::FirstParameter (const CurveGen& C) {
|
||||
return(C->FirstParameter());
|
||||
}
|
||||
//============================================================
|
||||
inline Standard_Real IntCurveSurface_HCurveTool::LastParameter (const CurveGen& C) {
|
||||
return(C->LastParameter());
|
||||
}
|
||||
//============================================================
|
||||
inline GeomAbs_Shape IntCurveSurface_HCurveTool::Continuity (const CurveGen& C) {
|
||||
return(C->Continuity());
|
||||
}
|
||||
//============================================================
|
||||
inline Standard_Integer IntCurveSurface_HCurveTool::NbIntervals(const CurveGen& C,const GeomAbs_Shape Sh) {
|
||||
return(C->NbIntervals(Sh));
|
||||
}
|
||||
//============================================================
|
||||
inline void IntCurveSurface_HCurveTool::Intervals(const CurveGen& C,
|
||||
TColStd_Array1OfReal& Tab,
|
||||
const GeomAbs_Shape Sh) {
|
||||
C->Intervals(Tab,Sh);
|
||||
}
|
||||
//============================================================
|
||||
inline Standard_Boolean IntCurveSurface_HCurveTool::IsClosed(const CurveGen& C) {
|
||||
return(C->IsClosed());
|
||||
}
|
||||
//============================================================
|
||||
inline Standard_Boolean IntCurveSurface_HCurveTool::IsPeriodic(const CurveGen& C) {
|
||||
return(C->IsPeriodic());
|
||||
}
|
||||
//============================================================
|
||||
inline Standard_Real IntCurveSurface_HCurveTool::Period(const CurveGen& C) {
|
||||
return(C->Period());
|
||||
}
|
||||
//============================================================
|
||||
inline gp_Pnt IntCurveSurface_HCurveTool::Value (const CurveGen& C,
|
||||
const Standard_Real U) {
|
||||
return(C->Value(U));
|
||||
}
|
||||
//============================================================
|
||||
inline void IntCurveSurface_HCurveTool::D0(const CurveGen& C,
|
||||
const Standard_Real U,
|
||||
gp_Pnt& P) {
|
||||
C->D0(U,P);
|
||||
}
|
||||
//============================================================
|
||||
inline void IntCurveSurface_HCurveTool::D1 (const CurveGen& C,
|
||||
const Standard_Real U,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& T) {
|
||||
C->D1(U,P,T);
|
||||
}
|
||||
//============================================================
|
||||
inline void IntCurveSurface_HCurveTool::D2 (const CurveGen& C,
|
||||
const Standard_Real U,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& T,
|
||||
gp_Vec& N) {
|
||||
|
||||
C->D2(U,P,T,N);
|
||||
}
|
||||
//============================================================
|
||||
inline void IntCurveSurface_HCurveTool::D3 (const CurveGen& C,
|
||||
const Standard_Real U,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& V1,
|
||||
gp_Vec& V2,
|
||||
gp_Vec& V3) {
|
||||
|
||||
C->D3(U,P,V1,V2,V3);
|
||||
}
|
||||
//============================================================
|
||||
inline gp_Vec IntCurveSurface_HCurveTool::DN (const CurveGen& C,
|
||||
const Standard_Real U,
|
||||
const Standard_Integer N) {
|
||||
|
||||
return(C->DN(U,N));
|
||||
}
|
||||
//============================================================
|
||||
inline Standard_Real IntCurveSurface_HCurveTool::Resolution(const CurveGen& C,
|
||||
const Standard_Real R3d) {
|
||||
return(C->Resolution(R3d));
|
||||
}
|
||||
//============================================================
|
||||
inline GeomAbs_CurveType IntCurveSurface_HCurveTool::GetType(const CurveGen& C) {
|
||||
return(C->GetType());
|
||||
}
|
||||
//============================================================
|
||||
inline gp_Lin IntCurveSurface_HCurveTool::Line (const CurveGen& C) {
|
||||
return(C->Line());
|
||||
}
|
||||
//============================================================
|
||||
inline gp_Circ IntCurveSurface_HCurveTool::Circle (const CurveGen& C) {
|
||||
return(C->Circle());
|
||||
}
|
||||
//============================================================
|
||||
inline gp_Elips IntCurveSurface_HCurveTool::Ellipse (const CurveGen& C) {
|
||||
return(C->Ellipse());
|
||||
}
|
||||
//============================================================
|
||||
inline gp_Parab IntCurveSurface_HCurveTool::Parabola (const CurveGen& C) {
|
||||
return(C->Parabola());
|
||||
}
|
||||
//============================================================
|
||||
inline gp_Hypr IntCurveSurface_HCurveTool::Hyperbola (const CurveGen& C) {
|
||||
return(C->Hyperbola());
|
||||
}
|
||||
//============================================================
|
||||
inline Handle(Geom_BezierCurve) IntCurveSurface_HCurveTool::Bezier (const CurveGen& C) {
|
||||
return(C->Bezier());
|
||||
}
|
||||
//============================================================
|
||||
inline Handle(Geom_BSplineCurve) IntCurveSurface_HCurveTool::BSpline (const CurveGen& C) {
|
||||
return(C->BSpline());
|
||||
}
|
||||
//============================================================
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
271
src/IntCurveSurface/IntCurveSurface_TheHCurveTool.cxx
Normal file
271
src/IntCurveSurface/IntCurveSurface_TheHCurveTool.cxx
Normal file
@ -0,0 +1,271 @@
|
||||
// Copyright (c) 1993-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2024 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <IntCurveSurface_TheHCurveTool.hxx>
|
||||
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <TColStd_Array1OfBoolean.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <gce_MakeLin.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
|
||||
#define myMinPnts 5
|
||||
|
||||
Standard_Integer IntCurveSurface_TheHCurveTool::NbSamples(const Handle(Adaptor3d_Curve)& C,
|
||||
const Standard_Real U0,
|
||||
const Standard_Real U1)
|
||||
{
|
||||
GeomAbs_CurveType typC = C->GetType();
|
||||
const 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();
|
||||
nbs *= C->LastParameter() - C->FirstParameter();
|
||||
nbs /= U1 - U0;
|
||||
if (nbs < 2.0)
|
||||
nbs = 2;
|
||||
}
|
||||
if (nbs > 50)
|
||||
nbs = 50;
|
||||
return ((Standard_Integer)nbs);
|
||||
}
|
||||
|
||||
void IntCurveSurface_TheHCurveTool::SamplePars(const Handle(Adaptor3d_Curve)& C,
|
||||
const Standard_Real U0,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real Defl,
|
||||
const Standard_Integer NbMin,
|
||||
Handle(TColStd_HArray1OfReal)& Pars)
|
||||
{
|
||||
GeomAbs_CurveType typC = C->GetType();
|
||||
const Standard_Real nbsOther = 10.0;
|
||||
Standard_Real nbs = nbsOther;
|
||||
|
||||
if (typC == GeomAbs_Line)
|
||||
nbs = 2;
|
||||
else if (typC == GeomAbs_BezierCurve)
|
||||
{
|
||||
nbs = 3 + C->NbPoles();
|
||||
}
|
||||
|
||||
if (typC != GeomAbs_BSplineCurve)
|
||||
{
|
||||
if (nbs > 50)
|
||||
nbs = 50;
|
||||
Standard_Integer nnbs = (Standard_Integer)nbs;
|
||||
|
||||
Pars = new TColStd_HArray1OfReal(1, nnbs);
|
||||
Standard_Real du = (U1 - U0) / (nnbs - 1);
|
||||
|
||||
Pars->SetValue(1, U0);
|
||||
Pars->SetValue(nnbs, U1);
|
||||
Standard_Integer i;
|
||||
Standard_Real u;
|
||||
for (i = 2, u = U0 + du; i < nnbs; ++i, u += du)
|
||||
{
|
||||
Pars->SetValue(i, u);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const Handle(Geom_BSplineCurve)& aBC = C->BSpline();
|
||||
|
||||
Standard_Integer i, j, k, nbi;
|
||||
Standard_Real t1, t2, dt;
|
||||
Standard_Integer ui1 = aBC->FirstUKnotIndex();
|
||||
Standard_Integer ui2 = aBC->LastUKnotIndex();
|
||||
|
||||
for (i = ui1; i < ui2; ++i)
|
||||
{
|
||||
if (U0 >= aBC->Knot(i) && U0 < aBC->Knot(i + 1))
|
||||
{
|
||||
ui1 = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = ui2; i > ui1; --i)
|
||||
{
|
||||
if (U1 <= aBC->Knot(i) && U1 > aBC->Knot(i - 1))
|
||||
{
|
||||
ui2 = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer nbsu = ui2 - ui1 + 1;
|
||||
nbsu += (nbsu - 1) * (aBC->Degree() - 1);
|
||||
Standard_Boolean bUniform = Standard_False;
|
||||
if (nbsu < NbMin)
|
||||
{
|
||||
nbsu = NbMin;
|
||||
bUniform = Standard_True;
|
||||
}
|
||||
|
||||
TColStd_Array1OfReal aPars(1, nbsu);
|
||||
TColStd_Array1OfBoolean aFlg(1, nbsu);
|
||||
//Filling of sample parameters
|
||||
if (bUniform)
|
||||
{
|
||||
t1 = U0;
|
||||
t2 = U1;
|
||||
dt = (t2 - t1) / (nbsu - 1);
|
||||
aPars(1) = t1;
|
||||
aFlg(1) = Standard_False;
|
||||
aPars(nbsu) = t2;
|
||||
aFlg(nbsu) = Standard_False;
|
||||
for (i = 2, t1 += dt; i < nbsu; ++i, t1 += dt)
|
||||
{
|
||||
aPars(i) = t1;
|
||||
aFlg(i) = Standard_False;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nbi = aBC->Degree();
|
||||
k = 0;
|
||||
t1 = U0;
|
||||
for (i = ui1 + 1; i <= ui2; ++i)
|
||||
{
|
||||
if (i == ui2)
|
||||
t2 = U1;
|
||||
else
|
||||
t2 = aBC->Knot(i);
|
||||
dt = (t2 - t1) / nbi;
|
||||
j = 1;
|
||||
do
|
||||
{
|
||||
++k;
|
||||
aPars(k) = t1;
|
||||
aFlg(k) = Standard_False;
|
||||
t1 += dt;
|
||||
} while (++j <= nbi);
|
||||
t1 = t2;
|
||||
}
|
||||
++k;
|
||||
aPars(k) = t1;
|
||||
}
|
||||
//Analysis of deflection
|
||||
|
||||
Standard_Real aDefl2 = Max(Defl * Defl, 1.e-9);
|
||||
Standard_Real tol = Max(0.01 * aDefl2, 1.e-9);
|
||||
Standard_Integer l;
|
||||
|
||||
Standard_Integer NbSamples = 2;
|
||||
aFlg(1) = Standard_True;
|
||||
aFlg(nbsu) = Standard_True;
|
||||
j = 1;
|
||||
Standard_Boolean bCont = Standard_True;
|
||||
while (j < nbsu - 1 && bCont)
|
||||
{
|
||||
if (aFlg(j + 1))
|
||||
{
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
|
||||
t2 = aPars(j);
|
||||
gp_Pnt p1 = aBC->Value(t2);
|
||||
for (k = j + 2; k <= nbsu; ++k)
|
||||
{
|
||||
t2 = aPars(k);
|
||||
gp_Pnt p2 = aBC->Value(t2);
|
||||
|
||||
if (p1.SquareDistance(p2) <= tol)
|
||||
continue;
|
||||
|
||||
gce_MakeLin MkLin(p1, p2);
|
||||
const gp_Lin& lin = MkLin.Value();
|
||||
Standard_Boolean ok = Standard_True;
|
||||
for (l = j + 1; l < k; ++l)
|
||||
{
|
||||
if (aFlg(l))
|
||||
{
|
||||
ok = Standard_False;
|
||||
break;
|
||||
}
|
||||
|
||||
gp_Pnt pp = aBC->Value(aPars(l));
|
||||
Standard_Real d = lin.SquareDistance(pp);
|
||||
|
||||
if (d <= aDefl2)
|
||||
continue;
|
||||
|
||||
ok = Standard_False;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
j = k - 1;
|
||||
aFlg(j) = Standard_True;
|
||||
++NbSamples;
|
||||
break;
|
||||
}
|
||||
|
||||
if (aFlg(k))
|
||||
{
|
||||
j = k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (k >= nbsu)
|
||||
bCont = Standard_False;
|
||||
}
|
||||
|
||||
if (NbSamples < myMinPnts)
|
||||
{
|
||||
//uniform distribution
|
||||
NbSamples = myMinPnts;
|
||||
Pars = new TColStd_HArray1OfReal(1, NbSamples);
|
||||
t1 = U0;
|
||||
t2 = U1;
|
||||
dt = (t2 - t1) / (NbSamples - 1);
|
||||
Pars->SetValue(1, t1);
|
||||
Pars->SetValue(NbSamples, t2);
|
||||
for (i = 2, t1 += dt; i < NbSamples; ++i, t1 += dt)
|
||||
{
|
||||
Pars->SetValue(i, t1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Pars = new TColStd_HArray1OfReal(1, NbSamples);
|
||||
j = 0;
|
||||
for (i = 1; i <= nbsu; ++i)
|
||||
{
|
||||
if (aFlg(i))
|
||||
{
|
||||
++j;
|
||||
Pars->SetValue(j, aPars(i));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,5 @@
|
||||
// Created on: 1993-04-07
|
||||
// Created by: Laurent BUCHARD
|
||||
// Copyright (c) 1993-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
// Copyright (c) 1999-2024 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
@ -18,12 +16,20 @@
|
||||
#define _IntCurveSurface_TheHCurveTool_HeaderFile
|
||||
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Elips.hxx>
|
||||
#include <gp_Hypr.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Parab.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
class Standard_OutOfRange;
|
||||
class Standard_NoSuchObject;
|
||||
class Standard_DomainError;
|
||||
@ -32,129 +38,107 @@ class gp_Vec;
|
||||
class Geom_BezierCurve;
|
||||
class Geom_BSplineCurve;
|
||||
|
||||
|
||||
|
||||
class IntCurveSurface_TheHCurveTool
|
||||
class IntCurveSurface_TheHCurveTool
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
static Standard_Real FirstParameter (const Handle(Adaptor3d_Curve)& C);
|
||||
|
||||
static Standard_Real LastParameter (const Handle(Adaptor3d_Curve)& C);
|
||||
|
||||
static GeomAbs_Shape Continuity (const Handle(Adaptor3d_Curve)& C);
|
||||
|
||||
static Standard_Real FirstParameter(const Handle(Adaptor3d_Curve)& C) { return C->FirstParameter(); }
|
||||
|
||||
static Standard_Real LastParameter(const Handle(Adaptor3d_Curve)& C) { return C->LastParameter(); }
|
||||
|
||||
static GeomAbs_Shape Continuity(const Handle(Adaptor3d_Curve)& C) { return C->Continuity(); }
|
||||
|
||||
//! Returns the number of intervals for continuity
|
||||
//! <S>. May be one if Continuity(myclass) >= <S>
|
||||
static Standard_Integer NbIntervals (const Handle(Adaptor3d_Curve)& C, const GeomAbs_Shape S);
|
||||
|
||||
static Standard_Integer NbIntervals(const Handle(Adaptor3d_Curve)& C, const GeomAbs_Shape S) { return C->NbIntervals(S); }
|
||||
|
||||
//! Stores in <T> the parameters bounding the intervals
|
||||
//! of continuity <S>.
|
||||
//!
|
||||
//! The array must provide enough room to accommodate
|
||||
//! for the parameters. i.e. T.Length() > NbIntervals()
|
||||
static void Intervals (const Handle(Adaptor3d_Curve)& C, TColStd_Array1OfReal& T, const GeomAbs_Shape S);
|
||||
|
||||
static Standard_Boolean IsClosed (const Handle(Adaptor3d_Curve)& C);
|
||||
|
||||
static Standard_Boolean IsPeriodic (const Handle(Adaptor3d_Curve)& C);
|
||||
|
||||
static Standard_Real Period (const Handle(Adaptor3d_Curve)& C);
|
||||
|
||||
static void Intervals(const Handle(Adaptor3d_Curve)& C, TColStd_Array1OfReal& T, const GeomAbs_Shape S)
|
||||
{
|
||||
C->Intervals(T, S);
|
||||
}
|
||||
|
||||
static Standard_Boolean IsClosed(const Handle(Adaptor3d_Curve)& C) { return C->IsClosed(); }
|
||||
|
||||
static Standard_Boolean IsPeriodic(const Handle(Adaptor3d_Curve)& C) { return C->IsPeriodic(); }
|
||||
|
||||
static Standard_Real Period(const Handle(Adaptor3d_Curve)& C) { return C->Period(); }
|
||||
|
||||
//! Computes the point of parameter U on the curve.
|
||||
static gp_Pnt Value (const Handle(Adaptor3d_Curve)& C, const Standard_Real U);
|
||||
|
||||
static gp_Pnt Value(const Handle(Adaptor3d_Curve)& C, const Standard_Real U) { return C->Value(U); }
|
||||
|
||||
//! Computes the point of parameter U on the curve.
|
||||
static void D0 (const Handle(Adaptor3d_Curve)& C, const Standard_Real U, gp_Pnt& P);
|
||||
|
||||
static void D0(const Handle(Adaptor3d_Curve)& C, const Standard_Real U, gp_Pnt& P) { C->D0(U, P); }
|
||||
|
||||
//! Computes the point of parameter U on the curve with its
|
||||
//! first derivative.
|
||||
//! Raised if the continuity of the current interval
|
||||
//! is not C1.
|
||||
static void D1 (const Handle(Adaptor3d_Curve)& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V);
|
||||
|
||||
static void D1(const Handle(Adaptor3d_Curve)& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V) { C->D1(U, P, V); }
|
||||
|
||||
//! Returns the point P of parameter U, the first and second
|
||||
//! derivatives V1 and V2.
|
||||
//! Raised if the continuity of the current interval
|
||||
//! is not C2.
|
||||
static void D2 (const Handle(Adaptor3d_Curve)& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2);
|
||||
|
||||
static void D2(const Handle(Adaptor3d_Curve)& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2)
|
||||
{
|
||||
C->D2(U, P, V1, V2);
|
||||
}
|
||||
|
||||
//! Returns the point P of parameter U, the first, the second
|
||||
//! and the third derivative.
|
||||
//! Raised if the continuity of the current interval
|
||||
//! is not C3.
|
||||
static void D3 (const Handle(Adaptor3d_Curve)& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3);
|
||||
|
||||
static void D3(const Handle(Adaptor3d_Curve)& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3)
|
||||
{
|
||||
C->D3(U, P, V1, V2, V3);
|
||||
}
|
||||
|
||||
//! The returned vector gives the value of the derivative for the
|
||||
//! order of derivation N.
|
||||
//! Raised if the continuity of the current interval
|
||||
//! is not CN.
|
||||
//! Raised if N < 1.
|
||||
static gp_Vec DN (const Handle(Adaptor3d_Curve)& C, const Standard_Real U, const Standard_Integer N);
|
||||
|
||||
static gp_Vec DN(const Handle(Adaptor3d_Curve)& C, const Standard_Real U, const Standard_Integer N) { return C->DN(U, N); }
|
||||
|
||||
//! Returns the parametric resolution corresponding
|
||||
//! to the real space resolution <R3d>.
|
||||
static Standard_Real Resolution (const Handle(Adaptor3d_Curve)& C, const Standard_Real R3d);
|
||||
|
||||
static Standard_Real Resolution(const Handle(Adaptor3d_Curve)& C, const Standard_Real R3d) { return C->Resolution(R3d); }
|
||||
|
||||
//! Returns the type of the curve in the current
|
||||
//! interval : Line, Circle, Ellipse, Hyperbola,
|
||||
//! Parabola, BezierCurve, BSplineCurve, OtherCurve.
|
||||
static GeomAbs_CurveType GetType (const Handle(Adaptor3d_Curve)& C);
|
||||
|
||||
static gp_Lin Line (const Handle(Adaptor3d_Curve)& C);
|
||||
|
||||
static gp_Circ Circle (const Handle(Adaptor3d_Curve)& C);
|
||||
|
||||
static gp_Elips Ellipse (const Handle(Adaptor3d_Curve)& C);
|
||||
|
||||
static gp_Hypr Hyperbola (const Handle(Adaptor3d_Curve)& C);
|
||||
|
||||
static gp_Parab Parabola (const Handle(Adaptor3d_Curve)& C);
|
||||
|
||||
static Handle(Geom_BezierCurve) Bezier (const Handle(Adaptor3d_Curve)& C);
|
||||
|
||||
static Handle(Geom_BSplineCurve) BSpline (const Handle(Adaptor3d_Curve)& C);
|
||||
|
||||
Standard_EXPORT static Standard_Integer NbSamples (const Handle(Adaptor3d_Curve)& C, const Standard_Real U0, const Standard_Real U1);
|
||||
|
||||
Standard_EXPORT static void SamplePars (const Handle(Adaptor3d_Curve)& C, const Standard_Real U0, const Standard_Real U1, const Standard_Real Defl, const Standard_Integer NbMin, Handle(TColStd_HArray1OfReal)& Pars);
|
||||
static GeomAbs_CurveType GetType(const Handle(Adaptor3d_Curve)& C) { return C->GetType(); }
|
||||
|
||||
static gp_Lin Line(const Handle(Adaptor3d_Curve)& C) { return C->Line(); }
|
||||
|
||||
static gp_Circ Circle(const Handle(Adaptor3d_Curve)& C) { return C->Circle(); }
|
||||
|
||||
static gp_Elips Ellipse(const Handle(Adaptor3d_Curve)& C) { return C->Ellipse(); }
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
static gp_Hypr Hyperbola(const Handle(Adaptor3d_Curve)& C) { return C->Hyperbola(); }
|
||||
|
||||
static gp_Parab Parabola(const Handle(Adaptor3d_Curve)& C) { return C->Parabola(); }
|
||||
|
||||
static Handle(Geom_BezierCurve) Bezier(const Handle(Adaptor3d_Curve)& C) { return C->Bezier(); }
|
||||
|
||||
static Handle(Geom_BSplineCurve) BSpline(const Handle(Adaptor3d_Curve)& C) { return C->BSpline(); }
|
||||
|
||||
Standard_EXPORT static Standard_Integer NbSamples(const Handle(Adaptor3d_Curve)& C,
|
||||
const Standard_Real U0,
|
||||
const Standard_Real U1);
|
||||
|
||||
Standard_EXPORT static void SamplePars(const Handle(Adaptor3d_Curve)& C,
|
||||
const Standard_Real U0,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real Defl,
|
||||
const Standard_Integer NbMin,
|
||||
Handle(TColStd_HArray1OfReal)& Pars);
|
||||
};
|
||||
|
||||
#define CurveGen Handle(Adaptor3d_Curve)
|
||||
#define CurveGen_hxx <Adaptor3d_Curve.hxx>
|
||||
#define IntCurveSurface_HCurveTool IntCurveSurface_TheHCurveTool
|
||||
#define IntCurveSurface_HCurveTool_hxx <IntCurveSurface_TheHCurveTool.hxx>
|
||||
|
||||
#include <IntCurveSurface_HCurveTool.lxx>
|
||||
|
||||
#undef CurveGen
|
||||
#undef CurveGen_hxx
|
||||
#undef IntCurveSurface_HCurveTool
|
||||
#undef IntCurveSurface_HCurveTool_hxx
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntCurveSurface_TheHCurveTool_HeaderFile
|
||||
|
@ -1,34 +0,0 @@
|
||||
// Created on: 1993-04-07
|
||||
// Created by: Laurent BUCHARD
|
||||
// Copyright (c) 1993-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <IntCurveSurface_TheHCurveTool.hxx>
|
||||
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
|
||||
|
||||
#define CurveGen Handle(Adaptor3d_Curve)
|
||||
#define CurveGen_hxx <Adaptor3d_Curve.hxx>
|
||||
#define IntCurveSurface_HCurveTool IntCurveSurface_TheHCurveTool
|
||||
#define IntCurveSurface_HCurveTool_hxx <IntCurveSurface_TheHCurveTool.hxx>
|
||||
#include "../IntCurveSurface/IntCurveSurface_HCurveTool.gxx"
|
||||
|
Loading…
x
Reference in New Issue
Block a user