mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-27 13:30:33 +05:00
Fixing pb for not closed surfaces
This commit is contained in:
parent
4a784c2ca9
commit
76f56fa1c7
@ -105,7 +105,7 @@ Standard_Integer GEOMImpl_SmoothingSurfaceDriver::Execute(TFunction_Logbook& log
|
|||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
TopoDS_Face aInitShape;
|
TopoDS_Face aInitShape;
|
||||||
|
|
||||||
GeomPlate_BuildPlateSurface aBuilder(3,0);
|
GeomPlate_BuildPlateSurface aBuilder(3,10);
|
||||||
|
|
||||||
// ** Creation of compound
|
// ** Creation of compound
|
||||||
BRep_Builder aB;
|
BRep_Builder aB;
|
||||||
@ -123,6 +123,7 @@ Standard_Integer GEOMImpl_SmoothingSurfaceDriver::Execute(TFunction_Logbook& log
|
|||||||
BRepBndLib::Add(aComp, BoundingBox);
|
BRepBndLib::Add(aComp, BoundingBox);
|
||||||
BoundingBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
BoundingBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
||||||
|
|
||||||
|
cout << "test isClosed" << endl;
|
||||||
if (isClosed)
|
if (isClosed)
|
||||||
{
|
{
|
||||||
// Initial surface : Sphere
|
// Initial surface : Sphere
|
||||||
@ -139,6 +140,7 @@ Standard_Integer GEOMImpl_SmoothingSurfaceDriver::Execute(TFunction_Logbook& log
|
|||||||
aRMax = aZmax-aZmin;
|
aRMax = aZmax-aZmin;
|
||||||
// ** Creation of sphere
|
// ** Creation of sphere
|
||||||
aInitShape = BRepPrimAPI_MakeSphere(aCenterMass, aRMax).Face();
|
aInitShape = BRepPrimAPI_MakeSphere(aCenterMass, aRMax).Face();
|
||||||
|
cout << "Closed " << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -151,9 +153,10 @@ Standard_Integer GEOMImpl_SmoothingSurfaceDriver::Execute(TFunction_Logbook& log
|
|||||||
gp_Pnt aPnt3;
|
gp_Pnt aPnt3;
|
||||||
if (aX > aY)
|
if (aX > aY)
|
||||||
{
|
{
|
||||||
if (aX > aZ)
|
if (aZ > aY)
|
||||||
{
|
{
|
||||||
// X Plane
|
// Y Plane
|
||||||
|
cout << "cas 1 " << endl;
|
||||||
aPnt1 = gp_Pnt(aXmin, aYmin+aY/2, aZmin);
|
aPnt1 = gp_Pnt(aXmin, aYmin+aY/2, aZmin);
|
||||||
aPnt2 = gp_Pnt(aXmin, aYmin+aY/2, aZmax);
|
aPnt2 = gp_Pnt(aXmin, aYmin+aY/2, aZmax);
|
||||||
aPnt3 = gp_Pnt(aXmax, aYmin+aY/2, aZmin);
|
aPnt3 = gp_Pnt(aXmax, aYmin+aY/2, aZmin);
|
||||||
@ -161,29 +164,34 @@ Standard_Integer GEOMImpl_SmoothingSurfaceDriver::Execute(TFunction_Logbook& log
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Z Plane
|
// Z Plane
|
||||||
aPnt1 = gp_Pnt(aXmin+aX/2, aYmin, aZmin);
|
cout << "cas 2 " << endl;
|
||||||
aPnt2 = gp_Pnt(aXmin+aX/2, aYmin, aZmax);
|
|
||||||
aPnt3 = gp_Pnt(aXmin+aX/2, aYmax, aZmin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (aY > aZ)
|
|
||||||
{
|
|
||||||
// Y Plane
|
|
||||||
aPnt1 = gp_Pnt(aXmin, aYmin, aZmin+aZ/2);
|
aPnt1 = gp_Pnt(aXmin, aYmin, aZmin+aZ/2);
|
||||||
aPnt2 = gp_Pnt(aXmin, aYmax, aZmin+aZ/2);
|
aPnt2 = gp_Pnt(aXmin, aYmax, aZmin+aZ/2);
|
||||||
aPnt3 = gp_Pnt(aXmax, aYmin, aZmin+aZ/2);
|
aPnt3 = gp_Pnt(aXmax, aYmin, aZmin+aZ/2);
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// aY > aX
|
||||||
|
if (aZ > aX)
|
||||||
{
|
{
|
||||||
// Z Plane
|
// X Plane
|
||||||
|
cout << "cas 3 " << endl;
|
||||||
aPnt1 = gp_Pnt(aXmin+aX/2, aYmin, aZmin);
|
aPnt1 = gp_Pnt(aXmin+aX/2, aYmin, aZmin);
|
||||||
aPnt2 = gp_Pnt(aXmin+aX/2, aYmin, aZmax);
|
aPnt2 = gp_Pnt(aXmin+aX/2, aYmin, aZmax);
|
||||||
aPnt3 = gp_Pnt(aXmin+aX/2, aYmax, aZmin);
|
aPnt3 = gp_Pnt(aXmin+aX/2, aYmax, aZmin);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Z Plane
|
||||||
|
cout << "cas 4 " << endl;
|
||||||
|
aPnt1 = gp_Pnt(aXmin, aYmin, aZmin+aZ/2);
|
||||||
|
aPnt2 = gp_Pnt(aXmin, aYmax, aZmin+aZ/2);
|
||||||
|
aPnt3 = gp_Pnt(aXmax, aYmin, aZmin+aZ/2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
GC_MakePlane aMakePlane (aPnt1, aPnt2, aPnt3);
|
GC_MakePlane aMakePlane (aPnt1, aPnt2, aPnt3);
|
||||||
|
cout << "Not closed " << endl;
|
||||||
double aSize = (aX+aY+aZ)/2;
|
double aSize = (aX+aY+aZ)/2;
|
||||||
#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version
|
#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version
|
||||||
aInitShape = BRepBuilderAPI_MakeFace(aMakePlane, -aSize, aSize, -aSize, aSize, Precision::Confusion()).Face();
|
aInitShape = BRepBuilderAPI_MakeFace(aMakePlane, -aSize, aSize, -aSize, aSize, Precision::Confusion()).Face();
|
||||||
@ -197,6 +205,7 @@ Standard_Integer GEOMImpl_SmoothingSurfaceDriver::Execute(TFunction_Logbook& log
|
|||||||
HSI->ChangeSurface().Initialize(aInitShape);
|
HSI->ChangeSurface().Initialize(aInitShape);
|
||||||
aBuilder.LoadInitSurface( BRep_Tool::Surface(HSI->ChangeSurface().Face()));
|
aBuilder.LoadInitSurface( BRep_Tool::Surface(HSI->ChangeSurface().Face()));
|
||||||
|
|
||||||
|
cout << "Init surface" << endl;
|
||||||
for (int i=1; i<=nbPoints ; i++)
|
for (int i=1; i<=nbPoints ; i++)
|
||||||
{
|
{
|
||||||
Handle(GEOM_Function) aPoint = aData.GetPoint(i);
|
Handle(GEOM_Function) aPoint = aData.GetPoint(i);
|
||||||
@ -206,22 +215,26 @@ Standard_Integer GEOMImpl_SmoothingSurfaceDriver::Execute(TFunction_Logbook& log
|
|||||||
Handle(GeomPlate_PointConstraint) PCont= new GeomPlate_PointConstraint(aPnt,0);
|
Handle(GeomPlate_PointConstraint) PCont= new GeomPlate_PointConstraint(aPnt,0);
|
||||||
aBuilder.Add(PCont);
|
aBuilder.Add(PCont);
|
||||||
}
|
}
|
||||||
|
cout << "avant Perform surface" << endl;
|
||||||
aBuilder.Perform();
|
aBuilder.Perform();
|
||||||
|
cout << "Perform surface" << endl;
|
||||||
|
|
||||||
|
// A ce niveau : surface algo
|
||||||
Handle(GeomPlate_Surface) gpPlate = aBuilder.Surface();
|
Handle(GeomPlate_Surface) gpPlate = aBuilder.Surface();
|
||||||
|
|
||||||
Standard_Integer nbcarreau=9;
|
Standard_Integer nbcarreau=9;
|
||||||
Standard_Integer degmax=8;
|
Standard_Integer degmax=8;
|
||||||
Standard_Real seuil;
|
Standard_Real seuil;
|
||||||
TColgp_SequenceOfXY S2d;
|
/*TColgp_SequenceOfXY S2d;
|
||||||
TColgp_SequenceOfXYZ S3d;
|
TColgp_SequenceOfXYZ S3d;
|
||||||
S2d.Clear();
|
S2d.Clear();
|
||||||
S3d.Clear();
|
S3d.Clear();
|
||||||
aBuilder.Disc2dContour(4,S2d);
|
aBuilder.Disc2dContour(4,S2d);
|
||||||
aBuilder.Disc3dContour(4,0,S3d);
|
aBuilder.Disc3dContour(4,0,S3d);*/
|
||||||
seuil = Max(0.0001,10*aBuilder.G0Error());
|
seuil = Max(0.0001,10*aBuilder.G0Error());
|
||||||
GeomPlate_PlateG0Criterion critere (S2d,S3d,seuil);
|
//GeomPlate_PlateG0Criterion critere (S2d,S3d,seuil);
|
||||||
GeomPlate_MakeApprox Mapp(gpPlate,critere,0.0001,nbcarreau,degmax);
|
GeomPlate_MakeApprox Mapp(gpPlate,0.0001,nbcarreau,degmax,seuil);
|
||||||
|
cout << "Approx surface" << endl;
|
||||||
|
|
||||||
Handle (Geom_Surface) Surf (Mapp.Surface());
|
Handle (Geom_Surface) Surf (Mapp.Surface());
|
||||||
|
|
||||||
@ -230,7 +243,9 @@ Standard_Integer GEOMImpl_SmoothingSurfaceDriver::Execute(TFunction_Logbook& log
|
|||||||
aBuilder.Surface()->Bounds( Umin, Umax, Vmin, Vmax);
|
aBuilder.Surface()->Bounds( Umin, Umax, Vmin, Vmax);
|
||||||
|
|
||||||
BRepBuilderAPI_MakeFace MF(Surf,Umin, Umax, Vmin, Vmax);
|
BRepBuilderAPI_MakeFace MF(Surf,Umin, Umax, Vmin, Vmax);
|
||||||
|
aShape = MF.Shape();
|
||||||
|
cout << "RES surface" << endl;
|
||||||
|
|
||||||
if (aShape.IsNull()) return 0;
|
if (aShape.IsNull()) return 0;
|
||||||
|
|
||||||
aFunction->SetValue(aShape);
|
aFunction->SetValue(aShape);
|
||||||
|
Loading…
Reference in New Issue
Block a user