// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#include <IntPatch_WLine.ixx>
+
+#include <Adaptor2d_HCurve2d.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Pnt2d.hxx>
+#include <IntPatch_Point.hxx>
+#include <IntPatch_WLine.hxx>
+#include <IntSurf_LineOn2S.hxx>
+#include <IntSurf_PntOn2S.hxx>
+#include <Standard_DomainError.hxx>
+#include <Standard_OutOfRange.hxx>
+#include <Standard_Type.hxx>
#define DEBUG 0
#define DEBUGV 0
const Standard_Boolean Tang,
const IntSurf_TypeTrans Trans1,
const IntSurf_TypeTrans Trans2) :
- IntPatch_Line(Tang,Trans1,Trans2),fipt(Standard_False),lapt(Standard_False),
+ IntPatch_PointLine(Tang,Trans1,Trans2),fipt(Standard_False),lapt(Standard_False),
hasArcOnS1(Standard_False),hasArcOnS2(Standard_False)
{
typ = IntPatch_Walking;
const Standard_Boolean Tang,
const IntSurf_Situation Situ1,
const IntSurf_Situation Situ2) :
- IntPatch_Line(Tang,Situ1,Situ2),fipt(Standard_False),lapt(Standard_False),
+ IntPatch_PointLine(Tang,Situ1,Situ2),fipt(Standard_False),lapt(Standard_False),
hasArcOnS1(Standard_False),hasArcOnS2(Standard_False)
{
typ = IntPatch_Walking;
IntPatch_WLine::IntPatch_WLine (const Handle(IntSurf_LineOn2S)& Line,
const Standard_Boolean Tang) :
- IntPatch_Line(Tang),fipt(Standard_False),lapt(Standard_False),
+ IntPatch_PointLine(Tang),fipt(Standard_False),lapt(Standard_False),
hasArcOnS1(Standard_False),hasArcOnS2(Standard_False)
{
typ = IntPatch_Walking;
}
static Standard_Boolean CompareVertexAndPoint(const gp_Pnt& V, const gp_Pnt& P, const Standard_Real& Tol) {
- return (V.Distance(P) <= Tol);
+ const Standard_Real aSQDist = V.SquareDistance(P);
+ const Standard_Real aSQTol = Tol*Tol;
+ return (aSQDist <= aSQTol);
}
void IntPatch_WLine::SetPeriod(const Standard_Real pu1,
}
-void IntPatch_WLine::Dump() const {
-
- cout<<" ----------- D u m p I n t P a t c h _ W L i n e --------------"<<endl;
- Standard_Integer i;
- Standard_Integer nbp = NbPnts();
- printf("Num [X Y Z] [U1 V1] [U2 V2]\n");
-// for(Standard_Integer i=1;i<=nbp;i++) {
- for(i=1;i<=nbp;i++) {
- Standard_Real u1,v1,u2,v2;
- Point(i).Parameters(u1,v1,u2,v2);
- printf("%4d [%+5.8e %+5.8e %+5.8e] [%+5.8e %+5.8e] [%+5.8e %+5.8e]\n",
- i,
- Point(i).Value().X(),
- Point(i).Value().Y(),
- Point(i).Value().Z(),
- u1,v1,u2,v2);
-
+void IntPatch_WLine::Dump(const Standard_Integer theMode) const
+{
+ cout<<" ----------- D u m p I n t P a t c h _ W L i n e -(begin)------"<<endl;
+ const Standard_Integer aNbPoints = NbPnts();
+ const Standard_Integer aNbVertex = NbVertex();
+
+ switch(theMode)
+ {
+ case 0:
+ printf("Num [X Y Z] [U1 V1] [U2 V2]\n");
+ for(Standard_Integer i=1; i<=aNbPoints; i++)
+ {
+ Standard_Real u1,v1,u2,v2;
+ Point(i).Parameters(u1,v1,u2,v2);
+ printf("%4d [%+10.20f %+10.20f %+10.20f] [%+10.20f %+10.20f] [%+10.20f %+10.20f]\n",
+ i,Point(i).Value().X(),Point(i).Value().Y(),Point(i).Value().Z(),
+ u1,v1,u2,v2);
+ }
- //cout<<"IntSurf_PntOn2S : "<<i<<" Pnt ("<<curv->Value(i).Value().X()
- // <<","<<curv->Value(i).Value().Y()
- // <<","<<curv->Value(i).Value().Z()<<")"<<endl;
- //cout<<" : u1("<<u1<<") v1("<<v1<<") u2("<<u2<<") v2("<<v2<<")"<<endl;
- }
- nbp = NbVertex();
- for(i=1;i<=nbp;i++) {
- Vertex(i).Dump();
- Standard_Real polr = Vertex(i).ParameterOnLine();
- Standard_Integer pol = (Standard_Integer)polr;
- if(pol>=1 && pol<=nbp) {
- cout<<"----> IntSurf_PntOn2S : "<<polr<<" Pnt ("<<Vertex(pol).Value().X()
- <<","<<Vertex(pol).Value().Y()
- <<","<<Vertex(pol).Value().Z()<<")"<<endl;
+ for(Standard_Integer i=1;i<=aNbVertex;i++)
+ {
+ Vertex(i).Dump();
+ Standard_Real polr = Vertex(i).ParameterOnLine();
+ Standard_Integer pol = static_cast<Standard_Integer>(polr);
+
+ if(pol>=1 && pol<=aNbVertex)
+ {
+ cout<<"----> IntSurf_PntOn2S : "<<
+ polr <<", Pnt (" << Vertex(pol).Value().X() << "," <<
+ Vertex(pol).Value().Y() << "," <<
+ Vertex(pol).Value().Z() <<")" <<endl;
+ }
}
+
+ break;
+ case 1:
+ for(Standard_Integer i = 1; i <= aNbPoints; i++)
+ {
+ Standard_Real u1,v1,u2,v2;
+ Point(i).Parameters(u1,v1,u2,v2);
+ printf("point p%d %+10.20f %+10.20f %+10.20f\n",
+ i,Point(i).Value().X(),Point(i).Value().Y(),Point(i).Value().Z());
+ }
+
+ break;
+ case 2:
+ for(Standard_Integer i = 1; i <= aNbPoints; i++)
+ {
+ Standard_Real u1,v1,u2,v2;
+ Point(i).Parameters(u1,v1,u2,v2);
+ printf("point p%d %+10.20f %+10.20f\n", i, u1, v1);
+ }
+
+ break;
+ default:
+ for(Standard_Integer i = 1; i <= aNbPoints; i++)
+ {
+ Standard_Real u1,v1,u2,v2;
+ Point(i).Parameters(u1,v1,u2,v2);
+ printf("point p%d %+10.20f %+10.20f\n", i, u2, v2);
+ }
+
+ break;
}
- cout<<"\n----------------------------------------------------------"<<endl;
+ cout<<"\n--------------------------------------------------- (end) -------"<<endl;
}