mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0026431: Can't cut a sphere from a cylinder
This branch contains fixes for 26675 and 26431 bugs. 1. Normalization has been eliminated. 2. Interfaces of AppDef_Compute::Parametrization(...) and BRepAlgo_BooleanOperations::SetApproxParameters() methods have been changed. 3. Overloaded methods for ApproxInt_Approx::SetParameters(...), TopOpeBRepTool_GeomTool::GetTolerances(...) and TopOpeBRepTool_GeomTool::SetTolerances(...) have been removed (because some fields of these classes are not used more). 4. Comments for some methods have been changed in BRepApprox_TheMultiLineOfApprox.hxx and GeomInt_TheMultiLineOfWLApprox.hxx files. 5. Some fields have been deleted from ApproxInt_MultiLine class. Kept members have become constant. 6. Interface of ksection DRAW-command has been changed. 7. Now, 2dintersect DRAW-command prints information about found segments. 8. Some code fragments have been rewritten to make them easier. 9. Algorithm of splitting WLine, which goes through pole of sphere has been improved. 10. Improve approximation algorithm in order to it will compute correct 2D- and 3D-tangent at the end of bezier constraints (including case when curve goes through or finishes on singular points). 11. Interface of IntPatch_WLine::Dump(...) method has been corrected. 12. Some methods for working with Walking-line are made more universal (available for both GeomInt and IntTools packages). 13. Problem in BRepLib::SameParameter(...) method has been fixed (see corresponding comment). 14. Small correction in Draft package. 15. Any outputs in IntPatch_Intersection::Dump(...) method have become disabled because they are useless. If anybody need in this outputs he/she will correct this method himself/herself. Adjusting some test cases according to their new behavior. Creation of new test cases. ---------------------------------------------------------------------------------------------------------------------------- Some explanation of new behavior of some test cases: 1. Regressions: a) blend simple X4 The problem is described in the issue #0026740. According to this description, the result on the current MASTER seems to be wrong indeed. b) boolean bcommon_complex C7 and boolean bcut_complex Q1 These test case use same shapes with different Boolean operation (COMMON and CUT). They are already BAD (on the MASTER). Now, some sub-shapes have become not-shared, simply. In my opinion, we shall apply new behavior of these tests. c) boolean bsection M3 The problem described in the issue #0026777 exists even on the current MASTER. d) boolean bsection M9 The problem is described in the message http://tracker.dev.opencascade.org/view.php?id=26815#c47546. Here, we have really regression in the picture. e) boolean bsection N2 The problem is described in issue #0026814. f) boolean volumemaker G1 The problem is described in issue #26020. g) bugs modalg_1 bug1255 (and bug1255_1) The problem is described in issue #26815. h) bugs modalg_2 bug5805_18, bugs modalg_2 bug5805_42, bugs modalg_2 bug5805_46 The problem is described in issue #25925. i) bugs modalg_3 bug602 The problem is describes in issue #602. j) bugs modalg_5 bug24915 The problem is described in the message http://tracker.dev.opencascade.org/view.php?id=25929#c48565. It is not fixed by this issue. k) bugs modalg_5 bug25838 The main reason is described in issue #0026816. ---------------------------------------------------------------------------- 2. Improvements: a) boolean volumemaker F9 b) bugs modalg_1 bug10160_3 c) bugs modalg_2 bug22557 d) bugs modalg_5 bug25319_1 (_2) e) draft angle G2 f) offset shape A1 g) offset with_intersect_80 N7
This commit is contained in:
@@ -40,6 +40,7 @@ class gp_Pnt2d;
|
||||
class IntPatch_RLine;
|
||||
class Bnd_Box2d;
|
||||
class Adaptor3d_TopolTool;
|
||||
class IntPatch_WLine;
|
||||
|
||||
|
||||
|
||||
@@ -110,7 +111,9 @@ public:
|
||||
//! of the source surface.
|
||||
Standard_EXPORT static void TrimILineOnSurfBoundaries (const Handle(Geom2d_Curve)& theC2d1, const Handle(Geom2d_Curve)& theC2d2, const Bnd_Box2d& theBound1, const Bnd_Box2d& theBound2, GeomInt_VectorOfReal& theArrayOfParameters);
|
||||
|
||||
Standard_EXPORT static Handle(Geom_Curve) MakeBSpline (const Handle(IntPatch_WLine)& WL, const Standard_Integer ideb, const Standard_Integer ifin);
|
||||
|
||||
Standard_EXPORT static Handle(Geom2d_BSplineCurve) MakeBSpline2d(const Handle(IntPatch_WLine)& theWLine, const Standard_Integer ideb, const Standard_Integer ifin, const Standard_Boolean onFirst);
|
||||
|
||||
|
||||
protected:
|
||||
|
@@ -15,6 +15,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <IntPatch_Point.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -14,15 +14,250 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <GeomInt_LineTool.hxx>
|
||||
|
||||
#include <Extrema_ExtPS.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <IntPatch_ALine.hxx>
|
||||
#include <IntPatch_GLine.hxx>
|
||||
#include <IntPatch_Line.hxx>
|
||||
#include <IntPatch_Point.hxx>
|
||||
#include <IntPatch_RLine.hxx>
|
||||
#include <IntPatch_WLine.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
#include <NCollection_LocalArray.hxx>
|
||||
#include <NCollection_StdAllocator.hxx>
|
||||
#include <TColStd_Array1OfListOfInteger.hxx>
|
||||
|
||||
class ProjectPointOnSurf
|
||||
{
|
||||
public:
|
||||
ProjectPointOnSurf() : myIsDone (Standard_False),myIndex(0) {}
|
||||
void Init(const Handle(Geom_Surface)& Surface,
|
||||
const Standard_Real Umin,
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vmin,
|
||||
const Standard_Real Vsup);
|
||||
void Init ();
|
||||
void Perform(const gp_Pnt& P);
|
||||
Standard_Boolean IsDone () const { return myIsDone; }
|
||||
void LowerDistanceParameters(Standard_Real& U, Standard_Real& V ) const;
|
||||
Standard_Real LowerDistance() const;
|
||||
protected:
|
||||
Standard_Boolean myIsDone;
|
||||
Standard_Integer myIndex;
|
||||
Extrema_ExtPS myExtPS;
|
||||
GeomAdaptor_Surface myGeomAdaptor;
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void ProjectPointOnSurf::Init ( const Handle(Geom_Surface)& Surface,
|
||||
const Standard_Real Umin,
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vmin,
|
||||
const Standard_Real Vsup )
|
||||
{
|
||||
const Standard_Real Tolerance = Precision::PConfusion();
|
||||
//
|
||||
myGeomAdaptor.Load(Surface, Umin,Usup,Vmin,Vsup);
|
||||
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
myIsDone = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void ProjectPointOnSurf::Init ()
|
||||
{
|
||||
myIsDone = myExtPS.IsDone() && (myExtPS.NbExt() > 0);
|
||||
if (myIsDone) {
|
||||
// evaluate the lower distance and its index;
|
||||
Standard_Real Dist2Min = myExtPS.SquareDistance(1);
|
||||
myIndex = 1;
|
||||
for (Standard_Integer i = 2; i <= myExtPS.NbExt(); i++)
|
||||
{
|
||||
const Standard_Real Dist2 = myExtPS.SquareDistance(i);
|
||||
if (Dist2 < Dist2Min) {
|
||||
Dist2Min = Dist2;
|
||||
myIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void ProjectPointOnSurf::Perform(const gp_Pnt& P)
|
||||
{
|
||||
myExtPS.Perform(P);
|
||||
Init ();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LowerDistanceParameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void ProjectPointOnSurf::LowerDistanceParameters (Standard_Real& U,
|
||||
Standard_Real& V ) const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!myIsDone, "GeomInt_IntSS::ProjectPointOnSurf::LowerDistanceParameters");
|
||||
(myExtPS.Point(myIndex)).Parameter(U,V);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LowerDistance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real ProjectPointOnSurf::LowerDistance() const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!myIsDone, "GeomInt_IntSS::ProjectPointOnSurf::LowerDistance");
|
||||
return sqrt(myExtPS.SquareDistance(myIndex));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AdjustPeriodic
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Real AdjustPeriodic(const Standard_Real theParameter,
|
||||
const Standard_Real parmin,
|
||||
const Standard_Real parmax,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real& theOffset)
|
||||
{
|
||||
Standard_Real aresult = theParameter;
|
||||
theOffset = 0.;
|
||||
while(aresult < parmin) {
|
||||
aresult += thePeriod;
|
||||
theOffset += thePeriod;
|
||||
}
|
||||
while(aresult > parmax) {
|
||||
aresult -= thePeriod;
|
||||
theOffset -= thePeriod;
|
||||
}
|
||||
return aresult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsPointOnBoundary
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Boolean IsPointOnBoundary(const Standard_Real theParameter,
|
||||
const Standard_Real theFirstBoundary,
|
||||
const Standard_Real theSecondBoundary,
|
||||
const Standard_Real theResolution,
|
||||
Standard_Boolean& IsOnFirstBoundary)
|
||||
{
|
||||
IsOnFirstBoundary = Standard_True;
|
||||
if(fabs(theParameter - theFirstBoundary) < theResolution)
|
||||
return Standard_True;
|
||||
if(fabs(theParameter - theSecondBoundary) < theResolution)
|
||||
{
|
||||
IsOnFirstBoundary = Standard_False;
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FindPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Boolean FindPoint(const gp_Pnt2d& theFirstPoint,
|
||||
const gp_Pnt2d& theLastPoint,
|
||||
const Standard_Real theUmin,
|
||||
const Standard_Real theUmax,
|
||||
const Standard_Real theVmin,
|
||||
const Standard_Real theVmax,
|
||||
gp_Pnt2d& theNewPoint)
|
||||
{
|
||||
gp_Vec2d aVec(theFirstPoint, theLastPoint);
|
||||
Standard_Integer i = 0, j = 0;
|
||||
|
||||
for(i = 0; i < 4; i++) {
|
||||
gp_Vec2d anOtherVec;
|
||||
gp_Vec2d anOtherVecNormal;
|
||||
gp_Pnt2d aprojpoint = theLastPoint;
|
||||
|
||||
if((i % 2) == 0) {
|
||||
anOtherVec.SetX(0.);
|
||||
anOtherVec.SetY(1.);
|
||||
anOtherVecNormal.SetX(1.);
|
||||
anOtherVecNormal.SetY(0.);
|
||||
|
||||
if(i < 2)
|
||||
aprojpoint.SetX(theUmin);
|
||||
else
|
||||
aprojpoint.SetX(theUmax);
|
||||
}
|
||||
else {
|
||||
anOtherVec.SetX(1.);
|
||||
anOtherVec.SetY(0.);
|
||||
anOtherVecNormal.SetX(0.);
|
||||
anOtherVecNormal.SetY(1.);
|
||||
|
||||
if(i < 2)
|
||||
aprojpoint.SetY(theVmin);
|
||||
else
|
||||
aprojpoint.SetY(theVmax);
|
||||
}
|
||||
gp_Vec2d anormvec = aVec;
|
||||
anormvec.Normalize();
|
||||
Standard_Real adot1 = anormvec.Dot(anOtherVecNormal);
|
||||
|
||||
if(fabs(adot1) < Precision::Angular())
|
||||
continue;
|
||||
Standard_Real adist = 0.;
|
||||
|
||||
if((i % 2) == 0) {
|
||||
adist = (i < 2) ? fabs(theLastPoint.X() - theUmin) : fabs(theLastPoint.X() - theUmax);
|
||||
}
|
||||
else {
|
||||
adist = (i < 2) ? fabs(theLastPoint.Y() - theVmin) : fabs(theLastPoint.Y() - theVmax);
|
||||
}
|
||||
Standard_Real anoffset = adist * anOtherVec.Dot(anormvec) / adot1;
|
||||
|
||||
for(j = 0; j < 2; j++) {
|
||||
anoffset = (j == 0) ? anoffset : -anoffset;
|
||||
gp_Pnt2d acurpoint(aprojpoint.XY() + (anOtherVec.XY()*anoffset));
|
||||
gp_Vec2d acurvec(theLastPoint, acurpoint);
|
||||
|
||||
//
|
||||
Standard_Real aDotX, anAngleX, aPC;
|
||||
//
|
||||
aDotX=aVec.Dot(acurvec);
|
||||
anAngleX=aVec.Angle(acurvec);
|
||||
aPC=Precision::PConfusion();
|
||||
//
|
||||
if(aDotX > 0. && fabs(anAngleX) < aPC) {
|
||||
//
|
||||
if((i % 2) == 0) {
|
||||
if((acurpoint.Y() >= theVmin) &&
|
||||
(acurpoint.Y() <= theVmax)) {
|
||||
theNewPoint = acurpoint;
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if((acurpoint.X() >= theUmin) &&
|
||||
(acurpoint.X() <= theUmax)) {
|
||||
theNewPoint = acurpoint;
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbVertex
|
||||
@@ -164,3 +399,600 @@ Standard_Real GeomInt_LineTool::LastParameter (const Handle(IntPatch_Line)& L)
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DecompositionOfWLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GeomInt_LineTool::
|
||||
DecompositionOfWLine( const Handle(IntPatch_WLine)& theWLine,
|
||||
const Handle(GeomAdaptor_HSurface)& theSurface1,
|
||||
const Handle(GeomAdaptor_HSurface)& theSurface2,
|
||||
const Standard_Real aTolSum,
|
||||
const GeomInt_LineConstructor& theLConstructor,
|
||||
IntPatch_SequenceOfLine& theNewLines)
|
||||
{
|
||||
typedef NCollection_List<Standard_Integer> ListOfInteger;
|
||||
//have to use std::vector, not NCollection_Vector in order to use copy constructor of
|
||||
//ListOfInteger which will be created with specific allocator instance
|
||||
typedef std::vector<ListOfInteger, NCollection_StdAllocator<
|
||||
ListOfInteger> > ArrayOfListOfInteger;
|
||||
|
||||
Standard_Boolean bIsPrevPointOnBoundary, bIsCurrentPointOnBoundary;
|
||||
Standard_Integer nblines, aNbPnts, aNbParts, pit, i, j, aNbListOfPointIndex;
|
||||
Standard_Real aTol, umin, umax, vmin, vmax;
|
||||
|
||||
//an inc allocator, it will contain wasted space (upon list's Clear()) but it should
|
||||
//still be faster than the standard allocator, and wasted memory should not be
|
||||
//significant and will be limited by time span of this function;
|
||||
//this is a separate allocator from the anIncAlloc below what provides better data
|
||||
//locality in the latter (by avoiding wastes which will only be in anIdxAlloc)
|
||||
Handle(NCollection_IncAllocator) anIdxAlloc = new NCollection_IncAllocator();
|
||||
ListOfInteger aListOfPointIndex (anIdxAlloc);
|
||||
|
||||
//GeomAPI_ProjectPointOnSurf aPrj1, aPrj2;
|
||||
ProjectPointOnSurf aPrj1, aPrj2;
|
||||
Handle(Geom_Surface) aSurf1, aSurf2;
|
||||
//
|
||||
aNbParts=theLConstructor.NbParts();
|
||||
aNbPnts=theWLine->NbPnts();
|
||||
//
|
||||
if((!aNbPnts) || (!aNbParts)){
|
||||
return Standard_False;
|
||||
}
|
||||
//
|
||||
Handle(NCollection_IncAllocator) anIncAlloc = new NCollection_IncAllocator();
|
||||
NCollection_StdAllocator<ListOfInteger> anAlloc (anIncAlloc);
|
||||
const ListOfInteger aDummy (anIncAlloc); //empty list to be copy constructed from
|
||||
ArrayOfListOfInteger anArrayOfLines (aNbPnts + 1, aDummy, anAlloc);
|
||||
|
||||
NCollection_LocalArray<Standard_Integer> anArrayOfLineTypeArr (aNbPnts + 1);
|
||||
Standard_Integer* anArrayOfLineType = anArrayOfLineTypeArr;
|
||||
//
|
||||
nblines = 0;
|
||||
aTol = Precision::Confusion();
|
||||
//
|
||||
aSurf1 = theSurface1->ChangeSurface().Surface();
|
||||
aSurf1->Bounds(umin, umax, vmin, vmax);
|
||||
aPrj1.Init(aSurf1, umin, umax, vmin, vmax);
|
||||
//
|
||||
aSurf2 = theSurface2->ChangeSurface().Surface();
|
||||
aSurf2->Bounds(umin, umax, vmin, vmax);
|
||||
aPrj2.Init(aSurf2, umin, umax, vmin, vmax);
|
||||
//
|
||||
//
|
||||
bIsPrevPointOnBoundary=Standard_False;
|
||||
for(pit=1; pit<=aNbPnts; pit++) {
|
||||
const IntSurf_PntOn2S& aPoint = theWLine->Point(pit);
|
||||
bIsCurrentPointOnBoundary=Standard_False;
|
||||
//
|
||||
// whether aPoint is on boundary or not
|
||||
//
|
||||
for(i=0; i<2; i++) {// exploration Surface 1,2
|
||||
Handle(GeomAdaptor_HSurface) aGASurface = (!i) ? theSurface1 : theSurface2;
|
||||
aGASurface->ChangeSurface().Surface()->Bounds(umin, umax, vmin, vmax);
|
||||
//
|
||||
for(j=0; j<2; j++) {// exploration of coordinate U,V
|
||||
Standard_Boolean isperiodic;
|
||||
//
|
||||
isperiodic = (!j) ? aGASurface->IsUPeriodic() : aGASurface->IsVPeriodic();
|
||||
if(!isperiodic) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
Standard_Real aResolution, aPeriod, alowerboundary, aupperboundary, U, V;
|
||||
Standard_Real aParameter, anoffset, anAdjustPar;
|
||||
Standard_Boolean bIsOnFirstBoundary, bIsPointOnBoundary;
|
||||
//
|
||||
aResolution = (!j) ? aGASurface->UResolution(aTol) : aGASurface->VResolution(aTol);
|
||||
aPeriod = (!j) ? aGASurface->UPeriod() : aGASurface->VPeriod();
|
||||
alowerboundary = (!j) ? umin : vmin;
|
||||
aupperboundary = (!j) ? umax : vmax;
|
||||
U=0.;V=0.;//?
|
||||
//
|
||||
if(!i){
|
||||
aPoint.ParametersOnS1(U, V);
|
||||
}
|
||||
else{
|
||||
aPoint.ParametersOnS2(U, V);
|
||||
}
|
||||
//
|
||||
aParameter = (!j) ? U : V;
|
||||
anoffset=0.;
|
||||
anAdjustPar=AdjustPeriodic(aParameter, alowerboundary, aupperboundary, aPeriod, anoffset);
|
||||
//
|
||||
bIsOnFirstBoundary=Standard_True;
|
||||
//
|
||||
bIsPointOnBoundary=
|
||||
IsPointOnBoundary(anAdjustPar, alowerboundary, aupperboundary, aResolution, bIsOnFirstBoundary);
|
||||
|
||||
if(bIsPointOnBoundary) {
|
||||
bIsCurrentPointOnBoundary = Standard_True;
|
||||
break;
|
||||
}
|
||||
}// for(j=0; j<2; j++)
|
||||
|
||||
if(bIsCurrentPointOnBoundary){
|
||||
break;
|
||||
}
|
||||
}// for(i=0; i<2; i++)
|
||||
//
|
||||
if((bIsCurrentPointOnBoundary != bIsPrevPointOnBoundary)) {
|
||||
|
||||
if(!aListOfPointIndex.IsEmpty()) {
|
||||
nblines++;
|
||||
anArrayOfLines[nblines] = aListOfPointIndex;
|
||||
anArrayOfLineType[nblines] = bIsPrevPointOnBoundary;
|
||||
aListOfPointIndex.Clear();
|
||||
}
|
||||
bIsPrevPointOnBoundary = bIsCurrentPointOnBoundary;
|
||||
}
|
||||
aListOfPointIndex.Append(pit);
|
||||
} // for(pit=1; pit<=aNbPnts; pit++)
|
||||
//
|
||||
aNbListOfPointIndex=aListOfPointIndex.Extent();
|
||||
if(aNbListOfPointIndex) {
|
||||
nblines++;
|
||||
anArrayOfLines[nblines].Assign (aListOfPointIndex);
|
||||
anArrayOfLineType[nblines] = bIsPrevPointOnBoundary;
|
||||
aListOfPointIndex.Clear();
|
||||
}
|
||||
//
|
||||
if(nblines <= 1){
|
||||
return Standard_False;
|
||||
}
|
||||
//
|
||||
// Correct wlines.begin
|
||||
Standard_Integer aLineType;
|
||||
TColStd_Array1OfListOfInteger anArrayOfLineEnds(1, nblines);
|
||||
Handle(IntSurf_LineOn2S) aSeqOfPntOn2S = new IntSurf_LineOn2S (new NCollection_IncAllocator());
|
||||
//
|
||||
for(i = 1; i <= nblines; i++) {
|
||||
aLineType=anArrayOfLineType[i];
|
||||
if(aLineType) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const ListOfInteger& aListOfIndex = anArrayOfLines[i];
|
||||
if(aListOfIndex.Extent() < 2) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
TColStd_ListOfInteger aListOfFLIndex;
|
||||
Standard_Integer aneighbourindex, aLineTypeNeib;
|
||||
//
|
||||
for(j = 0; j < 2; j++) {// neighbour line choice
|
||||
aneighbourindex = (!j) ? (i-1) : (i+1);
|
||||
if((aneighbourindex < 1) || (aneighbourindex > nblines)){
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aLineTypeNeib=anArrayOfLineType[aneighbourindex];
|
||||
if(!aLineTypeNeib){
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const ListOfInteger& aNeighbour = anArrayOfLines[aneighbourindex];
|
||||
Standard_Integer anIndex = (!j) ? aNeighbour.Last() : aNeighbour.First();
|
||||
const IntSurf_PntOn2S& aPoint = theWLine->Point(anIndex);
|
||||
// check if need use derivative.begin .end [absence]
|
||||
//
|
||||
IntSurf_PntOn2S aNewP = aPoint;
|
||||
Standard_Integer surfit, parit;
|
||||
//
|
||||
for(surfit = 0; surfit < 2; ++surfit) {
|
||||
|
||||
Handle(GeomAdaptor_HSurface) aGASurface = (!surfit) ? theSurface1 : theSurface2;
|
||||
|
||||
umin = aGASurface->FirstUParameter();
|
||||
umax = aGASurface->LastUParameter();
|
||||
vmin = aGASurface->FirstVParameter();
|
||||
vmax = aGASurface->LastVParameter();
|
||||
Standard_Real U=0., V=0.;
|
||||
|
||||
if(!surfit) {
|
||||
aNewP.ParametersOnS1(U, V);
|
||||
}
|
||||
else {
|
||||
aNewP.ParametersOnS2(U, V);
|
||||
}
|
||||
//
|
||||
Standard_Integer nbboundaries = 0;
|
||||
Standard_Integer bIsUBoundary = Standard_False; // use if nbboundaries == 1
|
||||
Standard_Integer bIsFirstBoundary = Standard_False; // use if nbboundaries == 1
|
||||
//
|
||||
for(parit = 0; parit < 2; parit++) {
|
||||
Standard_Boolean isperiodic = (!parit) ? aGASurface->IsUPeriodic() : aGASurface->IsVPeriodic();
|
||||
|
||||
Standard_Real aResolution = (!parit) ? aGASurface->UResolution(aTol) : aGASurface->VResolution(aTol);
|
||||
Standard_Real alowerboundary = (!parit) ? umin : vmin;
|
||||
Standard_Real aupperboundary = (!parit) ? umax : vmax;
|
||||
|
||||
Standard_Real aParameter = (!parit) ? U : V;
|
||||
Standard_Boolean bIsOnFirstBoundary = Standard_True;
|
||||
|
||||
if(!isperiodic) {
|
||||
if(IsPointOnBoundary(aParameter, alowerboundary, aupperboundary, aResolution, bIsOnFirstBoundary)) {
|
||||
bIsUBoundary = (!parit);
|
||||
bIsFirstBoundary = bIsOnFirstBoundary;
|
||||
nbboundaries++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Standard_Real aPeriod = (!parit) ? aGASurface->UPeriod() : aGASurface->VPeriod();
|
||||
Standard_Real anoffset = 0.;
|
||||
Standard_Real anAdjustPar = AdjustPeriodic(aParameter, alowerboundary, aupperboundary, aPeriod, anoffset);
|
||||
|
||||
if(IsPointOnBoundary(anAdjustPar, alowerboundary, aupperboundary, aResolution, bIsOnFirstBoundary)) {
|
||||
bIsUBoundary = (parit == 0);
|
||||
bIsFirstBoundary = bIsOnFirstBoundary;
|
||||
nbboundaries++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
Standard_Boolean bComputeLineEnd = Standard_False;
|
||||
|
||||
if(nbboundaries == 2) {
|
||||
bComputeLineEnd = Standard_True;
|
||||
}
|
||||
else if(nbboundaries == 1) {
|
||||
Standard_Boolean isperiodic = (bIsUBoundary) ? aGASurface->IsUPeriodic() : aGASurface->IsVPeriodic();
|
||||
|
||||
if(isperiodic) {
|
||||
Standard_Real alowerboundary = (bIsUBoundary) ? umin : vmin;
|
||||
Standard_Real aupperboundary = (bIsUBoundary) ? umax : vmax;
|
||||
Standard_Real aPeriod = (bIsUBoundary) ? aGASurface->UPeriod() : aGASurface->VPeriod();
|
||||
Standard_Real aParameter = (bIsUBoundary) ? U : V;
|
||||
Standard_Real anoffset = 0.;
|
||||
Standard_Real anAdjustPar = AdjustPeriodic(aParameter, alowerboundary, aupperboundary, aPeriod, anoffset);
|
||||
|
||||
Standard_Real adist = (bIsFirstBoundary) ? fabs(anAdjustPar - alowerboundary) : fabs(anAdjustPar - aupperboundary);
|
||||
Standard_Real anotherPar = (bIsFirstBoundary) ? (aupperboundary - adist) : (alowerboundary + adist);
|
||||
anotherPar += anoffset;
|
||||
Standard_Integer aneighbourpointindex = (j == 0) ? aListOfIndex.First() : aListOfIndex.Last();
|
||||
const IntSurf_PntOn2S& aNeighbourPoint = theWLine->Point(aneighbourpointindex);
|
||||
Standard_Real nU1, nV1;
|
||||
|
||||
if(surfit == 0)
|
||||
aNeighbourPoint.ParametersOnS1(nU1, nV1);
|
||||
else
|
||||
aNeighbourPoint.ParametersOnS2(nU1, nV1);
|
||||
|
||||
Standard_Real adist1 = (bIsUBoundary) ? fabs(nU1 - U) : fabs(nV1 - V);
|
||||
Standard_Real adist2 = (bIsUBoundary) ? fabs(nU1 - anotherPar) : fabs(nV1 - anotherPar);
|
||||
bComputeLineEnd = Standard_True;
|
||||
Standard_Boolean bCheckAngle1 = Standard_False;
|
||||
Standard_Boolean bCheckAngle2 = Standard_False;
|
||||
gp_Vec2d aNewVec;
|
||||
Standard_Real anewU = (bIsUBoundary) ? anotherPar : U;
|
||||
Standard_Real anewV = (bIsUBoundary) ? V : anotherPar;
|
||||
//
|
||||
if(((adist1 - adist2) > Precision::PConfusion()) &&
|
||||
(adist2 < (aPeriod / 4.))) {
|
||||
bCheckAngle1 = Standard_True;
|
||||
aNewVec = gp_Vec2d(gp_Pnt2d(nU1, nV1), gp_Pnt2d(anewU, anewV));
|
||||
|
||||
if(aNewVec.SquareMagnitude() < (gp::Resolution() * gp::Resolution())) {
|
||||
aNewP.SetValue((surfit == 0), anewU, anewV);
|
||||
bCheckAngle1 = Standard_False;
|
||||
}
|
||||
}
|
||||
else if(adist1 < (aPeriod / 4.)) {
|
||||
bCheckAngle2 = Standard_True;
|
||||
aNewVec = gp_Vec2d(gp_Pnt2d(nU1, nV1), gp_Pnt2d(U, V));
|
||||
|
||||
if(aNewVec.SquareMagnitude() < (gp::Resolution() * gp::Resolution())) {
|
||||
bCheckAngle2 = Standard_False;
|
||||
}
|
||||
}
|
||||
//
|
||||
if(bCheckAngle1 || bCheckAngle2) {
|
||||
// assume there are at least two points in line (see "if" above)
|
||||
Standard_Integer anindexother = aneighbourpointindex;
|
||||
|
||||
while((anindexother <= aListOfIndex.Last()) && (anindexother >= aListOfIndex.First())) {
|
||||
anindexother = (j == 0) ? (anindexother + 1) : (anindexother - 1);
|
||||
const IntSurf_PntOn2S& aPrevNeighbourPoint = theWLine->Point(anindexother);
|
||||
Standard_Real nU2, nV2;
|
||||
|
||||
if(surfit == 0)
|
||||
aPrevNeighbourPoint.ParametersOnS1(nU2, nV2);
|
||||
else
|
||||
aPrevNeighbourPoint.ParametersOnS2(nU2, nV2);
|
||||
gp_Vec2d aVecOld(gp_Pnt2d(nU2, nV2), gp_Pnt2d(nU1, nV1));
|
||||
|
||||
if(aVecOld.SquareMagnitude() <= (gp::Resolution() * gp::Resolution())) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
Standard_Real anAngle = aNewVec.Angle(aVecOld);
|
||||
|
||||
if((fabs(anAngle) < (M_PI * 0.25)) && (aNewVec.Dot(aVecOld) > 0.)) {
|
||||
|
||||
if(bCheckAngle1) {
|
||||
Standard_Real U1, U2, V1, V2;
|
||||
IntSurf_PntOn2S atmppoint = aNewP;
|
||||
atmppoint.SetValue((surfit == 0), anewU, anewV);
|
||||
atmppoint.Parameters(U1, V1, U2, V2);
|
||||
gp_Pnt P1 = theSurface1->Value(U1, V1);
|
||||
gp_Pnt P2 = theSurface2->Value(U2, V2);
|
||||
gp_Pnt P0 = aPoint.Value();
|
||||
|
||||
if(P0.IsEqual(P1, aTol) &&
|
||||
P0.IsEqual(P2, aTol) &&
|
||||
P1.IsEqual(P2, aTol)) {
|
||||
bComputeLineEnd = Standard_False;
|
||||
aNewP.SetValue((surfit == 0), anewU, anewV);
|
||||
}
|
||||
}
|
||||
|
||||
if(bCheckAngle2) {
|
||||
bComputeLineEnd = Standard_False;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} // end while(anindexother...)
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
if(bComputeLineEnd) {
|
||||
Standard_Integer aneighbourpointindex1 = (j == 0) ? aListOfIndex.First() : aListOfIndex.Last();
|
||||
const IntSurf_PntOn2S& aNeighbourPoint = theWLine->Point(aneighbourpointindex1);
|
||||
Standard_Real nU1, nV1;
|
||||
|
||||
if(surfit == 0)
|
||||
aNeighbourPoint.ParametersOnS1(nU1, nV1);
|
||||
else
|
||||
aNeighbourPoint.ParametersOnS2(nU1, nV1);
|
||||
gp_Pnt2d ap1(nU1, nV1);
|
||||
gp_Pnt2d ap2(nU1, nV1);
|
||||
Standard_Integer aneighbourpointindex2 = aneighbourpointindex1;
|
||||
|
||||
while((aneighbourpointindex2 <= aListOfIndex.Last()) && (aneighbourpointindex2 >= aListOfIndex.First())) {
|
||||
aneighbourpointindex2 = (j == 0) ? (aneighbourpointindex2 + 1) : (aneighbourpointindex2 - 1);
|
||||
const IntSurf_PntOn2S& aPrevNeighbourPoint = theWLine->Point(aneighbourpointindex2);
|
||||
Standard_Real nU2, nV2;
|
||||
|
||||
if(surfit == 0)
|
||||
aPrevNeighbourPoint.ParametersOnS1(nU2, nV2);
|
||||
else
|
||||
aPrevNeighbourPoint.ParametersOnS2(nU2, nV2);
|
||||
ap2.SetX(nU2);
|
||||
ap2.SetY(nV2);
|
||||
|
||||
if(ap1.SquareDistance(ap2) > (gp::Resolution() * gp::Resolution())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
gp_Pnt2d anewpoint;
|
||||
Standard_Boolean found = FindPoint(ap2, ap1, umin, umax, vmin, vmax, anewpoint);
|
||||
|
||||
if(found) {
|
||||
// check point
|
||||
Standard_Real aCriteria =aTolSum;// BRep_Tool::Tolerance(theFace1) + BRep_Tool::Tolerance(theFace2);
|
||||
//GeomAPI_ProjectPointOnSurf& aProjector = (surfit == 0) ? aPrj2 : aPrj1;
|
||||
ProjectPointOnSurf& aProjector = (surfit == 0) ? aPrj2 : aPrj1;
|
||||
Handle(GeomAdaptor_HSurface) aSurface = (surfit == 0) ? theSurface1 : theSurface2;
|
||||
|
||||
gp_Pnt aP3d = aSurface->Value(anewpoint.X(), anewpoint.Y());
|
||||
aProjector.Perform(aP3d);
|
||||
|
||||
if(aProjector.IsDone()) {
|
||||
if(aProjector.LowerDistance() < aCriteria) {
|
||||
Standard_Real foundU = U, foundV = V;
|
||||
aProjector.LowerDistanceParameters(foundU, foundV);
|
||||
|
||||
if(surfit == 0)
|
||||
aNewP.SetValue(aP3d, anewpoint.X(), anewpoint.Y(), foundU, foundV);
|
||||
else
|
||||
aNewP.SetValue(aP3d, foundU, foundV, anewpoint.X(), anewpoint.Y());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
aSeqOfPntOn2S->Add(aNewP);
|
||||
aListOfFLIndex.Append(aSeqOfPntOn2S->NbPoints());
|
||||
}
|
||||
anArrayOfLineEnds.SetValue(i, aListOfFLIndex);
|
||||
}
|
||||
// Correct wlines.end
|
||||
|
||||
// Split wlines.begin
|
||||
for(j = 1; j <= theLConstructor.NbParts(); j++) {
|
||||
Standard_Real fprm = 0., lprm = 0.;
|
||||
theLConstructor.Part(j, fprm, lprm);
|
||||
Standard_Integer ifprm = (Standard_Integer)fprm;
|
||||
Standard_Integer ilprm = (Standard_Integer)lprm;
|
||||
//
|
||||
Handle(IntSurf_LineOn2S) aLineOn2S = new IntSurf_LineOn2S();
|
||||
//
|
||||
for(i = 1; i <= nblines; i++) {
|
||||
if(anArrayOfLineType[i] != 0) {
|
||||
continue;
|
||||
}
|
||||
const ListOfInteger& aListOfIndex = anArrayOfLines[i];
|
||||
|
||||
if(aListOfIndex.Extent() < 2) {
|
||||
continue;
|
||||
}
|
||||
const TColStd_ListOfInteger& aListOfFLIndex = anArrayOfLineEnds.Value(i);
|
||||
Standard_Boolean bhasfirstpoint = (aListOfFLIndex.Extent() == 2);
|
||||
Standard_Boolean bhaslastpoint = (aListOfFLIndex.Extent() == 2);
|
||||
|
||||
if(!bhasfirstpoint && !aListOfFLIndex.IsEmpty()) {
|
||||
bhasfirstpoint = (i != 1);
|
||||
}
|
||||
|
||||
if(!bhaslastpoint && !aListOfFLIndex.IsEmpty()) {
|
||||
bhaslastpoint = (i != nblines);
|
||||
}
|
||||
Standard_Boolean bIsFirstInside = ((ifprm >= aListOfIndex.First()) && (ifprm <= aListOfIndex.Last()));
|
||||
Standard_Boolean bIsLastInside = ((ilprm >= aListOfIndex.First()) && (ilprm <= aListOfIndex.Last()));
|
||||
|
||||
if(!bIsFirstInside && !bIsLastInside) {
|
||||
if((ifprm < aListOfIndex.First()) && (ilprm > aListOfIndex.Last())) {
|
||||
// append whole line, and boundaries if neccesary
|
||||
if(bhasfirstpoint) {
|
||||
const IntSurf_PntOn2S& aP = aSeqOfPntOn2S->Value(aListOfFLIndex.First());
|
||||
aLineOn2S->Add(aP);
|
||||
}
|
||||
ListOfInteger::Iterator anIt(aListOfIndex);
|
||||
|
||||
for(; anIt.More(); anIt.Next()) {
|
||||
const IntSurf_PntOn2S& aP = theWLine->Point(anIt.Value());
|
||||
aLineOn2S->Add(aP);
|
||||
}
|
||||
|
||||
if(bhaslastpoint) {
|
||||
const IntSurf_PntOn2S& aP = aSeqOfPntOn2S->Value(aListOfFLIndex.Last());
|
||||
aLineOn2S->Add(aP);
|
||||
}
|
||||
|
||||
// check end of split line (end is almost always)
|
||||
Standard_Integer aneighbour = i + 1;
|
||||
Standard_Boolean bIsEndOfLine = Standard_True;
|
||||
|
||||
if(aneighbour <= nblines) {
|
||||
const ListOfInteger& aListOfNeighbourIndex = anArrayOfLines[aneighbour];
|
||||
|
||||
if((anArrayOfLineType[aneighbour] != 0) &&
|
||||
(aListOfNeighbourIndex.IsEmpty())) {
|
||||
bIsEndOfLine = Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
if(bIsEndOfLine) {
|
||||
if(aLineOn2S->NbPoints() > 1) {
|
||||
Handle(IntPatch_WLine) aNewWLine =
|
||||
new IntPatch_WLine(aLineOn2S, Standard_False);
|
||||
theNewLines.Append(aNewWLine);
|
||||
}
|
||||
aLineOn2S = new IntSurf_LineOn2S();
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// end if(!bIsFirstInside && !bIsLastInside)
|
||||
|
||||
if(bIsFirstInside && bIsLastInside) {
|
||||
// append inside points between ifprm and ilprm
|
||||
ListOfInteger::Iterator anIt(aListOfIndex);
|
||||
|
||||
for(; anIt.More(); anIt.Next()) {
|
||||
if((anIt.Value() < ifprm) || (anIt.Value() > ilprm))
|
||||
continue;
|
||||
const IntSurf_PntOn2S& aP = theWLine->Point(anIt.Value());
|
||||
aLineOn2S->Add(aP);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if(bIsFirstInside) {
|
||||
// append points from ifprm to last point + boundary point
|
||||
ListOfInteger::Iterator anIt(aListOfIndex);
|
||||
|
||||
for(; anIt.More(); anIt.Next()) {
|
||||
if(anIt.Value() < ifprm)
|
||||
continue;
|
||||
const IntSurf_PntOn2S& aP = theWLine->Point(anIt.Value());
|
||||
aLineOn2S->Add(aP);
|
||||
}
|
||||
|
||||
if(bhaslastpoint) {
|
||||
const IntSurf_PntOn2S& aP = aSeqOfPntOn2S->Value(aListOfFLIndex.Last());
|
||||
aLineOn2S->Add(aP);
|
||||
}
|
||||
// check end of split line (end is almost always)
|
||||
Standard_Integer aneighbour = i + 1;
|
||||
Standard_Boolean bIsEndOfLine = Standard_True;
|
||||
|
||||
if(aneighbour <= nblines) {
|
||||
const ListOfInteger& aListOfNeighbourIndex = anArrayOfLines[aneighbour];
|
||||
|
||||
if((anArrayOfLineType[aneighbour] != 0) &&
|
||||
(aListOfNeighbourIndex.IsEmpty())) {
|
||||
bIsEndOfLine = Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
if(bIsEndOfLine) {
|
||||
if(aLineOn2S->NbPoints() > 1) {
|
||||
Handle(IntPatch_WLine) aNewWLine =
|
||||
new IntPatch_WLine(aLineOn2S, Standard_False);
|
||||
theNewLines.Append(aNewWLine);
|
||||
}
|
||||
aLineOn2S = new IntSurf_LineOn2S();
|
||||
}
|
||||
}
|
||||
// end if(bIsFirstInside)
|
||||
|
||||
if(bIsLastInside) {
|
||||
// append points from first boundary point to ilprm
|
||||
if(bhasfirstpoint) {
|
||||
const IntSurf_PntOn2S& aP = aSeqOfPntOn2S->Value(aListOfFLIndex.First());
|
||||
aLineOn2S->Add(aP);
|
||||
}
|
||||
ListOfInteger::Iterator anIt(aListOfIndex);
|
||||
|
||||
for(; anIt.More(); anIt.Next()) {
|
||||
if(anIt.Value() > ilprm)
|
||||
continue;
|
||||
const IntSurf_PntOn2S& aP = theWLine->Point(anIt.Value());
|
||||
aLineOn2S->Add(aP);
|
||||
}
|
||||
}
|
||||
//end if(bIsLastInside)
|
||||
}
|
||||
}
|
||||
|
||||
if(aLineOn2S->NbPoints() > 1) {
|
||||
Handle(IntPatch_WLine) aNewWLine =
|
||||
new IntPatch_WLine(aLineOn2S, Standard_False);
|
||||
theNewLines.Append(aNewWLine);
|
||||
}
|
||||
}
|
||||
// Split wlines.end
|
||||
//
|
||||
// cda002/I3
|
||||
Standard_Real fprm, lprm;
|
||||
Standard_Integer ifprm, ilprm, aNbPoints, aIndex;
|
||||
//
|
||||
aNbParts=theLConstructor.NbParts();
|
||||
//
|
||||
for(j = 1; j <= aNbParts; j++) {
|
||||
theLConstructor.Part(j, fprm, lprm);
|
||||
ifprm=(Standard_Integer)fprm;
|
||||
ilprm=(Standard_Integer)lprm;
|
||||
//
|
||||
if ((ilprm-ifprm)==1) {
|
||||
for(i = 1; i <= nblines; i++) {
|
||||
aLineType=anArrayOfLineType[i];
|
||||
if(aLineType) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const ListOfInteger& aListOfIndex = anArrayOfLines[i];
|
||||
aNbPoints=aListOfIndex.Extent();
|
||||
if(aNbPoints==1) {
|
||||
aIndex=aListOfIndex.First();
|
||||
if (aIndex==ifprm || aIndex==ilprm) {
|
||||
Handle(IntSurf_LineOn2S) aLineOn2S = new IntSurf_LineOn2S();
|
||||
const IntSurf_PntOn2S& aP1 = theWLine->Point(ifprm);
|
||||
const IntSurf_PntOn2S& aP2 = theWLine->Point(ilprm);
|
||||
aLineOn2S->Add(aP1);
|
||||
aLineOn2S->Add(aP2);
|
||||
Handle(IntPatch_WLine) aNewWLine =
|
||||
new IntPatch_WLine(aLineOn2S, Standard_False);
|
||||
theNewLines.Append(aNewWLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -23,9 +23,12 @@
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <GeomInt_LineConstructor.hxx>
|
||||
#include <IntPatch_SequenceOfLine.hxx>
|
||||
class IntPatch_Line;
|
||||
class IntPatch_Point;
|
||||
|
||||
class IntPatch_WLine;
|
||||
class GeomAdaptor_HSurface;
|
||||
|
||||
|
||||
class GeomInt_LineTool
|
||||
@@ -43,7 +46,13 @@ public:
|
||||
|
||||
Standard_EXPORT static Standard_Real LastParameter (const Handle(IntPatch_Line)& L);
|
||||
|
||||
|
||||
Standard_EXPORT static Standard_Boolean
|
||||
DecompositionOfWLine( const Handle(IntPatch_WLine)& theWLine,
|
||||
const Handle(GeomAdaptor_HSurface)& theSurface1,
|
||||
const Handle(GeomAdaptor_HSurface)& theSurface2,
|
||||
const Standard_Real aTolSum,
|
||||
const GeomInt_LineConstructor& theLConstructor,
|
||||
IntPatch_SequenceOfLine& theNewLines);
|
||||
|
||||
|
||||
protected:
|
||||
|
@@ -116,8 +116,8 @@ public:
|
||||
Standard_EXPORT const AppParCurves_MultiBSpCurve& SplineValue();
|
||||
|
||||
//! returns the type of parametrization
|
||||
Standard_EXPORT void Parametrization (Approx_ParametrizationType& partype) const;
|
||||
|
||||
Standard_EXPORT Approx_ParametrizationType Parametrization () const;
|
||||
|
||||
//! returns the new parameters of the approximation
|
||||
//! corresponding to the points of the multicurve <Index>.
|
||||
Standard_EXPORT const TColStd_Array1OfReal& Parameters (const Standard_Integer Index = 1) const;
|
||||
|
@@ -41,55 +41,75 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! The class SvSurfaces is used when the
|
||||
//! approximation algorithm needs some extra points on
|
||||
//! the line <line>. A New line is then created which
|
||||
//! shares the same surfaces and functions.
|
||||
//!
|
||||
//! SvSurfaces is a deferred class which allows
|
||||
//! several implementations of this algorithm with
|
||||
//! different surfaces (bi-parametric ones, or
|
||||
//! The class SvSurfaces is used when the approximation algorithm
|
||||
//! needs some extra points on the line <line>.
|
||||
//! A New line is then created which shares the same surfaces and functions.
|
||||
//! SvSurfaces is a deferred class which allows several implementations of
|
||||
//! this algorithm with different surfaces (bi-parametric ones, or
|
||||
//! implicit and biparametric ones)
|
||||
Standard_EXPORT GeomInt_TheMultiLineOfWLApprox(const Handle(IntPatch_WLine)& line, const Standard_Address PtrSvSurfaces, const Standard_Integer NbP3d, const Standard_Integer NbP2d, const Standard_Real xo, const Standard_Real ax, const Standard_Real yo, const Standard_Real ay, const Standard_Real zo, const Standard_Real az, const Standard_Real u1o, const Standard_Real a1u, const Standard_Real v1o, const Standard_Real a1v, const Standard_Real u2o, const Standard_Real a2u, const Standard_Real v2o, const Standard_Real a2v, const Standard_Boolean P2DOnFirst, const Standard_Integer IndMin = 0, const Standard_Integer IndMax = 0);
|
||||
Standard_EXPORT GeomInt_TheMultiLineOfWLApprox( const Handle(IntPatch_WLine)& line,
|
||||
const Standard_Address PtrSvSurfaces,
|
||||
const Standard_Integer NbP3d,
|
||||
const Standard_Integer NbP2d,
|
||||
const Standard_Real xo,
|
||||
const Standard_Real yo,
|
||||
const Standard_Real zo,
|
||||
const Standard_Real u1o,
|
||||
const Standard_Real v1o,
|
||||
const Standard_Real u2o,
|
||||
const Standard_Real v2o,
|
||||
const Standard_Boolean P2DOnFirst,
|
||||
const Standard_Integer IndMin = 0,
|
||||
const Standard_Integer IndMax = 0);
|
||||
|
||||
//! No Extra points will be added on the current line
|
||||
Standard_EXPORT GeomInt_TheMultiLineOfWLApprox(const Handle(IntPatch_WLine)& line, const Standard_Integer NbP3d, const Standard_Integer NbP2d, const Standard_Real xo, const Standard_Real ax, const Standard_Real yo, const Standard_Real ay, const Standard_Real zo, const Standard_Real az, const Standard_Real u1o, const Standard_Real a1u, const Standard_Real v1o, const Standard_Real a1v, const Standard_Real u2o, const Standard_Real a2u, const Standard_Real v2o, const Standard_Real a2v, const Standard_Boolean P2DOnFirst, const Standard_Integer IndMin = 0, const Standard_Integer IndMax = 0);
|
||||
Standard_EXPORT GeomInt_TheMultiLineOfWLApprox( const Handle(IntPatch_WLine)& line,
|
||||
const Standard_Integer NbP3d,
|
||||
const Standard_Integer NbP2d,
|
||||
const Standard_Real xo,
|
||||
const Standard_Real yo,
|
||||
const Standard_Real zo,
|
||||
const Standard_Real u1o,
|
||||
const Standard_Real v1o,
|
||||
const Standard_Real u2o,
|
||||
const Standard_Real v2o,
|
||||
const Standard_Boolean P2DOnFirst,
|
||||
const Standard_Integer IndMin = 0,
|
||||
const Standard_Integer IndMax = 0);
|
||||
|
||||
Standard_EXPORT Standard_Integer FirstPoint() const;
|
||||
|
||||
Standard_EXPORT Standard_Integer LastPoint() const;
|
||||
|
||||
|
||||
//! Returns the number of 2d points of a TheLine.
|
||||
Standard_EXPORT Standard_Integer NbP2d() const;
|
||||
|
||||
|
||||
//! Returns the number of 3d points of a TheLine.
|
||||
Standard_EXPORT Standard_Integer NbP3d() const;
|
||||
|
||||
Standard_EXPORT Approx_Status WhatStatus() const;
|
||||
|
||||
//! returns the 3d points of the multipoint <MPointIndex>
|
||||
//! when only 3d points exist.
|
||||
//! Returns the 3d points of the multipoint <MPointIndex> when only 3d points exist.
|
||||
Standard_EXPORT void Value (const Standard_Integer MPointIndex, TColgp_Array1OfPnt& tabPt) const;
|
||||
|
||||
//! returns the 2d points of the multipoint <MPointIndex>
|
||||
//! when only 2d points exist.
|
||||
Standard_EXPORT void Value (const Standard_Integer MPointIndex, TColgp_Array1OfPnt2d& tabPt2d) const;
|
||||
|
||||
//! returns the 3d and 2d points of the multipoint
|
||||
//! <MPointIndex>.
|
||||
//! Returns the 2d points of the multipoint <MPointIndex> when only 2d points exist.
|
||||
Standard_EXPORT void Value (const Standard_Integer MPointIndex,
|
||||
TColgp_Array1OfPnt2d& tabPt2d) const;
|
||||
|
||||
//! returns the 3d and 2d points of the multipoint <MPointIndex>.
|
||||
Standard_EXPORT void Value (const Standard_Integer MPointIndex, TColgp_Array1OfPnt& tabPt, TColgp_Array1OfPnt2d& tabPt2d) const;
|
||||
|
||||
//! returns the 3d points of the multipoint <MPointIndex>
|
||||
//! when only 3d points exist.
|
||||
Standard_EXPORT Standard_Boolean Tangency (const Standard_Integer MPointIndex, TColgp_Array1OfVec& tabV) const;
|
||||
//! Returns the 3d tangency points of the multipoint <MPointIndex> only
|
||||
//! when 3d points exist.
|
||||
Standard_EXPORT Standard_Boolean Tangency ( const Standard_Integer MPointIndex,
|
||||
TColgp_Array1OfVec& tabV) const;
|
||||
|
||||
//! returns the 2d tangency points of the multipoint
|
||||
//! <MPointIndex> only when 2d points exist.
|
||||
Standard_EXPORT Standard_Boolean Tangency (const Standard_Integer MPointIndex, TColgp_Array1OfVec2d& tabV2d) const;
|
||||
//! Returns the 2d tangency points of the multipoint <MPointIndex> only
|
||||
//! when 2d points exist.
|
||||
Standard_EXPORT Standard_Boolean Tangency ( const Standard_Integer MPointIndex,
|
||||
TColgp_Array1OfVec2d& tabV2d) const;
|
||||
|
||||
//! returns the 3d and 2d points of the multipoint
|
||||
//! <MPointIndex>.
|
||||
//! Returns the 3d and 2d points of the multipoint <MPointIndex>.
|
||||
Standard_EXPORT Standard_Boolean Tangency (const Standard_Integer MPointIndex, TColgp_Array1OfVec& tabV, TColgp_Array1OfVec2d& tabV2d) const;
|
||||
|
||||
Standard_EXPORT GeomInt_TheMultiLineOfWLApprox MakeMLBetween (const Standard_Integer Low, const Standard_Integer High, const Standard_Integer NbPointsToInsert) const;
|
||||
@@ -101,44 +121,25 @@ public:
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
GeomInt_TheMultiLineOfWLApprox operator=(GeomInt_TheMultiLineOfWLApprox&);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Standard_Address PtrOnmySvSurfaces;
|
||||
Handle(IntPatch_WLine) myLine;
|
||||
Standard_Integer indicemin;
|
||||
Standard_Integer indicemax;
|
||||
Standard_Integer nbp3d;
|
||||
Standard_Integer nbp2d;
|
||||
Standard_Boolean p2donfirst;
|
||||
Standard_Real Xo;
|
||||
Standard_Real Ax;
|
||||
Standard_Real Yo;
|
||||
Standard_Real Ay;
|
||||
Standard_Real Zo;
|
||||
Standard_Real Az;
|
||||
Standard_Real U1o;
|
||||
Standard_Real A1u;
|
||||
Standard_Real V1o;
|
||||
Standard_Real A1v;
|
||||
Standard_Real U2o;
|
||||
Standard_Real A2u;
|
||||
Standard_Real V2o;
|
||||
Standard_Real A2v;
|
||||
const Standard_Address PtrOnmySvSurfaces;
|
||||
const Handle(IntPatch_WLine) myLine;
|
||||
const Standard_Integer indicemin;
|
||||
const Standard_Integer indicemax;
|
||||
const Standard_Integer nbp3d;
|
||||
const Standard_Integer nbp2d;
|
||||
const Standard_Boolean p2donfirst;
|
||||
const Standard_Real Xo;
|
||||
const Standard_Real Yo;
|
||||
const Standard_Real Zo;
|
||||
const Standard_Real U1o;
|
||||
const Standard_Real V1o;
|
||||
const Standard_Real U2o;
|
||||
const Standard_Real V2o;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _GeomInt_TheMultiLineOfWLApprox_HeaderFile
|
||||
|
@@ -51,19 +51,22 @@ class AppParCurves_MultiBSpCurve;
|
||||
|
||||
struct Approx_Data
|
||||
{
|
||||
Approx_Data()
|
||||
Approx_Data() : myBezierApprox(Standard_True),
|
||||
Xo(0.0), Yo(0.0), Zo(0.0),
|
||||
U1o(0.0), V1o(0.0), U2o(0.0), V2o(0.0),
|
||||
ApproxXYZ(Standard_True),
|
||||
ApproxU1V1(Standard_True),
|
||||
ApproxU2V2(Standard_True),
|
||||
indicemin(0), indicemax(0),
|
||||
myNbPntMax(30), parametrization(Approx_ChordLength)
|
||||
{
|
||||
myMinFactorXYZ = 0.0;
|
||||
myMinFactorUV = 0.0;
|
||||
}
|
||||
|
||||
Standard_Boolean myBezierApprox;
|
||||
Standard_Real Xo, Ax, Yo, Ay, Zo, Az,
|
||||
U1o, A1u, V1o, A1v, U2o, A2u, V2o, A2v;
|
||||
Standard_Real Xo, Yo, Zo, U1o, V1o, U2o, V2o;
|
||||
Standard_Boolean ApproxXYZ, ApproxU1V1, ApproxU2V2;
|
||||
Standard_Integer indicemin, indicemax, nbpntmax;
|
||||
Standard_Integer indicemin, indicemax, myNbPntMax;
|
||||
Approx_ParametrizationType parametrization;
|
||||
Standard_Real myMinFactorXYZ, myMinFactorUV;
|
||||
};
|
||||
|
||||
|
||||
@@ -80,10 +83,15 @@ public:
|
||||
|
||||
Standard_EXPORT void Perform (const Handle(IntPatch_WLine)& aLine, const Standard_Boolean ApproxXYZ = Standard_True, const Standard_Boolean ApproxU1V1 = Standard_True, const Standard_Boolean ApproxU2V2 = Standard_True, const Standard_Integer indicemin = 0, const Standard_Integer indicemax = 0);
|
||||
|
||||
Standard_EXPORT void SetParameters (const Standard_Real Tol3d, const Standard_Real Tol2d, const Standard_Integer DegMin, const Standard_Integer DegMax, const Standard_Integer NbIterMax, const Standard_Boolean ApproxWithTangency = Standard_True, const Approx_ParametrizationType Parametrization = Approx_ChordLength);
|
||||
|
||||
Standard_EXPORT void SetParameters (const Standard_Real Tol3d, const Standard_Real Tol2d, const Standard_Boolean RelativeTol, const Standard_Integer DegMin, const Standard_Integer DegMax, const Standard_Integer NbIterMax, const Standard_Integer NbPntMax, const Standard_Boolean ApproxWithTangency = Standard_True, const Approx_ParametrizationType Parametrization = Approx_ChordLength);
|
||||
|
||||
Standard_EXPORT
|
||||
void SetParameters (const Standard_Real Tol3d, const Standard_Real Tol2d,
|
||||
const Standard_Integer DegMin,
|
||||
const Standard_Integer DegMax,
|
||||
const Standard_Integer NbIterMax,
|
||||
const Standard_Integer NbPntMax = 30,
|
||||
const Standard_Boolean ApproxWithTangency = Standard_True,
|
||||
const Approx_ParametrizationType
|
||||
Parametrization = Approx_ChordLength);
|
||||
Standard_EXPORT void Perform();
|
||||
|
||||
Standard_EXPORT Standard_Real TolReached3d() const;
|
||||
@@ -106,22 +114,12 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Standard_EXPORT Standard_Integer CorrectFinishIdx(const Standard_Integer theMinIdx,
|
||||
const Standard_Integer theMaxIdx,
|
||||
const Handle(IntPatch_WLine)& theline);
|
||||
|
||||
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Surf1, const IntSurf_Quadric& Surf2, const Handle(IntPatch_WLine)& aLine, const Standard_Boolean ApproxXYZ, const Standard_Boolean ApproxU1V1, const Standard_Boolean ApproxU2V2, const Standard_Integer indicemin, const Standard_Integer indicemax);
|
||||
|
||||
Standard_EXPORT void Perform (const IntSurf_Quadric& Surf1, const Handle(Adaptor3d_HSurface)& Surf2, const Handle(IntPatch_WLine)& aLine, const Standard_Boolean ApproxXYZ, const Standard_Boolean ApproxU1V1, const Standard_Boolean ApproxU2V2, const Standard_Integer indicemin, const Standard_Integer indicemax);
|
||||
Standard_EXPORT void Perform (const IntSurf_Quadric& Surf1, const Handle(Adaptor3d_HSurface)& Surf2, const Handle(IntPatch_WLine)& aLine, const Standard_Boolean ApproxXYZ, const Standard_Boolean ApproxU1V1, const Standard_Boolean ApproxU2V2, const Standard_Integer indicemin, const Standard_Integer indicemax, const Standard_Boolean isTheQuadFirst);
|
||||
|
||||
Standard_EXPORT void UpdateTolReached();
|
||||
|
||||
//! Fill data structure for intersection approximation.
|
||||
Standard_EXPORT void fillData(const Handle(IntPatch_WLine)& theLine,
|
||||
const Standard_Boolean theApproxXYZ,
|
||||
const Standard_Boolean theApproxU1V1,
|
||||
const Standard_Boolean theApproxU2V2);
|
||||
Standard_EXPORT void fillData(const Handle(IntPatch_WLine)& theLine);
|
||||
|
||||
//! Prepare data structure for further computations.
|
||||
Standard_EXPORT void prepareDS(const Standard_Boolean theApproxXYZ,
|
||||
@@ -141,19 +139,15 @@ private:
|
||||
GeomInt_TheComputeLineOfWLApprox myComputeLine;
|
||||
GeomInt_TheComputeLineBezierOfWLApprox myComputeLineBezier;
|
||||
Approx_MCurvesToBSpCurve myBezToBSpl;
|
||||
Standard_Boolean myTolReached;
|
||||
Standard_Boolean myWithTangency;
|
||||
Standard_Real myTol3d;
|
||||
Standard_Real myTol2d;
|
||||
Standard_Boolean myRelativeTol;
|
||||
Standard_Integer myDegMin;
|
||||
Standard_Integer myDegMax;
|
||||
Standard_Integer myNbPntMax;
|
||||
Standard_Integer myNbIterMax;
|
||||
Standard_Real myTolReached3d;
|
||||
Standard_Real myTolReached2d;
|
||||
Approx_Data myData;
|
||||
Standard_Real myUVRes1, myUVRes2;
|
||||
NCollection_Vector<Standard_Integer> myKnots;
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user