#include "SMESH_SMESH.hxx"
-#include <Geom2d_Curve.hxx>
-#include <Geom_Curve.hxx>
-#include <Geom_Surface.hxx>
+//#include <Geom2d_Curve.hxx>
+//#include <Geom_Curve.hxx>
+//#include <Geom_Surface.hxx>
+
#include <TopExp.hxx>
#include <TopTools_IndexedMapOfOrientedShape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Vertex.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Trsf.hxx>
#include <gp_XY.hxx>
#include <gp_XYZ.hxx>
#include <math_FunctionSetWithDerivatives.hxx>
-#include <math_Matrix.hxx>
-#include <math_Vector.hxx>
#include <ostream>
#include <vector>
class Adaptor3d_Surface;
class Adaptor2d_Curve2d;
class Adaptor3d_Curve;
+class gp_Pnt;
// =========================================================
// class calculating coordinates of 3D points by normalized
// ShapeIndex( ID_Ex00 ) == 0
// ShapeIndex( ID_Ex10 ) == 1
- static void GetFaceEdgesIDs (const int faceID, vector< int >& edgeVec );
+ static void GetFaceEdgesIDs (const int faceID, std::vector< int >& edgeVec );
// return edges IDs of a face in the order u0, u1, 0v, 1v
- static void GetEdgeVertexIDs (const int edgeID, vector< int >& vertexVec );
+ static void GetEdgeVertexIDs (const int edgeID, std::vector< int >& vertexVec );
// return vertex IDs of an edge
static int GetCoordIndOnEdge (const int theEdgeID)
static int GetShapeIDByParams ( const gp_XYZ& theParams );
// define an id of the block sub-shape by point parameters
- static ostream& DumpShapeID (const int theBlockShapeID, ostream& stream);
+ static std::ostream& DumpShapeID (const int theBlockShapeID, std::ostream& stream);
// DEBUG: dump an id of a block sub-shape
// Initialization
// ---------------
- SMESH_Block (): myNbIterations(0), mySumDist(0.) {}
+ SMESH_Block();
bool LoadBlockShapes(const TopoDS_Shell& theShell,
const TopoDS_Vertex& theVertex000,
bool LoadMeshBlock(const SMDS_MeshVolume* theVolume,
const int theNode000Index,
const int theNode001Index,
- vector<const SMDS_MeshNode*>& theOrderedNodes);
+ std::vector<const SMDS_MeshNode*>& theOrderedNodes);
// prepare to work with theVolume and
// return nodes in theVolume corners in the order of TShapeID enum
// return coordinates of a point in shell
static bool ShellPoint(const gp_XYZ& theParams,
- const vector<gp_XYZ>& thePointOnShape,
+ const std::vector<gp_XYZ>& thePointOnShape,
gp_XYZ& thePoint );
// computes coordinates of a point in shell by points on sub-shapes
// and point parameters.
bool ComputeParameters (const gp_Pnt& thePoint,
gp_XYZ& theParams,
- const int theShapeID = ID_Shell);
+ const int theShapeID = ID_Shell,
+ const gp_XYZ& theParamsHint = gp_XYZ(-1,-1,-1));
// compute point parameters in the block.
// Note: for edges, it is better to use EdgeParameters()
// Note: to compute params of a point on a face, it is enough to set
// TFace, TEdge's and points for that face only
+ // Note 2: curve adaptors need to have only Value(double), FirstParameter() and
+ // LastParameter() defined to be used by Block algoritms
+
class SMESH_EXPORT TEdge {
int myCoordInd;
double myFirst;
// for param computation
+ enum { SQUARE_DIST = 0, DRV_1, DRV_2, DRV_3 };
+ double distance () const { return sqrt( myValues[ SQUARE_DIST ]); }
+ double funcValue(double sqDist) const { return mySquareFunc ? sqDist : sqrt(sqDist); }
+ bool computeParameters(const gp_Pnt& thePoint, gp_XYZ& theParams, const gp_XYZ& theParamsHint);
+
int myFaceIndex;
double myFaceParam;
int myNbIterations;
double mySumDist;
+ double myTolerance;
+ bool mySquareFunc;
gp_XYZ myPoint; // the given point
gp_XYZ myParam; // the best parameters guess
- double myValues[ 4 ]; // values computed at myParam: function value and 3 derivatives
+ double myValues[ 4 ]; // values computed at myParam: square distance and 3 derivatives
- typedef pair<gp_XYZ,gp_XYZ> TxyzPair;
+ typedef std::pair<gp_XYZ,gp_XYZ> TxyzPair;
TxyzPair my3x3x3GridNodes[ 27 ]; // to compute the first param guess
bool myGridComputed;
};