00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef ROUTINE_H
00028 #define ROUTINE_H
00029
00030
00031
00032 #include <vector>
00033
00034
00035
00036
00037 #include <Mod/Mesh/App/Core/MeshKernel.h>
00038 #include <Mod/Mesh/App/Core/TopoAlgorithm.h>
00039 #include <Mod/Mesh/App/Core/Iterator.h>
00040 #include <Mod/Mesh/App/MeshPy.h>
00041 #include <Mod/Mesh/App/Mesh.h>
00042
00043
00044
00048 typedef struct
00049 {
00050 std::vector<double> CntrlArray;
00051 std::vector<double> KnotU;
00052 std::vector<double> KnotV;
00053 int MaxKnotU;
00054 int MaxKnotV;
00055 int MaxU;
00056 int MaxV;
00057 int DegreeU;
00058 int DegreeV;
00059 }NURBS;
00060
00061
00062
00070 class CamExport Routines
00071 {
00072 public:
00073
00074 static std::vector<double> NewtonStep(std::vector<double> &F,std::vector<std::vector<double> > &DF);
00075 protected:
00076 double TrapezoidIntergration(const std::vector<double> &WithRespectTo, const std::vector<double> &Intergral);
00077
00078 void CramerSolve(std::vector< std::vector<double> > &RHS1, std::vector<double>& RHS2, std::vector<double> &LHS);
00079 double CalcAngle(Base::Vector3f a, Base::Vector3f b, Base::Vector3f c);
00081 inline double det2(std::vector< std::vector<double> > &Matrix)
00082 {
00083 return ((Matrix[0][0] * Matrix[1][1]) - (Matrix[0][1] * Matrix[1][0]));
00084 };
00085
00086 double AreaTriangle(Base::Vector3f &a, Base::Vector3f &b, Base::Vector3f &c);
00087
00088
00089 int FindSpan(int n, int p, double u, std::vector<double> KnotSequence);
00090 void DersBasisFuns(int i, double u, int p, int n,
00091 std::vector<double> &KnotSequence, std::vector< std::vector<double> > &Derivate);
00092 void Basisfun(int i, double u, int p, std::vector<double> &KnotSequence, std::vector<double> &output);
00093 void NrbDEval(NURBS &MainNurb, std::vector<NURBS> &DerivNurb, std::vector<double> &Point,
00094 std::vector<double> &EvalPoint, std::vector<std::vector<double> > &jac);
00095 void PointNrbEval(std::vector<double> &p, std::vector<double> &CurPoint, NURBS &MainNurb);
00096 void PointBSPEval(int DegreeU, std::vector< std::vector<double> > &Cntrl, std::vector<double> &KnotSequence,
00097 std::vector< double > &Output, double CurEvalPoint);
00098 void PointNrbDerivate(NURBS MainNurb, std::vector<NURBS> &OutNurbs);
00099 void bspderiv(int d, std::vector< std::vector<double> > &c, std::vector<double> &k,
00100 std::vector< std::vector<double> > &OutputC, std::vector<double> &Outputk);
00101 void ExtendKnot(double ErrPnt, int NurbDegree, int MaxCntrl, std::vector<double> &KnotSequence);
00102 void Extension(std::vector<double> &KnotSequence, int SmallerIndex, int LargerIndex, double SmallerIndNewValue,
00103 double LargerIndNewValue);
00104 void GenerateUniformKnot(int MaxCntrl, int NurbDegree, std::vector<double> &KnotSequence);
00105 unsigned long FindCorner(float ParamX, float ParamY, std::vector<unsigned long> &v_neighbour, std::vector <Base::Vector3f> &v_pnts);
00106 private:
00107
00108 double m_h, m_result;
00109 int m_N;
00110
00111
00112 };
00113
00114 #endif
00115