typedef sequence<string> string_array;
typedef sequence<short> short_array;
+ typedef sequence<boolean> ListOfBool;
typedef sequence<long> ListOfLong;
typedef sequence<double> ListOfDouble;
*/
string WhatIs (in GEOM_Object theShape);
+ /*!
+ * Check if points defined by coords = [x1, y1, z1, x2, y2, z2, ...] are inside or on
+ * the shape theShape.
+ * \param theShape Shape to check.
+ * \param coords list of coordinates.
+ * \param tolerance tolerance.
+ * \return list of boolean.
+ */
+ ListOfBool AreCoordsInside(in GEOM_Object theShape, in ListOfDouble coords, in double tolerance);
+
/*!
* Get minimal distance between the given shapes.
* \param theShape1,theShape2 Shapes to find minimal distance between.
*/
+//=============================================================================
+/*!
+ * AreCoordsInside
+ */
+//=============================================================================
+std::vector<bool> GEOMImpl_IMeasureOperations::AreCoordsInside(Handle(GEOM_Object) theShape,
+ const std::vector<double>& coords,
+ double tolerance)
+{
+ std::vector<bool> res;
+ if (!theShape.IsNull()) {
+ Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
+ if (!aRefShape.IsNull()) {
+ TopoDS_Shape aShape = aRefShape->GetValue();
+ if (!aShape.IsNull()) {
+ BRepClass3d_SolidClassifier SC(aShape);
+ unsigned int nb_points = coords.size()/3;
+ for (int i = 0; i < nb_points; i++) {
+ double x = coords[3*i];
+ double y = coords[3*i+1];
+ double z = coords[3*i+2];
+ gp_Pnt aPnt(x, y, z);
+ SC.Perform(aPnt, tolerance);
+ res.push_back( ( SC.State() == TopAbs_IN ) || ( SC.State() == TopAbs_ON ) );
+ }
+ }
+ }
+ }
+ return res;
+}
+
//=============================================================================
/*!
* GetMinDistance
#include <TColStd_HSequenceOfReal.hxx>
#include <gp_Ax3.hxx>
#include <Geom_Surface.hxx>
+#include <Precision.hxx>
class GEOM_Engine;
class Handle(GEOM_Object);
Standard_EXPORT TCollection_AsciiString WhatIs (Handle(GEOM_Object) theShape);
+ Standard_EXPORT std::vector<bool> AreCoordsInside (Handle(GEOM_Object) theShape,
+ const std::vector<double>& coords,
+ double tolerance = Precision::Confusion());
+
Standard_EXPORT Standard_Real GetMinDistance (Handle(GEOM_Object) theShape1,
Handle(GEOM_Object) theShape2,
Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1,
return CORBA::string_dup(aDescription.ToCString());
}
+//=============================================================================
+/*!
+ * AreCoordsInside
+ */
+//=============================================================================
+GEOM::ListOfBool* GEOM_IMeasureOperations_i::AreCoordsInside (GEOM::GEOM_Object_ptr theShape,
+ const GEOM::ListOfDouble& theCoords,
+ CORBA::Double tolerance)
+{
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ unsigned int nb_points = theCoords.length()/3;
+
+ GEOM::ListOfBool_var aResults = new GEOM::ListOfBool;
+ aResults->length(nb_points);
+
+ Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+
+ std::vector<double> tmp(3*nb_points);
+ for (int i = 0; i < 3*nb_points; i++)
+ tmp[i] = theCoords[i];
+ std::vector<bool> res = GetOperations()->AreCoordsInside(aShape, tmp, tolerance);
+ for (int i = 0; i < nb_points; i++)
+ aResults[i] = i < res.size() ? res[i] : false;
+ return aResults._retn();
+}
+
//=============================================================================
/*!
* GetMinDistance
char* WhatIs (GEOM::GEOM_Object_ptr theShape);
+ GEOM::ListOfBool* AreCoordsInside (GEOM::GEOM_Object_ptr theShape,
+ const GEOM::ListOfDouble& theCoords,
+ CORBA::Double theTolerance);
+
CORBA::Double GetMinDistance (GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2,
CORBA::Double& X1, CORBA::Double& Y1, CORBA::Double& Z1,
RaiseIfFailed("GetInertia", self.MeasuOp)
return aTuple
+ ## Get if coords are included in the shape (ST_IN or ST_ON)
+ # @param theShape Shape
+ # @param coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...]
+ # @param tolerance to be used (default is 1.0e-7)
+ # @return list_of_boolean = [res1, res2, ...]
+ def AreCoordsInside(self, theShape, coords, tolerance=1.e-7):
+ return self.MeasuOp.AreCoordsInside(theShape, coords, tolerance)
+
## Get minimal distance between the given shapes.
# @param theShape1,theShape2 Shapes to find minimal distance between.
# @return Value of the minimal distance between the given shapes.