The main class for the approximate routine. More...
#include <Approx.h>
Public Member Functions | |
Approximate (const MeshCore::MeshKernel &m, std::vector< double > &_Cntrl, std::vector< double > &_KnotU, std::vector< double > &_KnotV, int &_OrderU, int &_OrderV, double tol) | |
~Approximate () | |
Public Attributes | |
GeomAdaptor_Surface | aAdaptorSurface |
MeshCore::MeshKernel | MeshParam |
Protected Member Functions | |
void | ApproxMain () |
Main Approximation Program. | |
void | ComputeError (int &h, double eps_1, double eps_2, double &max_error, double &av, double &c2, std::vector< double > &err_w) |
This function will compute the current error. | |
void | eFair2 (ublas::compressed_matrix< double > &E_Matrix) |
Smoothing. | |
void | ErrorApprox () |
Main Error Approximations routine. | |
void | ExtendNurb (double c2, int h) |
Extend the Nurb. | |
void | ParameterBoundary () |
Parameterizing the Boundary Points. | |
void | ParameterInnerPoints () |
Parameterizing the Inner Points. | |
void | ReorderNeighbourList (std::set< unsigned long > &pnt, std::set< unsigned long > &face, std::vector< unsigned long > &nei, unsigned long CurInd) |
Reorder the neighbour list. | |
double | Reparam () |
Reparameterization after error computation. |
The main class for the approximate routine.
Inheriting the Routines class defined in Routines.h, it takes a mesh structure and tolerance level as it's input parameter.
As output, it gives out the following NURBS info:- Control Points, Knot U, Knot V, Order U, Order V
where Control Points, Knot U, Knot V are of type std::vectors, Order U and Order V of type int
In this program, it will be directly converted into a topo surface from the given information
Definition at line 60 of file Approx.h.
Approximate::Approximate | ( | const MeshCore::MeshKernel & | m, | |
std::vector< double > & | _Cntrl, | |||
std::vector< double > & | _KnotU, | |||
std::vector< double > & | _KnotV, | |||
int & | _OrderU, | |||
int & | _OrderV, | |||
double | tol | |||
) |
Definition at line 68 of file Approx.cpp.
References aAdaptorSurface, ApproxMain(), NURBS::CntrlArray, MeshCore::MeshKernel::CountPoints(), NURBS::DegreeU, NURBS::DegreeV, Routines::GenerateUniformKnot(), MeshCore::MeshKernel::GetBoundBox(), Handle(), Py::int, NURBS::KnotU, NURBS::KnotV, Base::BoundBox3< _Precision >::LengthX(), Base::BoundBox3< _Precision >::LengthY(), NURBS::MaxKnotU, NURBS::MaxKnotV, NURBS::MaxU, NURBS::MaxV, KDL::sqrt(), and Draft::tolerance().
Approximate::~Approximate | ( | ) |
Definition at line 246 of file Approx.cpp.
void Approximate::ApproxMain | ( | ) | [protected] |
Main Approximation Program.
Definition at line 251 of file Approx.cpp.
References ErrorApprox(), ParameterBoundary(), and ParameterInnerPoints().
Referenced by Approximate().
void Approximate::ComputeError | ( | int & | h, | |
double | eps_1, | |||
double | eps_2, | |||
double & | max_error, | |||
double & | av, | |||
double & | c2, | |||
std::vector< double > & | err_w | |||
) | [protected] |
This function will compute the current error.
Definition at line 1124 of file Approx.cpp.
References CblasNoTrans, CblasTrans, Routines::CramerSolve(), draftlibs::dxfReader::error(), boost::numeric::bindings::atlas::gemm(), k, Routines::NrbDEval(), Routines::PointNrbDerivate(), Routines::PointNrbEval(), and Draft::tolerance().
void Approximate::eFair2 | ( | ublas::compressed_matrix< double > & | E_Matrix | ) | [protected] |
Smoothing.
Definition at line 1014 of file Approx.cpp.
References FemExample::b, Routines::DersBasisFuns(), Routines::FindSpan(), k, NURBS::KnotU, NURBS::KnotV, RobotExample::l, NURBS::MaxKnotU, NURBS::MaxKnotV, NURBS::MaxU, NURBS::MaxV, draftlibs::fcgeo::precision, Routines::TrapezoidIntergration(), and RobotExample::w.
Referenced by ErrorApprox().
void Approximate::ErrorApprox | ( | ) | [protected] |
Main Error Approximations routine.
This function will be ended once max_err < tolerance
Definition at line 837 of file Approx.cpp.
References Routines::Basisfun(), CblasNoTrans, CblasTrans, NURBS::CntrlArray, NURBS::DegreeU, NURBS::DegreeV, eFair2(), Routines::FindSpan(), boost::numeric::bindings::atlas::gemm(), k, NURBS::KnotU, NURBS::KnotV, NURBS::MaxU, NURBS::MaxV, Reparam(), KDL::sqrt(), Draft::tolerance(), and boost::numeric::bindings::umfpack::detail::umf_solve().
Referenced by ApproxMain().
void Approximate::ExtendNurb | ( | double | c2, | |
int | h | |||
) | [protected] |
Extend the Nurb.
Once error is computed and the generated nurb is stil not satisfactory (i.e max_err > tolerance), this function will extend the given Nurb by extending the Knot vectors by 2 and, because the degree is held constant, the control points
Definition at line 1453 of file Approx.cpp.
References NURBS::DegreeU, NURBS::DegreeV, Routines::ExtendKnot(), NURBS::KnotU, NURBS::KnotV, NURBS::MaxKnotU, NURBS::MaxKnotV, NURBS::MaxU, and NURBS::MaxV.
void Approximate::ParameterBoundary | ( | ) | [protected] |
Parameterizing the Boundary Points.
This function will first parameterized the boundary points. Using Routines::FindCorner() that it inherited to find the corner points, it will parameterized from side to side, using the ratio between the distance between current evaluated point and the it's next boundary to the total distance of the side.
Definition at line 269 of file Approx.cpp.
References FemExample::b, MeshCore::MeshPointIterator::Begin(), RobotExampleTrajectoryOutOfShapes::count, MeshCore::MeshKernel::CountPoints(), MeshCore::MeshPointIterator::EndReached(), SketcherExample::f, draftlibs::fcvec::find(), Routines::FindCorner(), MeshCore::MeshKernel::GetBoundBox(), MeshCore::MeshAlgorithm::GetMeshBorders(), MeshCore::MeshKernel::GetPoint(), Py::int, Base::BoundBox3< _Precision >::MaxX, Base::BoundBox3< _Precision >::MaxY, Base::BoundBox3< _Precision >::MinX, Base::BoundBox3< _Precision >::MinY, MeshCore::MeshPointIterator::Position(), and KDL::sqrt().
Referenced by ApproxMain().
void Approximate::ParameterInnerPoints | ( | ) | [protected] |
Parameterizing the Inner Points.
This function will parameterize the inner points. Using the algorithim based on paper from Michael S. Floater, published in Computer Aided Design 14(1997) page 231 - 250, entitled Parametrization and smooth approximation of surface triangulation
Definition at line 521 of file Approx.cpp.
References Base::Angle, Routines::AreaTriangle(), MeshCore::MeshKernel::Assign(), FemExample::b, MeshCore::MeshPointIterator::Begin(), Routines::CalcAngle(), MeshCore::MeshKernel::Clear(), KDL::cos(), RobotExampleTrajectoryOutOfShapes::count, Routines::CramerSolve(), D_PI, Routines::det2(), MeshCore::MeshPointIterator::EndReached(), SketcherExample::f, draftlibs::fcvec::find(), Base::fmod(), MeshCore::MeshKernel::GetFacets(), MeshCore::MeshKernel::GetPoint(), MeshCore::MeshKernel::GetPoints(), Py::int, k, RobotExample::l, MeshParam, MeshCore::MeshPointIterator::Position(), ReorderNeighbourList(), KDL::sin(), KDL::sqrt(), and boost::numeric::bindings::umfpack::detail::umf_solve().
Referenced by ApproxMain().
void Approximate::ReorderNeighbourList | ( | std::set< unsigned long > & | pnt, | |
std::set< unsigned long > & | face, | |||
std::vector< unsigned long > & | nei, | |||
unsigned long | CurInd | |||
) | [protected] |
Reorder the neighbour list.
This function will reorder the list in one-direction. Clockwise or counter clockwise is depending on the facet list and will not be checked by this function. (i.e the third vertex i.e vertex in first facet that is not the CurIndex or the first neighbour in pnt[Ok, I am also lost with this..., just debug and step to see what I mean...])
Definition at line 1473 of file Approx.cpp.
References draftlibs::fcvec::find(), MeshCore::MeshKernel::GetFacets(), MeshCore::MeshKernel::GetPoints(), and k.
Referenced by ParameterInnerPoints().
double Approximate::Reparam | ( | ) | [protected] |
Reparameterization after error computation.
Definition at line 1312 of file Approx.cpp.
References MeshCore::MeshKernel::Assign(), FemExample::b, MeshCore::MeshPointIterator::Begin(), cblas_dgemm(), CblasNoTrans, CblasRowMajor, Routines::CramerSolve(), MeshCore::MeshPointIterator::EndReached(), draftlibs::dxfReader::error(), draftlibs::fcvec::find(), MeshCore::MeshKernel::GetFacets(), MeshCore::MeshKernel::GetPoints(), k, RobotExample::l, MeshParam, Routines::NrbDEval(), draftTools::p, Routines::PointNrbDerivate(), MeshCore::MeshPointIterator::Position(), and KDL::sqrt().
Referenced by ErrorApprox().
GeomAdaptor_Surface Approximate::aAdaptorSurface |
Definition at line 68 of file Approx.h.
Referenced by Approximate(), and CamGui::Cutting::on_best_fit_go_button_clicked().
Definition at line 66 of file Approx.h.
Referenced by CamGui::Cutting::on_best_fit_go_button_clicked(), ParameterInnerPoints(), and Reparam().