IMPLEMENT_STANDARD_RTTIEXT(IntSurf_LineOn2S,Standard_Transient)
-IntSurf_LineOn2S::IntSurf_LineOn2S (const IntSurf_Allocator& theAllocator) :
- mySeq (theAllocator)
-{}
+IntSurf_LineOn2S::
+ IntSurf_LineOn2S(const IntSurf_Allocator& theAllocator) : mySeq(theAllocator)
+{
+ myBuv1.SetWhole();
+ myBuv2.SetWhole();
+ myBxyz.SetWhole();
+}
Handle(IntSurf_LineOn2S) IntSurf_LineOn2S::Split (const Standard_Integer Index)
else {
mySeq.InsertBefore(index,P);
}
+
+ if (!myBxyz.IsWhole())
+ {
+ myBxyz.Add(P.Value());
+ }
+
+ if (!myBuv1.IsWhole())
+ {
+ myBuv1.Add(P.ValueOnSurface(Standard_True));
+ }
+
+ if (!myBuv2.IsWhole())
+ {
+ myBuv2.Add(P.ValueOnSurface(Standard_False));
+ }
}
void IntSurf_LineOn2S::RemovePoint(const Standard_Integer index) {
mySeq.Remove(index);
+ myBuv1.SetWhole();
+ myBuv2.SetWhole();
+ myBxyz.SetWhole();
}
+
+Standard_Boolean IntSurf_LineOn2S::IsOutBox(const gp_Pnt& Pxyz)
+{
+ if (myBxyz.IsWhole())
+ {
+ Standard_Integer n = NbPoints();
+ myBxyz.SetVoid();
+ for (Standard_Integer i = 1; i <= n; i++)
+ {
+ gp_Pnt P = mySeq(i).Value();
+ myBxyz.Add(P);
+ }
+ Standard_Real x0, y0, z0, x1, y1, z1;
+ myBxyz.Get(x0, y0, z0, x1, y1, z1);
+ x1 -= x0; y1 -= y0; z1 -= z0;
+ if (x1>y1)
+ {
+ if (x1>z1)
+ {
+ myBxyz.Enlarge(x1*0.01);
+ }
+ else
+ {
+ myBxyz.Enlarge(z1*0.01);
+ }
+ }
+ else
+ {
+ if (y1>z1)
+ {
+ myBxyz.Enlarge(y1*0.01);
+ }
+ else
+ {
+ myBxyz.Enlarge(z1*0.01);
+ }
+ }
+ }
+ Standard_Boolean out = myBxyz.IsOut(Pxyz);
+ return(out);
+}
+
+Standard_Boolean IntSurf_LineOn2S::IsOutSurf1Box(const gp_Pnt2d& P1uv)
+{
+ if (myBuv1.IsWhole())
+ {
+ Standard_Integer n = NbPoints();
+ Standard_Real pu1, pu2, pv1, pv2;
+ myBuv1.SetVoid();
+ for (Standard_Integer i = 1; i <= n; i++)
+ {
+ mySeq(i).Parameters(pu1, pv1, pu2, pv2);
+ myBuv1.Add(gp_Pnt2d(pu1, pv1));
+ }
+ myBuv1.Get(pu1, pv1, pu2, pv2);
+ pu2 -= pu1;
+ pv2 -= pv1;
+ if (pu2>pv2)
+ {
+ myBuv1.Enlarge(pu2*0.01);
+ }
+ else
+ {
+ myBuv1.Enlarge(pv2*0.01);
+ }
+ }
+ Standard_Boolean out = myBuv1.IsOut(P1uv);
+ return(out);
+}
+
+Standard_Boolean IntSurf_LineOn2S::IsOutSurf2Box(const gp_Pnt2d& P2uv)
+{
+ if (myBuv2.IsWhole())
+ {
+ Standard_Integer n = NbPoints();
+ Standard_Real pu1, pu2, pv1, pv2;
+ myBuv2.SetVoid();
+ for (Standard_Integer i = 1; i <= n; i++)
+ {
+ mySeq(i).Parameters(pu1, pv1, pu2, pv2);
+ myBuv2.Add(gp_Pnt2d(pu2, pv2));
+ }
+ myBuv2.Get(pu1, pv1, pu2, pv2);
+ pu2 -= pu1;
+ pv2 -= pv1;
+ if (pu2>pv2)
+ {
+ myBuv2.Enlarge(pu2*0.01);
+ }
+ else
+ {
+ myBuv2.Enlarge(pv2*0.01);
+ }
+ }
+ Standard_Boolean out = myBuv2.IsOut(P2uv);
+ return(out);
+}
+