// File: GEOMAlgo_SurfaceTools.cxx // Created: Thu Jan 27 11:05:16 2005 // Author: Peter KURNEV // #include #include #include #include #include #include #include #include #include #include //======================================================================= //function : GetState //purpose : //======================================================================= Standard_Integer GEOMAlgo_SurfaceTools::GetState(const gp_Pnt& aP, const Handle(Geom_Surface)& aSurf, const Standard_Real aTol, TopAbs_State& aState) { Standard_Integer iErr; Standard_Real aDp, aR; GeomAbs_SurfaceType aType; GeomAdaptor_Surface aGAS; gp_Sphere aSph; gp_Cylinder aCyl; gp_Pln aPln; // iErr=0; aState=TopAbs_UNKNOWN; aGAS.Load(aSurf); // aType=aGAS.GetType(); switch (aType) { case GeomAbs_Plane: aPln=aGAS.Plane(); aR=0.; aDp=GEOMAlgo_SurfaceTools::Distance(aP, aPln); break; case GeomAbs_Cylinder: aCyl=aGAS.Cylinder(); aR=aCyl.Radius(); aDp=GEOMAlgo_SurfaceTools::Distance(aP, aCyl); break; case GeomAbs_Sphere: aSph=aGAS.Sphere(); aR=aSph.Radius(); aDp=GEOMAlgo_SurfaceTools::Distance(aP, aSph); break; default: iErr=1; // unprocessed surface type break; } // if (!iErr) { aState=TopAbs_ON; if (aDp>aR+aTol) { aState=TopAbs_OUT; } else if (aDp