mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Commit for 2d offset algorithm
This commit is contained in:
@@ -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.
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <BRep_PolygonOnClosedTriangulation.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
@@ -52,6 +53,10 @@
|
||||
#include <Poly_Polygon2D.hxx>
|
||||
#include <Poly_PolygonOnTriangulation.hxx>
|
||||
|
||||
#include <NCollection_Map.hxx>
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
#include <TopTools_ShapeMapHasher.hxx>
|
||||
|
||||
//modified by NIZNHY-PKV Fri Oct 17 14:13:29 2008f
|
||||
static
|
||||
Standard_Boolean IsPlane(const Handle(Geom_Surface)& aS);
|
||||
@@ -314,28 +319,30 @@ Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E,
|
||||
GP = Handle(Geom_Plane)::DownCast(S);
|
||||
//fin modif du 21-05-97
|
||||
|
||||
if (!GP.IsNull()) {
|
||||
|
||||
if (!GP.IsNull())
|
||||
{
|
||||
Handle(GeomAdaptor_HCurve) HC;
|
||||
Handle(GeomAdaptor_HSurface) HS;
|
||||
|
||||
HC = new GeomAdaptor_HCurve();
|
||||
HS = new GeomAdaptor_HSurface();
|
||||
|
||||
TopLoc_Location LC;
|
||||
TopLoc_Location aCurveLocation;
|
||||
|
||||
Standard_Real f, l;// for those who call with (u,u).
|
||||
Handle(Geom_Curve) C3d =
|
||||
BRep_Tool::Curve(E,/*LC,*/f,l); // transforming plane instead of curve
|
||||
// we can loose scale factor of Curve transformation (eap 13 May 2002)
|
||||
Handle(Geom_Curve) C3d = BRep_Tool::Curve(E, aCurveLocation, f, l);
|
||||
|
||||
LC = L/*.Predivided(LC)*/;
|
||||
if (C3d.IsNull())
|
||||
{
|
||||
return nullPCurve;
|
||||
}
|
||||
|
||||
if (C3d.IsNull()) return nullPCurve;
|
||||
aCurveLocation = L.Predivided(aCurveLocation);
|
||||
|
||||
Handle(Geom_Plane) Plane = GP;
|
||||
if (!LC.IsIdentity()) {
|
||||
const gp_Trsf& T = LC.Transformation();
|
||||
if (!aCurveLocation.IsIdentity())
|
||||
{
|
||||
const gp_Trsf& T = aCurveLocation.Transformation();
|
||||
Handle(Geom_Geometry) GPT = GP->Transformed(T);
|
||||
Plane = *((Handle(Geom_Plane)*)&GPT);
|
||||
}
|
||||
@@ -1139,6 +1146,12 @@ Standard_Boolean BRep_Tool::HasContinuity(const TopoDS_Edge& E)
|
||||
gp_Pnt BRep_Tool::Pnt(const TopoDS_Vertex& V)
|
||||
{
|
||||
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
|
||||
|
||||
if (TV.IsNull())
|
||||
{
|
||||
Standard_NullObject::Raise("BRep_Tool:: TopoDS_Vertex hasn't gp_Pnt");
|
||||
}
|
||||
|
||||
gp_Pnt P = TV->Pnt();
|
||||
P.Transform(V.Location().Transformation());
|
||||
return P;
|
||||
@@ -1151,7 +1164,14 @@ gp_Pnt BRep_Tool::Pnt(const TopoDS_Vertex& V)
|
||||
|
||||
Standard_Real BRep_Tool::Tolerance(const TopoDS_Vertex& V)
|
||||
{
|
||||
Standard_Real p = (*((Handle(BRep_TVertex)*)&V.TShape()))->Tolerance();
|
||||
Handle(BRep_TVertex)& aTVert = *((Handle(BRep_TVertex)*)&V.TShape());
|
||||
|
||||
if (aTVert.IsNull())
|
||||
{
|
||||
Standard_NullObject::Raise("BRep_Tool:: TopoDS_Vertex hasn't gp_Pnt");
|
||||
}
|
||||
|
||||
Standard_Real p = aTVert->Tolerance();
|
||||
Standard_Real pMin = Precision::Confusion();
|
||||
if (p > pMin) return p;
|
||||
else return pMin;
|
||||
@@ -1431,24 +1451,43 @@ gp_Pnt2d BRep_Tool::Parameters(const TopoDS_Vertex& V,
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsClosed
|
||||
//purpose : Returns <True> if S if flaged Closed, if S is a
|
||||
// Solid,Shell or Compound returns <True> is S has no free boundaries.
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRep_Tool::IsClosed(const TopoDS_Shape& S)
|
||||
Standard_Boolean BRep_Tool::IsClosed (const TopoDS_Shape& theShape)
|
||||
{
|
||||
if (S.ShapeType() == TopAbs_SHELL || S.ShapeType() == TopAbs_SOLID ||
|
||||
S.ShapeType() == TopAbs_COMPOUND) {
|
||||
TopTools_MapOfShape M;
|
||||
TopExp_Explorer exp;
|
||||
for (exp.Init(S,TopAbs_EDGE); exp.More(); exp.Next()) {
|
||||
// for (TopExp_Explorer exp(S,TopAbs_EDGE); exp.More(); exp.Next()) {
|
||||
if (theShape.ShapeType() == TopAbs_SHELL || theShape.ShapeType() == TopAbs_SOLID)
|
||||
{
|
||||
NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> aMap (101, new NCollection_IncAllocator);
|
||||
TopExp_Explorer exp (theShape.Oriented(TopAbs_FORWARD), TopAbs_EDGE);
|
||||
Standard_Boolean hasBound = Standard_False;
|
||||
for (; exp.More(); exp.Next())
|
||||
{
|
||||
const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
|
||||
if (BRep_Tool::Degenerated(E)) continue;
|
||||
if (!M.Add(E)) M.Remove(E);
|
||||
if (BRep_Tool::Degenerated(E) || E.Orientation() == TopAbs_INTERNAL || E.Orientation() == TopAbs_EXTERNAL)
|
||||
continue;
|
||||
hasBound = Standard_True;
|
||||
if (!aMap.Add(E))
|
||||
aMap.Remove(E);
|
||||
}
|
||||
if ( M.IsEmpty()) return 1;
|
||||
return hasBound && aMap.IsEmpty();
|
||||
}
|
||||
return (S.Closed());
|
||||
else if (theShape.ShapeType() == TopAbs_WIRE)
|
||||
{
|
||||
NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> aMap (101, new NCollection_IncAllocator);
|
||||
TopExp_Explorer exp (theShape.Oriented(TopAbs_FORWARD), TopAbs_VERTEX);
|
||||
Standard_Boolean hasBound = Standard_False;
|
||||
for (; exp.More(); exp.Next())
|
||||
{
|
||||
const TopoDS_Shape& V = exp.Current();
|
||||
if (V.Orientation() == TopAbs_INTERNAL || V.Orientation() == TopAbs_EXTERNAL)
|
||||
continue;
|
||||
hasBound = Standard_True;
|
||||
if (!aMap.Add(V))
|
||||
aMap.Remove(V);
|
||||
}
|
||||
return hasBound && aMap.IsEmpty();
|
||||
}
|
||||
return theShape.Closed();
|
||||
}
|
||||
|
||||
//modified by NIZNHY-PKV Fri Oct 17 14:09:58 2008 f
|
||||
@@ -1480,3 +1519,4 @@ Standard_Boolean IsPlane(const Handle(Geom_Surface)& aS)
|
||||
//
|
||||
return bRet;
|
||||
}
|
||||
|
||||
|
@@ -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.
|
||||
@@ -31,13 +31,17 @@
|
||||
#include <Precision.hxx>
|
||||
#include <IntRes2d_IntersectionPoint.hxx>
|
||||
#include <IntRes2d_IntersectionSegment.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
#ifdef DEB
|
||||
//#define DRAW
|
||||
#ifdef DRAW
|
||||
#include <DrawTrSurf.hxx>
|
||||
#include <DBRep.hxx>
|
||||
static Standard_Boolean Affich = Standard_False;
|
||||
static Standard_Boolean AffichInt = Standard_False;
|
||||
static Standard_Integer intind = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -83,18 +87,18 @@ BRepFill_TrimEdgeTool::BRepFill_TrimEdgeTool()
|
||||
//=======================================================================
|
||||
|
||||
BRepFill_TrimEdgeTool::BRepFill_TrimEdgeTool
|
||||
(const Bisector_Bisec& Bisec,
|
||||
(const Bisector_Bisec& Bisec,
|
||||
const Handle(Geom2d_Geometry)& S1,
|
||||
const Handle(Geom2d_Geometry)& S2,
|
||||
const Standard_Real Offset) :
|
||||
myOffset(Offset),
|
||||
myBisec(Bisec)
|
||||
myBisec(Bisec)
|
||||
{
|
||||
isPoint1 = (S1->DynamicType() == STANDARD_TYPE(Geom2d_CartesianPoint));
|
||||
isPoint2 = (S2->DynamicType() == STANDARD_TYPE(Geom2d_CartesianPoint));
|
||||
|
||||
// return geometries of shapes.
|
||||
// Standard_Real f,l;
|
||||
// return geometries of shapes.
|
||||
// Standard_Real f,l;
|
||||
if (isPoint1) {
|
||||
myP1 = Handle(Geom2d_Point)::DownCast(S1)->Pnt2d();
|
||||
}
|
||||
@@ -102,10 +106,10 @@ myBisec(Bisec)
|
||||
myC1 = Handle(Geom2d_Curve)::DownCast(S1);
|
||||
#ifdef DRAW
|
||||
if ( Affich) {
|
||||
//POP pour NT
|
||||
//POP pour NT
|
||||
char* myC1name = "myC1";
|
||||
DrawTrSurf::Set(myC1name,myC1);
|
||||
// DrawTrSurf::Set("myC1",myC1);
|
||||
// DrawTrSurf::Set("myC1",myC1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -118,7 +122,7 @@ myBisec(Bisec)
|
||||
if ( Affich) {
|
||||
char* myC2name = "myC2";
|
||||
DrawTrSurf::Set(myC2name,myC2);
|
||||
// DrawTrSurf::Set("myC2",myC2);
|
||||
// DrawTrSurf::Set("myC2",myC2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -169,7 +173,7 @@ static void EvalParameters(const Geom2dAdaptor_Curve& Bis,
|
||||
{
|
||||
Geom2dInt_GInter Intersector;
|
||||
Standard_Real Tol = Precision::Confusion();
|
||||
// Standard_Real TolC = 1.e-9;
|
||||
// Standard_Real TolC = 1.e-9;
|
||||
|
||||
Geom2dAdaptor_Curve CBis(Bis);
|
||||
Geom2dAdaptor_Curve CAC (AC);
|
||||
@@ -318,23 +322,24 @@ void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1,
|
||||
Geom2dAdaptor_Curve AC2(C2,f,l);
|
||||
|
||||
#ifdef DRAW
|
||||
if ( Affich) {
|
||||
if ( AffichInt) {
|
||||
f = AC1.FirstParameter();
|
||||
l = AC1.LastParameter();
|
||||
char* CURVE1name = "CURVE1";
|
||||
DrawTrSurf::Set(CURVE1name, new Geom2d_TrimmedCurve(C1,f,l));
|
||||
char name[32];
|
||||
sprintf(name,"C1_%d", ++intind);
|
||||
DrawTrSurf::Set(name, new Geom2d_TrimmedCurve(C1,f,l));
|
||||
f = AC2.FirstParameter();
|
||||
l = AC2.LastParameter();
|
||||
char* CURVE2name = "CURVE2";
|
||||
DrawTrSurf::Set(CURVE2name, new Geom2d_TrimmedCurve(C2,f,l));
|
||||
sprintf(name,"C2_%d", intind);
|
||||
DrawTrSurf::Set(name, new Geom2d_TrimmedCurve(C2,f,l));
|
||||
f = myBis.FirstParameter();
|
||||
l = myBis.LastParameter();
|
||||
char* bisname = "BIS";
|
||||
DrawTrSurf::Set(bisname, new Geom2d_TrimmedCurve(myBis.Curve(),f,l));
|
||||
char* Edge1name = "E1";
|
||||
DBRep::Set(Edge1name, Edge1);
|
||||
char* Edge2name = "E2";
|
||||
DBRep::Set(Edge2name, Edge2);
|
||||
sprintf(name,"BIS%d", intind);
|
||||
DrawTrSurf::Set(name, new Geom2d_TrimmedCurve(myBis.Curve(),f,l));
|
||||
sprintf(name,"E1_%d", intind);
|
||||
DBRep::Set(name, Edge1);
|
||||
sprintf(name,"E2_%d", intind);
|
||||
DBRep::Set(name, Edge2);
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -347,6 +352,7 @@ void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1,
|
||||
EvalParameters (myBis,AC2,Points2);
|
||||
|
||||
|
||||
|
||||
Standard_Integer SeanceDeRattrapage=0;
|
||||
Standard_Real TolInit= 1.e-9;
|
||||
Standard_Integer nn = 7;
|
||||
@@ -358,11 +364,68 @@ void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1,
|
||||
nn = 6;
|
||||
}
|
||||
|
||||
if(Params.IsEmpty() && Points2.IsEmpty())
|
||||
{
|
||||
//Check, may be there are no intersections at all
|
||||
// for case myBis == Line
|
||||
if(myBis.GetType() == GeomAbs_Line)
|
||||
{
|
||||
Standard_Real dmax = TolInit;
|
||||
Standard_Integer n = 0;
|
||||
while(n < nn)
|
||||
{
|
||||
dmax *= 10.0;
|
||||
++n;
|
||||
}
|
||||
dmax *= dmax;
|
||||
//
|
||||
gp_Lin2d anL = myBis.Line();
|
||||
Standard_Boolean isFar1 = Standard_True;
|
||||
Standard_Boolean isFar2 = Standard_True;
|
||||
gp_Pnt2d aP;
|
||||
//
|
||||
Standard_Real d = RealLast();
|
||||
AC1.D0(AC1.FirstParameter(), aP);
|
||||
Standard_Real par = ElCLib::Parameter(anL, aP);
|
||||
if(par >= myBis.FirstParameter() && par <= myBis.LastParameter())
|
||||
{
|
||||
d = anL.SquareDistance(aP);
|
||||
}
|
||||
AC1.D0(AC1.LastParameter(), aP);
|
||||
par = ElCLib::Parameter(anL, aP);
|
||||
if(par >= myBis.FirstParameter() && par <= myBis.LastParameter())
|
||||
{
|
||||
d = Min(anL.SquareDistance(aP), d);
|
||||
}
|
||||
isFar1 = d > dmax;
|
||||
//
|
||||
d = RealLast();
|
||||
AC2.D0(AC2.FirstParameter(), aP);
|
||||
par = ElCLib::Parameter(anL, aP);
|
||||
if(par >= myBis.FirstParameter() && par <= myBis.LastParameter())
|
||||
{
|
||||
d = anL.SquareDistance(aP);
|
||||
}
|
||||
AC2.D0(AC2.LastParameter(), aP);
|
||||
par = ElCLib::Parameter(anL, aP);
|
||||
if(par >= myBis.FirstParameter() && par <= myBis.LastParameter())
|
||||
{
|
||||
d = Min(anL.SquareDistance(aP), d);
|
||||
}
|
||||
isFar2 = d > dmax;
|
||||
//
|
||||
if(isFar1 && isFar2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while ( SeanceDeRattrapage < nn // TolInit <= 0.01
|
||||
&& ( Points2.Length() != Params.Length() ||
|
||||
(Points2.Length() == 0 && Params.Length() == 0) ) ) {
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "BRepFill_TrimEdgeTool: incoherent intersection. Try with a greater tolerance" << endl;
|
||||
#endif
|
||||
|
||||
@@ -376,7 +439,7 @@ void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1,
|
||||
SeanceDeRattrapage++;
|
||||
}
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef OCCT_DEBUG
|
||||
if(SeanceDeRattrapage != 0) cout << "SeanceDeRattrapage = " << SeanceDeRattrapage << endl;
|
||||
if(SeanceDeRattrapage == nn) {
|
||||
cout << "BRepFill_TrimEdgeTool: incoherent intersection" << endl;
|
||||
@@ -387,7 +450,7 @@ void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1,
|
||||
if(Params.Length() == 0 && Points2.Length() == 1) {
|
||||
|
||||
//cout << "Params.Length() == 0 && Points2.Length() == 1" << endl;
|
||||
Standard_Real dmin;
|
||||
Standard_Real dmin, dmax = 0.25*myOffset*myOffset;
|
||||
Standard_Real tBis = Points2(1).X();
|
||||
gp_Pnt2d PBis = myBis.Value(tBis);
|
||||
|
||||
@@ -395,19 +458,26 @@ void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1,
|
||||
gp_Pnt2d PC = AC1.Value(t);
|
||||
dmin = PC.SquareDistance(PBis);
|
||||
gp_Pnt P(tBis, t, 0.);
|
||||
if(dmin < dmax)
|
||||
{
|
||||
Params.Append(P);
|
||||
}
|
||||
|
||||
t = AC1.LastParameter();
|
||||
PC = AC1.Value(t);
|
||||
if(dmin > PC.SquareDistance(PBis)) {
|
||||
Standard_Real dmin1 = PC.SquareDistance(PBis);
|
||||
if(dmin > dmin1 && dmin1 < dmax ) {
|
||||
P.SetY(t);
|
||||
if(Params.IsEmpty())
|
||||
Params.Append(P);
|
||||
else
|
||||
Params.SetValue(1,P);
|
||||
}
|
||||
}
|
||||
else if(Params.Length() == 1 && Points2.Length() == 0) {
|
||||
|
||||
//cout << "Params.Length() == 1 && Points2.Length() == 0" << endl;
|
||||
Standard_Real dmin;
|
||||
Standard_Real dmin, dmax = 0.25*myOffset*myOffset;
|
||||
Standard_Real tBis = Params(1).X();
|
||||
gp_Pnt2d PBis = myBis.Value(tBis);
|
||||
|
||||
@@ -415,12 +485,19 @@ void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1,
|
||||
gp_Pnt2d PC = AC2.Value(t);
|
||||
dmin = PC.SquareDistance(PBis);
|
||||
gp_Pnt P(tBis, t, 0.);
|
||||
if(dmin < dmax)
|
||||
{
|
||||
Points2.Append(P);
|
||||
}
|
||||
|
||||
t = AC2.LastParameter();
|
||||
PC = AC2.Value(t);
|
||||
if(dmin > PC.SquareDistance(PBis)) {
|
||||
Standard_Real dmin1 = PC.SquareDistance(PBis);
|
||||
if(dmin > dmin1 && dmin1 < dmax ) {
|
||||
P.SetY(t);
|
||||
if(Points2.IsEmpty())
|
||||
Points2.Append(P);
|
||||
else
|
||||
Points2.SetValue(1,P);
|
||||
}
|
||||
}
|
||||
@@ -452,11 +529,11 @@ void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1,
|
||||
Standard_Real P1xP2x=Abs( P1.X() - P2.X());
|
||||
|
||||
if ( P1xP2x > Tol ) {
|
||||
#ifdef DEB
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "BRepFill_TrimEdgeTool: no same parameter on the bissectrice" << endl;
|
||||
#endif
|
||||
if(P1xP2x>TolInit) {
|
||||
#ifdef DEB
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "BRepFill_TrimEdgeTool: Continue somehow" << endl;
|
||||
#endif
|
||||
i++;
|
||||
@@ -495,7 +572,7 @@ void BRepFill_TrimEdgeTool::AddOrConfuse(const Standard_Boolean Start,
|
||||
const TopoDS_Edge& Edge1,
|
||||
const TopoDS_Edge& Edge2,
|
||||
TColgp_SequenceOfPnt& Params)
|
||||
const
|
||||
const
|
||||
{
|
||||
Standard_Boolean ToProj = Standard_True;
|
||||
gp_Pnt2d PBis;
|
||||
@@ -523,7 +600,7 @@ const
|
||||
}
|
||||
|
||||
if (ToProj) {
|
||||
#ifdef DEB
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << " project extremity bissectrice on parallel."<<endl;
|
||||
#endif
|
||||
|
||||
@@ -537,25 +614,25 @@ const
|
||||
Geom2dAPI_ProjectPointOnCurve Projector2(PBis,C2,f2,l2);
|
||||
|
||||
if (Projector1.NbPoints() == 0) {
|
||||
#ifdef DEB
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "Failed projection in BRepFill_TrimEdgeTool::AddOrConfuse"<<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (!Projector1.NearestPoint().IsEqual(PBis,Tol)) {
|
||||
#ifdef DEB
|
||||
#ifdef OCCT_DEBUG
|
||||
cout <<"Incorrect solution in BRepFill_TrimEdgeTool::AddOrConfuse"<<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (Projector2.NbPoints() == 0) {
|
||||
#ifdef DEB
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "Failed projection in BRepFill_TrimEdgeTool::AddOrConfuse"<<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (!Projector2.NearestPoint().IsEqual(PBis,Tol)) {
|
||||
#ifdef DEB
|
||||
#ifdef OCCT_DEBUG
|
||||
cout <<" Mauvaisesolution dans BRepFill_TrimEdgeTool::AddOrConfuse"<<endl;
|
||||
#endif
|
||||
return;
|
||||
@@ -581,10 +658,10 @@ const
|
||||
|
||||
Standard_Boolean BRepFill_TrimEdgeTool::IsInside(const gp_Pnt2d& P) const
|
||||
{
|
||||
// Modified by Sergey KHROMOV - Fri Sep 27 11:43:12 2002 Begin
|
||||
// Standard_Real Dist;
|
||||
// Modified by Sergey KHROMOV - Fri Sep 27 11:43:12 2002 Begin
|
||||
// Standard_Real Dist;
|
||||
Standard_Real Dist = RealLast();
|
||||
// Modified by Sergey KHROMOV - Fri Sep 27 11:43:12 2002 End
|
||||
// Modified by Sergey KHROMOV - Fri Sep 27 11:43:12 2002 End
|
||||
if (isPoint1)
|
||||
Dist = P.Distance(myP1);
|
||||
else if (isPoint2)
|
||||
@@ -594,26 +671,26 @@ Standard_Boolean BRepFill_TrimEdgeTool::IsInside(const gp_Pnt2d& P) const
|
||||
if (Projector.NbPoints() > 0) {
|
||||
Dist = Projector.LowerDistance();
|
||||
}
|
||||
// Modified by Sergey KHROMOV - Fri Sep 27 11:43:43 2002 Begin
|
||||
// else {
|
||||
// gp_Pnt2d PF = myC1->Value(myC1->FirstParameter());
|
||||
// gp_Pnt2d PL = myC1->Value(myC1->LastParameter());
|
||||
// Dist = Min (P.Distance(PF),P.Distance(PL));
|
||||
// }
|
||||
// Modified by Sergey KHROMOV - Fri Sep 27 11:43:43 2002 Begin
|
||||
// else {
|
||||
// gp_Pnt2d PF = myC1->Value(myC1->FirstParameter());
|
||||
// gp_Pnt2d PL = myC1->Value(myC1->LastParameter());
|
||||
// Dist = Min (P.Distance(PF),P.Distance(PL));
|
||||
// }
|
||||
|
||||
// Check of distances between P and first and last point of the first curve
|
||||
// should be performed in any case, despite of the results of projection.
|
||||
// Check of distances between P and first and last point of the first curve
|
||||
// should be performed in any case, despite of the results of projection.
|
||||
gp_Pnt2d PF = myC1->Value(myC1->FirstParameter());
|
||||
gp_Pnt2d PL = myC1->Value(myC1->LastParameter());
|
||||
Standard_Real aDistMin = Min (P.Distance(PF),P.Distance(PL));
|
||||
|
||||
if (Dist > aDistMin)
|
||||
Dist = aDistMin;
|
||||
// Modified by Sergey KHROMOV - Fri Sep 27 11:43:44 2002 End
|
||||
// Modified by Sergey KHROMOV - Fri Sep 27 11:43:44 2002 End
|
||||
}
|
||||
|
||||
// return (Dist < Abs(myOffset);
|
||||
// return (Dist < Abs(myOffset) + Precision::Confusion());
|
||||
// return (Dist < Abs(myOffset);
|
||||
// return (Dist < Abs(myOffset) + Precision::Confusion());
|
||||
return (Dist < Abs(myOffset) - Precision::Confusion());
|
||||
}
|
||||
|
||||
|
@@ -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.
|
||||
@@ -299,9 +299,9 @@ Standard_Boolean BRepLib::BuildCurve3d(const TopoDS_Edge& AnEdge,
|
||||
const Standard_Integer MaxSegment)
|
||||
{
|
||||
Standard_Integer //ErrorCode,
|
||||
// ReturnCode = 0,
|
||||
// ReturnCode = 0,
|
||||
ii,
|
||||
// num_knots,
|
||||
// num_knots,
|
||||
jj;
|
||||
|
||||
TopLoc_Location LocalLoc,L[2],LC;
|
||||
@@ -319,10 +319,10 @@ Standard_Boolean BRepLib::BuildCurve3d(const TopoDS_Edge& AnEdge,
|
||||
const Handle(Geom_Curve) C = BRep_Tool::Curve(AnEdge,LocalLoc,f,l);
|
||||
if (!C.IsNull())
|
||||
return Standard_True;
|
||||
//
|
||||
// this should not exists but UpdateEdge makes funny things
|
||||
// if the edge is not same range
|
||||
//
|
||||
//
|
||||
// this should not exists but UpdateEdge makes funny things
|
||||
// if the edge is not same range
|
||||
//
|
||||
if (! CheckSameRange(AnEdge,
|
||||
Precision::Confusion())) {
|
||||
SameRange(AnEdge,
|
||||
@@ -439,10 +439,10 @@ Standard_Boolean BRepLib::BuildCurve3d(const TopoDS_Edge& AnEdge,
|
||||
TopoDS_Edge E = AnEdge ;
|
||||
E.Closed(is_closed) ;
|
||||
if (jj == 1 ) {
|
||||
//
|
||||
// if there is only one curve on surface attached to the edge
|
||||
// than it can be qualified sameparameter
|
||||
//
|
||||
//
|
||||
// if there is only one curve on surface attached to the edge
|
||||
// than it can be qualified sameparameter
|
||||
//
|
||||
B.SameParameter(TopoDS::Edge(AnEdge),
|
||||
Standard_True) ;
|
||||
}
|
||||
@@ -502,7 +502,7 @@ Standard_Boolean BRepLib::BuildCurves3d(const TopoDS_Shape& S,
|
||||
Standard_Boolean BRepLib::UpdateEdgeTol(const TopoDS_Edge& AnEdge,
|
||||
const Standard_Real MinToleranceRequested,
|
||||
const Standard_Real MaxToleranceToCheck)
|
||||
{
|
||||
{
|
||||
|
||||
Standard_Integer curve_on_surface_index,
|
||||
curve_index,
|
||||
@@ -633,8 +633,8 @@ Standard_Boolean BRepLib::UpdateEdgeTol(const TopoDS_Edge& AnEdge,
|
||||
curve_index != curve_on_surface_index) {
|
||||
has_closed_curve =
|
||||
has_curve = Standard_False ;
|
||||
// first = geometric_representation_ptr->First();
|
||||
// last = geometric_representation_ptr->Last();
|
||||
// first = geometric_representation_ptr->First();
|
||||
// last = geometric_representation_ptr->Last();
|
||||
local_location = geometric_representation_ptr->Location() ;
|
||||
if (geometric_representation_ptr->IsCurveOnSurface()) {
|
||||
curve2d_ptr = geometric_representation_ptr->PCurve() ;
|
||||
@@ -701,7 +701,7 @@ Standard_Boolean BRepLib::UpdateEdgeTol(const TopoDS_Edge& AnEdge,
|
||||
TE->Tolerance(edge_tolerance);
|
||||
return Standard_True ;
|
||||
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : UpdateEdgeTolerance
|
||||
//purpose :
|
||||
@@ -790,7 +790,13 @@ static void SetEdgeTol(const TopoDS_Edge& E,
|
||||
gp_Pnt Pc3d = HC->Value(u);
|
||||
gp_Pnt2d p2d = pc->Value(u);
|
||||
gp_Pnt Pcons = ElSLib::Value(p2d.X(),p2d.Y(),pln);
|
||||
Standard_Real eps = Max(Pc3d.XYZ().SquareModulus(), Pcons.XYZ().SquareModulus());
|
||||
eps = Epsilon(eps);
|
||||
Standard_Real temp = Pc3d.SquareDistance(Pcons);
|
||||
if(temp <= eps)
|
||||
{
|
||||
temp = 0.;
|
||||
}
|
||||
if(temp > d2) d2 = temp;
|
||||
}
|
||||
d2 = 1.5*sqrt(d2);
|
||||
@@ -881,17 +887,14 @@ static Standard_Real ComputeTol(const Handle(Adaptor3d_HCurve)& c3d,
|
||||
TColStd_Array1OfReal dist(1,nbp+10);
|
||||
dist.Init(-1.);
|
||||
|
||||
|
||||
Adaptor3d_CurveOnSurface cons(c2d,surf);
|
||||
Standard_Real d2 = 0.;
|
||||
Standard_Integer nn = nbp;
|
||||
Standard_Real unsurnn = 1./nn;
|
||||
Standard_Real first = c3d->FirstParameter();
|
||||
Standard_Real last = c3d->LastParameter();
|
||||
Standard_Integer i = 0;
|
||||
for(i = 0; i <= nn; i++){
|
||||
Standard_Real t = unsurnn*i;
|
||||
Standard_Real u = first*(1.-t) + last*t;
|
||||
for(i = 0; i <= nbp; i++){
|
||||
const Standard_Real t = IntToReal(i)/IntToReal(nbp);
|
||||
const Standard_Real u = first*(1.-t) + last*t;
|
||||
gp_Pnt Pc3d = c3d->Value(u);
|
||||
gp_Pnt Pcons = cons.Value(u);
|
||||
if (Precision::IsInfinite(Pcons.X()) ||
|
||||
@@ -937,8 +940,6 @@ static Standard_Real ComputeTol(const Handle(Adaptor3d_HCurve)& c3d,
|
||||
return d2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BRepLib::SameParameter(const TopoDS_Edge& AnEdge,
|
||||
const Standard_Real Tolerance)
|
||||
{
|
||||
@@ -1008,9 +1009,9 @@ void BRepLib::SameParameter(const TopoDS_Edge& AnEdge,
|
||||
Standard_Boolean IsSameP = 1;
|
||||
Standard_Real maxdist = 0.;
|
||||
|
||||
// Modified by skv - Thu Jun 3 12:39:19 2004 OCC5898 Begin
|
||||
// Modified by skv - Thu Jun 3 12:39:19 2004 OCC5898 Begin
|
||||
Standard_Real anEdgeTol = BRep_Tool::Tolerance(AnEdge);
|
||||
// Modified by skv - Thu Jun 3 12:39:20 2004 OCC5898 End
|
||||
// Modified by skv - Thu Jun 3 12:39:20 2004 OCC5898 End
|
||||
Standard_Boolean SameRange = BRep_Tool::SameRange(AnEdge);
|
||||
Standard_Boolean YaPCu = Standard_False;
|
||||
It.Initialize(CList);
|
||||
@@ -1029,6 +1030,7 @@ void BRepLib::SameParameter(const TopoDS_Edge& AnEdge,
|
||||
if (!PCLoc.IsIdentity() ) {
|
||||
S = Handle(Geom_Surface)::DownCast(S->Transformed(PCLoc.Transformation()));
|
||||
}
|
||||
|
||||
GAS.Load(S);
|
||||
if (GCurve->IsCurveOnClosedSurface()) {
|
||||
PC[1] = GCurve->PCurve2();
|
||||
@@ -1202,7 +1204,7 @@ void BRepLib::SameParameter(const TopoDS_Edge& AnEdge,
|
||||
if(IsBad ) { //if BSpline "bad", try to reparametrize it
|
||||
// by its curve length
|
||||
|
||||
// GeomAbs_Shape cont = bs2d->Continuity();
|
||||
// GeomAbs_Shape cont = bs2d->Continuity();
|
||||
if(cont > GeomAbs_C2) cont = GeomAbs_C2;
|
||||
Standard_Integer maxdeg = bs2d->Degree();
|
||||
if(maxdeg == 1) maxdeg = 14;
|
||||
@@ -1218,7 +1220,7 @@ void BRepLib::SameParameter(const TopoDS_Edge& AnEdge,
|
||||
Standard_Integer NbKnots = bs2d->NbKnots();
|
||||
TColStd_Array1OfReal Knots(1,NbKnots);
|
||||
bs2d->Knots(Knots);
|
||||
// BSplCLib::Reparametrize(f3d,l3d,Knots);
|
||||
// BSplCLib::Reparametrize(f3d,l3d,Knots);
|
||||
BSplCLib::Reparametrize(fC0,lC0,Knots);
|
||||
bs2d->SetKnots(Knots);
|
||||
GAC2d.Load(bs2d,f3d,l3d);
|
||||
@@ -1234,7 +1236,7 @@ void BRepLib::SameParameter(const TopoDS_Edge& AnEdge,
|
||||
|
||||
|
||||
if(goodpc){
|
||||
// Approx_SameParameter SameP(HC,HC2d,HS,Tolerance);
|
||||
// Approx_SameParameter SameP(HC,HC2d,HS,Tolerance);
|
||||
Standard_Real aTol = (isANA && isBSP) ? 1.e-7 : Tolerance;
|
||||
Approx_SameParameter SameP(HC,HC2d,HS,aTol);
|
||||
|
||||
@@ -1265,14 +1267,14 @@ void BRepLib::SameParameter(const TopoDS_Edge& AnEdge,
|
||||
}
|
||||
else IsSameP = 0;
|
||||
|
||||
// Modified by skv - Thu Jun 3 12:39:19 2004 OCC5898 Begin
|
||||
// Modified by skv - Thu Jun 3 12:39:19 2004 OCC5898 Begin
|
||||
if (!IsSameP) {
|
||||
if (anEdgeTol > error) {
|
||||
maxdist = Max(maxdist, anEdgeTol);
|
||||
IsSameP = Standard_True;
|
||||
}
|
||||
}
|
||||
// Modified by skv - Thu Jun 3 12:39:20 2004 OCC5898 End
|
||||
// Modified by skv - Thu Jun 3 12:39:20 2004 OCC5898 End
|
||||
}
|
||||
}
|
||||
It.Next() ;
|
||||
@@ -1309,8 +1311,8 @@ void BRepLib::UpdateTolerances(const TopoDS_Shape& aShape,
|
||||
const Standard_Boolean verifyTolerance)
|
||||
{
|
||||
|
||||
// Harmonize tolerances
|
||||
// with rule Tolerance(VERTEX)>=Tolerance(EDGE)>=Tolerance(FACE)
|
||||
// Harmonize tolerances
|
||||
// with rule Tolerance(VERTEX)>=Tolerance(EDGE)>=Tolerance(FACE)
|
||||
BRep_Builder B;
|
||||
Standard_Real tol=0;
|
||||
if (verifyTolerance) {
|
||||
@@ -1464,7 +1466,7 @@ void BRepLib::UpdateTolerances(const TopoDS_Shape& aShape,
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepLib::OrientClosedSolid(TopoDS_Solid& solid)
|
||||
{
|
||||
// Set material inside the solid
|
||||
// Set material inside the solid
|
||||
BRepClass3d_SolidClassifier where(solid);
|
||||
where.PerformInfinitePoint(Precision::Confusion());
|
||||
if (where.State()==TopAbs_IN) {
|
||||
@@ -1488,6 +1490,16 @@ static Standard_Boolean tgtfaces(const TopoDS_Edge& Ed,
|
||||
const Standard_Real ta,
|
||||
const Standard_Boolean couture)
|
||||
{
|
||||
// Check if pcurves exist on both faces of edge
|
||||
Standard_Real aFirst,aLast;
|
||||
Handle(Geom2d_Curve) aCurve;
|
||||
aCurve = BRep_Tool::CurveOnSurface(Ed,F1,aFirst,aLast);
|
||||
if(aCurve.IsNull())
|
||||
return Standard_False;
|
||||
aCurve = BRep_Tool::CurveOnSurface(Ed,F2,aFirst,aLast);
|
||||
if(aCurve.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
Standard_Real u;
|
||||
TopoDS_Edge E = Ed;
|
||||
BRepAdaptor_Surface aBAS1(F1,Standard_False);
|
||||
@@ -1772,4 +1784,3 @@ void BRepLib::ReverseSortFaces (const TopoDS_Shape& Sh,
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -19,7 +19,9 @@
|
||||
#include <Precision.hxx>
|
||||
#include <math_Matrix.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <math_Gauss.hxx>
|
||||
//#include <math_Gauss.hxx>
|
||||
#include <math_SVD.hxx>
|
||||
#include <math_Jacobi.hxx>
|
||||
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
@@ -45,6 +47,8 @@
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepTopAdaptor_FClass2d.hxx>
|
||||
|
||||
#include <GeomLib.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
@@ -331,27 +335,15 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
|
||||
continue;
|
||||
else
|
||||
{
|
||||
const Standard_Integer aNbPolMax = 200;
|
||||
Standard_Integer incr = 1;
|
||||
if(iNbPol > aNbPolMax)
|
||||
{
|
||||
Standard_Integer nb = iNbPol;
|
||||
while(nb > aNbPolMax)
|
||||
{
|
||||
incr++;
|
||||
nb = (iNbPol-1) / incr;
|
||||
}
|
||||
}
|
||||
Handle(TColgp_HArray1OfPnt) aPoles = new (TColgp_HArray1OfPnt) (1, iNbPol);
|
||||
GC->Poles(aPoles->ChangeArray1());
|
||||
gp_Pnt aPolePrev = aPoles->Value(1), aPoleNext;
|
||||
Standard_Real dfDistPrev = 0., dfDistNext;
|
||||
Standard_Integer iPol;
|
||||
for (iPol = 1; iPol <= iNbPol; iPol += incr)
|
||||
for (Standard_Integer iPol=1; iPol<=iNbPol; iPol++)
|
||||
{
|
||||
if (iPol <= iNbPol - incr)
|
||||
if (iPol<iNbPol)
|
||||
{
|
||||
aPoleNext = aPoles->Value(iPol+incr);
|
||||
aPoleNext = aPoles->Value(iPol+1);
|
||||
dfDistNext = aPolePrev.Distance(aPoleNext);
|
||||
}
|
||||
else
|
||||
@@ -436,50 +428,115 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
|
||||
aMat(1,1)+=w*p.X()*p.X();
|
||||
aMat(1,2)+=w*p.X()*p.Y();
|
||||
aMat(1,3)+=w*p.X()*p.Z();
|
||||
aMat(2,1)+=w*p.Y()*p.X();
|
||||
//
|
||||
aMat(2,2)+=w*p.Y()*p.Y();
|
||||
aMat(2,3)+=w*p.Y()*p.Z();
|
||||
aMat(3,1)+=w*p.Z()*p.X();
|
||||
aMat(3,2)+=w*p.Z()*p.Y();
|
||||
//
|
||||
aMat(3,3)+=w*p.Z()*p.Z();
|
||||
aVec(1) -= w*p.X();
|
||||
aVec(2) -= w*p.Y();
|
||||
aVec(3) -= w*p.Z();
|
||||
}
|
||||
aMat(2,1) = aMat(1,2);
|
||||
aMat(3,1) = aMat(1,3);
|
||||
aMat(3,2) = aMat(2,3);
|
||||
//
|
||||
math_Jacobi anEignval(aMat);
|
||||
math_Vector anEVals(1,3);
|
||||
Standard_Boolean isSolved = anEignval.IsDone();
|
||||
Standard_Integer isol = 0;
|
||||
if(isSolved)
|
||||
{
|
||||
anEVals = anEignval.Values();
|
||||
//We need vector with eigenvalue ~ 0.
|
||||
Standard_Real anEMin = RealLast();
|
||||
Standard_Real anEMax = -anEMin;
|
||||
for(i = 1; i <= 3; ++i)
|
||||
{
|
||||
Standard_Real anE = Abs(anEVals(i));
|
||||
if(anEMin > anE)
|
||||
{
|
||||
anEMin = anE;
|
||||
isol = i;
|
||||
}
|
||||
if(anEMax < anE)
|
||||
{
|
||||
anEMax = anE;
|
||||
}
|
||||
}
|
||||
|
||||
if(isol == 0)
|
||||
{
|
||||
isSolved = Standard_False;
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real eps = Epsilon(anEMax);
|
||||
if(anEMin <= eps)
|
||||
{
|
||||
anEignval.Vector(isol, aVec);
|
||||
}
|
||||
else
|
||||
{
|
||||
//try using vector product of other axes
|
||||
Standard_Integer ind[2] = {0,0};
|
||||
for(i = 1; i <= 3; ++i)
|
||||
{
|
||||
if(i == isol)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(ind[0] == 0)
|
||||
{
|
||||
ind[0] = i;
|
||||
continue;
|
||||
}
|
||||
if(ind[1] == 0)
|
||||
{
|
||||
ind[1] = i;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
math_Vector aVec1(1, 3, 0.), aVec2(1, 3, 0.);
|
||||
anEignval.Vector(ind[0], aVec1);
|
||||
anEignval.Vector(ind[1], aVec2);
|
||||
gp_Vec aV1(aVec1(1), aVec1(2), aVec1(3));
|
||||
gp_Vec aV2(aVec2(1), aVec2(2), aVec2(3));
|
||||
gp_Vec aN = aV1^ aV2;
|
||||
aVec(1) = aN.X();
|
||||
aVec(2) = aN.Y();
|
||||
aVec(3) = aN.Z();
|
||||
}
|
||||
if (aVec.Norm2() < gp::Resolution()) {
|
||||
isSolved = Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Solve the system of equations to get plane coefficients
|
||||
math_Gauss aSolver(aMat);
|
||||
Standard_Boolean isSolved = aSolver.IsDone();
|
||||
//
|
||||
// let us be more tolerant (occ415)
|
||||
Standard_Real dfDist = RealLast();
|
||||
Handle(Geom_Plane) aPlane;
|
||||
//
|
||||
if (isSolved) {
|
||||
aSolver.Solve(aVec);
|
||||
if (aVec.Norm2()<gp::Resolution()) {
|
||||
isSolved = Standard_False;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (isSolved) {
|
||||
aPlane = new Geom_Plane(aBaryCenter,gp_Dir(aVec(1),aVec(2),aVec(3)));
|
||||
//Plane normal can have two directions, direction is chosen
|
||||
//according to direction of eigenvector
|
||||
gp_Vec anN(aVec(1), aVec(2), aVec(3));
|
||||
aPlane = new Geom_Plane(aBaryCenter,anN);
|
||||
dfDist = Controle (aPoints, aPlane);
|
||||
}
|
||||
//
|
||||
if (!isSolved || myTolerance < dfDist) {
|
||||
gp_Pnt aFirstPnt=aPoints(1);
|
||||
for (iPoint=2; iPoint<=aPoints.Length(); iPoint++) {
|
||||
const gp_Pnt& aNextPnt = aPoints(iPoint);
|
||||
gp_Vec aDir(aFirstPnt, aNextPnt);
|
||||
gp_Vec aDir(aFirstPnt,aPoints(iPoint));
|
||||
Standard_Real dfSide=aDir.Magnitude();
|
||||
if (dfSide<myTolerance) {
|
||||
continue; // degeneration
|
||||
}
|
||||
for (Standard_Integer iP1=iPoint+1; iP1<=aPoints.Length(); iP1++) {
|
||||
|
||||
gp_Vec aCross = gp_Vec(aFirstPnt,aPoints(iP1)) ^ aDir ;
|
||||
|
||||
if (aCross.Magnitude() > dfSide*myTolerance) {
|
||||
Handle(Geom_Plane) aPlane2 = new Geom_Plane(aFirstPnt, aCross);
|
||||
Handle(Geom_Plane) aPlane2 = new Geom_Plane(aBaryCenter, aCross);
|
||||
Standard_Real dfDist2 = Controle (aPoints, aPlane2);
|
||||
if (dfDist2 < myTolerance) {
|
||||
myTolReached = dfDist2;
|
||||
@@ -504,6 +561,23 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
|
||||
//myTolReached = dfDist;
|
||||
//XXt
|
||||
mySurface = aPlane;
|
||||
//If S is wire, try to orient surface according to orientation of wire.
|
||||
if(S.ShapeType() == TopAbs_WIRE && S.Closed())
|
||||
{
|
||||
//
|
||||
TopoDS_Wire aW = TopoDS::Wire(S);
|
||||
TopoDS_Face aTmpFace = BRepLib_MakeFace(mySurface, Precision::Confusion());
|
||||
BRep_Builder BB;
|
||||
BB.Add(aTmpFace, aW);
|
||||
BRepTopAdaptor_FClass2d FClass(aTmpFace, 0.);
|
||||
if ( FClass.PerformInfinitePoint() == TopAbs_IN )
|
||||
{
|
||||
gp_Dir aN = aPlane->Position().Direction();
|
||||
aN.Reverse();
|
||||
mySurface = new Geom_Plane(aPlane->Position().Location(), aN);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//XXf
|
||||
myTolReached = dfDist;
|
||||
@@ -558,4 +632,3 @@ TopLoc_Location BRepLib_FindSurface::Location() const
|
||||
return myLocation;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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.
|
||||
@@ -39,14 +39,27 @@
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepLib.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
|
||||
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_Ellipse.hxx>
|
||||
#include <Geom2d_Parabola.hxx>
|
||||
#include <Geom2d_Hyperbola.hxx>
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <GCE2d_MakeArcOfCircle.hxx>
|
||||
#include <GCE2d_MakeSegment.hxx>
|
||||
//
|
||||
// Modified by Sergey KHROMOV - Thu Dec 5 10:38:14 2002 Begin
|
||||
static TopoDS_Edge MakeEdge(const Handle(Geom2d_Curve) &theCurve,
|
||||
const TopoDS_Face &theFace,
|
||||
const TopoDS_Vertex &theVFirst,
|
||||
const TopoDS_Vertex &theVLast);
|
||||
// Modified by Sergey KHROMOV - Thu Dec 5 10:38:16 2002 End
|
||||
|
||||
//
|
||||
static GeomAbs_CurveType GetCurveType(const Handle(Geom2d_Curve)& theC2d);
|
||||
static void AdjustCurveEnd(Handle(Geom2d_BoundedCurve)& theC2d, const gp_Pnt2d theP,
|
||||
const Standard_Boolean isFirst);
|
||||
//
|
||||
//=======================================================================
|
||||
//function : BRepMAT2d_Explorer
|
||||
//purpose :
|
||||
@@ -79,7 +92,7 @@ void BRepMAT2d_Explorer::Perform(const TopoDS_Face& aFace)
|
||||
TopoDS_Face F = TopoDS::Face(aFace);
|
||||
F.Orientation(TopAbs_FORWARD);
|
||||
TopExp_Explorer Exp (F,TopAbs_WIRE);
|
||||
// Modified by Sergey KHROMOV - Tue Nov 26 16:10:37 2002 Begin
|
||||
// Modified by Sergey KHROMOV - Tue Nov 26 16:10:37 2002 Begin
|
||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(F);
|
||||
TopoDS_Face aNewF = BRepBuilderAPI_MakeFace(aSurf, Precision::Confusion());
|
||||
|
||||
@@ -91,8 +104,8 @@ void BRepMAT2d_Explorer::Perform(const TopoDS_Face& aFace)
|
||||
BRepLib::BuildCurves3d(aNewF);
|
||||
|
||||
myModifShapes.Add(aFace, aNewF);
|
||||
// CheckConnection();
|
||||
// Modified by Sergey KHROMOV - Tue Nov 26 16:10:38 2002 End
|
||||
// CheckConnection();
|
||||
// Modified by Sergey KHROMOV - Tue Nov 26 16:10:38 2002 End
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -104,40 +117,40 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
const TopoDS_Face& aFace,
|
||||
TopoDS_Face& aNewFace)
|
||||
{
|
||||
// Modified by Sergey KHROMOV - Tue Nov 26 14:25:46 2002 Begin
|
||||
// This method is totally rewroted to include check
|
||||
// of connection and creation of a new spine.
|
||||
// Modified by Sergey KHROMOV - Tue Nov 26 14:25:46 2002 Begin
|
||||
// This method is totally rewroted to include check
|
||||
// of connection and creation of a new spine.
|
||||
NewContour();
|
||||
myIsClosed(currentContour) = (Spine.Closed()) ? Standard_True : Standard_False;
|
||||
|
||||
// Modified by skv - Wed Jun 23 12:23:01 2004 Integration Begin
|
||||
// Taking into account side of bisecting loci construction.
|
||||
// TopoDS_Wire aWFwd = TopoDS::Wire(Spine.Oriented(TopAbs_FORWARD));
|
||||
// BRepTools_WireExplorer anExp(aWFwd, aFace);
|
||||
// Modified by skv - Wed Jun 23 12:23:01 2004 Integration Begin
|
||||
// Taking into account side of bisecting loci construction.
|
||||
// TopoDS_Wire aWFwd = TopoDS::Wire(Spine.Oriented(TopAbs_FORWARD));
|
||||
// BRepTools_WireExplorer anExp(aWFwd, aFace);
|
||||
BRepTools_WireExplorer anExp(Spine, aFace);
|
||||
// Modified by skv - Wed Jun 23 12:23:02 2004 Integration End
|
||||
// Modified by skv - Wed Jun 23 12:23:02 2004 Integration End
|
||||
TopTools_IndexedDataMapOfShapeShape anOldNewE;
|
||||
|
||||
if (!anExp.More())
|
||||
return;
|
||||
|
||||
TopoDS_Edge aFirstEdge = anExp.Current();
|
||||
TopoDS_Edge aPrevEdge = aFirstEdge;
|
||||
Standard_Real UFirst,ULast, aD;
|
||||
Handle(Geom2d_BSplineCurve) BCurve;
|
||||
Handle(Geom2d_Curve) C2d;
|
||||
Handle(Geom2d_TrimmedCurve) CT2d;
|
||||
Handle(Geom2d_TrimmedCurve) aFirstCurve;
|
||||
gp_Pnt2d aPFirst;
|
||||
gp_Pnt2d aPLast;
|
||||
gp_Pnt2d aPCurFirst;
|
||||
// Modified by skv - Mon Jul 11 19:00:25 2005 Integration Begin
|
||||
// Set the confusion tolerance in accordance with the further algo
|
||||
// Standard_Real aTolConf = Precision::Confusion();
|
||||
// Modified by skv - Mon Jul 11 19:00:25 2005 Integration Begin
|
||||
// Set the confusion tolerance in accordance with the further algo
|
||||
// Standard_Real aTolConf = Precision::Confusion();
|
||||
Standard_Real aTolConf = 1.e-8;
|
||||
// Modified by skv - Mon Jul 11 19:00:25 2005 Integration End
|
||||
// Modified by skv - Mon Jul 11 19:00:25 2005 Integration End
|
||||
Standard_Boolean isModif = Standard_False;
|
||||
|
||||
// Treatment of the first edge of a wire.
|
||||
// Treatment of the first edge of a wire.
|
||||
anOldNewE.Add(aFirstEdge, aFirstEdge);
|
||||
C2d = BRep_Tool::CurveOnSurface (aFirstEdge, aFace, UFirst, ULast);
|
||||
CT2d = new Geom2d_TrimmedCurve(C2d,UFirst,ULast);
|
||||
@@ -152,7 +165,7 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
aFirstCurve = CT2d;
|
||||
anExp.Next();
|
||||
|
||||
// Treatment of the next edges:
|
||||
// Treatment of the next edges:
|
||||
for (; anExp.More(); anExp.Next()) {
|
||||
TopoDS_Edge anEdge = anExp.Current();
|
||||
|
||||
@@ -175,15 +188,16 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
// code should be rewritten.
|
||||
isModif = Standard_True;
|
||||
//
|
||||
//modified by NIZNHY-PKV Tue Aug 7 09:14:03 2007f
|
||||
//BCurve = Geom2dConvert::CurveToBSplineCurve(CT2d);
|
||||
BCurve=Geom2dConvert::CurveToBSplineCurve(CT2d, Convert_QuasiAngular);
|
||||
//modified by NIZNHY-PKV Tue Aug 7 09:14:07 2007t
|
||||
|
||||
BCurve->SetPole(1, aPLast);
|
||||
CT2d = new Geom2d_TrimmedCurve(BCurve, BCurve->FirstParameter(),
|
||||
BCurve->LastParameter());
|
||||
|
||||
Standard_Integer aNbC = theCurves.Value(currentContour).Length();
|
||||
Handle(Geom2d_BoundedCurve) CPrev =
|
||||
Handle(Geom2d_BoundedCurve)::DownCast(theCurves.ChangeValue(currentContour).ChangeValue(aNbC));
|
||||
//
|
||||
GeomAbs_CurveType TCPrev = GetCurveType(CPrev);
|
||||
GeomAbs_CurveType TCCurr = GetCurveType(CT2d);
|
||||
//
|
||||
if(TCCurr <= TCPrev)
|
||||
{
|
||||
AdjustCurveEnd(CT2d, aPLast, Standard_True);
|
||||
// Creation of new edge.
|
||||
TopoDS_Edge aNewEdge;
|
||||
TopoDS_Vertex aVf = TopExp::FirstVertex(anEdge);
|
||||
@@ -198,9 +212,32 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
|
||||
anOldNewE.ChangeFromKey(anEdge) = aNewEdge;
|
||||
}
|
||||
else
|
||||
{
|
||||
gp_Pnt2d aP = CT2d->Value(CT2d->FirstParameter());
|
||||
AdjustCurveEnd(CPrev, aP, Standard_False);
|
||||
theCurves.ChangeValue(currentContour).ChangeValue(aNbC) = CPrev;
|
||||
//Change previous edge
|
||||
TopoDS_Edge aNewEdge;
|
||||
TopoDS_Vertex aVf = TopExp::FirstVertex(aPrevEdge);
|
||||
TopoDS_Vertex aVl = TopExp::LastVertex(aPrevEdge);
|
||||
|
||||
if (aPrevEdge.Orientation() == TopAbs_FORWARD)
|
||||
aNewEdge = MakeEdge(CPrev, aNewFace, aVf, aVl);
|
||||
else
|
||||
aNewEdge = MakeEdge(CPrev->Reversed(), aNewFace, aVf, aVl);
|
||||
|
||||
aNewEdge.Orientation(aPrevEdge.Orientation());
|
||||
|
||||
anOldNewE.ChangeFromKey(aPrevEdge) = aNewEdge;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
aPLast = CT2d->Value(CT2d->LastParameter());
|
||||
Add(CT2d);
|
||||
aPrevEdge = anEdge;
|
||||
}
|
||||
|
||||
// Check of the distance between the first and the last point of wire
|
||||
@@ -208,19 +245,19 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
if (myIsClosed(currentContour) && aPLast.Distance(aPFirst) > aTolConf) {
|
||||
isModif = Standard_True;
|
||||
|
||||
|
||||
//modified by NIZNHY-PKV Tue Aug 7 09:20:08 2007f
|
||||
//Handle(Geom2d_BSplineCurve)
|
||||
//BCurve = Geom2dConvert::CurveToBSplineCurve(aFirstCurve);
|
||||
BCurve = Geom2dConvert::CurveToBSplineCurve(aFirstCurve, Convert_QuasiAngular);
|
||||
//modified by NIZNHY-PKV Tue Aug 7 09:20:11 2007t
|
||||
|
||||
BCurve->SetPole(1, aPLast);
|
||||
aFirstCurve = new Geom2d_TrimmedCurve(BCurve, BCurve->FirstParameter(),
|
||||
BCurve->LastParameter());
|
||||
//
|
||||
Standard_Integer aNbC = theCurves.Value(currentContour).Length();
|
||||
Handle(Geom2d_BoundedCurve) CPrev =
|
||||
Handle(Geom2d_BoundedCurve)::DownCast(theCurves.ChangeValue(currentContour).ChangeValue(aNbC));
|
||||
//
|
||||
GeomAbs_CurveType TCPrev = GetCurveType(CPrev);
|
||||
GeomAbs_CurveType TCCurr = GetCurveType(aFirstCurve);
|
||||
//
|
||||
if(TCCurr <= TCPrev)
|
||||
{
|
||||
AdjustCurveEnd(aFirstCurve, aPLast, Standard_True);
|
||||
theCurves.ChangeValue(currentContour).ChangeValue(1) = aFirstCurve;
|
||||
|
||||
// Creation of new first edge.
|
||||
// Creation of new edge.
|
||||
TopoDS_Edge aNewEdge;
|
||||
TopoDS_Vertex aVf = TopExp::FirstVertex(aFirstEdge);
|
||||
TopoDS_Vertex aVl = TopExp::LastVertex(aFirstEdge);
|
||||
@@ -231,8 +268,31 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
aNewEdge = MakeEdge(aFirstCurve->Reversed(), aNewFace, aVf, aVl);
|
||||
|
||||
aNewEdge.Orientation(aFirstEdge.Orientation());
|
||||
|
||||
anOldNewE.ChangeFromKey(aFirstEdge) = aNewEdge;
|
||||
}
|
||||
else
|
||||
{
|
||||
gp_Pnt2d aP = aFirstCurve->Value(aFirstCurve->FirstParameter());
|
||||
AdjustCurveEnd(CPrev, aP, Standard_False);
|
||||
theCurves.ChangeValue(currentContour).ChangeValue(aNbC) = CPrev;
|
||||
//Change previous edge
|
||||
TopoDS_Edge aNewEdge;
|
||||
TopoDS_Vertex aVf = TopExp::FirstVertex(aPrevEdge);
|
||||
TopoDS_Vertex aVl = TopExp::LastVertex(aPrevEdge);
|
||||
|
||||
if (aPrevEdge.Orientation() == TopAbs_FORWARD)
|
||||
aNewEdge = MakeEdge(CPrev, aNewFace, aVf, aVl);
|
||||
else
|
||||
aNewEdge = MakeEdge(CPrev->Reversed(), aNewFace, aVf, aVl);
|
||||
|
||||
aNewEdge.Orientation(aPrevEdge.Orientation());
|
||||
|
||||
anOldNewE.ChangeFromKey(aPrevEdge) = aNewEdge;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TopoDS_Wire aNewWire;
|
||||
BRep_Builder aBuilder;
|
||||
@@ -263,7 +323,7 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
aNewWire = Spine;
|
||||
|
||||
aBuilder.Add(aNewFace, aNewWire);
|
||||
// Modified by Sergey KHROMOV - Tue Nov 26 14:25:53 2002 End
|
||||
// Modified by Sergey KHROMOV - Tue Nov 26 14:25:53 2002 End
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -302,10 +362,10 @@ void BRepMAT2d_Explorer::Clear()
|
||||
{
|
||||
theCurves.Clear() ;
|
||||
currentContour = 0;
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 16:07:55 2002 Begin
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 16:07:55 2002 Begin
|
||||
myIsClosed.Clear();
|
||||
myModifShapes.Clear();
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 16:07:55 2002 End
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 16:07:55 2002 End
|
||||
}
|
||||
|
||||
|
||||
@@ -318,9 +378,9 @@ void BRepMAT2d_Explorer::NewContour()
|
||||
{
|
||||
TColGeom2d_SequenceOfCurve Contour;
|
||||
theCurves.Append(Contour);
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 16:12:05 2002 Begin
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 16:12:05 2002 Begin
|
||||
myIsClosed.Append(Standard_False);
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 16:12:05 2002 End
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 16:12:05 2002 End
|
||||
currentContour ++ ;
|
||||
}
|
||||
|
||||
@@ -353,7 +413,7 @@ Standard_Integer BRepMAT2d_Explorer::NumberOfContours() const
|
||||
|
||||
Standard_Integer BRepMAT2d_Explorer::NumberOfCurves
|
||||
(const Standard_Integer IndexContour)
|
||||
const
|
||||
const
|
||||
{
|
||||
return theCurves.Value(IndexContour).Length();
|
||||
}
|
||||
@@ -421,7 +481,7 @@ TopoDS_Shape BRepMAT2d_Explorer::Shape() const
|
||||
|
||||
const TColGeom2d_SequenceOfCurve& BRepMAT2d_Explorer::Contour
|
||||
(const Standard_Integer IC)
|
||||
const
|
||||
const
|
||||
{
|
||||
return theCurves.Value(IC);
|
||||
}
|
||||
@@ -498,3 +558,85 @@ TopoDS_Edge MakeEdge(const Handle(Geom2d_Curve) &theCurve,
|
||||
return aNewEdge;
|
||||
}
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 17:40:14 2002 End
|
||||
//
|
||||
//=======================================================================
|
||||
//function : GetCurveType
|
||||
//purpose : Get curve type.
|
||||
//=======================================================================
|
||||
|
||||
GeomAbs_CurveType GetCurveType(const Handle(Geom2d_Curve)& theC2d)
|
||||
{
|
||||
GeomAbs_CurveType aTypeCurve = GeomAbs_OtherCurve;
|
||||
Handle(Standard_Type) TheType = theC2d->DynamicType();
|
||||
if ( TheType == STANDARD_TYPE(Geom2d_TrimmedCurve)) {
|
||||
TheType = (*((Handle(Geom2d_TrimmedCurve)*)&theC2d))->BasisCurve()->DynamicType();
|
||||
}
|
||||
|
||||
if ( TheType == STANDARD_TYPE(Geom2d_Circle)) {
|
||||
aTypeCurve = GeomAbs_Circle;
|
||||
}
|
||||
else if ( TheType ==STANDARD_TYPE(Geom2d_Line)) {
|
||||
aTypeCurve = GeomAbs_Line;
|
||||
}
|
||||
else if ( TheType == STANDARD_TYPE(Geom2d_Ellipse)) {
|
||||
aTypeCurve = GeomAbs_Ellipse;
|
||||
}
|
||||
else if ( TheType == STANDARD_TYPE(Geom2d_Parabola)) {
|
||||
aTypeCurve = GeomAbs_Parabola;
|
||||
}
|
||||
else if ( TheType == STANDARD_TYPE(Geom2d_Hyperbola)) {
|
||||
aTypeCurve = GeomAbs_Hyperbola;
|
||||
}
|
||||
else if ( TheType == STANDARD_TYPE(Geom2d_BezierCurve)) {
|
||||
aTypeCurve = GeomAbs_BezierCurve;
|
||||
}
|
||||
else if ( TheType == STANDARD_TYPE(Geom2d_BSplineCurve)) {
|
||||
aTypeCurve = GeomAbs_BSplineCurve;
|
||||
}
|
||||
else {
|
||||
aTypeCurve = GeomAbs_OtherCurve;
|
||||
}
|
||||
return aTypeCurve;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : AdjustCurveEnd
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AdjustCurveEnd(Handle(Geom2d_BoundedCurve)& theC2d, const gp_Pnt2d theP,
|
||||
const Standard_Boolean isFirst)
|
||||
{
|
||||
GeomAbs_CurveType aType = GetCurveType(theC2d);
|
||||
if(aType == GeomAbs_Line)
|
||||
{
|
||||
//create new line
|
||||
if(isFirst)
|
||||
{
|
||||
gp_Pnt2d aP = theC2d->Value(theC2d->LastParameter());
|
||||
theC2d = GCE2d_MakeSegment(theP, aP);
|
||||
}
|
||||
else
|
||||
{
|
||||
gp_Pnt2d aP = theC2d->Value(theC2d->FirstParameter());
|
||||
theC2d = GCE2d_MakeSegment(aP, theP);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Convert to BSpline and adjust first pole
|
||||
Handle(Geom2d_BSplineCurve) BCurve =
|
||||
Geom2dConvert::CurveToBSplineCurve(theC2d, Convert_QuasiAngular);
|
||||
if(isFirst)
|
||||
{
|
||||
BCurve->SetPole(1, theP);
|
||||
theC2d = new Geom2d_TrimmedCurve(BCurve, BCurve->FirstParameter(),
|
||||
BCurve->LastParameter());
|
||||
}
|
||||
else
|
||||
{
|
||||
BCurve->SetPole(BCurve->NbPoles(), theP);
|
||||
theC2d = new Geom2d_TrimmedCurve(BCurve, BCurve->FirstParameter(),
|
||||
BCurve->LastParameter());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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.
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <Geom2d_Point.hxx>
|
||||
#include <Geom2d_CartesianPoint.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
@@ -31,13 +32,19 @@
|
||||
#include <Bisector_BisecAna.hxx>
|
||||
#include <Bisector_BisecPC.hxx>
|
||||
#include <Bisector_BisecCC.hxx>
|
||||
#include <GCE2d_MakeSegment.hxx>
|
||||
|
||||
/*
|
||||
#ifdef DEB
|
||||
//#define DRAW
|
||||
#ifdef DRAW
|
||||
#include <DrawTrSurf.hxx>
|
||||
static char tname[100];
|
||||
static Standard_CString name = tname ;
|
||||
#pragma comment(lib, "TKDraw.lib")
|
||||
static char name[100];
|
||||
static Standard_Integer nbb = 0;
|
||||
*/
|
||||
static Standard_Boolean Affich = Standard_False;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
static Standard_Boolean IsMaxRC (const Handle(Geom2d_Curve)& C,
|
||||
Standard_Real U,
|
||||
@@ -78,6 +85,24 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
|
||||
Handle(Standard_Type) Type2 = asecondcurve->DynamicType();
|
||||
Handle(Bisector_Curve) Bis;
|
||||
Standard_Real UFirst,ULast;
|
||||
//gp_XY ref1( -65.9325, -200.28055 );
|
||||
//gp_XY ref2(50.00154, -201.54198 );
|
||||
|
||||
//gp_XY p1 = afirstcurve->Value(afirstcurve->FirstParameter()).XY();
|
||||
//gp_XY p2 = afirstcurve->Value(afirstcurve->LastParameter()).XY();
|
||||
|
||||
//if(p1.IsEqual(ref1, 1.e-5) && p2.IsEqual(ref2,1.e-5))
|
||||
//{
|
||||
// cout << "111" << endl;
|
||||
//}
|
||||
|
||||
//p1 = asecondcurve->Value(asecondcurve->FirstParameter()).XY();
|
||||
//p2 = asecondcurve->Value(asecondcurve->LastParameter()).XY();
|
||||
|
||||
//if(p1.IsEqual(ref1, 1.e-5) && p2.IsEqual(ref2,1.e-5))
|
||||
//{
|
||||
// cout << "222" << endl;
|
||||
//}
|
||||
|
||||
if (Type1 == STANDARD_TYPE(Geom2d_TrimmedCurve)) {
|
||||
Type1 = Handle(Geom2d_TrimmedCurve)::DownCast(afirstcurve)
|
||||
@@ -88,14 +113,63 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
|
||||
->BasisCurve()->DynamicType();
|
||||
}
|
||||
|
||||
Handle(Geom2d_Curve) afirstcurve1 = afirstcurve;
|
||||
Handle(Geom2d_Curve) asecondcurve1 = asecondcurve;
|
||||
|
||||
if(Type1 == STANDARD_TYPE(Geom2d_BSplineCurve))
|
||||
{
|
||||
Handle(Geom2d_BSplineCurve) aBS;
|
||||
if(afirstcurve->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve))
|
||||
{
|
||||
aBS = Handle(Geom2d_BSplineCurve)::DownCast(Handle(Geom2d_TrimmedCurve)::DownCast(afirstcurve)
|
||||
->BasisCurve());
|
||||
}
|
||||
else
|
||||
{
|
||||
aBS = Handle(Geom2d_BSplineCurve)::DownCast(afirstcurve);
|
||||
}
|
||||
if(aBS->Degree() == 1 && aBS->NbPoles() == 2)
|
||||
{
|
||||
if(aBS->Pole(1).Distance(aBS->Pole(2)) < 1.e-4)
|
||||
{
|
||||
afirstcurve1 = GCE2d_MakeSegment(aBS->Pole(1), aBS->Pole(2));
|
||||
Type1 = STANDARD_TYPE(Geom2d_Line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(Type2 == STANDARD_TYPE(Geom2d_BSplineCurve))
|
||||
{
|
||||
Handle(Geom2d_BSplineCurve) aBS;
|
||||
if(asecondcurve->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve))
|
||||
{
|
||||
aBS = Handle(Geom2d_BSplineCurve)::DownCast(Handle(Geom2d_TrimmedCurve)::DownCast(asecondcurve)
|
||||
->BasisCurve());
|
||||
}
|
||||
else
|
||||
{
|
||||
aBS = Handle(Geom2d_BSplineCurve)::DownCast(asecondcurve);
|
||||
}
|
||||
if(aBS->Degree() == 1 && aBS->NbPoles() == 2)
|
||||
{
|
||||
if(aBS->Pole(1).Distance(aBS->Pole(2)) < 1.e-4)
|
||||
{
|
||||
asecondcurve1 = GCE2d_MakeSegment(aBS->Pole(1), aBS->Pole(2));
|
||||
Type2 = STANDARD_TYPE(Geom2d_Line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( (Type1 == STANDARD_TYPE(Geom2d_Circle) || Type1 == STANDARD_TYPE(Geom2d_Line)) &&
|
||||
(Type2 == STANDARD_TYPE(Geom2d_Circle) || Type2 == STANDARD_TYPE(Geom2d_Line)) ) {
|
||||
(Type2 == STANDARD_TYPE(Geom2d_Circle) || Type2 == STANDARD_TYPE(Geom2d_Line)) )
|
||||
{
|
||||
//------------------------------------------------------------------
|
||||
// Analytic Bissectrice.
|
||||
//------------------------------------------------------------------
|
||||
Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna();
|
||||
BisAna->Perform(afirstcurve ,
|
||||
asecondcurve ,
|
||||
BisAna->Perform(afirstcurve1 ,
|
||||
asecondcurve1 ,
|
||||
apoint ,
|
||||
afirstvector ,
|
||||
asecondvector ,
|
||||
@@ -137,8 +211,8 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
|
||||
// Bissectrice algo
|
||||
//-------------------------------------------------------------------
|
||||
Handle(Bisector_BisecCC) BisCC = new Bisector_BisecCC();
|
||||
BisCC -> Perform(asecondcurve,
|
||||
afirstcurve ,
|
||||
BisCC -> Perform(asecondcurve1,
|
||||
afirstcurve1 ,
|
||||
adirection ,
|
||||
adirection ,
|
||||
apoint);
|
||||
@@ -146,18 +220,33 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
|
||||
if (BisCC -> IsEmpty()) {
|
||||
// bissectrice is empty. a point is projected at the end of the guide curve.
|
||||
// Construction of a false bissectrice.
|
||||
// modified by NIZHNY-EAP Mon Feb 21 12:00:13 2000 ___BEGIN___
|
||||
// modified by NIZHNY-EAP Mon Feb 21 12:00:13 2000 ___BEGIN___
|
||||
gp_Pnt2d aP1 = afirstcurve1->Value(afirstcurve1->LastParameter());
|
||||
gp_Pnt2d aP2 = asecondcurve1->Value(asecondcurve1->FirstParameter());
|
||||
gp_Pnt2d aPm(.5*(aP1.XY()+aP2.XY()));
|
||||
Standard_Real Nx, Ny;
|
||||
if(aPm.Distance(apoint) > 10.*Precision::Confusion())
|
||||
{
|
||||
Nx = apoint.X() - aPm.X();
|
||||
Ny = apoint.Y() - aPm.Y();
|
||||
if(adirection < 0)
|
||||
{
|
||||
Nx = -Nx;
|
||||
Ny = -Ny;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gp_Dir2d dir1(afirstvector), dir2(asecondvector);
|
||||
Standard_Real
|
||||
Nx = - dir1.X() - dir2.X(),
|
||||
Ny = - dir1.Y() - dir2.Y();
|
||||
if (Abs(Nx) <= gp::Resolution() && Abs(Ny) <= gp::Resolution()) {
|
||||
Nx = - afirstvector.Y();
|
||||
Nx = -afirstvector.Y();
|
||||
Ny = afirstvector.X();
|
||||
}
|
||||
//gp_Dir2d N ( - adirection*afirstvector.Y(), adirection*afirstvector.X());
|
||||
}
|
||||
gp_Dir2d N ( adirection*Nx, adirection*Ny);
|
||||
// modified by NIZHNY-EAP Mon Feb 21 12:00:19 2000 ___END___
|
||||
// modified by NIZHNY-EAP Mon Feb 21 12:00:19 2000 ___END___
|
||||
|
||||
Handle (Geom2d_CartesianPoint) PG = new Geom2d_CartesianPoint(apoint);
|
||||
Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N);
|
||||
@@ -177,9 +266,12 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
|
||||
}
|
||||
}
|
||||
}
|
||||
UFirst = Max(UFirst, Bis->FirstParameter());
|
||||
ULast = Min(ULast, Bis->LastParameter());
|
||||
thebisector = new Geom2d_TrimmedCurve(Bis,UFirst,ULast);
|
||||
|
||||
/*
|
||||
#ifdef DRAW
|
||||
if(Affich)
|
||||
{
|
||||
sprintf( name, "c1_%d", ++nbb );
|
||||
DrawTrSurf::Set( name, afirstcurve );
|
||||
sprintf( name, "c2_%d", nbb );
|
||||
@@ -188,7 +280,9 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
|
||||
DrawTrSurf::Set( name, apoint );
|
||||
sprintf( name, "b%d", nbb );
|
||||
DrawTrSurf::Set( name, thebisector );
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
@@ -273,7 +367,7 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
|
||||
BisPC -> Perform(afirstcurvereverse ,
|
||||
asecondpoint->Pnt2d(),
|
||||
- adirection );
|
||||
// Modified by Sergey KHROMOV - Thu Feb 21 16:49:54 2002 Begin
|
||||
// Modified by Sergey KHROMOV - Thu Feb 21 16:49:54 2002 Begin
|
||||
if (BisPC -> IsEmpty()) {
|
||||
gp_Dir2d dir1(afirstvector), dir2(asecondvector);
|
||||
Standard_Real
|
||||
@@ -283,7 +377,7 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
|
||||
Nx = - afirstvector.Y();
|
||||
Ny = afirstvector.X();
|
||||
}
|
||||
// gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X());
|
||||
// gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X());
|
||||
gp_Dir2d N ( adirection*Nx, adirection*Ny);
|
||||
Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N);
|
||||
Handle (Geom2d_TrimmedCurve) BisL = new Geom2d_TrimmedCurve(L,0,RC);
|
||||
@@ -293,7 +387,7 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
|
||||
ULast = BisAna->ParameterOfEndPoint();
|
||||
Bis = BisAna;
|
||||
} else {
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 17:01:08 2002 End
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 17:01:08 2002 End
|
||||
UFirst = BisPC->Parameter(apoint);
|
||||
ULast = BisPC->LastParameter();
|
||||
if(UFirst >= ULast)
|
||||
@@ -317,18 +411,25 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
|
||||
}
|
||||
}
|
||||
}
|
||||
if(UFirst < Bis->FirstParameter())
|
||||
UFirst = Bis->FirstParameter();
|
||||
if(ULast > Bis->LastParameter())
|
||||
ULast = Bis->LastParameter();
|
||||
thebisector = new Geom2d_TrimmedCurve(Bis,UFirst,ULast);
|
||||
|
||||
/*
|
||||
#ifdef DRAW
|
||||
if(Affich)
|
||||
{
|
||||
sprintf( name, "c1_%d", ++nbb );
|
||||
DrawTrSurf::Set( name, afirstcurve );
|
||||
sprintf( name, "c2_%d", nbb );
|
||||
DrawTrSurf::Set( name, SecondPnt );
|
||||
DrawTrSurf::Set( name, asecondpoint->Pnt2d() );
|
||||
sprintf( name, "p%d", nbb );
|
||||
DrawTrSurf::Set( name, apoint );
|
||||
sprintf( name, "b%d", nbb );
|
||||
DrawTrSurf::Set( name, thebisector );
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
@@ -382,7 +483,7 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Point)& afirstpoint ,
|
||||
Bis = BisAna;
|
||||
}
|
||||
else {
|
||||
// Standard_Real UPoint = 0.;
|
||||
// Standard_Real UPoint = 0.;
|
||||
Standard_Boolean IsLine = Standard_False;
|
||||
Standard_Real RC = Precision::Infinite();
|
||||
|
||||
@@ -413,7 +514,7 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Point)& afirstpoint ,
|
||||
BisPC -> Perform(asecondcurve ,
|
||||
afirstpoint->Pnt2d(),
|
||||
adirection );
|
||||
// Modified by Sergey KHROMOV - Thu Feb 21 16:49:54 2002 Begin
|
||||
// Modified by Sergey KHROMOV - Thu Feb 21 16:49:54 2002 Begin
|
||||
if (BisPC -> IsEmpty()) {
|
||||
gp_Dir2d dir1(afirstvector), dir2(asecondvector);
|
||||
Standard_Real
|
||||
@@ -423,7 +524,7 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Point)& afirstpoint ,
|
||||
Nx = - afirstvector.Y();
|
||||
Ny = afirstvector.X();
|
||||
}
|
||||
// gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X());
|
||||
// gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X());
|
||||
gp_Dir2d N ( adirection*Nx, adirection*Ny);
|
||||
Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N);
|
||||
Handle (Geom2d_TrimmedCurve) BisL = new Geom2d_TrimmedCurve(L,0,RC);
|
||||
@@ -433,7 +534,7 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Point)& afirstpoint ,
|
||||
ULast = BisAna->ParameterOfEndPoint();
|
||||
Bis = BisAna;
|
||||
} else {
|
||||
// Modified by Sergey KHROMOV - Thu Feb 21 16:49:58 2002 End
|
||||
// Modified by Sergey KHROMOV - Thu Feb 21 16:49:58 2002 End
|
||||
UFirst = BisPC->Parameter(apoint);
|
||||
ULast = BisPC->LastParameter();
|
||||
if(UFirst >= ULast)
|
||||
@@ -455,18 +556,25 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Point)& afirstpoint ,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UFirst = Max(UFirst, Bis->FirstParameter());
|
||||
ULast = Min(ULast, Bis->LastParameter());
|
||||
thebisector = new Geom2d_TrimmedCurve(Bis,UFirst,ULast);
|
||||
|
||||
/*
|
||||
#ifdef DRAW
|
||||
if(Affich)
|
||||
{
|
||||
sprintf( name, "c1_%d", ++nbb );
|
||||
DrawTrSurf::Set( name, FirstPnt );
|
||||
DrawTrSurf::Set( name, afirstpoint->Pnt2d() );
|
||||
sprintf( name, "c2_%d", nbb );
|
||||
DrawTrSurf::Set( name, asecondcurve );
|
||||
sprintf( name, "p%d", nbb );
|
||||
DrawTrSurf::Set( name, apoint );
|
||||
sprintf( name, "b%d", nbb );
|
||||
DrawTrSurf::Set( name, thebisector );
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
@@ -503,7 +611,9 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Point)& afirstpoint ,
|
||||
Bis->ParameterOfStartPoint(),
|
||||
Bis->ParameterOfEndPoint());
|
||||
|
||||
/*
|
||||
#ifdef DRAW
|
||||
if(Affich)
|
||||
{
|
||||
sprintf( name, "c1_%d", ++nbb );
|
||||
DrawTrSurf::Set( name, afirstpoint->Pnt2d() );
|
||||
sprintf( name, "c2_%d", nbb );
|
||||
@@ -512,7 +622,8 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Point)& afirstpoint ,
|
||||
DrawTrSurf::Set( name, apoint );
|
||||
sprintf( name, "b%d", nbb );
|
||||
DrawTrSurf::Set( name, thebisector );
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@@ -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.
|
||||
@@ -122,7 +122,6 @@ void Bisector_BisecCC::Perform(const Handle(Geom2d_Curve)& Cu1,
|
||||
// Calculate first point of the polygon.
|
||||
//---------------------------------------------
|
||||
Standard_Boolean isProjDone = ProjOnCurve (Origin,curve1, U);
|
||||
P = ValueByInt (U,UC1,UC2,Dist);
|
||||
|
||||
if(!isProjDone)
|
||||
{
|
||||
@@ -130,6 +129,20 @@ void Bisector_BisecCC::Perform(const Handle(Geom2d_Curve)& Cu1,
|
||||
return;
|
||||
}
|
||||
|
||||
P = ValueByInt (U,UC1,UC2,Dist);
|
||||
if(Dist < Precision::Confusion())
|
||||
{
|
||||
gp_Pnt2d aP1 = curve1->Value(UC1);
|
||||
gp_Pnt2d aP2 = curve2->Value(UC2);
|
||||
Standard_Real dp = (aP1.Distance(P)+aP2.Distance(P));
|
||||
Standard_Real dorig = (aP1.Distance(Origin)+aP2.Distance(Origin));
|
||||
if(dp < dorig)
|
||||
{
|
||||
isEmpty = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Dist < Precision::Infinite()) {
|
||||
//----------------------------------------------------
|
||||
// the parameter of the origin point gives a point
|
||||
@@ -164,7 +177,7 @@ void Bisector_BisecCC::Perform(const Handle(Geom2d_Curve)& Cu1,
|
||||
}
|
||||
}
|
||||
|
||||
if ( !myPolygon.Length() == 0) {
|
||||
if ( myPolygon.Length() != 0 ) {
|
||||
SupLastParameter();
|
||||
//----------------------------------------------
|
||||
// Construction of the polygon of the bissectrice.
|
||||
@@ -619,8 +632,8 @@ gp_Pnt2d Bisector_BisecCC::ValueAndDist (const Standard_Real U,
|
||||
//---------------------------------------------------------------
|
||||
gp_Pnt2d P1;
|
||||
gp_Vec2d T1;
|
||||
Standard_Real EpsH = 1.E-8;
|
||||
Standard_Real EpsH100 = 1.E-6;
|
||||
Standard_Real EpsH = 1.E-9;
|
||||
Standard_Real EpsH100 = 1.E-7;
|
||||
curve1->D1 (U1,P1,T1);
|
||||
gp_Vec2d N1(T1.Y(), - T1.X());
|
||||
|
||||
@@ -818,7 +831,7 @@ gp_Pnt2d Bisector_BisecCC::ValueByInt (const Standard_Real U,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
if (!YaSol) {
|
||||
//--------------------------------------------------------------------
|
||||
// Construction de la bisectrice point courbe et de la droite passant
|
||||
@@ -859,7 +872,7 @@ gp_Pnt2d Bisector_BisecCC::ValueByInt (const Standard_Real U,
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
if (YaSol) {
|
||||
Dist = DMin;
|
||||
@@ -1294,6 +1307,17 @@ static Standard_Boolean PointByInt(const Handle(Geom2d_Curve)& CA,
|
||||
// Point found => Test distance curvature + Angular test
|
||||
//---------------------------------------------------------------
|
||||
P2 = CB->Value(UOnB);
|
||||
if(P1.SquareDistance(PSol) < 1.e-32)
|
||||
{
|
||||
YaSol = Standard_False;
|
||||
return YaSol;
|
||||
}
|
||||
if(P2.SquareDistance(PSol) < 1.e-32)
|
||||
{
|
||||
YaSol = Standard_False;
|
||||
return YaSol;
|
||||
}
|
||||
|
||||
gp_Dir2d PP1Unit(P1.X() - PSol.X(),P1.Y() - PSol.Y());
|
||||
gp_Dir2d PP2Unit(P2.X() - PSol.X(),P2.Y() - PSol.Y());
|
||||
|
||||
@@ -1431,8 +1455,8 @@ void Bisector_BisecCC::Dump(const Standard_Integer ,
|
||||
Indent (Offset);
|
||||
cout <<"Bisector_BisecCC :"<<endl;
|
||||
Indent (Offset);
|
||||
// cout <<"Curve1 :"<<curve1<<endl;
|
||||
// cout <<"Curve2 :"<<curve2<<endl;
|
||||
// cout <<"Curve1 :"<<curve1<<endl;
|
||||
// cout <<"Curve2 :"<<curve2<<endl;
|
||||
cout <<"Sign1 :"<<sign1<<endl;
|
||||
cout <<"Sign2 :"<<sign2<<endl;
|
||||
|
||||
|
@@ -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.
|
||||
@@ -33,14 +33,14 @@
|
||||
#include <Precision.hxx>
|
||||
#include <math_BissecNewton.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
|
||||
#ifdef DRAW
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <DrawTrSurf_Curve2d.hxx>
|
||||
#include <Draw_Marker2D.hxx>
|
||||
#endif
|
||||
#ifdef DEB
|
||||
//#define DRAW
|
||||
#ifdef DRAW
|
||||
#include <DrawTrSurf.hxx>
|
||||
static char name[100];
|
||||
static Standard_Boolean Affich = Standard_False;
|
||||
static Standard_Integer nbint = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//===================================================================================
|
||||
@@ -287,21 +287,17 @@ void Bisector_Inter::SinglePerform(const Handle(Geom2d_Curve)& CBis1,
|
||||
|
||||
#ifdef DRAW
|
||||
if (Affich) {
|
||||
Handle(DrawTrSurf_Curve2d) dr;
|
||||
Draw_Color Couleur = Draw_bleu;
|
||||
|
||||
dr = new DrawTrSurf_Curve2d(Bis1,Couleur,100);
|
||||
dout << dr;
|
||||
dr = new DrawTrSurf_Curve2d(Bis2,Couleur,100);
|
||||
dout << dr;
|
||||
sprintf( name, "i1_%d", ++nbint);
|
||||
DrawTrSurf::Set(name, Bis1);
|
||||
sprintf( name, "i2_%d", nbint);
|
||||
DrawTrSurf::Set(name, Bis2);
|
||||
if (IsDone() && !IsEmpty()) {
|
||||
for (Standard_Integer k = 1; k <= NbPoints(); k++) {
|
||||
gp_Pnt2d P = Point(k).Value();
|
||||
Handle(Draw_Marker2D) drp = new Draw_Marker2D(P,Draw_Plus,Draw_vert);
|
||||
dout << drp;
|
||||
sprintf( name, "ip_%d_%d", nbint, k);
|
||||
DrawTrSurf::Set(name, P);
|
||||
}
|
||||
}
|
||||
dout.Flush();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -334,7 +330,7 @@ void Bisector_Inter::NeighbourPerform(const Handle(Bisector_BisecCC)& Bis1,
|
||||
// Change guiedline on Bis2.
|
||||
BisTemp = Bis2->ChangeGuide();
|
||||
Guide = Bis2->Curve(2);
|
||||
#ifdef DEB
|
||||
#ifdef OCCT_DEBUG
|
||||
gp_Pnt2d P2S = Bis2->ValueAndDist(D2.FirstParameter(),U1,UMax,Dist);
|
||||
gp_Pnt2d P2E = Bis2->ValueAndDist(D2.LastParameter() ,U1,UMin,Dist);
|
||||
#else
|
||||
|
@@ -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.
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#define Debug(expr) cout<<" MAT2d_Tool2d.cxx : expr :"<<expr<<endl;
|
||||
|
||||
//#define DRAW
|
||||
#ifdef DRAW
|
||||
#include <DBRep.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
@@ -68,12 +69,14 @@
|
||||
#include <Precision.hxx>
|
||||
|
||||
#ifdef DRAW
|
||||
static Handle(DrawTrSurf_Curve2d) draw;
|
||||
static Handle(DrawTrSurf_Curve2d) draw;
|
||||
static Standard_Integer AffichBis = Standard_False;
|
||||
#endif
|
||||
#ifdef DEB
|
||||
static void MAT2d_DrawCurve(const Handle(Geom2d_Curve)& aCurve,
|
||||
static void MAT2d_DrawCurve(const Handle(Geom2d_Curve)& aCurve,
|
||||
const Standard_Integer Indice);
|
||||
static Standard_Boolean Store = Standard_False;
|
||||
static Standard_Boolean Store = Standard_False;
|
||||
static Standard_Boolean AffichDist = Standard_False;
|
||||
#endif
|
||||
|
||||
//=====================================================================
|
||||
@@ -90,6 +93,10 @@ static Standard_Boolean AreNeighbours(const Standard_Integer IEdge1,
|
||||
const Standard_Integer NbEdge);
|
||||
|
||||
static void SetTrim(Bisector_Bisec& Bis , Handle(Geom2d_Curve)& Line1);
|
||||
static Standard_Boolean CheckEnds (const Handle(Geom2d_Geometry)& Elt ,
|
||||
const gp_Pnt2d& PCom ,
|
||||
const Standard_Real Distance,
|
||||
const Standard_Real Tol);
|
||||
|
||||
static Standard_Real MAT2d_TOLCONF = 1.e-7;
|
||||
|
||||
@@ -100,6 +107,7 @@ static Standard_Real MAT2d_TOLCONF = 1.e-7;
|
||||
MAT2d_Tool2d::MAT2d_Tool2d()
|
||||
{
|
||||
theDirection = 1.;
|
||||
//theJoinType = GeomAbs_Arc; //default
|
||||
theNumberOfBisectors = 0;
|
||||
theNumberOfVecs = 0;
|
||||
theNumberOfPnts = 0;
|
||||
@@ -132,6 +140,15 @@ void MAT2d_Tool2d::Sense(const MAT_Side aside)
|
||||
else theDirection = -1.;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : SetJoinType
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
//void MAT2d_Tool2d::SetJoinType(const GeomAbs_JoinType aJoinType)
|
||||
//{
|
||||
// theJoinType = aJoinType;
|
||||
//}
|
||||
|
||||
//=============================================================================
|
||||
//function : NumberOfItems
|
||||
//purpose :
|
||||
@@ -311,12 +328,12 @@ void MAT2d_Tool2d::CreateBisector(const Handle(MAT_Bisector)& abisector)
|
||||
cout<<" Item 1 : "<<endl;
|
||||
cout<<edge1number<<endl;
|
||||
cout<<endl;
|
||||
// elt1->Dump(1,1);
|
||||
// elt1->Dump(1,1);
|
||||
cout<<endl;
|
||||
cout<<" Item 2 : "<<endl;
|
||||
cout<<edge2number<<endl;
|
||||
cout<<endl;
|
||||
// elt2->Dump(1,1);
|
||||
// elt2->Dump(1,1);
|
||||
cout<<endl;
|
||||
}
|
||||
#endif
|
||||
@@ -406,8 +423,7 @@ void MAT2d_Tool2d::TrimBisec ( Bisector_Bisec& B1,
|
||||
|
||||
//gp_Vec2d Tan1,Tan2;
|
||||
gp_Pnt2d Ori; //PEdge;
|
||||
Standard_Integer IPrec,INext;
|
||||
IPrec = (IndexEdge == 1) ? theCircuit->NumberOfItems() : (IndexEdge - 1);
|
||||
Standard_Integer INext;
|
||||
INext = (IndexEdge == theCircuit->NumberOfItems()) ? 1 : (IndexEdge + 1);
|
||||
|
||||
Handle(Standard_Type) EdgeType = theCircuit->Value(IndexEdge)->DynamicType();
|
||||
@@ -503,7 +519,7 @@ Standard_Boolean MAT2d_Tool2d::TrimBisector
|
||||
Handle(Bisector_Curve) Bis = Handle(Bisector_Curve)::
|
||||
DownCast(Bisector->BasisCurve());
|
||||
|
||||
// Param = ParameterOnCurve(Bisector,theGeomPnts.Value(apoint));
|
||||
// Param = ParameterOnCurve(Bisector,theGeomPnts.Value(apoint));
|
||||
Param = Bis->Parameter(GeomPnt (apoint));
|
||||
|
||||
if (Bisector->BasisCurve()->IsPeriodic()) {
|
||||
@@ -535,7 +551,6 @@ Standard_Boolean MAT2d_Tool2d::Projection (const Standard_Integer IEdge ,
|
||||
Handle(Standard_Type) Type = Elt->DynamicType();
|
||||
Handle(Geom2d_TrimmedCurve) Curve;
|
||||
Standard_Integer INext;
|
||||
Standard_Real ParameterOnC;
|
||||
Standard_Real Eps = MAT2d_TOLCONF;//*10.;
|
||||
|
||||
if (Type == STANDARD_TYPE(Geom2d_CartesianPoint)) {
|
||||
@@ -569,9 +584,9 @@ Standard_Boolean MAT2d_Tool2d::Projection (const Standard_Integer IEdge ,
|
||||
GeomAbs_CurveType TypeC1 = C1.GetType();
|
||||
if (TypeC1 == GeomAbs_Circle) {
|
||||
Standard_Real R = C1.Circle().Radius();
|
||||
Standard_Real EpsCirc = Eps;
|
||||
Standard_Real EpsCirc = 100.*Eps;
|
||||
if ( R < 1.) EpsCirc = Eps/R;
|
||||
if (!((ParamMax - ParamMin + 2*EpsCirc) < 2*M_PI)) {
|
||||
if (((ParamMax - ParamMin + 2*EpsCirc) < 2*M_PI)) {
|
||||
ParamMax = ParamMax + EpsCirc; ParamMin = ParamMin - EpsCirc;
|
||||
}
|
||||
}
|
||||
@@ -583,13 +598,17 @@ Standard_Boolean MAT2d_Tool2d::Projection (const Standard_Integer IEdge ,
|
||||
//-----------------------------------------------------
|
||||
Extrema_ExtPC2d Extremas(PCom,C1,ParamMin,ParamMax);
|
||||
if (Extremas.IsDone()){
|
||||
if (Extremas.NbExt() == 0 ) return Standard_False; // Pas de solution!
|
||||
Distance = Precision::Infinite();
|
||||
if(Extremas.NbExt() < 1)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
for (Standard_Integer i = 1; i <= Extremas.NbExt(); i++) {
|
||||
if (Extremas.SquareDistance(i) < Distance * Distance) {
|
||||
ParameterOnC = Extremas.Point(i).Parameter();
|
||||
Distance = sqrt (Extremas.SquareDistance(i));
|
||||
if (Extremas.SquareDistance(i) < Distance) {
|
||||
Distance = Extremas.SquareDistance(i);
|
||||
}
|
||||
}
|
||||
Distance = Sqrt(Distance);
|
||||
}
|
||||
else {
|
||||
if (TypeC1 == GeomAbs_Circle) {
|
||||
@@ -611,6 +630,7 @@ Standard_Boolean MAT2d_Tool2d::IsSameDistance (
|
||||
Standard_Real& Distance) const
|
||||
{
|
||||
TColStd_Array1OfReal Dist(1,4);
|
||||
const Standard_Real eps = 1.e-7;
|
||||
Standard_Integer IEdge1,IEdge2,IEdge3,IEdge4;
|
||||
|
||||
IEdge1 = BisectorOne->FirstEdge() ->EdgeNumber();
|
||||
@@ -618,28 +638,83 @@ Standard_Boolean MAT2d_Tool2d::IsSameDistance (
|
||||
IEdge3 = BisectorTwo->FirstEdge() ->EdgeNumber();
|
||||
IEdge4 = BisectorTwo->SecondEdge()->EdgeNumber();
|
||||
|
||||
Projection(IEdge1,PCom,Dist(1));
|
||||
Projection(IEdge2,PCom,Dist(2));
|
||||
Standard_Boolean isDone1 = Projection(IEdge1,PCom,Dist(1));
|
||||
Standard_Boolean isDone2 = Projection(IEdge2,PCom,Dist(2));
|
||||
|
||||
if(isDone1)
|
||||
{
|
||||
if(!isDone2)
|
||||
{
|
||||
Handle(Geom2d_Geometry) Elt = theCircuit->Value(IEdge2);
|
||||
Standard_Real Tol = Max(Precision::Confusion(), eps*Dist(1));
|
||||
if(CheckEnds (Elt, PCom, Dist(1), Tol))
|
||||
{
|
||||
Dist(2) = Dist(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isDone2)
|
||||
{
|
||||
Handle(Geom2d_Geometry) Elt = theCircuit->Value(IEdge1);
|
||||
Standard_Real Tol = Max(Precision::Confusion(), eps*Dist(2));
|
||||
if(CheckEnds (Elt, PCom, Dist(2), Tol))
|
||||
{
|
||||
Dist(1) = Dist(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean isDone3 = Standard_True, isDone4 = Standard_True;
|
||||
if (IEdge3 == IEdge1) Dist(3) = Dist(1);
|
||||
else if (IEdge3 == IEdge2) Dist(3) = Dist(2);
|
||||
else Projection(IEdge3,PCom,Dist(3));
|
||||
else isDone3 = Projection(IEdge3,PCom,Dist(3));
|
||||
|
||||
if (IEdge4 == IEdge1) Dist(4) = Dist(1);
|
||||
else if (IEdge4 == IEdge2) Dist(4) = Dist(2);
|
||||
else Projection(IEdge4,PCom,Dist(4));
|
||||
else isDone4 = Projection(IEdge4,PCom,Dist(4));
|
||||
//
|
||||
if(isDone3)
|
||||
{
|
||||
if(!isDone4)
|
||||
{
|
||||
Handle(Geom2d_Geometry) Elt = theCircuit->Value(IEdge4);
|
||||
Standard_Real Tol = Max(Precision::Confusion(), eps*Dist(3));
|
||||
if(CheckEnds (Elt, PCom, Dist(3), Tol))
|
||||
{
|
||||
Dist(4) = Dist(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isDone4)
|
||||
{
|
||||
Handle(Geom2d_Geometry) Elt = theCircuit->Value(IEdge3);
|
||||
Standard_Real Tol = Max(Precision::Confusion(), eps*Dist(4));
|
||||
if(CheckEnds (Elt, PCom, Dist(4), Tol))
|
||||
{
|
||||
Dist(3) = Dist(4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEB
|
||||
Standard_Boolean Affich = Standard_False;
|
||||
if (Affich)
|
||||
|
||||
if (AffichDist)
|
||||
for (Standard_Integer j = 1; j <= 4;j++){
|
||||
cout <<"Distance number : "<<j<<" is :"<< Dist(j)<<endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
Standard_Real EpsDist = MAT2d_TOLCONF*100. ;
|
||||
Standard_Real EpsDist = MAT2d_TOLCONF*300. ;
|
||||
Distance = Dist(1);
|
||||
for (Standard_Integer i = 1; i <= 4; i++){
|
||||
//if (theJoinType == GeomAbs_Intersection &&
|
||||
// Precision::IsInfinite(Dist(i)))
|
||||
// continue;
|
||||
if (Abs(Dist(i) - Distance) > EpsDist) {
|
||||
Distance = Precision::Infinite();
|
||||
return Standard_False;
|
||||
@@ -715,13 +790,13 @@ Standard_Real MAT2d_Tool2d::IntersectBisector (
|
||||
cout<<"INTERSECTION de "<<BisectorOne->BisectorNumber()<<
|
||||
" et de "<<BisectorTwo->BisectorNumber()<<endl;
|
||||
cout<<" Bisector 1 : "<<endl;
|
||||
// (Bisector1->BasisCurve())->Dump(-1,1);
|
||||
// (Bisector1->BasisCurve())->Dump(-1,1);
|
||||
cout<<endl;
|
||||
Debug(Domain1.FirstParameter());
|
||||
Debug(Domain1.LastParameter());
|
||||
cout<<"-----------------"<<endl;
|
||||
cout<<" Bisector 2 : "<<endl;
|
||||
// (Bisector2->BasisCurve())->Dump(-1,1);
|
||||
// (Bisector2->BasisCurve())->Dump(-1,1);
|
||||
cout<<endl;
|
||||
Debug(Domain2.FirstParameter());
|
||||
Debug(Domain2.LastParameter());
|
||||
@@ -729,23 +804,23 @@ Standard_Real MAT2d_Tool2d::IntersectBisector (
|
||||
}
|
||||
#endif
|
||||
|
||||
// -------------------------
|
||||
// Calcul de l intersection.
|
||||
// -------------------------
|
||||
// -------------------------
|
||||
// Calcul de l intersection.
|
||||
// -------------------------
|
||||
|
||||
Bisector_Inter Intersect;
|
||||
Intersect.Perform (GeomBis(BisectorOne->BisectorNumber()),Domain1,
|
||||
GeomBis(BisectorTwo->BisectorNumber()),Domain2,
|
||||
Tolerance,Tolerance,Standard_True);
|
||||
|
||||
// Geom2dInt_GInter Intersect;
|
||||
// Intersect.Perform(Bisector1,Domain1,Bisector2,Domain2,Tolerance,Tolerance);
|
||||
// Geom2dInt_GInter Intersect;
|
||||
// Intersect.Perform(Bisector1,Domain1,Bisector2,Domain2,Tolerance,Tolerance);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Exploitation du resultat de l intersection et selection du point solution
|
||||
// equidistant des deux edges et le plus proche en parametre de l origine
|
||||
// des bissectrices.
|
||||
// -------------------------------------------------------------------------
|
||||
// -------------------------------------------------------------------------
|
||||
// Exploitation du resultat de l intersection et selection du point solution
|
||||
// equidistant des deux edges et le plus proche en parametre de l origine
|
||||
// des bissectrices.
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
if(!Intersect.IsDone()) return Precision::Infinite();
|
||||
|
||||
@@ -879,9 +954,9 @@ Standard_Real MAT2d_Tool2d::IntersectBisector (
|
||||
}
|
||||
|
||||
if (theCircuit->ConnexionOn(IndexEdge4)){
|
||||
// --------------------------------------
|
||||
// BisectorTwo est issue d une connexion.
|
||||
// --------------------------------------
|
||||
//--------------------------------------
|
||||
//BisectorTwo est issue d une connexion.
|
||||
//--------------------------------------
|
||||
if (AreNeighbours(IndexEdge1,IndexEdge2,NumberOfItems()) &&
|
||||
AreNeighbours(IndexEdge3,IndexEdge4,NumberOfItems()) &&
|
||||
IndexEdge2 == IndexEdge3 ){
|
||||
@@ -890,11 +965,40 @@ Standard_Real MAT2d_Tool2d::IntersectBisector (
|
||||
}
|
||||
}
|
||||
|
||||
if (ExtremiteControle) {
|
||||
if(Bisector1->StartPoint().Distance(PointSolution) < Tolerance ||
|
||||
Bisector2->StartPoint().Distance(PointSolution) < Tolerance )
|
||||
//if (ExtremiteControle) {
|
||||
// if(Bisector1->StartPoint().Distance(PointSolution) < Tolerance ||
|
||||
// Bisector2->StartPoint().Distance(PointSolution) < Tolerance )
|
||||
// return Precision::Infinite();
|
||||
//}
|
||||
|
||||
if(ExtremiteControle)
|
||||
{
|
||||
if(Bisector1->StartPoint().Distance(PointSolution) < Tolerance)
|
||||
{
|
||||
#ifdef DRAW
|
||||
if(AffichBis)
|
||||
{
|
||||
DrawTrSurf::Set("Bis1", Bisector1);
|
||||
DrawTrSurf::Set("Bis2", Bisector2);
|
||||
}
|
||||
#endif
|
||||
return Precision::Infinite();
|
||||
}
|
||||
if(Bisector2->StartPoint().Distance(PointSolution) < Tolerance)
|
||||
{
|
||||
|
||||
#ifdef DRAW
|
||||
if(AffichBis)
|
||||
{
|
||||
DrawTrSurf::Set("Bis1", Bisector1);
|
||||
DrawTrSurf::Set("Bis2", Bisector2);
|
||||
}
|
||||
#endif
|
||||
return Precision::Infinite();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(BisectorOne->SecondParameter() < Precision::Infinite() &&
|
||||
BisectorOne->SecondParameter() < Param1*(1. - Tolerance ))
|
||||
@@ -1067,11 +1171,11 @@ void MAT2d_Tool2d::BisecFusion(const Standard_Integer I1,
|
||||
UF1 = UF1 - DU;
|
||||
|
||||
Handle(Bisector_BisecAna) BAna = Handle(Bisector_BisecAna)::DownCast(Bisector1->BasisCurve());
|
||||
//---------------------------- uncomment if new method Bisector_BisecAna::SetTrim(f,l) is not used
|
||||
// Handle(Geom2d_Curve) C2d = BAna->Geom2dCurve();
|
||||
// Handle(Geom2d_TrimmedCurve) trimC2d = new Geom2d_TrimmedCurve(C2d, UF1, UL1);
|
||||
// BAna->Init(trimC2d);
|
||||
//--------------------------- end
|
||||
//---------------------------- uncomment if new method Bisector_BisecAna::SetTrim(f,l) is not used
|
||||
// Handle(Geom2d_Curve) C2d = BAna->Geom2dCurve();
|
||||
// Handle(Geom2d_TrimmedCurve) trimC2d = new Geom2d_TrimmedCurve(C2d, UF1, UL1);
|
||||
// BAna->Init(trimC2d);
|
||||
//--------------------------- end
|
||||
BAna->SetTrim(UF1,UL1); // put comment if SetTrim(f,l) is not used
|
||||
|
||||
Bisector1->SetTrim(UF1,UL1);
|
||||
@@ -1198,6 +1302,36 @@ IntRes2d_Domain Domain(const Handle(Geom2d_TrimmedCurve)& Bisector1,
|
||||
return Domain1;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Projection
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
Standard_Boolean CheckEnds (const Handle(Geom2d_Geometry)& Elt ,
|
||||
const gp_Pnt2d& PCom ,
|
||||
const Standard_Real Distance,
|
||||
const Standard_Real Tol)
|
||||
|
||||
{
|
||||
Handle(Standard_Type) Type = Elt->DynamicType();
|
||||
Handle(Geom2d_TrimmedCurve) Curve;
|
||||
|
||||
if (Type == STANDARD_TYPE(Geom2d_CartesianPoint)) {
|
||||
return Standard_False;
|
||||
}
|
||||
else {
|
||||
Curve = Handle(Geom2d_TrimmedCurve)::DownCast(Elt);
|
||||
gp_Pnt2d aPf = Curve->StartPoint();
|
||||
gp_Pnt2d aPl = Curve->EndPoint();
|
||||
Standard_Real df = PCom.Distance(aPf);
|
||||
Standard_Real dl = PCom.Distance(aPl);
|
||||
if(Abs(df - Distance) <= Tol)
|
||||
return Standard_True;
|
||||
if(Abs(dl - Distance) <= Tol)
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
#ifdef DEB
|
||||
//==========================================================================
|
||||
//function : MAT2d_DrawCurve
|
||||
@@ -1262,6 +1396,7 @@ void MAT2d_DrawCurve(const Handle(Geom2d_Curve)& aCurve,
|
||||
}
|
||||
|
||||
#ifdef DRAW
|
||||
Standard_Integer Indice = 1;
|
||||
if (Indice == 1) Couleur = Draw_jaune;
|
||||
else if (Indice == 2) Couleur = Draw_bleu;
|
||||
else if (Indice == 3) Couleur = Draw_rouge;
|
||||
@@ -1274,8 +1409,8 @@ void MAT2d_DrawCurve(const Handle(Geom2d_Curve)& aCurve,
|
||||
else
|
||||
dr = new DrawTrSurf_Curve2d(CurveDraw,Couleur,500);
|
||||
|
||||
dout << dr;
|
||||
dout.Flush();
|
||||
//dout << dr;
|
||||
//dout.Flush();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,3 @@
|
||||
puts "TODO DEBUG_OCC24121 Debian60-64 Windows: \\*\\* Exception \\*\\*.*"
|
||||
puts "TODO DEBUG_OCC24121 Debian60-64 Windows: An exception was caught"
|
||||
puts "TODO DEBUG_OCC24121 Debian60-64 Windows: TEST INCOMPLETE"
|
||||
|
||||
puts "============"
|
||||
puts "OCC22831"
|
||||
puts "============"
|
||||
|
@@ -11,7 +11,7 @@ CHECKSHAPE : Wires = 12 ( 18 ) Faces = 16 ( 16 ) Shells = 0 ( 0 )
|
||||
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 5163 ( 5163 ) Summary = 68418 ( 68418 )
|
||||
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 5163 ( 5163 ) FreeWire = 10 ( 10 ) FreeEdge = 283 ( 283 ) SharedEdge = 29071 ( 29075 )
|
||||
TOLERANCE : MaxTol = 0.9874083984 ( 0.9875071265 ) AvgTol = 0.0111430941 ( 0.01115568387 )
|
||||
LABELS : N0Labels = 5392 ( 5458 ) N1Labels = 18 ( 4437 ) N2Labels = 0 ( 0 ) TotalLabels = 5410 ( 9895 ) NameLabels = 5392 ( 5458 ) ColorLabels = 5391 ( 9829 ) LayerLabels = 5391 ( 9829 )
|
||||
LABELS : N0Labels = 5392 ( 5458 ) N1Labels = 18 ( 4443 ) N2Labels = 0 ( 0 ) TotalLabels = 5410 ( 9901 ) NameLabels = 5392 ( 5458 ) ColorLabels = 5391 ( 9835 ) LayerLabels = 5391 ( 9835 )
|
||||
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
|
||||
NCOLORS : NColors = 4 ( 4 )
|
||||
COLORS : Colors = BLACK BLUE1 CYAN1 GREEN ( BLACK BLUE1 CYAN1 GREEN )
|
||||
|
@@ -14,7 +14,7 @@ CHECKSHAPE : Wires = 12 ( 17 ) Faces = 12 ( 11 ) Shells = 0 ( 0 )
|
||||
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 4729 ( 4729 ) Summary = 63154 ( 63144 )
|
||||
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 4729 ( 4729 ) FreeWire = 18 ( 18 ) FreeEdge = 452 ( 452 ) SharedEdge = 26794 ( 26793 )
|
||||
TOLERANCE : MaxTol = 0.9804479161 ( 0.9805459497 ) AvgTol = 0.01153089029 ( 0.01154870945 )
|
||||
LABELS : N0Labels = 5089 ( 5165 ) N1Labels = 26 ( 3844 ) N2Labels = 0 ( 0 ) TotalLabels = 5115 ( 9009 ) NameLabels = 5089 ( 5165 ) ColorLabels = 5086 ( 8933 ) LayerLabels = 5086 ( 8933 )
|
||||
LABELS : N0Labels = 5089 ( 5165 ) N1Labels = 26 ( 3846 ) N2Labels = 0 ( 0 ) TotalLabels = 5115 ( 9011 ) NameLabels = 5089 ( 5165 ) ColorLabels = 5086 ( 8935 ) LayerLabels = 5086 ( 8935 )
|
||||
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
|
||||
NCOLORS : NColors = 3 ( 3 )
|
||||
COLORS : Colors = BLUE1 CYAN1 GREEN ( BLUE1 CYAN1 GREEN )
|
||||
|
@@ -14,8 +14,8 @@ TPSTAT : Faulties = 0 ( 0 ) Warnings = 6 ( 523 ) Summary = 6 ( 523 )
|
||||
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
|
||||
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1177 ( 1177 ) Summary = 18232 ( 18230 )
|
||||
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1177 ( 1177 ) FreeWire = 5 ( 5 ) FreeEdge = 714 ( 714 ) SharedEdge = 7614 ( 7614 )
|
||||
TOLERANCE : MaxTol = 0.9436610236 ( 0.8261873283 ) AvgTol = 0.01104814106 ( 0.01076280021 )
|
||||
LABELS : N0Labels = 1884 ( 1885 ) N1Labels = 0 ( 1020 ) N2Labels = 0 ( 0 ) TotalLabels = 1884 ( 2905 ) NameLabels = 1884 ( 1885 ) ColorLabels = 1873 ( 2904 ) LayerLabels = 1873 ( 2904 )
|
||||
TOLERANCE : MaxTol = 0.9436610236 ( 0.8261873283 ) AvgTol = 0.01104814109 ( 0.0107628002 )
|
||||
LABELS : N0Labels = 1884 ( 1885 ) N1Labels = 0 ( 1019 ) N2Labels = 0 ( 0 ) TotalLabels = 1884 ( 2904 ) NameLabels = 1884 ( 1885 ) ColorLabels = 1873 ( 2903 ) LayerLabels = 1873 ( 2903 )
|
||||
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
|
||||
NCOLORS : NColors = 7 ( 7 )
|
||||
COLORS : Colors = BLACK BLUE1 CYAN1 GREEN RED WHITE YELLOW ( BLACK BLUE1 CYAN1 GREEN RED WHITE YELLOW )
|
||||
|
@@ -1,6 +1,5 @@
|
||||
# !!!! This file is generated automatically, do not edit manually! See end script
|
||||
puts "TODO CR23096 ALL: TPSTAT : Faulty"
|
||||
puts "TODO CR23096 ALL: CHECKSHAPE : Faulty"
|
||||
puts "TODO CR23096 ALL: LABELS : Faulty"
|
||||
puts "TODO CR23096 Mandriva2010: Error : 2 differences with reference data found :"
|
||||
puts "TODO CR23096 Mandriva2010: STATSHAPE : Faulty"
|
||||
|
@@ -1,3 +1,3 @@
|
||||
set TheFileName shading_082.brep
|
||||
set bug_cross "OCC22687"
|
||||
set nbcross(All) 16
|
||||
set nbcross(All) 0
|
||||
|
@@ -1,16 +1,6 @@
|
||||
set os "ALL"
|
||||
if {[array get env os_type] != ""} {
|
||||
set os $env(os_type)
|
||||
}
|
||||
|
||||
if {
|
||||
[string compare $os "Debian40"] == 0
|
||||
|| [string compare $os "Mandriva2008"] == 0
|
||||
} {
|
||||
puts "TODO OCC23068 $os: Faulty shapes in variables faulty_1 to faulty_4"
|
||||
puts "TODO OCC23068 $os: Error : The length of result shape is"
|
||||
puts "TODO OCC23068 $os: Error : Result shape is WRONG"
|
||||
}
|
||||
puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_4"
|
||||
puts "TODO OCC23068 ALL: Error : The length of the resulting shape is"
|
||||
puts "TODO OCC23068 ALL: Error : The resulting shape is WRONG because it must contain"
|
||||
|
||||
restore [locate_data_file offset_wire_038.brep] s
|
||||
|
||||
|
Reference in New Issue
Block a user