1 /*
2 * SmoothCurve.hpp
3 *
4 */
5
6 #ifndef SMOOTHCURVE_HPP_
7 #define SMOOTHCURVE_HPP_
8
9 #include "moab/Interface.hpp"
10 #include "moab/Forward.hpp"
11 #include "moab/CartVect.hpp"
12
13 //#include "RefEdge.hpp"
14 //#include "SmoothFace.hpp"
15
16 #include <map>
17 #include <vector>
18
19 namespace moab
20 {
21 class SmoothFace;
22 class GeomTopoTool;
23 // class SmoothVertex;
24
25 // class CMLEdgeMesher;
26 // evaluator for Camal Edge Mesher
27 // this is really copying what Cubit is doing
28
29 class SmoothCurve
30 {
31 public:
32 // SmoothCurve(RefEdge * edge, SmoothFace * smoothFaceEval, int loopIndex);
33 SmoothCurve( Interface* mb, EntityHandle curve,
34 GeomTopoTool* gTool ); // the new constructor, which will use
35 // sense entities to establish the control points on feature edges (geo edges, sets of mesh
36 // edges)
37 virtual ~SmoothCurve();
38
39 virtual double arc_length();
40
41 //! \brief Get the parametric status of the curve.
42 //!
43 //! \return \a true if curve is parametric, \a false otherwise.
44 virtual bool is_parametric();
45
46 //! \brief Get the periodic status of the curve.
47 //!
48 //! \param period The period of the curve if periodic.
49 //!
50 //! \return \a true if curve is periodic, \a false otherwise.
51 virtual bool is_periodic( double& period );
52
53 //! \brief Get the parameter range of the curve.
54 //!
55 //! \param u_start The beginning curve parameter
56 //! \param u_end The ending curve parameter
57 //!
58 //! \note The numerical value of \a u_start may be greater
59 //! than the numerical value of \a u_end.
60 virtual void get_param_range( double& u_start, double& u_end );
61
62 //! Compute the parameter value at a specified distance along the curve.
63 //!
64 //! \param u_root The start parameter from which to compute the distance
65 //! along the curve.
66 //! \param arc_length The distance to move along the curve.
67 //!
68 //! \note For positive values of \a arc_length the distance will be
69 //! computed in the direction of increasing parameter value along the
70 //! curve. For negative values of \a arc_length the distance will be
71 //! computed in the direction of decreasing parameter value along the
72 //! curve.
73 //!
74 //! \return The parametric coordinate u along the curve
75 virtual double u_from_arc_length( double u_root, double arc_length );
76
77 //! \brief Evaluate the curve at a specified parameter value.
78 //!
79 //! \param u The parameter at which to evaluate the curve
80 //! \param x The x coordinate of the evaluated point
81 //! \param y The y coordinate of the evaluated point
82 //! \param z The z coordinate of the evaluated point
83 // ! \param tg, if not null, return the tangent too at u
84 virtual bool position_from_u( double u, double& x, double& y, double& z, double* tg = NULL );
85
86 //! \brief Move a point near the curve to the closest point on the curve.
87 //!
88 //! \param x The x coordinate of the point
89 //! \param y The y coordinate of the point
90 //! \param z The z coordinate of the point
91 virtual void move_to_curve( double& x, double& y, double& z );
92
93 //! Get the u parameter value on the curve closest to x,y,z
94 //! and the point on the curve.
95 //!
96 //! \param x The x coordinate of the point
97 //! \param y The y coordinate of the point
98 //! \param z The z coordinate of the point
99 //!
100 //! \return The parametric coordinate u on the curve
101 virtual double u_from_position( double x, double y, double z, EntityHandle& v, int& indexEdge );
102
103 //! \brief Get the starting point of the curve.
104 //!
105 //! \param x The x coordinate of the start point
106 //! \param y The y coordinate of the start point
107 //! \param z The z coordinate of the start point
108 virtual void start_coordinates( double& x, double& y, double& z );
109
110 //! \brief Get the ending point of the curve.
111 //!
112 //! \param x The x coordinate of the start point
113 //! \param y The y coordinate of the start point
114 //! \param z The z coordinate of the start point
115 virtual void end_coordinates( double& x, double& y, double& z );
116
117 // this will recompute the 2 tangents for each edge, considering the geo edge they are into
118 void compute_tangents_for_each_edge();
119
120 void compute_control_points_on_boundary_edges( double min_dot,
121 std::map< EntityHandle, SmoothFace* >& mapSurfaces,
122 Tag controlPointsTag,
123 Tag markTag );
124
125 ErrorCode evaluate_smooth_edge( EntityHandle eh, double& tt, CartVect& outv, CartVect& out_tangent );
126
127 private:
128 std::vector< EntityHandle > _entities; // the mesh edges are stored here for fast access
129 double _leng;
130 std::vector< double > _fractions; // they are increasing from 0. to 1., do we need these?
131 // this will be decided apriori, and eventually reset for paver
132 // fractions will be from 0.0.. to 1.0, they will be decided upon the length of the geo edge
133
134 Tag _edgeTag;
135
136 Interface* _mb;
137 EntityHandle _set;
138 GeomTopoTool* _gtt;
139 };
140
141 } // namespace moab
142 #endif /* SMOOTHCURVE_HPP_ */