* Constructor
*/
//=============================================================================
-GEOMImpl_IMeasureOperations::GEOMImpl_IMeasureOperations (GEOM_Engine* theEngine, int theDocID)
-: GEOM_IOperations(theEngine, theDocID)
+GEOMImpl_IMeasureOperations::GEOMImpl_IMeasureOperations (GEOM_Engine* theEngine)
+: GEOM_IOperations(theEngine)
{
MESSAGE("GEOMImpl_IMeasureOperations::GEOMImpl_IMeasureOperations");
}
return SK_LCS;
}
- // Interprete results
+ // Interpret results
TopAbs_ShapeEnum aType = anInfo.Type();
switch (aType)
{
theDoubles->Append(aP.Z());
}
break;
+ default:;
}
SetErrorCode(OK);
if (theShape.IsNull()) return NULL;
//Add a new CentreOfMass object
- Handle(GEOM_Object) aCDG = GetEngine()->AddObject(GetDocID(), GEOM_CDG);
+ Handle(GEOM_Object) aCDG = GetEngine()->AddObject(GEOM_CDG);
//Add a new CentreOfMass function
Handle(GEOM_Function) aFunction =
if (aRefShape.IsNull()) return NULL;
//Add a new Vertex object
- Handle(GEOM_Object) aVertex = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
+ Handle(GEOM_Object) aVertex = GetEngine()->AddObject(GEOM_POINT);
//Add a function
Handle(GEOM_Function) aFunction =
if (theFace.IsNull()) return NULL;
//Add a new Normale object
- Handle(GEOM_Object) aNorm = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR);
+ Handle(GEOM_Object) aNorm = GetEngine()->AddObject(GEOM_VECTOR);
//Add a new Normale function
Handle(GEOM_Function) aFunction =
if (theShape.IsNull()) return NULL;
//Add a new BoundingBox object
- Handle(GEOM_Object) aBnd = GetEngine()->AddObject(GetDocID(), GEOM_BOX);
+ Handle(GEOM_Object) aBnd = GetEngine()->AddObject(GEOM_BOX);
//Add a new BoundingBox function
const int aType = (precise ? BND_BOX_MEASURE_PRECISE : BND_BOX_MEASURE);
//=============================================================================
bool GEOMImpl_IMeasureOperations::CheckSelfIntersectionsFast
(Handle(GEOM_Object) theShape,
- float theDeflection, double theTolerance,
+ float theDeflection, double theTolerance,
Handle(TColStd_HSequenceOfInteger)& theIntersections)
{
SetErrorCode(KO);
aListOfShape.Append(s);
nbTypes[s.ShapeType()]++;
if ((sp.ShapeType() == TopAbs_COMPOUND) || (sp.ShapeType() == TopAbs_COMPSOLID)) {
- nbFlatType[s.ShapeType()]++;
+ nbFlatType[s.ShapeType()]++;
}
}
}
if ((aShape.ShapeType() == TopAbs_COMPOUND) || (aShape.ShapeType() == TopAbs_COMPSOLID)){
Astr = Astr + " --------------------- \n Flat content : \n";
if (nbFlatType[TopAbs_VERTEX] > 0)
- Astr = Astr + " VERTEX : " + TCollection_AsciiString(nbFlatType[TopAbs_VERTEX]) + "\n";
+ Astr = Astr + " VERTEX : " + TCollection_AsciiString(nbFlatType[TopAbs_VERTEX]) + "\n";
if (nbFlatType[TopAbs_EDGE] > 0)
- Astr = Astr + " EDGE : " + TCollection_AsciiString(nbFlatType[TopAbs_EDGE]) + "\n";
+ Astr = Astr + " EDGE : " + TCollection_AsciiString(nbFlatType[TopAbs_EDGE]) + "\n";
if (nbFlatType[TopAbs_WIRE] > 0)
- Astr = Astr + " WIRE : " + TCollection_AsciiString(nbFlatType[TopAbs_WIRE]) + "\n";
+ Astr = Astr + " WIRE : " + TCollection_AsciiString(nbFlatType[TopAbs_WIRE]) + "\n";
if (nbFlatType[TopAbs_FACE] > 0)
- Astr = Astr + " FACE : " + TCollection_AsciiString(nbFlatType[TopAbs_FACE]) + "\n";
+ Astr = Astr + " FACE : " + TCollection_AsciiString(nbFlatType[TopAbs_FACE]) + "\n";
if (nbFlatType[TopAbs_SHELL] > 0)
- Astr = Astr + " SHELL : " + TCollection_AsciiString(nbFlatType[TopAbs_SHELL]) + "\n";
+ Astr = Astr + " SHELL : " + TCollection_AsciiString(nbFlatType[TopAbs_SHELL]) + "\n";
if (nbFlatType[TopAbs_SOLID] > 0)
- Astr = Astr + " SOLID : " + TCollection_AsciiString(nbFlatType[TopAbs_SOLID]) + "\n";
+ Astr = Astr + " SOLID : " + TCollection_AsciiString(nbFlatType[TopAbs_SOLID]) + "\n";
}
}
catch (Standard_Failure& aFail) {
// skl 30.06.2008
// additional workaround for bugs 19899, 19908 and 19910 from Mantis
- gp_Pnt P1, P2;
- double dist = GEOMUtils::GetMinDistanceSingular(aShape1, aShape2, P1, P2);
- if (dist > -1.0) {
- nbSolutions = 1;
-
- theDoubles->Append(P1.X());
- theDoubles->Append(P1.Y());
- theDoubles->Append(P1.Z());
- theDoubles->Append(P2.X());
- theDoubles->Append(P2.Y());
- theDoubles->Append(P2.Z());
-
- SetErrorCode(OK);
- return nbSolutions;
- }
+ gp_Pnt P1s, P2s;
+ double dist = GEOMUtils::GetMinDistanceSingular(aShape1, aShape2, P1s, P2s);
+ bool singularBetter = dist >= 0;
BRepExtrema_DistShapeShape dst (aShape1, aShape2);
if (dst.IsDone()) {
for (int i = 1; i <= nbSolutions; i++) {
P1 = dst.PointOnShape1(i);
P2 = dst.PointOnShape2(i);
-
+
theDoubles->Append(P1.X());
theDoubles->Append(P1.Y());
theDoubles->Append(P1.Z());
theDoubles->Append(P2.X());
theDoubles->Append(P2.Y());
theDoubles->Append(P2.Z());
+
+ Standard_Real Dist = P1.Distance(P2);
+ singularBetter = singularBetter && dist < Dist;
}
}
+
+ if (singularBetter) {
+ if (theDoubles.IsNull()) theDoubles = new TColStd_HSequenceOfReal;
+ else theDoubles->Clear();
+
+ nbSolutions = 1;
+
+ theDoubles->Append(P1s.X());
+ theDoubles->Append(P1s.Y());
+ theDoubles->Append(P1s.Z());
+ theDoubles->Append(P2s.X());
+ theDoubles->Append(P2s.Y());
+ theDoubles->Append(P2s.Z());
+ }
}
catch (Standard_Failure& aFail) {
SetErrorCode(aFail.GetMessageString());