mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0023706: Cannot project point on curve
1. Approximation of derivative (by Taylor-series and by three points). 2. Some methods (Degree(), GetType(), D0(), D3(), DN()) are added. 3. Getting of subInterval's boundaries. 4. Algorithm for checking if 1st derivative is equal to zero is amended. 5. Cases are controlled when extrema or Project point do not exist. 6. GetNormal() function for gp_Vec2d was added. 7. Computing of Value, D0, D1, D2 and D3 for offset curves was changed. 8. Limitation of tolerance for derivative computing was added. 9. Methods for computing trihedron in singularity point are added. 10. Test tests/bugs/moddata_3/bug23706 is added. 11. Restriction on the LastParameter for visualization of 3-D curves. Calling PlotCurve(...) function for last interval. 12. LProp package is modified for tangent computing in singularity point (LProp_CLProps, LProp_SLProps). 13. Added test cases for issue. Deleting bad test cases for this fix
This commit is contained in:
@@ -55,12 +55,12 @@ Standard_IMPORT Draw_Viewer dout;
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if ( n < 5)
|
||||
{
|
||||
if ( n < 5)
|
||||
{
|
||||
cout << " Use proj curve/surf x y z [extrema algo: g(grad)/t(tree)]" << endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
gp_Pnt P(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]));
|
||||
|
||||
@@ -69,70 +69,88 @@ static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const ch
|
||||
Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[1]);
|
||||
Handle(Geom_Surface) GS;
|
||||
Extrema_ExtAlgo aProjAlgo = Extrema_ExtAlgo_Grad;
|
||||
|
||||
if (n == 6 && a[5][0] == 't')
|
||||
aProjAlgo = Extrema_ExtAlgo_Tree;
|
||||
|
||||
if (GC.IsNull()) {
|
||||
if (GC.IsNull())
|
||||
{
|
||||
GS = DrawTrSurf::GetSurface(a[1]);
|
||||
|
||||
if (GS.IsNull())
|
||||
return 1;
|
||||
|
||||
Standard_Real U1, U2, V1, V2;
|
||||
GS->Bounds(U1,U2,V1,V2);
|
||||
|
||||
GeomAPI_ProjectPointOnSurf proj(P,GS,U1,U2,V1,V2,aProjAlgo);
|
||||
|
||||
Standard_Real UU,VV;
|
||||
for ( Standard_Integer i = 1; i <= proj.NbPoints(); i++) {
|
||||
for ( Standard_Integer i = 1; i <= proj.NbPoints(); i++)
|
||||
{
|
||||
gp_Pnt P1 = proj.Point(i);
|
||||
if ( P.Distance(P1) > Precision::Confusion()) {
|
||||
Handle(Geom_Line) L = new Geom_Line(P,gp_Vec(P,P1));
|
||||
Handle(Geom_TrimmedCurve) CT =
|
||||
new Geom_TrimmedCurve(L, 0., P.Distance(P1));
|
||||
if ( P.Distance(P1) > Precision::Confusion())
|
||||
{
|
||||
Handle(Geom_Line) L = new Geom_Line(P,gp_Vec(P,P1));
|
||||
Handle(Geom_TrimmedCurve) CT =
|
||||
new Geom_TrimmedCurve(L, 0., P.Distance(P1));
|
||||
Sprintf(name,"%s%d","ext_",i);
|
||||
char* temp = name; // portage WNT
|
||||
DrawTrSurf::Set(temp, CT);
|
||||
di << name << " ";
|
||||
}
|
||||
else {
|
||||
char* temp = name; // portage WNT
|
||||
DrawTrSurf::Set(temp, CT);
|
||||
di << name << " ";
|
||||
}
|
||||
else
|
||||
{
|
||||
Sprintf(name,"%s%d","ext_",i);
|
||||
di << name << " ";
|
||||
char* temp = name; // portage WNT
|
||||
DrawTrSurf::Set(temp, P1);
|
||||
proj.Parameters(i,UU,VV);
|
||||
di << " Le point est sur la surface." << "\n";
|
||||
di << " Ses parametres sont: UU = " << UU << "\n";
|
||||
di << " VV = " << VV << "\n";
|
||||
di << name << " ";
|
||||
char* temp = name; // portage WNT
|
||||
DrawTrSurf::Set(temp, P1);
|
||||
proj.Parameters(i,UU,VV);
|
||||
di << " Le point est sur la surface." << "\n";
|
||||
di << " Ses parametres sont: UU = " << UU << "\n";
|
||||
di << " VV = " << VV << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
GeomAPI_ProjectPointOnCurve proj(P,GC,GC->FirstParameter(),
|
||||
GC->LastParameter());
|
||||
// Standard_Real UU;
|
||||
for ( Standard_Integer i = 1; i <= proj.NbPoints(); i++) {
|
||||
GC->LastParameter());
|
||||
|
||||
if(proj.NbPoints() == 0)
|
||||
{
|
||||
cout << "No project point was found." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
for ( Standard_Integer i = 1; i <= proj.NbPoints(); i++)
|
||||
{
|
||||
gp_Pnt P1 = proj.Point(i);
|
||||
Standard_Real UU = proj.Parameter(i);
|
||||
di << " parameter " << i << " = " << UU << "\n";
|
||||
if ( P.Distance(P1) > Precision::Confusion()) {
|
||||
Handle(Geom_Line) L = new Geom_Line(P,gp_Vec(P,P1));
|
||||
Handle(Geom_TrimmedCurve) CT =
|
||||
new Geom_TrimmedCurve(L, 0., P.Distance(P1));
|
||||
if ( P.Distance(P1) > Precision::Confusion())
|
||||
{
|
||||
Handle(Geom_Line) L = new Geom_Line(P,gp_Vec(P,P1));
|
||||
Handle(Geom_TrimmedCurve) CT =
|
||||
new Geom_TrimmedCurve(L, 0., P.Distance(P1));
|
||||
Sprintf(name,"%s%d","ext_",i);
|
||||
char* temp = name; // portage WNT
|
||||
DrawTrSurf::Set(temp, CT);
|
||||
di << name << " ";
|
||||
}
|
||||
else {
|
||||
char* temp = name; // portage WNT
|
||||
DrawTrSurf::Set(temp, CT);
|
||||
di << name << " ";
|
||||
}
|
||||
else
|
||||
{
|
||||
Sprintf(name,"%s%d","ext_",i);
|
||||
char* temp = name; // portage WNT
|
||||
DrawTrSurf::Set(temp, P1);
|
||||
di << name << " ";
|
||||
UU = proj.Parameter(i);
|
||||
di << " Le point est sur la courbe." << "\n";
|
||||
di << " Son parametre est U = " << UU << "\n";
|
||||
char* temp = name; // portage WNT
|
||||
DrawTrSurf::Set(temp, P1);
|
||||
di << name << " ";
|
||||
UU = proj.Parameter(i);
|
||||
di << " Le point est sur la courbe." << "\n";
|
||||
di << " Son parametre est U = " << UU << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -349,78 +367,133 @@ static Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer n, const
|
||||
}
|
||||
|
||||
char name[100];
|
||||
if ( C1 && C2) {
|
||||
if ( C1 && C2)
|
||||
{
|
||||
GeomAPI_ExtremaCurveCurve Ex(GC1,GC2,U1f,U1l,U2f,U2l);
|
||||
if(!Ex.Extrema().IsParallel()) {
|
||||
for ( Standard_Integer i = 1; i <= Ex.NbExtrema(); i++) {
|
||||
gp_Pnt P1,P2;
|
||||
Ex.Points(i,P1,P2);
|
||||
if (P1.Distance(P2) < 1.e-16) {
|
||||
di << "Extrema " << i << " is point : " << P1.X() << " " << P1.Y() << " " << P1.Z() << "\n";
|
||||
continue;
|
||||
}
|
||||
Handle(Geom_Line) L = new Geom_Line(P1,gp_Vec(P1,P2));
|
||||
Handle(Geom_TrimmedCurve) CT =
|
||||
new Geom_TrimmedCurve(L, 0., P1.Distance(P2));
|
||||
Sprintf(name,"%s%d","ext_",i);
|
||||
char* temp = name; // portage WNT
|
||||
DrawTrSurf::Set(temp, CT);
|
||||
di << name << " ";
|
||||
|
||||
if(!Ex.Extrema().IsParallel())
|
||||
{
|
||||
const Standard_Integer aNExtr = Ex.NbExtrema();
|
||||
if(aNExtr == 0)
|
||||
{
|
||||
di << "No solutions!\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( Standard_Integer i = 1; i <= aNExtr; i++)
|
||||
{
|
||||
gp_Pnt P1,P2;
|
||||
Ex.Points(i,P1,P2);
|
||||
Standard_Real U1,V1;
|
||||
Ex.Parameters(i,U1,V1);
|
||||
if (P1.Distance(P2) < 1.e-16)
|
||||
{
|
||||
di << "Extrema " << i << " is point : " << P1.X() << " " << P1.Y() << " " << P1.Z() << "\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(Geom_Line) L = new Geom_Line(P1,gp_Vec(P1,P2));
|
||||
Handle(Geom_TrimmedCurve) CT =
|
||||
new Geom_TrimmedCurve(L, 0., P1.Distance(P2));
|
||||
#ifdef DEB
|
||||
Sprintf(name,"%s%d (U=%f; V=%f)","ext_",i,U1,V1);
|
||||
#else
|
||||
Sprintf(name,"%s%d","ext_",i);
|
||||
#endif
|
||||
char* temp = name; // portage WNT
|
||||
DrawTrSurf::Set(temp, CT);
|
||||
di << name << " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
di << "Infinite number of extremas, distance = " << Ex.LowerDistance() << "\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
di << "Infinite number of extremas, distance = " << Ex.LowerDistance() << "\n";
|
||||
}
|
||||
}
|
||||
else if ( C1 & S2) {
|
||||
else if ( C1 & S2)
|
||||
{
|
||||
GeomAPI_ExtremaCurveSurface Ex(GC1,GS2,U1f,U1l,U2f,U2l,V2f,V2l);
|
||||
for ( Standard_Integer i = 1; i <= Ex.NbExtrema(); i++) {
|
||||
gp_Pnt P1,P2;
|
||||
Ex.Points(i,P1,P2);
|
||||
if (P1.Distance(P2) < 1.e-16) continue;
|
||||
Handle(Geom_Line) L = new Geom_Line(P1,gp_Vec(P1,P2));
|
||||
Handle(Geom_TrimmedCurve) CT =
|
||||
new Geom_TrimmedCurve(L, 0., P1.Distance(P2));
|
||||
Sprintf(name,"%s%d","ext_",i);
|
||||
char* temp = name; // portage WNT
|
||||
DrawTrSurf::Set(temp, CT);
|
||||
di << name << " ";
|
||||
|
||||
const Standard_Integer aNExtr = Ex.NbExtrema();
|
||||
if(aNExtr == 0)
|
||||
{
|
||||
di << "No solutions!\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( Standard_Integer i = 1; i <= aNExtr; i++)
|
||||
{
|
||||
gp_Pnt P1,P2;
|
||||
Ex.Points(i,P1,P2);
|
||||
if (P1.Distance(P2) < 1.e-16) continue;
|
||||
Handle(Geom_Line) L = new Geom_Line(P1,gp_Vec(P1,P2));
|
||||
Handle(Geom_TrimmedCurve) CT =
|
||||
new Geom_TrimmedCurve(L, 0., P1.Distance(P2));
|
||||
Sprintf(name,"%s%d","ext_",i);
|
||||
char* temp = name; // portage WNT
|
||||
DrawTrSurf::Set(temp, CT);
|
||||
di << name << " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( S1 & C2) {
|
||||
else if ( S1 & C2)
|
||||
{
|
||||
GeomAPI_ExtremaCurveSurface Ex(GC2,GS1,U2f,U2l,U1f,U1l,V1f,V1l);
|
||||
for ( Standard_Integer i = 1; i <= Ex.NbExtrema(); i++) {
|
||||
gp_Pnt P1,P2;
|
||||
Ex.Points(i,P1,P2);
|
||||
if (P1.Distance(P2) < 1.e-16) continue;
|
||||
Handle(Geom_Line) L = new Geom_Line(P1,gp_Vec(P1,P2));
|
||||
Handle(Geom_TrimmedCurve) CT =
|
||||
new Geom_TrimmedCurve(L, 0., P1.Distance(P2));
|
||||
Sprintf(name,"%s%d","ext_",i);
|
||||
char* temp = name; // portage WNT
|
||||
DrawTrSurf::Set(temp, CT);
|
||||
di << name << " ";
|
||||
|
||||
const Standard_Integer aNExtr = Ex.NbExtrema();
|
||||
if(aNExtr == 0)
|
||||
{
|
||||
di << "No solutions!\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( Standard_Integer i = 1; i <= aNExtr; i++)
|
||||
{
|
||||
gp_Pnt P1,P2;
|
||||
Ex.Points(i,P1,P2);
|
||||
if (P1.Distance(P2) < 1.e-16) continue;
|
||||
Handle(Geom_Line) L = new Geom_Line(P1,gp_Vec(P1,P2));
|
||||
Handle(Geom_TrimmedCurve) CT =
|
||||
new Geom_TrimmedCurve(L, 0., P1.Distance(P2));
|
||||
Sprintf(name,"%s%d","ext_",i);
|
||||
char* temp = name; // portage WNT
|
||||
DrawTrSurf::Set(temp, CT);
|
||||
di << name << " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( S1 & S2) {
|
||||
else if ( S1 & S2)
|
||||
{
|
||||
GeomAPI_ExtremaSurfaceSurface Ex(GS1,GS2,U1f,U1l,V1f,V1l,U2f,U2l,V2f,V2l);
|
||||
for ( Standard_Integer i = 1; i <= Ex.NbExtrema(); i++) {
|
||||
gp_Pnt P1,P2;
|
||||
Ex.Points(i,P1,P2);
|
||||
if (P1.Distance(P2) < 1.e-16) continue;
|
||||
Handle(Geom_Line) L = new Geom_Line(P1,gp_Vec(P1,P2));
|
||||
Handle(Geom_TrimmedCurve) CT =
|
||||
new Geom_TrimmedCurve(L, 0., P1.Distance(P2));
|
||||
Sprintf(name,"%s%d","ext_",i);
|
||||
char* temp = name; // portage WNT
|
||||
DrawTrSurf::Set(temp, CT);
|
||||
di << name << " ";
|
||||
|
||||
const Standard_Integer aNExtr = Ex.NbExtrema();
|
||||
if(aNExtr == 0)
|
||||
{
|
||||
di << "No solutions!\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( Standard_Integer i = 1; i <= aNExtr; i++)
|
||||
{
|
||||
gp_Pnt P1,P2;
|
||||
Ex.Points(i,P1,P2);
|
||||
if (P1.Distance(P2) < 1.e-16)
|
||||
continue;
|
||||
|
||||
Handle(Geom_Line) L = new Geom_Line(P1,gp_Vec(P1,P2));
|
||||
Handle(Geom_TrimmedCurve) CT =
|
||||
new Geom_TrimmedCurve(L, 0., P1.Distance(P2));
|
||||
Sprintf(name,"%s%d","ext_",i);
|
||||
char* temp = name; // portage WNT
|
||||
DrawTrSurf::Set(temp, CT);
|
||||
di << name << " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : totalextcc
|
||||
|
@@ -1329,150 +1329,219 @@ static Standard_Integer surfpoints (Draw_Interpretor& /*di*/, Standard_Integer /
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 4) {
|
||||
{
|
||||
if (n < 4)
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
Handle(Geom_Curve) GC1;
|
||||
Handle(Geom_Surface) GS1 = DrawTrSurf::GetSurface(a[2]);
|
||||
if (GS1.IsNull()) {
|
||||
if (GS1.IsNull())
|
||||
{
|
||||
GC1 = DrawTrSurf::GetCurve(a[2]);
|
||||
if (GC1.IsNull())
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
Handle(Geom_Surface) GS2 = DrawTrSurf::GetSurface(a[3]);
|
||||
if (GS2.IsNull()) {
|
||||
if (GS2.IsNull())
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
Standard_Real tol = Precision::Confusion();
|
||||
if (n == 5 || n == 9 || n == 13 || n == 17) tol = Draw::Atof(a[n-1]);
|
||||
if (n == 5 || n == 9 || n == 13 || n == 17)
|
||||
tol = Draw::Atof(a[n-1]);
|
||||
|
||||
//
|
||||
Handle(Geom_Curve) Result;
|
||||
gp_Pnt Point;
|
||||
|
||||
//
|
||||
if (GC1.IsNull()) {
|
||||
if (GC1.IsNull())
|
||||
{
|
||||
GeomInt_IntSS Inters;
|
||||
//
|
||||
// Surface Surface
|
||||
if (n <= 5) {
|
||||
if (n <= 5)
|
||||
{
|
||||
// General case
|
||||
Inters.Perform(GS1,GS2,tol,Standard_True);
|
||||
}
|
||||
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)
|
||||
{
|
||||
Standard_Boolean useStart = Standard_True, useBnd = Standard_True;
|
||||
Standard_Integer ista1=0,ista2=0,ibnd1=0,ibnd2=0;
|
||||
Standard_Real UVsta[4];
|
||||
Handle(GeomAdaptor_HSurface) AS1,AS2;
|
||||
|
||||
//
|
||||
if (n <= 9) { // user starting point
|
||||
if (n <= 9) // user starting point
|
||||
{
|
||||
useBnd = Standard_False;
|
||||
ista1 = 4; ista2 = 7;
|
||||
}
|
||||
else if (n <= 13) { // user bounding
|
||||
ista1 = 4;
|
||||
ista2 = 7;
|
||||
}
|
||||
else if (n <= 13) // user bounding
|
||||
{
|
||||
useStart = Standard_False;
|
||||
ibnd1 = 4; ibnd2 = 11;
|
||||
}
|
||||
else { // both user starting point and bounding
|
||||
}
|
||||
else // both user starting point and bounding
|
||||
{
|
||||
ista1 = 4; ista2 = 7;
|
||||
ibnd1 = 8; ibnd2 = 15;
|
||||
}
|
||||
}
|
||||
|
||||
if (useStart)
|
||||
{
|
||||
for (Standard_Integer i=ista1; i <= ista2; i++)
|
||||
{
|
||||
UVsta[i-ista1] = Draw::Atof(a[i]);
|
||||
if (useBnd) {
|
||||
}
|
||||
}
|
||||
|
||||
if (useBnd)
|
||||
{
|
||||
Standard_Real UVbnd[8];
|
||||
for (Standard_Integer i=ibnd1; i <= ibnd2; i++)
|
||||
UVbnd[i-ibnd1] = Draw::Atof(a[i]);
|
||||
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (useStart && !useBnd) {
|
||||
if (useStart && !useBnd)
|
||||
{
|
||||
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);
|
||||
}
|
||||
else {
|
||||
}
|
||||
else
|
||||
{
|
||||
Inters.Perform(AS1,AS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]);
|
||||
}
|
||||
}//else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 16 || n == 17) {
|
||||
else {
|
||||
}
|
||||
}//else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 16 || n == 17)
|
||||
else
|
||||
{
|
||||
di<<"incorrect number of arguments"<<"\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (!Inters.IsDone()) {
|
||||
if (!Inters.IsDone())
|
||||
{
|
||||
di<<"No intersections found!"<<"\n";
|
||||
|
||||
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);
|
||||
if (aNbLines >= 2)
|
||||
{
|
||||
for (i=1; i<=aNbLines; ++i)
|
||||
{
|
||||
Sprintf(buf, "%s_%d",a[1],i);
|
||||
di << buf << " ";
|
||||
Result = Inters.Line(i);
|
||||
const char* temp = buf;
|
||||
DrawTrSurf::Set(temp,Result);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (aNbLines == 1) {
|
||||
else if (aNbLines == 1)
|
||||
{
|
||||
Result = Inters.Line(1);
|
||||
Sprintf(buf,"%s",a[1]);
|
||||
di << buf << " ";
|
||||
DrawTrSurf::Set(a[1],Result);
|
||||
}
|
||||
|
||||
//
|
||||
aNbPoints=Inters.NbPoints();
|
||||
for (i=1; i<=aNbPoints; ++i) {
|
||||
for (i=1; i<=aNbPoints; ++i)
|
||||
{
|
||||
Point=Inters.Point(i);
|
||||
Sprintf(buf,"%s_p_%d",a[1],i);
|
||||
const char* temp =buf;
|
||||
di << buf << " ";
|
||||
const char* temp = buf;
|
||||
DrawTrSurf::Set(temp, Point);
|
||||
}
|
||||
}// if (GC1.IsNull()) {
|
||||
//
|
||||
else {
|
||||
}
|
||||
}// if (GC1.IsNull())
|
||||
else
|
||||
{
|
||||
// Curve Surface
|
||||
GeomAPI_IntCS Inters(GC1,GS2);
|
||||
//
|
||||
if (!Inters.IsDone()) return 1;
|
||||
|
||||
//
|
||||
if (!Inters.IsDone())
|
||||
{
|
||||
di<<"No intersections found!"<<"\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Integer nblines = Inters.NbSegments();
|
||||
Standard_Integer nbpoints = Inters.NbPoints();
|
||||
if ( (nblines+nbpoints) >= 2) {
|
||||
char newname[1024];
|
||||
|
||||
char newname[1024];
|
||||
|
||||
if ( (nblines+nbpoints) >= 2)
|
||||
{
|
||||
Standard_Integer i;
|
||||
Standard_Integer Compt = 1;
|
||||
for (i = 1; i <= nblines; i++, Compt++) {
|
||||
Sprintf(newname,"%s_%d",a[1],Compt);
|
||||
Result = Inters.Segment(i);
|
||||
const char* temp = newname; // pour portage WNT
|
||||
DrawTrSurf::Set(temp,Result);
|
||||
|
||||
if(nblines >= 1)
|
||||
cout << " Lines: " << endl;
|
||||
|
||||
for (i = 1; i <= nblines; i++, Compt++)
|
||||
{
|
||||
Sprintf(newname,"%s_%d",a[1],Compt);
|
||||
di << newname << " ";
|
||||
Result = Inters.Segment(i);
|
||||
const char* temp = newname; // pour portage WNT
|
||||
DrawTrSurf::Set(temp,Result);
|
||||
}
|
||||
|
||||
if(nbpoints >= 1)
|
||||
cout << " Points: " << endl;
|
||||
|
||||
const Standard_Integer imax = nblines+nbpoints;
|
||||
|
||||
for (/*i = 1*/; i <= imax; i++, Compt++)
|
||||
{
|
||||
Sprintf(newname,"%s_%d",a[1],i);
|
||||
di << newname << " ";
|
||||
Point = Inters.Point(i);
|
||||
const char* temp = newname; // pour portage WNT
|
||||
DrawTrSurf::Set(temp,Point);
|
||||
}
|
||||
}
|
||||
for (i = 1; i <= nbpoints; i++, Compt++) {
|
||||
Sprintf(newname,"%s_%d",a[1],i);
|
||||
Point = Inters.Point(i);
|
||||
const char* temp = newname; // pour portage WNT
|
||||
DrawTrSurf::Set(temp,Point);
|
||||
}
|
||||
}
|
||||
else if (nblines == 1) {
|
||||
else if (nblines == 1)
|
||||
{
|
||||
Result = Inters.Segment(1);
|
||||
Sprintf(newname,"%s",a[1]);
|
||||
di << newname << " ";
|
||||
DrawTrSurf::Set(a[1],Result);
|
||||
}
|
||||
else if (nbpoints == 1) {
|
||||
}
|
||||
else if (nbpoints == 1)
|
||||
{
|
||||
Point = Inters.Point(1);
|
||||
Sprintf(newname,"%s",a[1]);
|
||||
di << newname << " ";
|
||||
DrawTrSurf::Set(a[1],Point);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dout.Flush();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CurveCommands
|
||||
|
Reference in New Issue
Block a user