-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
* \brief Compute numerical functor for the shape.
*
* Resulting value can be used to sort out shapes according to some parameter.
- *
+ *
* Returns a pair of two values (dist, functor) where
* - \a dist is a some value that is computed according to the center of mass of given shape;
* - \a functor is a numerical functor value
*
* The numerical functor is computed according to the shape's topological properties as follows:
- * - orientation for vertices
+ * - orientation for vertices
* - length for edges and wires
* - area for faces and shells
* - volume for solids, compounds, compsolids
* \brief Sort shapes in the list by their coordinates.
* \param SL The list of shapes to sort.
*/
- struct CompareShapes : public std::binary_function<TopoDS_Shape, TopoDS_Shape, bool>
+ struct CompareShapes //: public std::binary_function<TopoDS_Shape, TopoDS_Shape, bool>
{
CompareShapes (bool isOldSorting)
: myIsOldSorting(isOldSorting) {}
Standard_EXPORT void AddSimpleShapes (const TopoDS_Shape& theShape,
TopTools_ListOfShape& theList);
- /*!
- * \brief Build a triangulation on \a theShape if it is absent.
- * \param theShape The shape to check/build triangulation on.
- * \retval bool Returns false if the shape has no faces, i.e. impossible to build triangulation.
- */
- Standard_EXPORT bool CheckTriangulation (const TopoDS_Shape& theShape);
-
/*!
* \brief Return type of shape for explode. In case of compound it will be a type of its first sub shape.
* \param theShape The shape to get type of.
Standard_EXPORT Standard_Real GetMinDistanceSingular(const TopoDS_Shape& aSh1,
const TopoDS_Shape& aSh2,
gp_Pnt& Ptmp1, gp_Pnt& Ptmp2);
-
+
/*!
* \brief Computes minumal distance between two shapes.
*
Standard_EXPORT Standard_Real GetMinDistance(const TopoDS_Shape& theShape1,
const TopoDS_Shape& theShape2,
gp_Pnt& thePnt1, gp_Pnt& thePnt2);
-
+
+ /*!
+ * \brief Computes normal projection of \a thePoint to \a theFace.
+ *
+ * \param thePoint the 3d point
+ * \param theFace the face shape
+ * \param theU the output U parameter of the point on the face
+ * \param theV the output V parameter of the point on the face
+ * \param theTol the tolerance value. Maximum of theTol and 1e-04 will be used for calculation.
+ * \retval the projection (3d point) if found, throws an exception otherwise
+ */
+ Standard_EXPORT gp_Pnt ProjectPointOnFace(const gp_Pnt& thePoint,
+ const TopoDS_Shape& theFace,
+ double& theU, double& theV,
+ const double theTol = 1e-04);
+
/*!
* \brief Returns the point clicked in 3D view.
*
Standard_EXPORT bool CheckShape( TopoDS_Shape& shape, bool checkGeometry = false );
/*!
- * \brief Check boolean and partition operations agruments
+ * \brief Check boolean and partition operations arguments
*
- * \param theShape the agrument of an operation to be checked
- * \return \c true if the agrument is valid for a boolean or partition
+ * \param theShape the argument of an operation to be checked
+ * \return \c true if the argument is valid for a boolean or partition
* operation or \c false otherwise
*/
Standard_EXPORT bool CheckBOPArguments(const TopoDS_Shape &theShape);
-
+
/*!
* \brief Limit shape tolerance to the given value
*
/*!
* \brief Fix curves of the given shape
- *
+ *
* The function checks each curve of the input shape in the following way:
* - compute deviation of the curve from the underlying surface in a set of points
* computed with the certain discretization step value
* - find maximum tolerance between computed deviation values
* - limit tolerance of the curve with the computed maximum value
- *
+ *
* \param shape shape being fixed
* \return \c true if resulting shape is valid
*/
*/
Standard_EXPORT bool Write( const TopoDS_Shape& shape,
const char* fileName );
-
+
/*!
* \brief Extract single SOLID from COMPSOLID or COMPOUND.
*
- * If the argument shape is a COMPUND or COMPSOLID and there's
+ * If the argument shape is a COMPOUND or COMPSOLID and there's
* only single simple-shape type inside, this sub-shape is returned as a result;
* otherwise, the shape is not changed.
*
Standard_EXPORT TopoDS_Shape ReduceCompound( const TopoDS_Shape& shape );
/*!
- * \brief Generate triangulation for the shape.
+ * \brief Get default deflection coefficient used for triangulation
+ * \return default deflection value
+ */
+ Standard_EXPORT double DefaultDeflection();
+
+ /*!
+ * \brief Generate triangulation for \a theShape.
*
- * \param shape shape being meshed
- * \param deflection deflection coefficient to be used
- * \param forced if \c true, causes generation of mesh regardless it is already present in the shape
+ * \param theShape shape to be meshed.
+ * \param theDeflection deflection coefficient to be used.
+ * \param theForced if \c true, causes generation of mesh regardless it is already present in the shape.
+ * \param theAngleDeflection angular deflection coefficient to be used.
+ * \param isRelative if true, \a theDeflection is considered relative to \a theShape maximum axial dimension.
+ * \param doPostCheck if true, check mesh generation result and return corresponding boolean value.
+ * \retval bool Returns false in the following cases:
+ * 1. The shape has neither faces nor edges, i.e. impossible to build triangulation or polygon.
+ * 2. \a theForced is false and \a theShape has no mesh or has incomplete mesh.
+ * 3. \a doPostCheck is true and mesh generation failed or produced an incomplete mesh.
*/
- Standard_EXPORT void MeshShape( const TopoDS_Shape shape,
- double deflection, bool forced = true );
+ Standard_EXPORT bool MeshShape( const TopoDS_Shape theShape,
+ const double theDeflection = DefaultDeflection(),
+ const bool theForced = true,
+ const double theAngleDeflection = 0.5,
+ const bool isRelative = true,
+ const bool doPostCheck = false);
/*!
- * \brief Get default deflection coefficient used for triangulation
- * \return default deflection value
+ * \brief Build a triangulation on \a theShape if it is absent.
+ * \param theShape The shape to check/build triangulation on.
+ * \retval bool Returns false if the shape has no faces, i.e. impossible to build triangulation.
*/
- Standard_EXPORT double DefaultDeflection();
+ Standard_EXPORT bool CheckTriangulation (const TopoDS_Shape& theShape);
/**
* \brief Check if the shape is not a closed wire or edge.
const double theTolShape,
const double theTolRef);
-};
+}
#endif