mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0022720: Wrong intersection point for the case of intersection between sphere and plane
This commit is contained in:
parent
aa396061a3
commit
c5c3447332
@ -1261,12 +1261,12 @@ static Standard_Integer surfpoints (Draw_Interpretor& /*di*/, Standard_Integer /
|
|||||||
//function : intersect
|
//function : intersect
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||||
{
|
{
|
||||||
|
if (n < 4) {
|
||||||
if (n < 4) return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
//
|
||||||
Handle(Geom_Curve) GC1;
|
Handle(Geom_Curve) GC1;
|
||||||
Handle(Geom_Surface) GS1 = DrawTrSurf::GetSurface(a[2]);
|
Handle(Geom_Surface) GS1 = DrawTrSurf::GetSurface(a[2]);
|
||||||
if (GS1.IsNull()) {
|
if (GS1.IsNull()) {
|
||||||
@ -1274,61 +1274,41 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n,
|
|||||||
if (GC1.IsNull())
|
if (GC1.IsNull())
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
Handle(Geom_Surface) GS2 = DrawTrSurf::GetSurface(a[3]);
|
Handle(Geom_Surface) GS2 = DrawTrSurf::GetSurface(a[3]);
|
||||||
if (GS2.IsNull()) return 1;
|
if (GS2.IsNull()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
//
|
||||||
Standard_Real tol = Precision::Confusion();
|
Standard_Real tol = Precision::Confusion();
|
||||||
if (n == 5 || n == 9 || n == 13 || n == 17) tol = atof(a[n-1]);
|
if (n == 5 || n == 9 || n == 13 || n == 17) tol = atof(a[n-1]);
|
||||||
|
//
|
||||||
Handle(Geom_Curve) Result;
|
Handle(Geom_Curve) Result;
|
||||||
gp_Pnt Point;
|
gp_Pnt Point;
|
||||||
|
//
|
||||||
if (GC1.IsNull()) {
|
if (GC1.IsNull()) {
|
||||||
|
GeomInt_IntSS Inters;
|
||||||
|
//
|
||||||
// Surface Surface
|
// Surface Surface
|
||||||
|
|
||||||
if (n <= 5) {
|
if (n <= 5) {
|
||||||
// General case
|
// General case
|
||||||
GeomAPI_IntSS Inters(GS1,GS2,tol);
|
Inters.Perform(GS1,GS2,tol,Standard_True);
|
||||||
|
|
||||||
if (!Inters.IsDone()) return 1;
|
|
||||||
|
|
||||||
Standard_Integer nblines = Inters.NbLines();
|
|
||||||
if (nblines >= 2) {
|
|
||||||
char newname[1024];
|
|
||||||
for (Standard_Integer i=1; i<=nblines; i++) {
|
|
||||||
sprintf(newname,"%s_%d",a[1],i);
|
|
||||||
Result = Inters.Line(i);
|
|
||||||
const char* temp = newname; // pour portage WNT
|
|
||||||
DrawTrSurf::Set(temp,Result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (nblines == 1) {
|
|
||||||
Result = Inters.Line(1);
|
|
||||||
DrawTrSurf::Set(a[1],Result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 16 || n == 17) {
|
else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 16 || n == 17) {
|
||||||
GeomInt_IntSS Inters;
|
|
||||||
Standard_Boolean useStart = Standard_True, useBnd = Standard_True;
|
Standard_Boolean useStart = Standard_True, useBnd = Standard_True;
|
||||||
Standard_Integer ista1=0,ista2=0,ibnd1=0,ibnd2=0;
|
Standard_Integer ista1=0,ista2=0,ibnd1=0,ibnd2=0;
|
||||||
Standard_Real UVsta[4];
|
Standard_Real UVsta[4];
|
||||||
Handle(GeomAdaptor_HSurface) AS1,AS2;
|
Handle(GeomAdaptor_HSurface) AS1,AS2;
|
||||||
|
//
|
||||||
if (n <= 9) {
|
if (n <= 9) { // user starting point
|
||||||
// user starting point
|
|
||||||
useBnd = Standard_False;
|
useBnd = Standard_False;
|
||||||
ista1 = 4; ista2 = 7;
|
ista1 = 4; ista2 = 7;
|
||||||
}
|
}
|
||||||
else if (n <= 13) {
|
else if (n <= 13) { // user bounding
|
||||||
// user bounding
|
|
||||||
useStart = Standard_False;
|
useStart = Standard_False;
|
||||||
ibnd1 = 4; ibnd2 = 11;
|
ibnd1 = 4; ibnd2 = 11;
|
||||||
}
|
}
|
||||||
else {
|
else { // both user starting point and bounding
|
||||||
// both user starting point and bounding
|
|
||||||
ista1 = 4; ista2 = 7;
|
ista1 = 4; ista2 = 7;
|
||||||
ibnd1 = 8; ibnd2 = 15;
|
ibnd1 = 8; ibnd2 = 15;
|
||||||
}
|
}
|
||||||
@ -1342,56 +1322,56 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n,
|
|||||||
AS1 = new GeomAdaptor_HSurface(GS1,UVbnd[0],UVbnd[1],UVbnd[2],UVbnd[3]);
|
AS1 = new GeomAdaptor_HSurface(GS1,UVbnd[0],UVbnd[1],UVbnd[2],UVbnd[3]);
|
||||||
AS2 = new GeomAdaptor_HSurface(GS2,UVbnd[4],UVbnd[5],UVbnd[6],UVbnd[7]);
|
AS2 = new GeomAdaptor_HSurface(GS2,UVbnd[4],UVbnd[5],UVbnd[6],UVbnd[7]);
|
||||||
}
|
}
|
||||||
|
//
|
||||||
if (useStart && !useBnd)
|
if (useStart && !useBnd) {
|
||||||
Inters.Perform(GS1,GS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]);
|
Inters.Perform(GS1,GS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]);
|
||||||
else if (!useStart && useBnd)
|
}
|
||||||
|
else if (!useStart && useBnd) {
|
||||||
Inters.Perform(AS1,AS2,tol);
|
Inters.Perform(AS1,AS2,tol);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
Inters.Perform(AS1,AS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]);
|
Inters.Perform(AS1,AS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]);
|
||||||
|
|
||||||
if (!Inters.IsDone()) return 1;
|
|
||||||
|
|
||||||
Standard_Integer nblines = Inters.NbLines();
|
|
||||||
if (nblines >= 2) {
|
|
||||||
char newname[1024];
|
|
||||||
for (Standard_Integer i=1; i<=nblines; i++) {
|
|
||||||
sprintf(newname,"%s_%d",a[1],i);
|
|
||||||
Result = Inters.Line(i);
|
|
||||||
const char* temp = newname;
|
|
||||||
DrawTrSurf::Set(temp,Result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (nblines == 1) {
|
}//else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 16 || n == 17) {
|
||||||
Result = Inters.Line(1);
|
|
||||||
DrawTrSurf::Set(a[1],Result);
|
|
||||||
}
|
|
||||||
|
|
||||||
nblines = Inters.NbBoundaries();
|
|
||||||
if (nblines > 0) {
|
|
||||||
di<<"there are "<<nblines<<" boundary solutions"<<"\n";
|
|
||||||
char newname[1024];
|
|
||||||
for (Standard_Integer i=1; i<=nblines; i++) {
|
|
||||||
if (nblines > 1) sprintf(newname,"%s_b_%d",a[1],i);
|
|
||||||
else sprintf(newname,"%s_b",a[1]);
|
|
||||||
Result = Inters.Boundary(i);
|
|
||||||
const char* temp = newname;
|
|
||||||
DrawTrSurf::Set(temp,Result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
else {
|
||||||
di<<"incorrect number of arguments"<<"\n";
|
di<<"incorrect number of arguments"<<"\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
//
|
||||||
|
if (!Inters.IsDone()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
char buf[1024];
|
||||||
|
Standard_Integer i, aNbLines, aNbPoints;
|
||||||
|
//
|
||||||
|
aNbLines = Inters.NbLines();
|
||||||
|
if (aNbLines >= 2) {
|
||||||
|
for (i=1; i<=aNbLines; ++i) {
|
||||||
|
sprintf(buf, "%s_%d",a[1],i);
|
||||||
|
Result = Inters.Line(i);
|
||||||
|
const char* temp = buf;
|
||||||
|
DrawTrSurf::Set(temp,Result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (aNbLines == 1) {
|
||||||
|
Result = Inters.Line(1);
|
||||||
|
DrawTrSurf::Set(a[1],Result);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aNbPoints=Inters.NbPoints();
|
||||||
|
for (i=1; i<=aNbPoints; ++i) {
|
||||||
|
Point=Inters.Point(i);
|
||||||
|
sprintf(buf,"%s_p_%d",a[1],i);
|
||||||
|
const char* temp =buf;
|
||||||
|
DrawTrSurf::Set(temp, Point);
|
||||||
|
}
|
||||||
|
}// if (GC1.IsNull()) {
|
||||||
|
//
|
||||||
else {
|
else {
|
||||||
|
|
||||||
// Curve Surface
|
// Curve Surface
|
||||||
GeomAPI_IntCS Inters(GC1,GS2);
|
GeomAPI_IntCS Inters(GC1,GS2);
|
||||||
|
//
|
||||||
if (!Inters.IsDone()) return 1;
|
if (!Inters.IsDone()) return 1;
|
||||||
|
|
||||||
Standard_Integer nblines = Inters.NbSegments();
|
Standard_Integer nblines = Inters.NbSegments();
|
||||||
@ -1431,8 +1411,6 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n,
|
|||||||
//function : CurveCommands
|
//function : CurveCommands
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
|
|
||||||
void GeometryTest::CurveCommands(Draw_Interpretor& theCommands)
|
void GeometryTest::CurveCommands(Draw_Interpretor& theCommands)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -3,11 +3,18 @@
|
|||||||
// Author: Jacques GOUSSARD
|
// Author: Jacques GOUSSARD
|
||||||
// Copyright: OPEN CASCADE 1992
|
// Copyright: OPEN CASCADE 1992
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : IntPatch_ImpImpIntersection
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
IntPatch_ImpImpIntersection::IntPatch_ImpImpIntersection ():
|
IntPatch_ImpImpIntersection::IntPatch_ImpImpIntersection ():
|
||||||
done(Standard_False)
|
done(Standard_False)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------
|
//=======================================================================
|
||||||
|
//function : IntPatch_ImpImpIntersection
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
IntPatch_ImpImpIntersection::IntPatch_ImpImpIntersection
|
IntPatch_ImpImpIntersection::IntPatch_ImpImpIntersection
|
||||||
(const Handle(Adaptor3d_HSurface)& S1,
|
(const Handle(Adaptor3d_HSurface)& S1,
|
||||||
const Handle(Adaptor3d_TopolTool)& D1,
|
const Handle(Adaptor3d_TopolTool)& D1,
|
||||||
@ -18,7 +25,10 @@ IntPatch_ImpImpIntersection::IntPatch_ImpImpIntersection
|
|||||||
{
|
{
|
||||||
Perform(S1,D1,S2,D2,TolArc,TolTang);
|
Perform(S1,D1,S2,D2,TolArc,TolTang);
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------
|
//=======================================================================
|
||||||
|
//function : Perform
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
||||||
const Handle(Adaptor3d_TopolTool)& D1,
|
const Handle(Adaptor3d_TopolTool)& D1,
|
||||||
const Handle(Adaptor3d_HSurface)& S2,
|
const Handle(Adaptor3d_HSurface)& S2,
|
||||||
@ -39,25 +49,21 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
|||||||
Standard_Boolean multpoint = Standard_False;
|
Standard_Boolean multpoint = Standard_False;
|
||||||
|
|
||||||
Standard_Boolean nosolonS1 = Standard_False;
|
Standard_Boolean nosolonS1 = Standard_False;
|
||||||
// indique s il y a des points sur restriction du carreau 1
|
// indique s il y a des points sur restriction du carreau 1
|
||||||
Standard_Boolean nosolonS2 = Standard_False;
|
Standard_Boolean nosolonS2 = Standard_False;
|
||||||
// indique s il y a des points sur restriction du carreau 2
|
// indique s il y a des points sur restriction du carreau 2
|
||||||
|
|
||||||
Standard_Integer i, nbpt, nbseg;
|
Standard_Integer i, nbpt, nbseg;
|
||||||
|
|
||||||
IntPatch_SequenceOfSegmentOfTheSOnBounds edg1,edg2;
|
IntPatch_SequenceOfSegmentOfTheSOnBounds edg1,edg2;
|
||||||
IntPatch_SequenceOfPathPointOfTheSOnBounds pnt1,pnt2;
|
IntPatch_SequenceOfPathPointOfTheSOnBounds pnt1,pnt2;
|
||||||
|
//
|
||||||
// On commence par intersecter les supports des surfaces
|
// On commence par intersecter les supports des surfaces
|
||||||
|
|
||||||
IntSurf_Quadric quad1;
|
IntSurf_Quadric quad1;
|
||||||
IntSurf_Quadric quad2;
|
IntSurf_Quadric quad2;
|
||||||
IntPatch_ArcFunction AFunc;
|
IntPatch_ArcFunction AFunc;
|
||||||
Standard_Real Tolang = 1.e-8;
|
Standard_Real Tolang = 1.e-8;
|
||||||
GeomAbs_SurfaceType typs1 = S1->GetType();
|
GeomAbs_SurfaceType typs1 = S1->GetType();
|
||||||
GeomAbs_SurfaceType typs2 = S2->GetType();
|
GeomAbs_SurfaceType typs2 = S2->GetType();
|
||||||
|
//
|
||||||
|
|
||||||
switch (typs1) {
|
switch (typs1) {
|
||||||
|
|
||||||
case GeomAbs_Plane :
|
case GeomAbs_Plane :
|
||||||
@ -338,22 +344,17 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
|||||||
Standard_ConstructionError::Raise();
|
Standard_ConstructionError::Raise();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} //switch (typs1) {
|
||||||
|
//
|
||||||
|
|
||||||
if (!SameSurf) {
|
if (!SameSurf) {
|
||||||
|
|
||||||
AFunc.SetQuadric(quad2);
|
AFunc.SetQuadric(quad2);
|
||||||
AFunc.Set(S1);
|
AFunc.Set(S1);
|
||||||
|
|
||||||
solrst.Perform(AFunc, D1, TolArc, TolTang);
|
solrst.Perform(AFunc, D1, TolArc, TolTang);
|
||||||
|
|
||||||
|
|
||||||
if (!solrst.IsDone()) {
|
if (!solrst.IsDone()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (solrst.AllArcSolution() && typs1 == typs2) {
|
if (solrst.AllArcSolution() && typs1 == typs2) {
|
||||||
all1 = Standard_True;
|
all1 = Standard_True;
|
||||||
}
|
}
|
||||||
@ -370,19 +371,16 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
|||||||
if (nosolonS1 && all1) { // cas de face sans restrictions
|
if (nosolonS1 && all1) { // cas de face sans restrictions
|
||||||
all1 = Standard_False;
|
all1 = Standard_False;
|
||||||
}
|
}
|
||||||
|
}//if (!SameSurf) {
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
nosolonS1 = Standard_True;
|
nosolonS1 = Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SameSurf) {
|
if (!SameSurf) {
|
||||||
|
|
||||||
AFunc.SetQuadric(quad1);
|
AFunc.SetQuadric(quad1);
|
||||||
AFunc.Set(S2);
|
AFunc.Set(S2);
|
||||||
|
|
||||||
solrst.Perform(AFunc, D2, TolArc, TolTang);
|
solrst.Perform(AFunc, D2, TolArc, TolTang);
|
||||||
|
|
||||||
if (!solrst.IsDone()) {
|
if (!solrst.IsDone()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -404,16 +402,13 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
|||||||
if (nosolonS2 && all2) { // cas de face sans restrictions
|
if (nosolonS2 && all2) { // cas de face sans restrictions
|
||||||
all2 = Standard_False;
|
all2 = Standard_False;
|
||||||
}
|
}
|
||||||
|
}// if (!SameSurf) {
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
nosolonS2 = Standard_True;
|
nosolonS2 = Standard_True;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
if (SameSurf || (all1 && all2)) {
|
if (SameSurf || (all1 && all2)) {
|
||||||
|
|
||||||
// faces "paralleles" parfaites
|
// faces "paralleles" parfaites
|
||||||
|
|
||||||
empt = Standard_False;
|
empt = Standard_False;
|
||||||
tgte = Standard_True;
|
tgte = Standard_True;
|
||||||
slin.Clear();
|
slin.Clear();
|
||||||
@ -422,46 +417,34 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
|||||||
gp_Pnt Ptreference;
|
gp_Pnt Ptreference;
|
||||||
|
|
||||||
switch (typs1) {
|
switch (typs1) {
|
||||||
case GeomAbs_Plane:
|
case GeomAbs_Plane: {
|
||||||
{
|
Ptreference = (S1->Plane()).Location();
|
||||||
Ptreference = (S1->Plane()).Location();
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case GeomAbs_Cylinder:
|
case GeomAbs_Cylinder: {
|
||||||
{
|
Ptreference = ElSLib::Value(0.,0.,S1->Cylinder());
|
||||||
Ptreference = ElSLib::Value(0.,0.,S1->Cylinder());
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case GeomAbs_Sphere:
|
case GeomAbs_Sphere: {
|
||||||
{
|
Ptreference = ElSLib::Value(PI/4.,PI/4.,S1->Sphere());
|
||||||
Ptreference = ElSLib::Value(PI/4.,PI/4.,S1->Sphere());
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case GeomAbs_Cone:
|
case GeomAbs_Cone: {
|
||||||
{
|
Ptreference = ElSLib::Value(0.,10.,S1->Cone());
|
||||||
Ptreference = ElSLib::Value(0.,10.,S1->Cone());
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifndef DEB
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
//
|
||||||
oppo = quad1.Normale(Ptreference).Dot(quad2.Normale(Ptreference)) < 0.0;
|
oppo = quad1.Normale(Ptreference).Dot(quad2.Normale(Ptreference)) < 0.0;
|
||||||
|
|
||||||
done = Standard_True;
|
done = Standard_True;
|
||||||
return;
|
return;
|
||||||
}
|
}// if (SameSurf || (all1 && all2)) {
|
||||||
|
|
||||||
if (!nosolonS1 || !nosolonS2) {
|
if (!nosolonS1 || !nosolonS2) {
|
||||||
|
|
||||||
|
|
||||||
empt = Standard_False;
|
empt = Standard_False;
|
||||||
|
|
||||||
// C est la qu il faut commencer a bosser...
|
// C est la qu il faut commencer a bosser...
|
||||||
|
|
||||||
|
|
||||||
PutPointsOnLine(S1,S2,pnt1, slin, Standard_True, D1, quad1,quad2,
|
PutPointsOnLine(S1,S2,pnt1, slin, Standard_True, D1, quad1,quad2,
|
||||||
multpoint,TolArc);
|
multpoint,TolArc);
|
||||||
|
|
||||||
@ -477,19 +460,52 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (edg1.Length() !=0 || edg2.Length() !=0) {
|
if (edg1.Length() !=0 || edg2.Length() !=0) {
|
||||||
// ProcessRLine(slin,S1,S2,TolArc);
|
// ProcessRLine(slin,S1,S2,TolArc);
|
||||||
ProcessRLine(slin,quad1,quad2,TolArc);
|
ProcessRLine(slin,quad1,quad2,TolArc);
|
||||||
}
|
}
|
||||||
|
}//if (!nosolonS1 || !nosolonS2) {
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
empt = ((slin.Length()==0) && (spnt.Length()==0));
|
empt = ((slin.Length()==0) && (spnt.Length()==0));
|
||||||
}
|
}
|
||||||
|
//
|
||||||
Standard_Integer nblin = slin.Length();
|
Standard_Integer nblin, aNbPnt;
|
||||||
|
//
|
||||||
|
//modified by NIZNHY-PKV Tue Sep 06 10:03:35 2011f
|
||||||
|
aNbPnt=spnt.Length();
|
||||||
|
if (aNbPnt) {
|
||||||
|
IntPatch_SequenceOfPoint aSIP;
|
||||||
|
//
|
||||||
|
for(i=1; i<=aNbPnt; ++i) {
|
||||||
|
Standard_Real aU1, aV1, aU2, aV2;
|
||||||
|
gp_Pnt2d aP2D;
|
||||||
|
TopAbs_State aState1, aState2;
|
||||||
|
//
|
||||||
|
const IntPatch_Point& aIP=spnt(i);
|
||||||
|
aIP.Parameters(aU1, aV1, aU2, aV2);
|
||||||
|
//
|
||||||
|
aP2D.SetCoord(aU1, aV1);
|
||||||
|
aState1=D1->Classify(aP2D, TolArc);
|
||||||
|
//
|
||||||
|
aP2D.SetCoord(aU2, aV2);
|
||||||
|
aState2=D2->Classify(aP2D, TolArc);
|
||||||
|
//
|
||||||
|
if(aState1!=TopAbs_OUT && aState2!=TopAbs_OUT) {
|
||||||
|
aSIP.Append(aIP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
spnt.Clear();
|
||||||
|
//
|
||||||
|
aNbPnt=aSIP.Length();
|
||||||
|
for(i=1; i<=aNbPnt; ++i) {
|
||||||
|
const IntPatch_Point& aIP=aSIP(i);
|
||||||
|
spnt.Append(aIP);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
}// if (aNbPnt) {
|
||||||
|
//modified by NIZNHY-PKV Tue Sep 06 10:18:20 2011t
|
||||||
|
//
|
||||||
|
nblin = slin.Length();
|
||||||
for(i=1; i<=nblin; i++) {
|
for(i=1; i<=nblin; i++) {
|
||||||
IntPatch_IType thetype = slin.Value(i)->ArcType();
|
IntPatch_IType thetype = slin.Value(i)->ArcType();
|
||||||
if( (thetype == IntPatch_Ellipse)
|
if( (thetype == IntPatch_Ellipse)
|
||||||
@ -498,70 +514,6 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
|||||||
||(thetype == IntPatch_Parabola)
|
||(thetype == IntPatch_Parabola)
|
||||||
||(thetype == IntPatch_Hyperbola)) {
|
||(thetype == IntPatch_Hyperbola)) {
|
||||||
Handle(IntPatch_GLine)& glin = *((Handle(IntPatch_GLine)*)&slin.Value(i));
|
Handle(IntPatch_GLine)& glin = *((Handle(IntPatch_GLine)*)&slin.Value(i));
|
||||||
|
|
||||||
/* if(thetype == IntPatch_Circle) {
|
|
||||||
gp_Pnt P;
|
|
||||||
IntPatch_Point point;
|
|
||||||
Standard_Real u1,v1,u2,v2;
|
|
||||||
Standard_Boolean Addf = Standard_False;
|
|
||||||
Standard_Boolean Addl = Standard_False;
|
|
||||||
Standard_Integer v=0;
|
|
||||||
Standard_Integer nbv;
|
|
||||||
gp_Circ Circ = glin->Circle();
|
|
||||||
nbv = glin->NbVertex();
|
|
||||||
if(glin->HasFirstPoint() == Standard_False) {
|
|
||||||
P=ElCLib::Value(0.0,Circ);
|
|
||||||
quad1.Parameters(P,u1,v1); quad2.Parameters(P,u2,v2);
|
|
||||||
point.SetValue(P,TolArc,Standard_False);
|
|
||||||
point.SetParameters(u1,v1,u2,v2);
|
|
||||||
point.SetParameter(0.0);
|
|
||||||
glin->AddVertex(point);
|
|
||||||
nbv++;
|
|
||||||
glin->SetFirstPoint(nbv);
|
|
||||||
}
|
|
||||||
if(glin->HasLastPoint() == Standard_False) {
|
|
||||||
P=ElCLib::Value(0.0,Circ);
|
|
||||||
quad1.Parameters(P,u1,v1); quad2.Parameters(P,u2,v2);
|
|
||||||
point.SetValue(P,TolArc,Standard_False);
|
|
||||||
point.SetParameters(u1,v1,u2,v2);
|
|
||||||
point.SetParameter(PI+PI);
|
|
||||||
glin->AddVertex(point);
|
|
||||||
nbv++;
|
|
||||||
glin->SetLastPoint(nbv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(thetype == IntPatch_Ellipse) {
|
|
||||||
gp_Pnt P;
|
|
||||||
IntPatch_Point point;
|
|
||||||
Standard_Real u1,v1,u2,v2;
|
|
||||||
Standard_Boolean Addf = Standard_False;
|
|
||||||
Standard_Boolean Addl = Standard_False;
|
|
||||||
Standard_Integer v=0;
|
|
||||||
Standard_Integer nbv;
|
|
||||||
gp_Elips Elips = glin->Ellipse();
|
|
||||||
nbv = glin->NbVertex();
|
|
||||||
if(glin->HasFirstPoint() == Standard_False) {
|
|
||||||
P=ElCLib::Value(0.0,Elips);
|
|
||||||
quad1.Parameters(P,u1,v1); quad2.Parameters(P,u2,v2);
|
|
||||||
point.SetValue(P,TolArc,Standard_False);
|
|
||||||
point.SetParameters(u1,v1,u2,v2);
|
|
||||||
point.SetParameter(0.0);
|
|
||||||
glin->AddVertex(point);
|
|
||||||
nbv++;
|
|
||||||
glin->SetFirstPoint(nbv);
|
|
||||||
}
|
|
||||||
if(glin->HasLastPoint() == Standard_False) {
|
|
||||||
P=ElCLib::Value(0.0,Elips);
|
|
||||||
quad1.Parameters(P,u1,v1); quad2.Parameters(P,u2,v2);
|
|
||||||
point.SetValue(P,TolArc,Standard_False);
|
|
||||||
point.SetParameters(u1,v1,u2,v2);
|
|
||||||
point.SetParameter(PI+PI);
|
|
||||||
glin->AddVertex(point);
|
|
||||||
nbv++;
|
|
||||||
glin->SetLastPoint(nbv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
glin->ComputeVertexParameters(TolArc);
|
glin->ComputeVertexParameters(TolArc);
|
||||||
}
|
}
|
||||||
else if(thetype == IntPatch_Analytic) {
|
else if(thetype == IntPatch_Analytic) {
|
||||||
@ -573,20 +525,14 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
|||||||
rlig->ComputeVertexParameters(TolArc);
|
rlig->ComputeVertexParameters(TolArc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 1
|
//
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
//-- On place 2 vertex sur les courbes de GLine qui n en
|
//-- On place 2 vertex sur les courbes de GLine qui n en
|
||||||
//-- contiennent pas.
|
//-- contiennent pas.
|
||||||
|
|
||||||
for(i=1; i<=nblin; i++) {
|
for(i=1; i<=nblin; i++) {
|
||||||
gp_Pnt P;
|
gp_Pnt P;
|
||||||
IntPatch_Point point;
|
IntPatch_Point point;
|
||||||
Standard_Real u1,v1,u2,v2;
|
Standard_Real u1,v1,u2,v2;
|
||||||
#ifdef DEB
|
|
||||||
Standard_Boolean Addf = Standard_False;
|
|
||||||
Standard_Boolean Addl = Standard_False;
|
|
||||||
Standard_Integer v=0;
|
|
||||||
#endif
|
|
||||||
Standard_Integer nbv;
|
Standard_Integer nbv;
|
||||||
if(slin.Value(i)->ArcType() == IntPatch_Circle) {
|
if(slin.Value(i)->ArcType() == IntPatch_Circle) {
|
||||||
const Handle(IntPatch_GLine)& glin = *((Handle(IntPatch_GLine)*)&slin.Value(i));
|
const Handle(IntPatch_GLine)& glin = *((Handle(IntPatch_GLine)*)&slin.Value(i));
|
||||||
@ -634,115 +580,6 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
done = Standard_True;
|
done = Standard_True;
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
//-- Ancien bout de code
|
|
||||||
//----------------------------------------------------------------
|
|
||||||
//-- On place 2 vertex sur les courbes de GLine qui n en
|
|
||||||
//-- contiennent pas.
|
|
||||||
|
|
||||||
for(i=1; i<=nblin; i++) {
|
|
||||||
gp_Pnt P;
|
|
||||||
IntPatch_Point point;
|
|
||||||
Standard_Real u1,v1,u2,v2;
|
|
||||||
Standard_Boolean Addf = Standard_False;
|
|
||||||
Standard_Boolean Addl = Standard_False;
|
|
||||||
Standard_Integer v=0;
|
|
||||||
Standard_Integer nbv;
|
|
||||||
if(slin.Value(i)->ArcType() == IntPatch_Circle) {
|
|
||||||
const Handle(IntPatch_GLine)& glin = *((Handle(IntPatch_GLine)*)&slin.Value(i));
|
|
||||||
nbv = glin->NbVertex();
|
|
||||||
if(glin->NbVertex() == 0) { Addf=Addl=Standard_True; }
|
|
||||||
else {
|
|
||||||
if(glin->HasFirstPoint() == Standard_False) {
|
|
||||||
Addf = Standard_True;
|
|
||||||
for(v=1;v<=nbv;v++) {
|
|
||||||
Standard_Real gv = glin->Vertex(v).ParameterOnLine();
|
|
||||||
if(gv<Precision::PConfusion())
|
|
||||||
Addf = Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(glin->HasLastPoint() == Standard_False) {
|
|
||||||
Addl = Standard_True;
|
|
||||||
for(v=1;v<=nbv;v++) {
|
|
||||||
Standard_Real gv = glin->Vertex(v).ParameterOnLine();
|
|
||||||
if((PI+PI-gv)<Precision::PConfusion())
|
|
||||||
Addl = Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(Addl || Addf) {
|
|
||||||
gp_Circ Circ = glin->Circle();
|
|
||||||
if(Addf) {
|
|
||||||
P=ElCLib::Value(0.0,Circ);
|
|
||||||
quad1.Parameters(P,u1,v1);
|
|
||||||
quad2.Parameters(P,u2,v2);
|
|
||||||
point.SetValue(P,TolArc,Standard_False);
|
|
||||||
point.SetParameters(u1,v1,u2,v2);
|
|
||||||
point.SetParameter(0.0);
|
|
||||||
glin->AddVertex(point);
|
|
||||||
}
|
|
||||||
if(Addl) {
|
|
||||||
P=ElCLib::Value(0.0,Circ);
|
|
||||||
quad1.Parameters(P,u1,v1);
|
|
||||||
quad2.Parameters(P,u2,v2);
|
|
||||||
point.SetValue(P,TolArc,Standard_False);
|
|
||||||
point.SetParameters(u1,v1,u2,v2);
|
|
||||||
point.SetParameter(PI+PI);
|
|
||||||
glin->AddVertex(point);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slin.Value(i)->ArcType() == IntPatch_Ellipse) {
|
|
||||||
const Handle(IntPatch_GLine)& glin = *((Handle(IntPatch_GLine)*)&slin.Value(i));
|
|
||||||
nbv = glin->NbVertex();
|
|
||||||
if(glin->NbVertex() == 0) { Addf=Addl=Standard_True; }
|
|
||||||
else {
|
|
||||||
if(glin->HasFirstPoint() == Standard_False) {
|
|
||||||
Addf = Standard_True;
|
|
||||||
for(v=1;v<=nbv;v++) {
|
|
||||||
Standard_Real gv = glin->Vertex(v).ParameterOnLine();
|
|
||||||
if(gv<Precision::PConfusion())
|
|
||||||
Addf = Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(glin->HasLastPoint() == Standard_False) {
|
|
||||||
Addl = Standard_True;
|
|
||||||
for(v=1;v<=nbv;v++) {
|
|
||||||
Standard_Real gv = glin->Vertex(v).ParameterOnLine();
|
|
||||||
if((PI+PI-gv)<Precision::PConfusion())
|
|
||||||
Addl = Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(Addl || Addf) {
|
|
||||||
gp_Elips Elips = glin->Ellipse();
|
|
||||||
if(Addf) {
|
|
||||||
P=ElCLib::Value(0.0,Elips);
|
|
||||||
quad1.Parameters(P,u1,v1);
|
|
||||||
quad2.Parameters(P,u2,v2);
|
|
||||||
point.SetValue(P,TolArc,Standard_False);
|
|
||||||
point.SetParameters(u1,v1,u2,v2);
|
|
||||||
point.SetParameter(0.0);
|
|
||||||
glin->AddVertex(point);
|
|
||||||
}
|
|
||||||
if(Addl) {
|
|
||||||
P=ElCLib::Value(0.0,Elips);
|
|
||||||
quad1.Parameters(P,u1,v1);
|
|
||||||
quad2.Parameters(P,u2,v2);
|
|
||||||
point.SetValue(P,TolArc,Standard_False);
|
|
||||||
point.SetParameters(u1,v1,u2,v2);
|
|
||||||
point.SetParameter(PI+PI);
|
|
||||||
glin->AddVertex(point);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user