routine.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2007                                                    *
00003  *   Joachim Zettler <Joachim.Zettler@gmx.de>                              *
00004  *   Mohamad Najib Muhammad Noor <najib_bean@yahoo.co.uk>                  *
00005  *                                                                         *
00006  *   This file is part of the FreeCAD CAx development system.              *
00007  *                                                                         *
00008  *   This library is free software; you can redistribute it and/or         *
00009  *   modify it under the terms of the GNU Library General Public           *
00010  *   License as published by the Free Software Foundation; either          *
00011  *   version 2 of the License, or (at your option) any later version.      *
00012  *                                                                         *
00013  *   This library  is distributed in the hope that it will be useful,      *
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00016  *   GNU Library General Public License for more details.                  *
00017  *                                                                         *
00018  *   You should have received a copy of the GNU Library General Public     *
00019  *   License along with this library; see the file COPYING.LIB. If not,    *
00020  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00021  *   Suite 330, Boston, MA  02111-1307, USA                                *
00022  *                                                                         *
00023  ***************************************************************************/
00024 
00025 
00026 /*********ROUTINE.H**********/
00027 #ifndef ROUTINE_H
00028 #define ROUTINE_H
00029 
00030 /******MAIN INCLUDE******/
00031 
00032 #include <vector>
00033 
00034 /********FREECAD MESH**********/
00035 
00036 // Things from the Mesh module
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 /******NURBS STRUCT*********/
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     // mehrdimensionales Newton-Verfahren mit festem Startwert 0
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     //Matrix and vectors
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     //NURBS
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     //Variables in Use by Routine TrapezoidIntegration
00108     double m_h, m_result;
00109     int m_N;
00110 
00111 
00112 };
00113 
00114 #endif /*ROUTINE_H DEFINED*/
00115 

Generated on Wed Nov 23 19:00:36 2011 for FreeCAD by  doxygen 1.6.1