Back to index

salome-geom  6.5.0
Functions
BlockFix_SphereSpaceModifier.cxx File Reference
#include <BlockFix_SphereSpaceModifier.ixx>
#include <TopLoc_Location.hxx>
#include <BRep_Tool.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <ShapeAnalysis.hxx>
#include <gp_Sphere.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopExp.hxx>
#include <ShapeFix_Edge.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>

Go to the source code of this file.

Functions

static Standard_Boolean ModifySurface (const TopoDS_Face &aFace, const Handle(Geom_Surface)&aSurface, Handle(Geom_Surface)&aNewSurface)

Function Documentation

static Standard_Boolean ModifySurface ( const TopoDS_Face &  aFace,
const Handle(Geom_Surface)&  aSurface,
Handle(Geom_Surface)&  aNewSurface 
) [static]

Definition at line 73 of file BlockFix_SphereSpaceModifier.cxx.

{
  Handle(Geom_Surface) S = aSurface;
  if(S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
    Handle(Geom_RectangularTrimmedSurface) RTS =
      Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
    S = RTS->BasisSurface();
  }

  if(S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
    Standard_Real Umin, Umax, Vmin, Vmax;
    ShapeAnalysis::GetFaceUVBounds(aFace,Umin, Umax, Vmin, Vmax);
    Standard_Real PI2 = M_PI/2.;
    if(Vmax > PI2 - Precision::PConfusion() || Vmin < -PI2+::Precision::PConfusion()) {
      Handle(Geom_SphericalSurface) aSphere = Handle(Geom_SphericalSurface)::DownCast(S);
      gp_Sphere sp = aSphere->Sphere();
      gp_Ax3 ax3 = sp.Position();
      if(Abs(Vmax-Vmin) < PI2) {
        gp_Ax3 axnew3(ax3.Axis().Location(), ax3.Direction()^ax3.XDirection(),ax3.XDirection());
        sp.SetPosition(axnew3);
        Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(sp);
        aNewSurface = aNewSphere;
        return Standard_True;
      }
      else {
        gp_Pnt PC = ax3.Location();
        Standard_Real Vpar;
        if(fabs(PI2-Vmax)>fabs(-PI2-Vmin))
          Vpar = (PI2+Vmax)/2.;
        else
          Vpar = (-PI2+Vmin)/2.;
        Standard_Real Upar = (Umin+Umax)/2.;;
        gp_Pnt PN,PX;
        S->D0(Upar,Vpar,PN);
        S->D0(Upar+PI2,0.,PX);
        gp_Dir newNorm(gp_Vec(PC,PN));
        gp_Dir newDirX(gp_Vec(PC,PX));
        gp_Ax3 axnew3(ax3.Axis().Location(), newNorm, newDirX);
        sp.SetPosition(axnew3);
        Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(sp);
        aNewSurface = aNewSphere;
        return Standard_True;
      }
    }
  }
  return Standard_False;
}

Here is the call graph for this function:

Here is the caller graph for this function: