- Standard_Integer i, iNear, iEnd;
- Standard_Real aUx, aVx, Dist2, Dist2Min;
- Extrema_POnSurf aPx;
- //
- iNear = 1;
- Dist2Min = Ext.SquareDistance(1);
- iEnd = Ext.NbExt();
- for (i = 2; i <= iEnd; i++) {
- aPx=Ext.Point(i);
- aPx.Parameter(aUx, aVx);
- if (aUx>=U1 && aUx<=U2 && aVx>=V1 && aVx<=V2) {
- Dist2 = Ext.SquareDistance(i);
- if (Dist2 < Dist2Min) {
- Dist2Min = Dist2;
- iNear = i;
- }
- }
- }
- //
- Standard_Real aDist2Tresh=1.e-24;
- //
- if (Dist2Min<aDist2Tresh) {
- if (anInfFlag) {
- return 1;
- }
- else {
- BRepClass_FaceClassifier classifier2d;
- Standard_Real aU;
- Standard_Real aV;
-
- (Ext.Point(iNear)).Parameter(aU, aV);
-
- gp_Pnt2d aPuv(aU, aV);
-
- classifier2d.Perform(face,aPuv,Precision::PConfusion());
-
- TopAbs_State aState = classifier2d.State();
-
- if (aState == TopAbs_IN || aState == TopAbs_ON) {
- return 1;
- }
- else {
- return 3; // skv - the point is on surface but outside face.
- }
- }
- }
- if (anInfFlag) {
- APoint = (Ext.Point(iNear)).Value();
- gp_Vec V(P,APoint);
- _Par = V.Magnitude();
- L = gp_Lin(P,V);
- ptfound=Standard_True;
- return 0;
- }
+ Standard_Integer i, iNear, iEnd;
+ Standard_Real aUx, aVx, Dist2, Dist2Min;
+ Extrema_POnSurf aPx;
+ //
+ iNear = 1;
+ Dist2Min = Ext.SquareDistance(1);
+ iEnd = Ext.NbExt();
+ for (i = 2; i <= iEnd; i++) {
+ aPx=Ext.Point(i);
+ aPx.Parameter(aUx, aVx);
+ if (aUx>=U1 && aUx<=U2 && aVx>=V1 && aVx<=V2) {
+ Dist2 = Ext.SquareDistance(i);
+ if (Dist2 < Dist2Min) {
+ Dist2Min = Dist2;
+ iNear = i;
+ }
+ }
+ }
+ //
+ Standard_Real aDist2Tresh=1.e-24;
+ //
+ if (Dist2Min<aDist2Tresh) {
+ if (anInfFlag) {
+ return 1;
+ }
+ else {
+ BRepClass_FaceClassifier classifier2d;
+ Standard_Real aU;
+ Standard_Real aV;
+
+ (Ext.Point(iNear)).Parameter(aU, aV);
+
+ gp_Pnt2d aPuv(aU, aV);
+
+ classifier2d.Perform(face,aPuv,Precision::PConfusion());
+
+ TopAbs_State aState = classifier2d.State();
+
+ if (aState == TopAbs_IN || aState == TopAbs_ON) {
+ return 1;
+ }
+ else {
+ return 3; // skv - the point is on surface but outside face.
+ }
+ }
+ }
+ if (anInfFlag) {
+ APoint = (Ext.Point(iNear)).Value();
+ gp_Vec V(P,APoint);
+ _Par = V.Magnitude();
+ L = gp_Lin(P,V);
+ ptfound=Standard_True;
+ return 0;
+ }