Some Mathematical Routines. More...
#include <routine.h>
Static Public Member Functions | |
static std::vector< double > | NewtonStep (std::vector< double > &F, std::vector< std::vector< double > > &DF) |
Protected Member Functions | |
double | AreaTriangle (Base::Vector3f &a, Base::Vector3f &b, Base::Vector3f &c) |
Calculate the Area of the triangle, bounded by three vectors from origin. A (bad) diagram is included in source code. | |
void | Basisfun (int i, double u, int p, std::vector< double > &KnotSequence, std::vector< double > &output) |
Algorithim A2.4 from NURBS Book page 70. | |
void | bspderiv (int d, std::vector< std::vector< double > > &c, std::vector< double > &k, std::vector< std::vector< double > > &OutputC, std::vector< double > &Outputk) |
Translation from bspderiv.m from NURBS Toolbox. WARNING: ONLY POINT EVALUATION ARE CONSIDERED!!!! | |
double | CalcAngle (Base::Vector3f a, Base::Vector3f b, Base::Vector3f c) |
Calculate angle between two vectors. | |
void | CramerSolve (std::vector< std::vector< double > > &RHS1, std::vector< double > &RHS2, std::vector< double > &LHS) |
Cramer-Rule Solver. | |
void | DersBasisFuns (int i, double u, int p, int n, std::vector< double > &KnotSequence, std::vector< std::vector< double > > &Derivate) |
Algorithim A2.3 from NURBS Book Page 72. | |
double | det2 (std::vector< std::vector< double > > &Matrix) |
void | ExtendKnot (double ErrPnt, int NurbDegree, int MaxCntrl, std::vector< double > &KnotSequence) |
Knot Extension. | |
void | Extension (std::vector< double > &KnotSequence, int SmallerIndex, int LargerIndex, double SmallerIndNewValue, double LargerIndNewValue) |
This routine is because it is done over and over again... | |
unsigned long | FindCorner (float ParamX, float ParamY, std::vector< unsigned long > &v_neighbour, std::vector< Base::Vector3f > &v_pnts) |
Find the corner points. | |
int | FindSpan (int n, int p, double u, std::vector< double > KnotSequence) |
Algorithim A2.1 from NURBS Book Page 68. | |
void | GenerateUniformKnot (int MaxCntrl, int NurbDegree, std::vector< double > &KnotSequence) |
Uniform Knot Generator. | |
void | NrbDEval (NURBS &MainNurb, std::vector< NURBS > &DerivNurb, std::vector< double > &Point, std::vector< double > &EvalPoint, std::vector< std::vector< double > > &jac) |
Translation from nrbdeval.m from NURBS Toolbox. WARNING: ONLY POINT EVALUATION ARE CONSIDERED!!!! | |
void | PointBSPEval (int DegreeU, std::vector< std::vector< double > > &Cntrl, std::vector< double > &KnotSequence, std::vector< double > &Output, double CurEvalPoint) |
Translation from bspeval.m from NURBS Toolbox. WARNING: ONLY POINT EVALUATION ARE CONSIDERED!!!! | |
void | PointNrbDerivate (NURBS MainNurb, std::vector< NURBS > &OutNurbs) |
Translation from nrbderivate.m from NURBS Toolbox. WARNING: ONLY POINT EVALUATION ARE CONSIDERED!!!! | |
void | PointNrbEval (std::vector< double > &p, std::vector< double > &CurPoint, NURBS &MainNurb) |
Translation from nrbeval.m from NURBS Toolbox. WARNING: ONLY POINT EVALUATION ARE CONSIDERED!!!! | |
double | TrapezoidIntergration (const std::vector< double > &WithRespectTo, const std::vector< double > &Intergral) |
Numerical Intergration according to trapezoid rules. |
Some Mathematical Routines.
This class will be inherited by the Approx class to reduce code bloat. This class have all the self-written matrix and vector routines, and some NURBS routines from the Nurbs Book or translated from the NURBS Toolbox for MATLAB
Definition at line 70 of file routine.h.
double Routines::AreaTriangle | ( | Base::Vector3f & | a, | |
Base::Vector3f & | b, | |||
Base::Vector3f & | c | |||
) | [protected] |
Calculate the Area of the triangle, bounded by three vectors from origin. A (bad) diagram is included in source code.
Definition at line 545 of file routine.cpp.
References det2(), Base::Vector3< _Precision >::x, and Base::Vector3< _Precision >::y.
Referenced by Approximate::ParameterInnerPoints().
void Routines::Basisfun | ( | int | i, | |
double | u, | |||
int | p, | |||
std::vector< double > & | KnotSequence, | |||
std::vector< double > & | output | |||
) | [protected] |
Algorithim A2.4 from NURBS Book page 70.
Definition at line 182 of file routine.cpp.
Referenced by Approximate::ErrorApprox(), UniGridApprox::MatComp(), and PointBSPEval().
void Routines::bspderiv | ( | int | d, | |
std::vector< std::vector< double > > & | c, | |||
std::vector< double > & | k, | |||
std::vector< std::vector< double > > & | OutputC, | |||
std::vector< double > & | Outputk | |||
) | [protected] |
Translation from bspderiv.m from NURBS Toolbox. WARNING: ONLY POINT EVALUATION ARE CONSIDERED!!!!
Definition at line 458 of file routine.cpp.
Referenced by PointNrbDerivate().
double Routines::CalcAngle | ( | Base::Vector3f | a, | |
Base::Vector3f | b, | |||
Base::Vector3f | c | |||
) | [protected] |
Calculate angle between two vectors.
Dependancies: Vector3D definitions and routines
Definition at line 140 of file routine.cpp.
References KDL::acos(), and Base::Vector3< _Precision >::Length().
Referenced by Approximate::ParameterInnerPoints().
void Routines::CramerSolve | ( | std::vector< std::vector< double > > & | RHS1, | |
std::vector< double > & | RHS2, | |||
std::vector< double > & | LHS | |||
) | [protected] |
Cramer-Rule Solver.
Cramer-Rule solver for 2x2 Matrix.
RHS1 * LHS = RHS2, LHS will be computed
Definition at line 110 of file routine.cpp.
References det2().
Referenced by Approximate::ComputeError(), Approximate::ParameterInnerPoints(), and Approximate::Reparam().
void Routines::DersBasisFuns | ( | int | i, | |
double | u, | |||
int | p, | |||
int | n, | |||
std::vector< double > & | KnotSequence, | |||
std::vector< std::vector< double > > & | Derivate | |||
) | [protected] |
Algorithim A2.3 from NURBS Book Page 72.
Definition at line 203 of file routine.cpp.
References k.
Referenced by Approximate::eFair2().
double Routines::det2 | ( | std::vector< std::vector< double > > & | Matrix | ) | [inline, protected] |
Determinant of a 2x2 Matrix
Definition at line 81 of file routine.h.
Referenced by AreaTriangle(), CramerSolve(), and Approximate::ParameterInnerPoints().
void Routines::ExtendKnot | ( | double | ErrPnt, | |
int | NurbDegree, | |||
int | MaxCntrl, | |||
std::vector< double > & | KnotSequence | |||
) | [protected] |
Knot Extension.
This method will extend the knots by 2. ErrPnt will tell where the knots should be inserted, NurbDegree and MaxCntrl will make sure that the amount of 0's and 1's are left untouched.
The new values will be calculated here and will be inserted in Extension function
Definition at line 572 of file routine.cpp.
References Extension(), Py::int, and Sketcher::mid.
Referenced by Approximate::ExtendNurb().
void Routines::Extension | ( | std::vector< double > & | KnotSequence, | |
int | SmallerIndex, | |||
int | LargerIndex, | |||
double | SmallerIndNewValue, | |||
double | LargerIndNewValue | |||
) | [protected] |
This routine is because it is done over and over again...
Definition at line 630 of file routine.cpp.
Referenced by ExtendKnot().
unsigned long Routines::FindCorner | ( | float | ParamX, | |
float | ParamY, | |||
std::vector< unsigned long > & | v_neighbour, | |||
std::vector< Base::Vector3f > & | v_pnts | |||
) | [protected] |
Find the corner points.
Idea: From the neighbour list, find the shortest distance of a point to the given parameter X and Y. Parameter X and Y are the bounding boxes parameter of the mesh (combinations of Min and Max of X and Y)
Definition at line 518 of file routine.cpp.
References eps, k, and KDL::sqrt().
Referenced by Approximate::ParameterBoundary().
int Routines::FindSpan | ( | int | n, | |
int | p, | |||
double | u, | |||
std::vector< double > | KnotSequence | |||
) | [protected] |
Algorithim A2.1 from NURBS Book Page 68.
Definition at line 157 of file routine.cpp.
References Sketcher::mid.
Referenced by Approximate::eFair2(), Approximate::ErrorApprox(), UniGridApprox::MatComp(), and PointBSPEval().
void Routines::GenerateUniformKnot | ( | int | MaxCntrl, | |
int | NurbDegree, | |||
std::vector< double > & | KnotSequence | |||
) | [protected] |
Uniform Knot Generator.
Definition at line 497 of file routine.cpp.
Referenced by Approximate::Approximate().
std::vector< double > Routines::NewtonStep | ( | std::vector< double > & | F, | |
std::vector< std::vector< double > > & | DF | |||
) | [static] |
Definition at line 66 of file routine.cpp.
References FemExample::b, boost::numeric::bindings::atlas::getrs(), Py::int, and boost::numeric::bindings::atlas::lu_factor().
void Routines::NrbDEval | ( | NURBS & | MainNurb, | |
std::vector< NURBS > & | DerivNurb, | |||
std::vector< double > & | Point, | |||
std::vector< double > & | EvalPoint, | |||
std::vector< std::vector< double > > & | jac | |||
) | [protected] |
Translation from nrbdeval.m from NURBS Toolbox. WARNING: ONLY POINT EVALUATION ARE CONSIDERED!!!!
Definition at line 479 of file routine.cpp.
References PointNrbEval().
Referenced by Approximate::ComputeError(), and Approximate::Reparam().
void Routines::PointBSPEval | ( | int | DegreeU, | |
std::vector< std::vector< double > > & | Cntrl, | |||
std::vector< double > & | KnotSequence, | |||
std::vector< double > & | Output, | |||
double | CurEvalPoint | |||
) | [protected] |
Translation from bspeval.m from NURBS Toolbox. WARNING: ONLY POINT EVALUATION ARE CONSIDERED!!!!
Definition at line 331 of file routine.cpp.
References Basisfun(), and FindSpan().
Referenced by PointNrbEval().
Translation from nrbderivate.m from NURBS Toolbox. WARNING: ONLY POINT EVALUATION ARE CONSIDERED!!!!
Definition at line 348 of file routine.cpp.
References bspderiv(), NURBS::CntrlArray, NURBS::DegreeU, NURBS::DegreeV, k, NURBS::KnotU, NURBS::KnotV, NURBS::MaxKnotU, NURBS::MaxKnotV, NURBS::MaxU, and NURBS::MaxV.
Referenced by Approximate::ComputeError(), and Approximate::Reparam().
void Routines::PointNrbEval | ( | std::vector< double > & | p, | |
std::vector< double > & | CurPoint, | |||
NURBS & | MainNurb | |||
) | [protected] |
Translation from nrbeval.m from NURBS Toolbox. WARNING: ONLY POINT EVALUATION ARE CONSIDERED!!!!
Definition at line 287 of file routine.cpp.
References NURBS::CntrlArray, NURBS::DegreeU, NURBS::DegreeV, NURBS::KnotU, NURBS::KnotV, NURBS::MaxU, NURBS::MaxV, and PointBSPEval().
Referenced by Approximate::ComputeError(), and NrbDEval().
double Routines::TrapezoidIntergration | ( | const std::vector< double > & | WithRespectTo, | |
const std::vector< double > & | Integral | |||
) | [protected] |
Numerical Intergration according to trapezoid rules.
This routine assumes that the Intergral values are already corresponding with WithRespectTo i.e: Intergral[i] == Intergral(WithRespectTo[i]); Also, it is assumed that WithRespectTo are evenly spaced with it's stepWidth
Definition at line 47 of file routine.cpp.
Referenced by Approximate::eFair2().