MeshPart: remove trailing whitespace
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
#include <Base/Console.h>
|
||||
#include <Base/PyObjectBase.h>
|
||||
#include <Base/Interpreter.h>
|
||||
|
||||
|
||||
|
||||
namespace MeshPart {
|
||||
extern PyObject* initModule();
|
||||
|
||||
@@ -221,7 +221,7 @@ private:
|
||||
}
|
||||
|
||||
TopoDS_Shape aShape = pcObject->getTopoShapePtr()->getShape();
|
||||
// use the MeshAlgos
|
||||
// use the MeshAlgos
|
||||
MeshPart::MeshAlgos::LoftOnCurve(M,aShape,poly,Base::Vector3f(x,y,z),size);
|
||||
return Py::asObject(new Mesh::MeshPy(new Mesh::MeshObject(M)));
|
||||
}
|
||||
|
||||
@@ -121,11 +121,11 @@ void CurveProjectorShape::projectCurve( const TopoDS_Edge& aEdge,
|
||||
{
|
||||
Standard_Real fFirst, fLast;
|
||||
Handle(Geom_Curve) hCurve = BRep_Tool::Curve( aEdge,fFirst,fLast );
|
||||
|
||||
|
||||
// getting start point
|
||||
gp_Pnt gpPt = hCurve->Value(fFirst);
|
||||
|
||||
// projection of the first point
|
||||
// projection of the first point
|
||||
Base::Vector3f cStartPoint = Base::Vector3f((float)gpPt.X(),
|
||||
(float)gpPt.Y(),
|
||||
(float)gpPt.Z());
|
||||
@@ -134,7 +134,7 @@ void CurveProjectorShape::projectCurve( const TopoDS_Edge& aEdge,
|
||||
MeshCore::FacetIndex uLastFacetIdx=MeshCore::FACET_INDEX_MAX-1; // use another value as FACET_INDEX_MAX
|
||||
MeshCore::FacetIndex auNeighboursIdx[3];
|
||||
bool GoOn;
|
||||
|
||||
|
||||
if( !findStartPoint(_Mesh,cStartPoint,cResultPoint,uStartFacetIdx) )
|
||||
return;
|
||||
|
||||
@@ -146,11 +146,11 @@ void CurveProjectorShape::projectCurve( const TopoDS_Edge& aEdge,
|
||||
|
||||
GoOn = false;
|
||||
int NbrOfHits = 0,HitIdx=0;
|
||||
|
||||
|
||||
for(int i=0; i<3; i++)
|
||||
{
|
||||
// ignore last visited facet
|
||||
if ( auNeighboursIdx[i] == uLastFacetIdx )
|
||||
if ( auNeighboursIdx[i] == uLastFacetIdx )
|
||||
continue;
|
||||
|
||||
// get points of the edge i
|
||||
@@ -169,10 +169,10 @@ void CurveProjectorShape::projectCurve( const TopoDS_Edge& aEdge,
|
||||
cPlanePnt = cP0;
|
||||
}
|
||||
|
||||
Handle(Geom_Plane) hPlane = new Geom_Plane(gp_Pln(gp_Pnt(cPlanePnt.x,cPlanePnt.y,cPlanePnt.z),
|
||||
Handle(Geom_Plane) hPlane = new Geom_Plane(gp_Pln(gp_Pnt(cPlanePnt.x,cPlanePnt.y,cPlanePnt.z),
|
||||
gp_Dir(cPlaneNormal.x,cPlaneNormal.y,cPlaneNormal.z)));
|
||||
|
||||
GeomAPI_IntCS Alg(hCurve,hPlane);
|
||||
|
||||
GeomAPI_IntCS Alg(hCurve,hPlane);
|
||||
|
||||
if ( Alg.IsDone() )
|
||||
{
|
||||
@@ -312,13 +312,13 @@ void CurveProjectorSimple::projectCurve( const TopoDS_Edge& aEdge,
|
||||
bool bFirst = true;
|
||||
//unsigned long auNeighboursIdx[3];
|
||||
//std::map<unsigned long,std::vector<Base::Vector3f> >::iterator N1,N2,N3;
|
||||
|
||||
|
||||
Standard_Real fBegin, fEnd;
|
||||
Handle(Geom_Curve) hCurve = BRep_Tool::Curve(aEdge,fBegin,fEnd);
|
||||
float fLen = float(fEnd - fBegin);
|
||||
|
||||
|
||||
unsigned long ulNbOfPoints = 1000,PointCount=0;
|
||||
|
||||
|
||||
MeshFacetIterator It(_Mesh);
|
||||
|
||||
Base::SequencerLauncher seq("Building up projection map...", ulNbOfPoints+1);
|
||||
@@ -328,7 +328,7 @@ void CurveProjectorSimple::projectCurve( const TopoDS_Edge& aEdge,
|
||||
str.setf(std::ios::fixed | std::ios::showpoint);
|
||||
|
||||
std::map<MeshCore::FacetIndex,std::vector<Base::Vector3f> > FaceProjctMap;
|
||||
|
||||
|
||||
for (unsigned long i = 0; i <= ulNbOfPoints; i++)
|
||||
{
|
||||
seq.next();
|
||||
@@ -338,12 +338,12 @@ void CurveProjectorSimple::projectCurve( const TopoDS_Edge& aEdge,
|
||||
for(It.Init();It.More();It.Next())
|
||||
{
|
||||
// try to project (with angle) to the face
|
||||
if (It->IntersectWithLine (Base::Vector3f((float)gpPt.X(),(float)gpPt.Y(),(float)gpPt.Z()),
|
||||
if (It->IntersectWithLine (Base::Vector3f((float)gpPt.X(),(float)gpPt.Y(),(float)gpPt.Z()),
|
||||
It->GetNormal(), TempResultPoint))
|
||||
{
|
||||
FaceProjctMap[It.Position()].push_back(TempResultPoint);
|
||||
str << TempResultPoint.x << " "
|
||||
<< TempResultPoint.y << " "
|
||||
str << TempResultPoint.x << " "
|
||||
<< TempResultPoint.y << " "
|
||||
<< TempResultPoint.z << std::endl;
|
||||
Base::Console().Log("IDX %d\n",It.Position());
|
||||
|
||||
@@ -375,13 +375,13 @@ void CurveProjectorSimple::projectCurve( const TopoDS_Edge& aEdge,
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
FaceProjctMap.erase(uCurFacetIdx);
|
||||
|
||||
// estimate next facet
|
||||
MeshGeomFacet cCurFacet= MeshK.GetFacet(uCurFacetIdx);
|
||||
MeshK.GetFacetNeighbours ( uCurFacetIdx, auNeighboursIdx[0], auNeighboursIdx[1], auNeighboursIdx[2]);
|
||||
|
||||
|
||||
uCurFacetIdx = MeshCore::FACET_INDEX_MAX;
|
||||
PointCount = 0;
|
||||
|
||||
@@ -413,11 +413,11 @@ void CurveProjectorSimple::projectCurve( const TopoDS_Edge& aEdge,
|
||||
|
||||
Standard_Real fFirst, fLast, fAct;
|
||||
Handle(Geom_Curve) hCurve = BRep_Tool::Curve( aEdge,fFirst,fLast );
|
||||
|
||||
|
||||
// getting start point
|
||||
gp_Pnt gpPt = hCurve->Value(fFirst);
|
||||
fAct = fFirst;
|
||||
// projection of the first point
|
||||
// projection of the first point
|
||||
Base::Vector3f cStartPoint = Base::Vector3f(gpPt.X(),gpPt.Y(),gpPt.Z());
|
||||
Base::Vector3f cResultPoint, cSplitPoint, cPlanePnt, cPlaneNormal,TempResultPoint;
|
||||
MeshCore::FacetIndex uStartFacetIdx,uCurFacetIdx;
|
||||
@@ -479,7 +479,7 @@ void CurveProjectorSimple::projectCurve( const TopoDS_Edge& aEdge,
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Sentinel++;
|
||||
|
||||
}while(HitCount!=1 && Sentinel < 20);
|
||||
@@ -499,23 +499,23 @@ void CurveProjectorSimple::projectCurve( const TopoDS_Edge& aEdge,
|
||||
|
||||
Standard_Real fFirst, fLast;
|
||||
Handle(Geom_Curve) hCurve = BRep_Tool::Curve( aEdge,fFirst,fLast );
|
||||
|
||||
|
||||
// getting start point
|
||||
gp_Pnt gpPt = hCurve->Value(fFirst);
|
||||
|
||||
// projection of the first point
|
||||
// projection of the first point
|
||||
Base::Vector3f cStartPoint = Base::Vector3f(gpPt.X(),gpPt.Y(),gpPt.Z());
|
||||
Base::Vector3f cResultPoint, cSplitPoint, cPlanePnt, cPlaneNormal;
|
||||
MeshCore::FacetIndex uStartFacetIdx,uCurFacetIdx;
|
||||
MeshCore::FacetIndex uLastFacetIdx=MeshCore::FACET_INDEX_MAX-1; // use another value as FACET_INDEX_MAX
|
||||
MeshCore::FacetIndex auNeighboursIdx[3];
|
||||
bool GoOn;
|
||||
|
||||
|
||||
if( !findStartPoint(MeshK,cStartPoint,cResultPoint,uStartFacetIdx) )
|
||||
return;
|
||||
|
||||
FILE* file = fopen("projected.asc", "w");
|
||||
|
||||
|
||||
// go through the whole Mesh
|
||||
MeshFacetIterator It1(MeshK);
|
||||
for(It1.Init();It1.More();It1.Next())
|
||||
@@ -607,10 +607,10 @@ void CurveProjectorWithToolMesh::makeToolMesh( const TopoDS_Edge& aEdge,std::vec
|
||||
|
||||
MeshFacetIterator It(_Mesh);
|
||||
|
||||
Base::SequencerLauncher seq("Building up tool mesh...", ulNbOfPoints+1);
|
||||
Base::SequencerLauncher seq("Building up tool mesh...", ulNbOfPoints+1);
|
||||
|
||||
std::map<MeshCore::FacetIndex,std::vector<Base::Vector3f> > FaceProjctMap;
|
||||
|
||||
|
||||
for (unsigned long i = 0; i < ulNbOfPoints; i++)
|
||||
{
|
||||
seq.next();
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
|
||||
template<class T>
|
||||
struct TopoDSLess {
|
||||
bool operator()(const T& x, const T& y) const {
|
||||
bool operator()(const T& x, const T& y) const {
|
||||
return x.HashCode(INT_MAX-1) < y.HashCode(INT_MAX-1);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -64,7 +64,7 @@ void MeshAlgos::offset(MeshCore::MeshKernel* Mesh, float fSize)
|
||||
|
||||
void MeshAlgos::offsetSpecial2(MeshCore::MeshKernel* Mesh, float fSize)
|
||||
{
|
||||
Base::Builder3D builder;
|
||||
Base::Builder3D builder;
|
||||
std::vector<Base::Vector3f> PointNormals= Mesh->CalcVertexNormals();
|
||||
std::vector<Base::Vector3f> FaceNormals;
|
||||
std::set<MeshCore::FacetIndex> fliped;
|
||||
@@ -154,9 +154,9 @@ void MeshAlgos::coarsen(MeshCore::MeshKernel* /*Mesh*/, float /*f*/)
|
||||
guint stop_number=100000;
|
||||
gdouble fold = 3.1415 / 180.;
|
||||
|
||||
gts_surface_coarsen (surface,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
gts_surface_coarsen (surface,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
(GtsStopFunc)gts_coarsen_stop_number,
|
||||
&stop_number, fold);
|
||||
|
||||
@@ -269,7 +269,7 @@ MeshCore::MeshKernel* MeshAlgos::boolean(MeshCore::MeshKernel* pMesh1,
|
||||
gts_surface_inter_boolean (si, s3, GTS_1_OUT_2);
|
||||
}
|
||||
|
||||
// check that the resulting surface is not self-intersecting
|
||||
// check that the resulting surface is not self-intersecting
|
||||
if (check_self_intersection) {
|
||||
GtsSurface * self_intersects;
|
||||
|
||||
@@ -288,22 +288,22 @@ MeshCore::MeshKernel* MeshAlgos::boolean(MeshCore::MeshKernel* pMesh1,
|
||||
throw std::runtime_error("the resulting surface is self-intersecting\n");
|
||||
}
|
||||
}
|
||||
// display summary information about the resulting surface
|
||||
// display summary information about the resulting surface
|
||||
// if (verbose)
|
||||
// gts_surface_print_stats (s3, stderr);
|
||||
// write resulting surface to standard output
|
||||
// write resulting surface to standard output
|
||||
|
||||
// get the standard mesh
|
||||
fillMeshFromGTSSurface(pResult,s3);
|
||||
|
||||
|
||||
// destroy surfaces
|
||||
// destroy surfaces
|
||||
gts_object_destroy (GTS_OBJECT (s1));
|
||||
gts_object_destroy (GTS_OBJECT (s2));
|
||||
// gts_object_destroy (GTS_OBJECT (s3));
|
||||
// gts_object_destroy (GTS_OBJECT (si));
|
||||
|
||||
// destroy bounding box trees (including bounding boxes)
|
||||
// destroy bounding box trees (including bounding boxes)
|
||||
// gts_bb_tree_destroy (tree1, true);
|
||||
// gts_bb_tree_destroy (tree2, true);
|
||||
|
||||
@@ -319,7 +319,7 @@ MeshCore::MeshKernel* MeshAlgos::boolean(MeshCore::MeshKernel* pMesh1,
|
||||
static GtsEdge * new_edge (GtsVertex * v1, GtsVertex * v2)
|
||||
{
|
||||
GtsSegment * s = gts_vertices_are_connected (v1, v2);
|
||||
if( s == NULL )
|
||||
if( s == NULL )
|
||||
return gts_edge_new (gts_edge_class (), v1, v2);
|
||||
else
|
||||
return GTS_EDGE (s);
|
||||
@@ -350,9 +350,9 @@ GtsSurface* MeshAlgos::createGTSSurface(MeshCore::MeshKernel* Mesh)
|
||||
{
|
||||
// getting the three points of the facet
|
||||
Mesh->GetFacetPoints(pFIter,p1,p2,p3);
|
||||
|
||||
|
||||
// creating the edges and add the face to the surface
|
||||
gts_surface_add_face (Surf,
|
||||
gts_surface_add_face (Surf,
|
||||
gts_face_new (Surf->face_class,
|
||||
new_edge (aVertex[p1],aVertex[p2]),
|
||||
new_edge (aVertex[p2],aVertex[p3]),
|
||||
@@ -398,7 +398,7 @@ void MeshAlgos::fillMeshFromGTSSurface(MeshCore::MeshKernel* pMesh, GtsSurface*
|
||||
// gts_surface_foreach_vertex(pSurface,(GtsFunc) onVertices,&MeshK);
|
||||
gts_surface_foreach_face (pSurface, (GtsFunc) onFaces,&VAry);
|
||||
|
||||
// destroy surfaces
|
||||
// destroy surfaces
|
||||
gts_object_destroy (GTS_OBJECT (pSurface));
|
||||
|
||||
// put the facets the simple way in the mesh, totp is recalculated!
|
||||
@@ -428,9 +428,9 @@ void MeshAlgos::cutByShape(const TopoDS_Shape &aShape,const MeshCore::MeshKernel
|
||||
CurveProjectorWithToolMesh Project(aShape,*pMesh,*pToolMesh);
|
||||
|
||||
//IntersectionLine Lines;
|
||||
// MeshWithProperty *ResultMesh = new MeshWithProperty();
|
||||
// MeshWithProperty *ResultMesh = new MeshWithProperty();
|
||||
|
||||
|
||||
|
||||
// boolean(pMesh,ToolMesh,ResultMesh,1);
|
||||
|
||||
|
||||
@@ -460,7 +460,7 @@ class _VertexCompare
|
||||
{
|
||||
public:
|
||||
bool operator () (const TopoDS_Vertex &rclV1, const TopoDS_Vertex &rclV2) const
|
||||
{
|
||||
{
|
||||
if (rclV1.IsSame(rclV2) == Standard_True)
|
||||
return false;
|
||||
|
||||
@@ -502,19 +502,19 @@ void MeshAlgos::LoftOnCurve(MeshCore::MeshKernel &ResultMesh, const TopoDS_Shape
|
||||
GeomLProp_CLProps prop(BRep_Tool::Curve(Edge,fBegin,fEnd),1,0.0000000001);
|
||||
int res = int((fEnd - fBegin)/MaxSize);
|
||||
// do at least 2 segments
|
||||
if(res < 2)
|
||||
if(res < 2)
|
||||
res = 2;
|
||||
gp_Dir Tangent;
|
||||
|
||||
std::vector<Base::Vector3f> prePoint(poly.size());
|
||||
std::vector<Base::Vector3f> actPoint(poly.size());
|
||||
|
||||
|
||||
// checking if there is already a end to connect
|
||||
if(ConnectMap.find(V1) != ConnectMap.end() ){
|
||||
bBegin = true;
|
||||
prePoint = ConnectMap[V1];
|
||||
}
|
||||
|
||||
|
||||
if(ConnectMap.find(V2) != ConnectMap.end() )
|
||||
bEnd = true;
|
||||
|
||||
@@ -550,7 +550,7 @@ void MeshAlgos::LoftOnCurve(MeshCore::MeshKernel &ResultMesh, const TopoDS_Shape
|
||||
ConnectMap[V2] = actPoint;
|
||||
|
||||
if(i==1 && bBegin)
|
||||
// using the end of an other edge as start
|
||||
// using the end of an other edge as start
|
||||
prePoint = ConnectMap[V1];
|
||||
|
||||
if(i==0 && !bBegin)
|
||||
@@ -561,7 +561,7 @@ void MeshAlgos::LoftOnCurve(MeshCore::MeshKernel &ResultMesh, const TopoDS_Shape
|
||||
{
|
||||
for(l=0;l<actPoint.size();l++)
|
||||
{
|
||||
if(l) // not first point in row
|
||||
if(l) // not first point in row
|
||||
{
|
||||
if(i == res-1 && bEnd) // if last row and a end to connect
|
||||
actPoint = ConnectMap[V2];
|
||||
|
||||
@@ -109,4 +109,4 @@ public:
|
||||
|
||||
} // namespace MeshPart
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -48,7 +48,7 @@ std::vector<ColMat<double, 3>> getBoundaries(ColMat<double, 3> vertices, ColMat<
|
||||
std::map<long, std::vector<long>> neighbour_map;
|
||||
std::vector<long> edge_vector_0;
|
||||
std::vector<std::vector<long>> edge_vector;
|
||||
|
||||
|
||||
|
||||
for (long i=0; i<tris.rows(); i++)
|
||||
{
|
||||
@@ -109,7 +109,7 @@ std::vector<ColMat<double, 3>> getBoundaries(ColMat<double, 3> vertices, ColMat<
|
||||
}
|
||||
neighbour_map.erase(start_index);
|
||||
edge_vector_0.push_back(next_index);
|
||||
|
||||
|
||||
}
|
||||
edge_vector.push_back(edge_vector_0);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ FaceUnwrapper::FaceUnwrapper(const TopoDS_Face& face)
|
||||
long i = 0;
|
||||
// transform to nurbs:
|
||||
TopLoc_Location location;
|
||||
|
||||
|
||||
// triangulate:
|
||||
const Handle(Poly_Triangulation) &triangulation = BRep_Tool::Triangulation(face, location);
|
||||
|
||||
@@ -156,7 +156,7 @@ FaceUnwrapper::FaceUnwrapper(const TopoDS_Face& face)
|
||||
i++;
|
||||
}
|
||||
}
|
||||
//
|
||||
//
|
||||
this->xyz_nodes.resize(numNodes, 3);
|
||||
i = 0;
|
||||
for (Standard_Integer index = 1; index <= numNodes; ++index)
|
||||
@@ -192,7 +192,7 @@ ColMat<double, 3> FaceUnwrapper::interpolateFlatFace(const TopoDS_Face& face)
|
||||
{
|
||||
if (this->uv_nodes.size() == 0)
|
||||
throw(std::runtime_error("no uv-coordinates found, interpolating with nurbs is only possible if the Flattener was constructed with a nurbs."));
|
||||
|
||||
|
||||
// extract xyz poles, knots, weights, degree
|
||||
const Handle(Geom_Surface) &_surface = BRep_Tool::Surface(face);
|
||||
const Handle(Geom_BSplineSurface) &_bspline = Handle(Geom_BSplineSurface)::DownCast(_surface);
|
||||
@@ -224,11 +224,11 @@ ColMat<double, 3> FaceUnwrapper::interpolateFlatFace(const TopoDS_Face& face)
|
||||
{
|
||||
v_knots[v - 1] = _vknots.Value(v);
|
||||
}
|
||||
|
||||
|
||||
|
||||
nu = nurbs::NurbsBase2D(u_knots, v_knots, weights, _bspline->UDegree(), _bspline->VDegree());
|
||||
A = nu.getInfluenceMatrix(this->uv_nodes);
|
||||
|
||||
|
||||
Eigen::LeastSquaresConjugateGradient<spMat > solver;
|
||||
solver.compute(A);
|
||||
ColMat<double, 2> ze_poles;
|
||||
@@ -239,7 +239,7 @@ ColMat<double, 3> FaceUnwrapper::interpolateFlatFace(const TopoDS_Face& face)
|
||||
ze_poles = solver.solve(ze_nodes);
|
||||
flat_poles.col(0) << ze_poles.col(0);
|
||||
flat_poles.col(1) << ze_poles.col(1);
|
||||
return flat_poles;
|
||||
return flat_poles;
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ FaceUnwrapper::FaceUnwrapper(ColMat< double, int(3) > xyz_nodes, ColMat< long in
|
||||
{
|
||||
this->tris = tris;
|
||||
this->xyz_nodes = xyz_nodes;
|
||||
|
||||
|
||||
}
|
||||
|
||||
std::vector<ColMat<double, 3>> FaceUnwrapper::getFlatBoundaryNodes()
|
||||
|
||||
@@ -199,7 +199,7 @@ struct eigen_matrix
|
||||
BOOST_PYTHON_MODULE(flatmesh)
|
||||
{
|
||||
//m.doc() = "functions to unwrapp faces/ meshes";
|
||||
|
||||
|
||||
py::class_<lscmrelax::LscmRelax>("LscmRelax")
|
||||
.def(py::init<ColMat<double, 3>, ColMat<long, 3>, std::vector<long>>())
|
||||
.def("lscm", &lscmrelax::LscmRelax::lscm)
|
||||
|
||||
@@ -94,7 +94,7 @@ unsigned int get_max_distance(Vector3 point, RowMat<double, 3> vertices, double
|
||||
|
||||
|
||||
LscmRelax::LscmRelax(
|
||||
RowMat<double, 3> vertices,
|
||||
RowMat<double, 3> vertices,
|
||||
RowMat<long, 3> triangles,
|
||||
std::vector<long> fixed_pins)
|
||||
{
|
||||
@@ -106,10 +106,10 @@ LscmRelax::LscmRelax(
|
||||
// set the fixed pins of the flat-mesh:
|
||||
this->set_fixed_pins();
|
||||
|
||||
|
||||
|
||||
unsigned int fixed_count = 0;
|
||||
for (long i=0; i < this->vertices.cols(); i++)
|
||||
{
|
||||
{
|
||||
if (fixed_count < this->fixed_pins.size())
|
||||
{
|
||||
if (i == this->fixed_pins[fixed_count])
|
||||
@@ -213,7 +213,7 @@ void LscmRelax::relax(double weight)
|
||||
// set the diagonal element of these pins to 1 + the rhs to zero
|
||||
// (? is it possible to fix in the inner of the face? for sure for fem, but lscm could have some problems)
|
||||
// (we also need some extra variables to see if the pins come from user)
|
||||
|
||||
|
||||
// fixing some points
|
||||
// although only internal forces are applied there has to be locked
|
||||
// at least 3 degrees of freedom to stop the mesh from pure rotation and pure translation
|
||||
@@ -223,7 +223,7 @@ void LscmRelax::relax(double weight)
|
||||
// fixed_dof.push_back(this->triangles(1, 0) * 2 + 1); // y1
|
||||
|
||||
// align flat mesh to fixed edge
|
||||
// Vector2 edge = this->flat_vertices.col(this->triangles(1, 0)) -
|
||||
// Vector2 edge = this->flat_vertices.col(this->triangles(1, 0)) -
|
||||
// this->flat_vertices.col(this->triangles(0, 0));
|
||||
// edge.normalize();
|
||||
// Eigen::Matrix<double, 2, 2> rot;
|
||||
@@ -284,7 +284,7 @@ void LscmRelax::relax(double weight)
|
||||
|
||||
K_g.setFromTriplets(K_g_triplets.begin(), K_g_triplets.end());
|
||||
// rhs += K_g * Eigen::VectorXd::Ones(K_g.rows());
|
||||
|
||||
|
||||
// solve linear system (privately store the value for guess in next step)
|
||||
Eigen::SimplicialLDLT<spMat, Eigen::Lower> solver;
|
||||
solver.compute(K_g);
|
||||
@@ -309,7 +309,7 @@ void LscmRelax::area_relax(double weight)
|
||||
Eigen::Matrix<double, 1, 6> B;
|
||||
double delta_a;
|
||||
Vector2 v1, v2, v3, v12, v23, v31;
|
||||
|
||||
|
||||
|
||||
for (long i=0; i<this->triangles.cols(); i++)
|
||||
{
|
||||
@@ -321,10 +321,10 @@ void LscmRelax::area_relax(double weight)
|
||||
v23 = v3 - v2;
|
||||
v31 = v1 - v3;
|
||||
B << -v23.y(), v23.x(), -v31.y(), v31.x(), -v12.y(), v12.x();
|
||||
delta_a = fabs(this->q_l_g(i, 0) * this->q_l_g(i, 2)) -
|
||||
delta_a = fabs(this->q_l_g(i, 0) * this->q_l_g(i, 2)) -
|
||||
fabs(this->q_l_m(i, 0) * this->q_l_m(i, 2));
|
||||
rhs_lsq[i] = delta_a * 0.1;
|
||||
|
||||
|
||||
std::array<int, 6> range_6 {{0, 1, 2, 3, 4, 5}};
|
||||
std::array<long, 6> indices;
|
||||
for (int index=0; index<3; index++)
|
||||
@@ -332,7 +332,7 @@ void LscmRelax::area_relax(double weight)
|
||||
indices[index * 2] = this->triangles(index, i) * 2;
|
||||
indices[index * 2 + 1] = this->triangles(index, i) * 2 + 1;
|
||||
}
|
||||
|
||||
|
||||
for(auto col: range_6)
|
||||
{
|
||||
K_g_triplets.push_back(trip(i, indices[col], (double) B[col]));
|
||||
@@ -340,13 +340,13 @@ void LscmRelax::area_relax(double weight)
|
||||
}
|
||||
K_g_lsq.setFromTriplets(K_g_triplets.begin(), K_g_triplets.end());
|
||||
K_g_triplets.clear();
|
||||
|
||||
|
||||
K_g.setFromTriplets(K_g_triplets.begin(), K_g_triplets.end());
|
||||
Eigen::ConjugateGradient<spMat> solver;
|
||||
solver.compute(K_g);
|
||||
this->sol = solver.solve(-rhs);
|
||||
this->set_shift(this->sol * weight);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void LscmRelax::edge_relax(double weight)
|
||||
@@ -390,16 +390,16 @@ void LscmRelax::edge_relax(double weight)
|
||||
double l_l = (v2_l - v1_l).norm();
|
||||
Vector2 t = (v2_l - v1_l); // direction
|
||||
t.normalize();
|
||||
|
||||
|
||||
Eigen::Matrix<double, 1, 4> B;
|
||||
Eigen::Matrix<double, 4, 4> K;
|
||||
Eigen::Matrix<double, 4, 1> rhs_m;
|
||||
|
||||
|
||||
B << -t.x(), -t.y(), t.x(), t.y();
|
||||
K = 1. / l_g * B.transpose() * B;
|
||||
rhs_m = - B.transpose() * (l_g - l_l);
|
||||
|
||||
|
||||
|
||||
|
||||
for(auto row: range_4)
|
||||
{
|
||||
for (auto col: range_4)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
// LeastSquareConformalMapping + fem relaxing
|
||||
// ------------------------------------------
|
||||
//
|
||||
//
|
||||
#ifndef UNWRAP_H
|
||||
#define UNWRAP_H
|
||||
|
||||
@@ -54,9 +54,9 @@ class NullSpaceProjector: public Eigen::IdentityPreconditioner
|
||||
public:
|
||||
Eigen::MatrixXd null_space_1;
|
||||
Eigen::MatrixXd null_space_2;
|
||||
|
||||
|
||||
template<typename Rhs>
|
||||
inline Rhs solve(Rhs& b) const {
|
||||
inline Rhs solve(Rhs& b) const {
|
||||
return b - this->null_space_1 * (this->null_space_2 * b);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ class NullSpaceProjector: public Eigen::IdentityPreconditioner
|
||||
this->null_space_2 = null_space.transpose();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
using Vector3 = Eigen::Vector3d;
|
||||
using Vector2 = Eigen::Vector2d;
|
||||
|
||||
@@ -93,7 +93,7 @@ private:
|
||||
public:
|
||||
LscmRelax() {}
|
||||
LscmRelax(
|
||||
RowMat<double, 3> vertices,
|
||||
RowMat<double, 3> vertices,
|
||||
RowMat<long, 3> triangles,
|
||||
std::vector<long> fixed_pins);
|
||||
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
|
||||
void rotate_by_min_bound_area();
|
||||
void transform(bool scale=false);
|
||||
|
||||
|
||||
double get_area();
|
||||
double get_flat_area();
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ std::function<double(double)> get_basis_derivative(int order, int degree, int i,
|
||||
// Return the derivation of the basis function
|
||||
// order of basis function
|
||||
// degree of basis function
|
||||
//
|
||||
//
|
||||
// knots sequence
|
||||
{
|
||||
if (order == 1)
|
||||
@@ -127,11 +127,11 @@ std::function<double(double)> get_basis_derivative(int order, int degree, int i,
|
||||
out -= get_basis(degree - 1, i + 1, knots)(t) *
|
||||
degree / (knots[i + degree + 1] - knots[i + 1]);
|
||||
}
|
||||
return out;
|
||||
return out;
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
return [degree, i, knots, order](double t)
|
||||
{
|
||||
double out = 0;
|
||||
@@ -145,7 +145,7 @@ std::function<double(double)> get_basis_derivative(int order, int degree, int i,
|
||||
out -= get_basis_derivative(order - 1, degree - 1, i + 1, knots)(t) *
|
||||
degree / (knots[i + degree + 1] - knots[i + 1]);
|
||||
}
|
||||
return out;
|
||||
return out;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -244,7 +244,7 @@ Eigen::VectorXd NurbsBase2D::getDuVector(Eigen::Vector2d u)
|
||||
n_v.resize(this->v_functions.size());
|
||||
for (unsigned int u_i=0; u_i < this->u_functions.size(); u_i++)
|
||||
{
|
||||
// std::cout << "u_i: " << u_i << " , n_u: " << n_u.size()
|
||||
// std::cout << "u_i: " << u_i << " , n_u: " << n_u.size()
|
||||
// << " , Dn_u: " << Dn_u.size() << std::endl;
|
||||
n_u[u_i] = this->u_functions[u_i](u.x());
|
||||
Dn_u[u_i] = this->Du_functions[u_i](u.x());
|
||||
@@ -300,9 +300,9 @@ Eigen::VectorXd NurbsBase2D::getDvVector(Eigen::Vector2d u)
|
||||
{
|
||||
C1 = weights[i] * Dn_v[v_i] * n_u[u_i];
|
||||
C2 = weights[i] * n_v[v_i] * n_u[u_i];
|
||||
A1[i] = C1;
|
||||
A1[i] = C1;
|
||||
A2[i] = C2;
|
||||
A3 += C2;
|
||||
A3 += C2;
|
||||
A5 += C1;
|
||||
i ++;
|
||||
}
|
||||
@@ -348,7 +348,7 @@ std::tuple<NurbsBase2D, Eigen::MatrixXd> NurbsBase2D::interpolateUBS(
|
||||
Eigen::VectorXd weights, u_knots, v_knots;
|
||||
u_knots = NurbsBase1D::getKnotSequence(u_min, u_max, degree_u, num_u_poles);
|
||||
v_knots = NurbsBase1D::getKnotSequence(v_min, v_max, degree_v, num_v_poles);
|
||||
|
||||
|
||||
weights.resize((u_knots.rows() - degree_u - 1) * (v_knots.rows() - degree_v - 1));
|
||||
weights.setOnes();
|
||||
NurbsBase2D new_base(u_knots, v_knots, weights, degree_u, degree_v);
|
||||
@@ -378,7 +378,7 @@ Eigen::Matrix<double, Eigen::Dynamic, 2> NurbsBase2D::getUVMesh(int num_u_points
|
||||
uv_points(i, 1) = v_min + (v_max - v_min) * v / (num_v_points - 1);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return uv_points;
|
||||
}
|
||||
@@ -458,10 +458,10 @@ Eigen::VectorXd NurbsBase1D::getDuVector(double u)
|
||||
{
|
||||
C1 = weights[i] * Dn_u[u_i];
|
||||
C2 = weights[i] * n_u[u_i];
|
||||
C3 += C1;
|
||||
C3 += C1;
|
||||
C4 += C2;
|
||||
|
||||
A1[i] = C1;
|
||||
A1[i] = C1;
|
||||
A2[i] = C2;
|
||||
i ++;
|
||||
}
|
||||
@@ -508,7 +508,7 @@ Eigen::VectorXd NurbsBase1D::getUMesh(int num_u_points)
|
||||
double u_max = this->u_knots(this->u_knots.size() - 1);
|
||||
Eigen::Matrix<double, Eigen::Dynamic, 1> u_points;
|
||||
u_points.setLinSpaced(num_u_points, u_min, u_max);
|
||||
return u_points;
|
||||
return u_points;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -68,9 +68,9 @@ struct NurbsBase2D
|
||||
|
||||
Eigen::VectorXd getDvVector(Eigen::Vector2d u);
|
||||
spMat getDvMatrix(Eigen::Matrix<double, Eigen::Dynamic, 2> U);
|
||||
|
||||
|
||||
Eigen::Matrix<double, Eigen::Dynamic, 2> getUVMesh(int num_u_points, int num_v_points);
|
||||
|
||||
|
||||
std::tuple<NurbsBase2D, Eigen::MatrixXd> interpolateUBS(
|
||||
Eigen::Matrix<double, Eigen::Dynamic, 3> poles,
|
||||
int degree_u,
|
||||
@@ -100,14 +100,14 @@ struct NurbsBase1D
|
||||
|
||||
Eigen::VectorXd getDuVector(double u);
|
||||
spMat getDuMatrix(Eigen::VectorXd u);
|
||||
|
||||
|
||||
static Eigen::VectorXd getKnotSequence(double u_min, double u_max, int deg, int num_poles);
|
||||
static Eigen::VectorXd getWeightList(Eigen::VectorXd knots, int u_deg);
|
||||
|
||||
|
||||
Eigen::VectorXd getUMesh(int num_u_points);
|
||||
|
||||
|
||||
std::tuple<NurbsBase1D, Eigen::Matrix<double, Eigen::Dynamic, 3>> interpolateUBS(
|
||||
Eigen::Matrix<double, Eigen::Dynamic, 3> poles,
|
||||
Eigen::Matrix<double, Eigen::Dynamic, 3> poles,
|
||||
int degree,
|
||||
int num_u_poles,
|
||||
int num_u_points);
|
||||
|
||||
@@ -110,7 +110,7 @@ ColMat<double, 3> interpolateFlatFacePy(FaceUnwrapper& instance, py::object* fac
|
||||
PYBIND11_MODULE(flatmesh, m)
|
||||
{
|
||||
m.doc() = "functions to unwrapp faces/ meshes";
|
||||
|
||||
|
||||
py::class_<lscmrelax::LscmRelax>(m, "LscmRelax")
|
||||
.def(py::init<ColMat<double, 3>, ColMat<long, 3>, std::vector<long>>())
|
||||
.def("lscm", &lscmrelax::LscmRelax::lscm)
|
||||
@@ -167,5 +167,5 @@ PYBIND11_MODULE(flatmesh, m)
|
||||
.def_readonly("ze_nodes", &FaceUnwrapper::ze_nodes)
|
||||
.def_readonly("ze_poles", &FaceUnwrapper::ze_poles)
|
||||
.def_readonly("A", &FaceUnwrapper::A);
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -84,7 +84,7 @@ using namespace MeshPart;
|
||||
SMESH_Gen* Mesher::_mesh_gen = nullptr;
|
||||
|
||||
|
||||
MeshingOutput::MeshingOutput()
|
||||
MeshingOutput::MeshingOutput()
|
||||
{
|
||||
buffer.reserve(80);
|
||||
}
|
||||
|
||||
@@ -21,4 +21,4 @@
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#include "PreCompiled.h"
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
#include <Standard_UUID.hxx>
|
||||
#include <Standard_WayOfLife.hxx>
|
||||
|
||||
|
||||
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TColStd_SequenceOfExtendedString.hxx>
|
||||
@@ -134,7 +134,7 @@
|
||||
#include <BRepCheck_ListIteratorOfListOfStatus.hxx>
|
||||
|
||||
#include <BRepTools.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
#include <GCE2d_MakeSegment.hxx>
|
||||
#include <GCPnts_TangentialDeflection.hxx>
|
||||
#include <GCPnts_UniformDeflection.hxx>
|
||||
|
||||
@@ -191,7 +191,7 @@ CrossSections::CrossSections(const Base::BoundBox3d& bb, QWidget* parent, Qt::Wi
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Destroys the object and frees any allocated resources
|
||||
*/
|
||||
CrossSections::~CrossSections()
|
||||
|
||||
@@ -21,4 +21,4 @@
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#include "PreCompiled.h"
|
||||
|
||||
@@ -47,4 +47,4 @@ protected:
|
||||
} // namespace MeshPartGui
|
||||
|
||||
|
||||
#endif // MESHPARTGUI_WORKBENCH_H
|
||||
#endif // MESHPARTGUI_WORKBENCH_H
|
||||
|
||||
Reference in New Issue
Block a user