X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMUtils%2FGEOMUtils.hxx;h=ba6b7d0459d4091d352eb0eb7b292c540ed0d226;hb=HEAD;hp=b6c5752e3a20648f78d363d6969678859243cde9;hpb=df260abc619ded3d424fed72772226ca63e3c90b;p=modules%2Fgeom.git diff --git a/src/GEOMUtils/GEOMUtils.hxx b/src/GEOMUtils/GEOMUtils.hxx index b6c5752e3..ba6b7d045 100644 --- a/src/GEOMUtils/GEOMUtils.hxx +++ b/src/GEOMUtils/GEOMUtils.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2020 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 @@ -74,13 +74,13 @@ namespace GEOMUtils * \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 @@ -116,7 +116,7 @@ namespace GEOMUtils * \brief Sort shapes in the list by their coordinates. * \param SL The list of shapes to sort. */ - struct CompareShapes : public std::binary_function + struct CompareShapes //: public std::binary_function { CompareShapes (bool isOldSorting) : myIsOldSorting(isOldSorting) {} @@ -155,13 +155,6 @@ namespace GEOMUtils 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. @@ -201,7 +194,7 @@ namespace GEOMUtils 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. * @@ -214,7 +207,22 @@ namespace GEOMUtils 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. * @@ -261,7 +269,7 @@ namespace GEOMUtils * operation or \c false otherwise */ Standard_EXPORT bool CheckBOPArguments(const TopoDS_Shape &theShape); - + /*! * \brief Limit shape tolerance to the given value * @@ -299,13 +307,13 @@ namespace GEOMUtils /*! * \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 */ @@ -319,7 +327,7 @@ namespace GEOMUtils */ Standard_EXPORT bool Write( const TopoDS_Shape& shape, const char* fileName ); - + /*! * \brief Extract single SOLID from COMPSOLID or COMPOUND. * @@ -333,20 +341,38 @@ namespace GEOMUtils 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. @@ -390,6 +416,6 @@ namespace GEOMUtils const double theTolShape, const double theTolRef); -}; +} #endif