mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-02 11:00:34 +05:00
Mantis issue 0021454: [CEA] non regression test fails : problem with group creation. A fix by Peter Kurnev.
This commit is contained in:
parent
03a8be76be
commit
d394961f4a
@ -18,16 +18,14 @@
|
|||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
|
||||||
|
|
||||||
// File: GEOMAlgo_FinderShapeOn1.cxx
|
// File: GEOMAlgo_FinderShapeOn1.cxx
|
||||||
// Created: Fri Mar 4 10:31:06 2005
|
// Created: Fri Mar 4 10:31:06 2005
|
||||||
// Author: Peter KURNEV
|
// Author: Peter KURNEV
|
||||||
// <pkv@irinox>
|
|
||||||
//
|
|
||||||
#include <GEOMAlgo_FinderShapeOn1.ixx>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
|
#include <GEOMAlgo_FinderShapeOn1.ixx>
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include <Precision.hxx>
|
#include <Precision.hxx>
|
||||||
#include <TColStd_Array1OfInteger.hxx>
|
#include <TColStd_Array1OfInteger.hxx>
|
||||||
@ -585,20 +583,11 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF,
|
|||||||
iCnt=aIt.Value();
|
iCnt=aIt.Value();
|
||||||
if (iCnt==1) {
|
if (iCnt==1) {
|
||||||
const GEOMAlgo_PassKey& aPK=aIt.Key();
|
const GEOMAlgo_PassKey& aPK=aIt.Key();
|
||||||
//qf
|
//
|
||||||
/*
|
|
||||||
aNbMax=aPK.NbMax();
|
|
||||||
pIds=(Standard_Integer*)aPK.Key();
|
|
||||||
for (k=1; k<3; ++k) {
|
|
||||||
aNx=*(pIds+aNbMax-k);
|
|
||||||
aMBN.Add(aNx);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
aNx=(Standard_Integer)aPK.Id(1);
|
aNx=(Standard_Integer)aPK.Id(1);
|
||||||
aMBN.Add(aNx);
|
aMBN.Add(aNx);
|
||||||
aNx=(Standard_Integer)aPK.Id(2);
|
aNx=(Standard_Integer)aPK.Id(2);
|
||||||
aMBN.Add(aNx);
|
aMBN.Add(aNx);
|
||||||
//qt
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -635,17 +624,10 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF,
|
|||||||
// take the first having occured inner link
|
// take the first having occured inner link
|
||||||
// and discretize it
|
// and discretize it
|
||||||
const GEOMAlgo_PassKey& aPK=aIt.Key();
|
const GEOMAlgo_PassKey& aPK=aIt.Key();
|
||||||
//qf
|
|
||||||
/*
|
|
||||||
aNbMax=aPK.NbMax();
|
|
||||||
pIds=(Standard_Integer*)aPK.Key();
|
|
||||||
aN1=*(pIds+aNbMax-1);
|
|
||||||
aN2=*(pIds+aNbMax-2);
|
|
||||||
*/
|
|
||||||
//
|
//
|
||||||
aN1=(Standard_Integer)aPK.Id(1);
|
aN1=(Standard_Integer)aPK.Id(1);
|
||||||
aN2=(Standard_Integer)aPK.Id(2);
|
aN2=(Standard_Integer)aPK.Id(2);
|
||||||
//qt
|
//
|
||||||
aP1=aNodes(aN1).Transformed(aTrsf);
|
aP1=aNodes(aN1).Transformed(aTrsf);
|
||||||
aP2=aNodes(aN2).Transformed(aTrsf);
|
aP2=aNodes(aN2).Transformed(aTrsf);
|
||||||
//
|
//
|
||||||
@ -677,6 +659,138 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF,
|
|||||||
}// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder)
|
}// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder)
|
||||||
}// if (!aNb && myNbPntsMin) {
|
}// if (!aNb && myNbPntsMin) {
|
||||||
}
|
}
|
||||||
|
//modified by NIZNHY-PKV Thu Jan 26 09:56:20 2012f
|
||||||
|
//=======================================================================
|
||||||
|
//function : InnerPoints
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
|
||||||
|
GEOMAlgo_ListOfPnt& aLP)
|
||||||
|
{
|
||||||
|
Standard_Integer aNbPntsMin;
|
||||||
|
//
|
||||||
|
myErrorStatus=0;
|
||||||
|
aNbPntsMin=21;
|
||||||
|
//
|
||||||
|
aLP.Clear();
|
||||||
|
InnerPoints(aE, aNbPntsMin, aLP);
|
||||||
|
}
|
||||||
|
//modified by NIZNHY-PKV Thu Jan 26 09:56:32 2012t
|
||||||
|
//=======================================================================
|
||||||
|
//function : InnerPoints
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
|
||||||
|
const Standard_Integer aNbPntsMin,
|
||||||
|
GEOMAlgo_ListOfPnt& aLP)
|
||||||
|
{
|
||||||
|
Standard_Boolean bInf1, bInf2;
|
||||||
|
Standard_Integer j, aNbT;
|
||||||
|
Standard_Real dT, aT, aT1, aT2;
|
||||||
|
gp_Pnt aP;
|
||||||
|
Handle(Geom_Curve) aC3D;
|
||||||
|
//
|
||||||
|
aC3D=BRep_Tool::Curve(aE, aT1, aT2);
|
||||||
|
if (aC3D.IsNull()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
bInf1=Precision::IsNegativeInfinite(aT1);
|
||||||
|
bInf2=Precision::IsPositiveInfinite(aT2);
|
||||||
|
if (bInf1 || bInf2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
//modified by NIZNHY-PKV Thu Jan 26 09:51:20 2012f
|
||||||
|
/*
|
||||||
|
aNbT=myNbPntsMin+1;
|
||||||
|
dT=(aT2-aT1)/aNbT;
|
||||||
|
for (j=1; j<=aNbPntsMin; ++j) {
|
||||||
|
aT=aT1+j*dT;
|
||||||
|
aC3D->D0(aT, aP);
|
||||||
|
aLP.Append(aP);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
aNbT=aNbPntsMin+1;
|
||||||
|
dT=(aT2-aT1)/aNbT;
|
||||||
|
for (j=1; j<aNbT; ++j) {
|
||||||
|
aT=aT1+j*dT;
|
||||||
|
aC3D->D0(aT, aP);
|
||||||
|
aLP.Append(aP);
|
||||||
|
}
|
||||||
|
//modified by NIZNHY-PKV Thu Jan 26 09:51:24 2012t
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : CheckData
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_FinderShapeOn1::CheckData()
|
||||||
|
{
|
||||||
|
myErrorStatus=0;
|
||||||
|
//
|
||||||
|
if(mySurface.IsNull()) {
|
||||||
|
myErrorStatus=10; // mySurface=NULL
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (myShape.IsNull()) {
|
||||||
|
myErrorStatus=11; // myShape=NULL
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (!(myShapeType==TopAbs_VERTEX ||
|
||||||
|
myShapeType==TopAbs_EDGE ||
|
||||||
|
myShapeType==TopAbs_FACE ||
|
||||||
|
myShapeType==TopAbs_SOLID)) {
|
||||||
|
myErrorStatus=12; // unallowed subshape type
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (myState==GEOMAlgo_ST_UNKNOWN ||
|
||||||
|
myState==GEOMAlgo_ST_INOUT) {
|
||||||
|
myErrorStatus=13; // unallowed state type
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
GeomAbs_SurfaceType aType;
|
||||||
|
//
|
||||||
|
myGAS.Load(mySurface);
|
||||||
|
aType=myGAS.GetType();
|
||||||
|
if (!(aType==GeomAbs_Plane ||
|
||||||
|
aType==GeomAbs_Cylinder ||
|
||||||
|
aType==GeomAbs_Sphere)) {
|
||||||
|
myErrorStatus=14; // unallowed surface type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : GetPointState
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
TopAbs_State GEOMAlgo_FinderShapeOn1::GetPointState(const gp_Pnt& aP)
|
||||||
|
{
|
||||||
|
TopAbs_State aSt;
|
||||||
|
GEOMAlgo_SurfaceTools::GetState(aP, myGAS, myTolerance, aSt);
|
||||||
|
return aSt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// myErrorStatus :
|
||||||
|
//
|
||||||
|
// 10 -mySurface=NULL
|
||||||
|
// 11 -myShape=NULL
|
||||||
|
// 12 -unallowed type of subshapes
|
||||||
|
// 13 -unallowed state
|
||||||
|
// 14 -unallowed surface type
|
||||||
|
// 15 -unallowed surface type
|
||||||
|
// 20- no triangulation found
|
||||||
|
// 30- can not obtain the line from the link
|
||||||
|
|
||||||
|
//modified by NIZNHY-PKV Thu Jan 26 10:01:14 2012f
|
||||||
|
/*
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : InnerPoints
|
//function : InnerPoints
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -733,159 +847,5 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
|
|||||||
aNb=aLP.Extent();
|
aNb=aLP.Extent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//=======================================================================
|
|
||||||
//function : InnerPoints
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
|
|
||||||
const Standard_Integer aNbPntsMin,
|
|
||||||
GEOMAlgo_ListOfPnt& aLP)
|
|
||||||
{
|
|
||||||
// try to fill it yourself
|
|
||||||
Standard_Boolean bInf1, bInf2;
|
|
||||||
Standard_Integer j, aNbT;
|
|
||||||
Standard_Real dT, aT, aT1, aT2;
|
|
||||||
gp_Pnt aP;
|
|
||||||
Handle(Geom_Curve) aC3D;
|
|
||||||
//
|
|
||||||
aC3D=BRep_Tool::Curve(aE, aT1, aT2);
|
|
||||||
if (aC3D.IsNull()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
bInf1=Precision::IsNegativeInfinite(aT1);
|
|
||||||
bInf2=Precision::IsPositiveInfinite(aT2);
|
|
||||||
if (bInf1 || bInf2) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aNbT=myNbPntsMin+1;
|
|
||||||
dT=(aT2-aT1)/aNbT;
|
|
||||||
for (j=1; j<=aNbPntsMin; ++j) {
|
|
||||||
aT=aT1+j*dT;
|
|
||||||
aC3D->D0(aT, aP);
|
|
||||||
aLP.Append(aP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : CheckData
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void GEOMAlgo_FinderShapeOn1::CheckData()
|
|
||||||
{
|
|
||||||
myErrorStatus=0;
|
|
||||||
//
|
|
||||||
if(mySurface.IsNull()) {
|
|
||||||
myErrorStatus=10; // mySurface=NULL
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (myShape.IsNull()) {
|
|
||||||
myErrorStatus=11; // myShape=NULL
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (!(myShapeType==TopAbs_VERTEX ||
|
|
||||||
myShapeType==TopAbs_EDGE ||
|
|
||||||
myShapeType==TopAbs_FACE ||
|
|
||||||
myShapeType==TopAbs_SOLID)) {
|
|
||||||
myErrorStatus=12; // unallowed sub-shape type
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (myState==GEOMAlgo_ST_UNKNOWN ||
|
|
||||||
myState==GEOMAlgo_ST_INOUT) {
|
|
||||||
myErrorStatus=13; // unallowed state type
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
GeomAbs_SurfaceType aType;
|
|
||||||
//
|
|
||||||
myGAS.Load(mySurface);
|
|
||||||
aType=myGAS.GetType();
|
|
||||||
if (!(aType==GeomAbs_Plane ||
|
|
||||||
aType==GeomAbs_Cylinder ||
|
|
||||||
aType==GeomAbs_Sphere)) {
|
|
||||||
myErrorStatus=14; // unallowed surface type
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetPointState
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
TopAbs_State GEOMAlgo_FinderShapeOn1::GetPointState(const gp_Pnt& aP)
|
|
||||||
{
|
|
||||||
TopAbs_State aSt;
|
|
||||||
GEOMAlgo_SurfaceTools::GetState(aP, myGAS, myTolerance, aSt);
|
|
||||||
return aSt;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// myErrorStatus :
|
|
||||||
//
|
|
||||||
// 10 -mySurface=NULL
|
|
||||||
// 11 -myShape=NULL
|
|
||||||
// 12 -unallowed type of sub-shapes
|
|
||||||
// 13 -unallowed state
|
|
||||||
// 14 -unallowed surface type
|
|
||||||
// 15 -unallowed surface type
|
|
||||||
// 20- no triangulation found
|
|
||||||
// 30- can not obtain the line from the link
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
// Chronometer
|
|
||||||
#include <OSD_Chronometer.hxx>
|
|
||||||
#include <Standard_Static.hxx>
|
|
||||||
|
|
||||||
Standard_STATIC(OSD_Chronometer, x_S_Chrono);
|
|
||||||
static void x_StartChrono();
|
|
||||||
static void x_StopChrono();
|
|
||||||
static Standard_Boolean x_IsToShow();
|
|
||||||
//
|
|
||||||
//=======================================================================
|
|
||||||
//function : x_StartChrono
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void x_StartChrono()
|
|
||||||
{
|
|
||||||
if (x_IsToShow()){
|
|
||||||
x_S_Chrono().Reset();
|
|
||||||
x_S_Chrono().Start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : x_StopChrono
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void x_StopChrono()
|
|
||||||
{
|
|
||||||
if (x_IsToShow()){
|
|
||||||
Standard_Real Chrono;
|
|
||||||
x_S_Chrono().Stop();
|
|
||||||
x_S_Chrono().Show(Chrono);
|
|
||||||
printf(" Tps: %lf\n", Chrono);
|
|
||||||
//cout << "Tps: " << Chrono << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : x_IsToShow
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean x_IsToShow()
|
|
||||||
{
|
|
||||||
Standard_Boolean bFlag=Standard_False;
|
|
||||||
//
|
|
||||||
char *xr=getenv ("STDCHRONO");
|
|
||||||
if (xr!=NULL){
|
|
||||||
if (!strcmp (xr, "yes")) {
|
|
||||||
bFlag=!bFlag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bFlag;
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
//modified by NIZNHY-PKV Thu Jan 26 10:01:17 2012t
|
||||||
|
Loading…
Reference in New Issue
Block a user