Found via `codespell v2.1.dev0` ``` codespell -q 3 -L aci,ake,aline,alle,alledges,alocation,als,ang,anid,apoints,ba,beginn,behaviour,bloaded,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childs,colour,colours,commen,connexion,currenty,dof,doubleclick,dum,eiter,elemente,ende,feld,finde,findf,freez,hist,iff,indicies,initialisation,initialise,initialised,initialises,initialisiert,ist,kilometre,lod,mantatory,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oder,orgin,orginx,orginy,ot,pard,pres,programm,que,recurrance,rougly,seperator,serie,sinc,strack,substraction,te,thist,thru,tread,uint,unter,vertexes,wallthickness,whitespaces -S ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml ```
86 lines
3.3 KiB
C++
86 lines
3.3 KiB
C++
/***************************************************************************
|
|
* Copyright (c) 2017 Lorenz Lechner *
|
|
* *
|
|
* This file is part of the FreeCAD CAx development system. *
|
|
* *
|
|
* This library is free software; you can redistribute it and/or *
|
|
* modify it under the terms of the GNU Library General Public *
|
|
* License as published by the Free Software Foundation; either *
|
|
* version 2 of the License, or (at your option) any later version. *
|
|
* *
|
|
* This library is distributed in the hope that it will be useful, *
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
* GNU Library General Public License for more details. *
|
|
* *
|
|
* You should have received a copy of the GNU Library General Public *
|
|
* License along with this library; see the file COPYING.LIB. If not, *
|
|
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
|
* Suite 330, Boston, MA 02111-1307, USA *
|
|
* *
|
|
***************************************************************************/
|
|
|
|
|
|
#ifndef MESHFLATTENING
|
|
#define MESHFLATTENING
|
|
|
|
// idea:
|
|
// - unwrap any meshed shells and output a 2d face (meshing is done externally)
|
|
// - unwrap faces which are nurbs and return nurbs (no cuts, meshing internally)
|
|
// - TODO: map any curves from origin to flattened faces
|
|
|
|
#include "MeshFlatteningNurbs.h"
|
|
#include <BRepTools.hxx>
|
|
#include <TopoDS_Face.hxx>
|
|
#include <vector>
|
|
|
|
#include <Eigen/Geometry>
|
|
#include <Eigen/IterativeLinearSolvers>
|
|
#include <Eigen/SparseCore>
|
|
#include <Eigen/QR>
|
|
|
|
#include <vector>
|
|
|
|
|
|
typedef Eigen::Vector3d Vector3;
|
|
typedef Eigen::Vector2d Vector2;
|
|
|
|
template <typename type, unsigned int size>
|
|
using ColMat = Eigen::Matrix<type, Eigen::Dynamic, size>;
|
|
|
|
template <typename type, unsigned int size>
|
|
using RowMat = Eigen::Matrix<type, size, Eigen::Dynamic>;
|
|
|
|
|
|
typedef Eigen::Triplet<double> trip;
|
|
typedef Eigen::SparseMatrix<double> spMat;
|
|
|
|
|
|
std::vector<ColMat<double, 3>> getBoundaries(ColMat<double, 3> vertices, ColMat<long, 3> tris);
|
|
|
|
class FaceUnwrapper{
|
|
nurbs::NurbsBase2D nu;
|
|
public:
|
|
FaceUnwrapper(){}
|
|
FaceUnwrapper(const TopoDS_Face & face);
|
|
FaceUnwrapper(ColMat<double, 3> xyz_nodes, ColMat<long, 3> tris);
|
|
void findFlatNodes(int steps, double val);
|
|
ColMat<double, 3> interpolateFlatFace(const TopoDS_Face& face);
|
|
std::vector<ColMat<double, 3>> getFlatBoundaryNodes();
|
|
|
|
bool use_nurbs = true;
|
|
// the mesh
|
|
ColMat<long, 3> tris; // input
|
|
ColMat<long, 1> fixed_nodes; // input
|
|
ColMat<double, 3> xyz_nodes; // compute from uv_mesh (xyz = A * poles)
|
|
ColMat<double, 2> uv_nodes; // input
|
|
ColMat<double, 2> ze_nodes; // compute
|
|
|
|
// nurbs
|
|
ColMat<double, 2> ze_poles; // compute
|
|
spMat A; // mapping between nurbs(poles) and mesh(vertices) computed with nurbs-basis-functions and uv_mesh
|
|
|
|
};
|
|
|
|
#endif // MESHFLATTENING
|