1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Version Open CASCADE 670 with fixes

This commit is contained in:
gka
2014-10-10 15:19:04 +04:00
parent 47d9074abb
commit d099845895
65 changed files with 6265 additions and 5290 deletions

View File

@@ -5,8 +5,8 @@
//
// 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 version 2.1 as published
// 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.
@@ -45,27 +45,27 @@ Extrema_ExtCS::Extrema_ExtCS()
}
Extrema_ExtCS::Extrema_ExtCS(const Adaptor3d_Curve& C,
const Adaptor3d_Surface& S,
const Standard_Real TolC,
const Standard_Real TolS)
const Adaptor3d_Surface& S,
const Standard_Real TolC,
const Standard_Real TolS)
{
Initialize(S, S.FirstUParameter(), S.LastUParameter(),
S.FirstVParameter(), S.LastVParameter(),
TolC, TolS);
S.FirstVParameter(), S.LastVParameter(),
TolC, TolS);
Perform(C, C.FirstParameter(), C.LastParameter());
}
Extrema_ExtCS::Extrema_ExtCS(const Adaptor3d_Curve& C,
const Adaptor3d_Surface& S,
const Standard_Real UCinf,
const Standard_Real UCsup,
const Standard_Real Uinf,
const Standard_Real Usup,
const Standard_Real Vinf,
const Standard_Real Vsup,
const Standard_Real TolC,
const Standard_Real TolS)
const Adaptor3d_Surface& S,
const Standard_Real UCinf,
const Standard_Real UCsup,
const Standard_Real Uinf,
const Standard_Real Usup,
const Standard_Real Vinf,
const Standard_Real Vsup,
const Standard_Real TolC,
const Standard_Real TolS)
{
Initialize(S, Uinf, Usup, Vinf, Vsup, TolC, TolS);
@@ -74,12 +74,12 @@ Extrema_ExtCS::Extrema_ExtCS(const Adaptor3d_Curve& C,
void Extrema_ExtCS::Initialize(const Adaptor3d_Surface& S,
const Standard_Real Uinf,
const Standard_Real Usup,
const Standard_Real Vinf,
const Standard_Real Vsup,
const Standard_Real TolC,
const Standard_Real TolS)
const Standard_Real Uinf,
const Standard_Real Usup,
const Standard_Real Vinf,
const Standard_Real Vsup,
const Standard_Real TolC,
const Standard_Real TolS)
{
myS = (Adaptor3d_SurfacePtr)&S;
myIsPar = Standard_False;
@@ -92,10 +92,10 @@ void Extrema_ExtCS::Initialize(const Adaptor3d_Surface& S,
myStype = myS->GetType();
}
void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
const Standard_Real Uinf,
const Standard_Real Usup)
const Standard_Real Uinf,
const Standard_Real Usup)
{
myucinf = Uinf;
myucsup = Usup;
@@ -112,17 +112,17 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
case GeomAbs_Line:
{
switch(myStype) {
case GeomAbs_Sphere:
myExtElCS.Perform(C.Line(), myS->Sphere());
break;
myExtElCS.Perform(C.Line(), myS->Sphere());
break;
case GeomAbs_Cylinder:
myExtElCS.Perform(C.Line(), myS->Cylinder());
break;
myExtElCS.Perform(C.Line(), myS->Cylinder());
break;
case GeomAbs_Plane:
myExtElCS.Perform(C.Line(), myS->Plane());
if (myExtElCS.IsParallel()) break;
myExtElCS.Perform(C.Line(), myS->Plane());
if (myExtElCS.IsParallel()) break;
case GeomAbs_Torus:
case GeomAbs_Cone:
@@ -130,104 +130,101 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
case GeomAbs_BSplineSurface:
case GeomAbs_SurfaceOfRevolution:
case GeomAbs_SurfaceOfExtrusion:
case GeomAbs_OffsetSurface:
case GeomAbs_OtherSurface:
{
Standard_Real cfirst = myucinf, clast = myucsup;
Standard_Real ufirst = myS->FirstUParameter(), ulast = myS->LastUParameter(),
vfirst = myS->FirstVParameter(), vlast = myS->LastVParameter();
{
Standard_Real cfirst = myucinf, clast = myucsup;
Standard_Real ufirst = myS->FirstUParameter(), ulast = myS->LastUParameter(),
vfirst = myS->FirstVParameter(), vlast = myS->LastVParameter();
if(Precision::IsInfinite(Abs(cfirst)) || Precision::IsInfinite(Abs(clast))) {
if(Precision::IsInfinite(Abs(cfirst)) || Precision::IsInfinite(Abs(clast))) {
Bnd_Box aSurfBox;
BndLib_AddSurface::Add(*myS, ufirst, ulast, vfirst, vlast, Precision::Confusion(), aSurfBox);
Standard_Real xmin, ymin, zmin, xmax, ymax, zmax;
aSurfBox.Get(xmin, ymin, zmin, xmax, ymax, zmax);
Standard_Real tmin = Precision::Infinite(), tmax = -tmin;
gp_Lin aLin = C.Line();
if(!( Precision::IsInfinite(Abs(xmin)) || Precision::IsInfinite(Abs(xmax)) ||
Precision::IsInfinite(Abs(ymin)) || Precision::IsInfinite(Abs(ymax)) ||
Precision::IsInfinite(Abs(zmin)) || Precision::IsInfinite(Abs(zmax))) ) {
Extrema_ExtPElC anExt;
Extrema_POnCurv aPntOnLin;
Standard_Real aParOnLin;
Standard_Real lim = Precision::Infinite();
gp_Pnt aLimPntArray[8];
aLimPntArray[0].SetCoord(xmin, ymin, zmin);
aLimPntArray[1].SetCoord(xmax, ymin, zmin);
aLimPntArray[2].SetCoord(xmin, ymax, zmin);
aLimPntArray[3].SetCoord(xmax, ymax, zmin);
aLimPntArray[4].SetCoord(xmin, ymin, zmax);
aLimPntArray[5].SetCoord(xmax, ymin, zmax);
aLimPntArray[6].SetCoord(xmin, ymax, zmax);
aLimPntArray[7].SetCoord(xmax, ymax, zmax);
for(i = 0; i <= 7; i++) {
anExt.Perform(aLimPntArray[i], aLin, Precision::Confusion(), -lim, lim);
aPntOnLin = anExt.Point(1);
aParOnLin = aPntOnLin.Parameter();
tmin = Min(aParOnLin, tmin);
tmax = Max(aParOnLin, tmax);
}
}
else {
tmin = -1.e+50;
tmax = 1.e+50;
}
Bnd_Box aSurfBox;
BndLib_AddSurface::Add(*myS, ufirst, ulast, vfirst, vlast, Precision::Confusion(), aSurfBox);
Standard_Real xmin, ymin, zmin, xmax, ymax, zmax;
aSurfBox.Get(xmin, ymin, zmin, xmax, ymax, zmax);
Standard_Real tmin = Precision::Infinite(), tmax = -tmin;
gp_Lin aLin = C.Line();
cfirst = Max(cfirst, tmin);
clast = Min(clast, tmax);
if(!( Precision::IsInfinite(Abs(xmin)) || Precision::IsInfinite(Abs(xmax)) ||
Precision::IsInfinite(Abs(ymin)) || Precision::IsInfinite(Abs(ymax)) ||
Precision::IsInfinite(Abs(zmin)) || Precision::IsInfinite(Abs(zmax))) ) {
}
Extrema_ExtPElC anExt;
Extrema_POnCurv aPntOnLin;
Standard_Real aParOnLin;
Standard_Real lim = Precision::Infinite();
gp_Pnt aLimPntArray[8];
aLimPntArray[0].SetCoord(xmin, ymin, zmin);
aLimPntArray[1].SetCoord(xmax, ymin, zmin);
aLimPntArray[2].SetCoord(xmin, ymax, zmin);
aLimPntArray[3].SetCoord(xmax, ymax, zmin);
aLimPntArray[4].SetCoord(xmin, ymin, zmax);
aLimPntArray[5].SetCoord(xmax, ymin, zmax);
aLimPntArray[6].SetCoord(xmin, ymax, zmax);
aLimPntArray[7].SetCoord(xmax, ymax, zmax);
for(i = 0; i <= 7; i++) {
anExt.Perform(aLimPntArray[i], aLin, Precision::Confusion(), -lim, lim);
aPntOnLin = anExt.Point(1);
aParOnLin = aPntOnLin.Parameter();
tmin = Min(aParOnLin, tmin);
tmax = Max(aParOnLin, tmax);
}
}
else {
tmin = -1.e+50;
tmax = 1.e+50;
}
Extrema_GenExtCS Ext(C, *myS, NbT, NbU, NbV, cfirst, clast, ufirst, ulast,
vfirst, vlast, mytolC, mytolS);
cfirst = Max(cfirst, tmin);
clast = Min(clast, tmax);
myDone = Ext.IsDone();
if (myDone) {
Standard_Integer NbExt = Ext.NbExt();
Standard_Real T,U,V;
Extrema_POnCurv PC;
Extrema_POnSurf PS;
for (i = 1; i <= NbExt; i++) {
PC = Ext.PointOnCurve(i);
PS = Ext.PointOnSurface(i);
T = PC.Parameter();
PS.Parameter(U, V);
}
Extrema_GenExtCS Ext(C, *myS, NbT, NbU, NbV, cfirst, clast, ufirst, ulast,
vfirst, vlast, mytolC, mytolS);
myDone = Ext.IsDone();
if (myDone) {
Standard_Integer NbExt = Ext.NbExt();
Standard_Real T,U,V;
Extrema_POnCurv PC;
Extrema_POnSurf PS;
for (i = 1; i <= NbExt; i++) {
PC = Ext.PointOnCurve(i);
PS = Ext.PointOnSurface(i);
T = PC.Parameter();
PS.Parameter(U, V);
AddSolution(C, T, U, V, PC.Value(), PS.Value(), Ext.SquareDistance(i));
}
}
return;
}
#ifndef DEB
default:
#endif
break;
}
}
return;
}
}
break;
}
// Modified by skv - Thu Jul 7 12:29:34 2005 OCC9134 Begin
// Modified by skv - Thu Jul 7 12:29:34 2005 OCC9134 Begin
case GeomAbs_Circle:
{
if(myStype == GeomAbs_Cylinder) {
myExtElCS.Perform(C.Circle(), myS->Cylinder());
break;
myExtElCS.Perform(C.Circle(), myS->Cylinder());
break;
}
}
case GeomAbs_Hyperbola:
{
if(myCtype == GeomAbs_Hyperbola && myStype == GeomAbs_Plane) {
// Modified by skv - Thu Jul 7 12:29:34 2005 OCC9134 End
myExtElCS.Perform(C.Hyperbola(), myS->Plane());
break;
// Modified by skv - Thu Jul 7 12:29:34 2005 OCC9134 End
myExtElCS.Perform(C.Hyperbola(), myS->Plane());
break;
}
}
default:
@@ -235,30 +232,30 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
Extrema_GenExtCS Ext;
Ext.Initialize(*myS, NbU, NbV, mytolS);
if(myCtype == GeomAbs_Hyperbola) {
Standard_Real tmin = Max(-20., C.FirstParameter());
Standard_Real tmax = Min(20., C.LastParameter());
Ext.Perform(C, NbT, tmin, tmax, mytolC); // to avoid overflow
Standard_Real tmin = Max(-20., C.FirstParameter());
Standard_Real tmax = Min(20., C.LastParameter());
Ext.Perform(C, NbT, tmin, tmax, mytolC); // to avoid overflow
}
else {
if(myCtype == GeomAbs_Circle && NbT < 13) {
NbT = 13;
}
Ext.Perform(C, NbT, mytolC);
if(myCtype == GeomAbs_Circle && NbT < 13) {
NbT = 13;
}
Ext.Perform(C, NbT, mytolC);
}
myDone = Ext.IsDone();
if (myDone) {
Standard_Integer NbExt = Ext.NbExt();
Standard_Real T,U,V;
Extrema_POnCurv PC;
Extrema_POnSurf PS;
for (i = 1; i <= NbExt; i++) {
PC = Ext.PointOnCurve(i);
PS = Ext.PointOnSurface(i);
T = PC.Parameter();
PS.Parameter(U, V);
Standard_Integer NbExt = Ext.NbExt();
Standard_Real T,U,V;
Extrema_POnCurv PC;
Extrema_POnSurf PS;
for (i = 1; i <= NbExt; i++) {
PC = Ext.PointOnCurve(i);
PS = Ext.PointOnSurface(i);
T = PC.Parameter();
PS.Parameter(U, V);
AddSolution(C, T, U, V, PC.Value(), PS.Value(), Ext.SquareDistance(i));
}
}
//Add sharp points
Standard_Integer SolNumber = mySqDist.Length();
@@ -289,7 +286,7 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
{
ProjPS.Point(jmin).Parameter(U,V);
AddSolution(C, T, U, V,
aPnt, ProjPS.Point(jmin).Value(), MinSqDist);
aPnt, ProjPS.Point(jmin).Value(), MinSqDist);
}
}
//Cut sharp solutions to keep only minimum and maximum
@@ -309,7 +306,7 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
Extrema_POnCurv MaxPC = myPOnC(imax);
Extrema_POnSurf MinPS = myPOnS(imin);
Extrema_POnSurf MaxPS = myPOnS(imax);
mySqDist.Remove(SolNumber + 1, mySqDist.Length());
myPOnC.Remove(SolNumber + 1, myPOnC.Length());
myPOnS.Remove(SolNumber + 1, myPOnS.Length());
@@ -326,7 +323,7 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
}
break;
}
myDone = myExtElCS.IsDone();
if (myDone) {
myIsPar = myExtElCS.IsParallel();
@@ -337,16 +334,16 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
Standard_Integer NbExt = myExtElCS.NbExt();
Standard_Real U, V;
for (i = 1; i <= NbExt; i++) {
Extrema_POnCurv PC;
Extrema_POnSurf PS;
myExtElCS.Points(i, PC, PS);
Standard_Real Ucurve = PC.Parameter();
PS.Parameter(U, V);
Extrema_POnCurv PC;
Extrema_POnSurf PS;
myExtElCS.Points(i, PC, PS);
Standard_Real Ucurve = PC.Parameter();
PS.Parameter(U, V);
AddSolution(C, Ucurve, U, V, PC.Value(), PS.Value(), myExtElCS.SquareDistance(i));
}
}
}
}
@@ -379,8 +376,8 @@ Standard_Integer Extrema_ExtCS::NbExt() const
void Extrema_ExtCS::Points(const Standard_Integer N,
Extrema_POnCurv& P1,
Extrema_POnSurf& P2) const
Extrema_POnCurv& P1,
Extrema_POnSurf& P2) const
{
if(!myDone) StdFail_NotDone::Raise();
P1 = myPOnC.Value(N);
@@ -388,17 +385,17 @@ void Extrema_ExtCS::Points(const Standard_Integer N,
}
Standard_Boolean Extrema_ExtCS::AddSolution(const Adaptor3d_Curve& theCurve,
const Standard_Real aT,
const Standard_Real aU,
const Standard_Real aV,
const gp_Pnt& PointOnCurve,
const gp_Pnt& PointOnSurf,
const Standard_Real SquareDist)
const Standard_Real aT,
const Standard_Real aU,
const Standard_Real aV,
const gp_Pnt& PointOnCurve,
const gp_Pnt& PointOnSurf,
const Standard_Real SquareDist)
{
Standard_Boolean Added = Standard_False;
Standard_Real T = aT, U = aU, V = aV;
if (theCurve.IsPeriodic())
T = ElCLib::InPeriod(T, myucinf, myucinf + theCurve.Period());
if (myS->IsUPeriodic())
@@ -409,8 +406,8 @@ Standard_Boolean Extrema_ExtCS::AddSolution(const Adaptor3d_Curve& theCurve,
Extrema_POnCurv aPC;
Extrema_POnSurf aPS;
if ((myucinf-T) <= mytolC && (T-myucsup) <= mytolC &&
(myuinf-U) <= mytolS && (U-myusup) <= mytolS &&
(myvinf-V) <= mytolS && (V-myvsup) <= mytolS)
(myuinf-U) <= mytolS && (U-myusup) <= mytolS &&
(myvinf-V) <= mytolS && (V-myvsup) <= mytolS)
{
Standard_Boolean IsNewSolution = Standard_True;
for (Standard_Integer j = 1; j <= mySqDist.Length(); j++)
@@ -421,8 +418,8 @@ Standard_Boolean Extrema_ExtCS::AddSolution(const Adaptor3d_Curve& theCurve,
Standard_Real Uj, Vj;
aPS.Parameter(Uj, Vj);
if (Abs(T - Tj) <= mytolC &&
Abs(U - Uj) <= mytolS &&
Abs(V - Vj) <= mytolS)
Abs(U - Uj) <= mytolS &&
Abs(V - Vj) <= mytolS)
{
IsNewSolution = Standard_False;
break;