2009-01-13 04:40:13 +05:00
|
|
|
#ifndef FILE_STLGEOM
|
|
|
|
#define FILE_STLGEOM
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
/* File: stlgeom.hpp */
|
|
|
|
/* Author: Joachim Schoeberl */
|
|
|
|
/* Author2: Johannes Gerstmayr */
|
|
|
|
/* Date: 26. Jul. 99 */
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
STL Geometry
|
|
|
|
|
|
|
|
|
|
|
|
Terminology:
|
|
|
|
|
|
|
|
Point ... coordinates of STL triangles
|
|
|
|
Triangle (short Trig) STL triangle
|
|
|
|
TopEdge .... edge in topology, boundary of STL triangles (many)
|
|
|
|
Edge .... Edges which will occur in the mesh (confirmed edges, less)
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <meshing.hpp>
|
|
|
|
|
2019-09-21 01:21:39 +05:00
|
|
|
#include "stltopology.hpp"
|
|
|
|
#include "stltool.hpp"
|
|
|
|
#include "stlline.hpp"
|
|
|
|
|
|
|
|
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
namespace netgen
|
|
|
|
{
|
2018-07-29 15:03:56 +05:00
|
|
|
/*
|
2019-07-09 13:39:16 +05:00
|
|
|
inline int IsInArray(int n, const NgArray<int>& ia)
|
2012-10-22 19:13:57 +06:00
|
|
|
{
|
|
|
|
return ia.Contains(n);
|
|
|
|
}
|
|
|
|
|
2019-07-09 13:39:16 +05:00
|
|
|
inline bool AddIfNotExists(NgArray<int>& list, int x)
|
2012-10-22 19:13:57 +06:00
|
|
|
{
|
|
|
|
if (list.Contains(x)) return false;
|
|
|
|
list.Append(x);
|
|
|
|
return true;
|
|
|
|
}
|
2018-07-29 15:03:56 +05:00
|
|
|
*/
|
2011-07-25 17:33:19 +06:00
|
|
|
|
2019-08-06 13:42:53 +05:00
|
|
|
// extern DLL_HEADER MeshingParameters mparam;
|
2011-07-25 17:33:19 +06:00
|
|
|
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class STLEdgeDataList
|
|
|
|
{
|
2019-07-09 13:39:16 +05:00
|
|
|
NgArray<int> storedstatus;
|
2009-01-13 04:40:13 +05:00
|
|
|
STLTopology & geom;
|
|
|
|
public:
|
|
|
|
|
|
|
|
STLEdgeDataList(STLTopology & ageom);
|
|
|
|
~STLEdgeDataList();
|
|
|
|
|
|
|
|
void Store ();
|
|
|
|
void Restore ();
|
|
|
|
|
|
|
|
void SetSize(int /* size */) { };
|
|
|
|
void Clear() { };
|
|
|
|
int Size() const { return geom.GetNTE(); }
|
|
|
|
const STLTopEdge & Get(int i) const { return geom.GetTopEdge(i); }
|
|
|
|
STLTopEdge & Elem(int i) { return geom.GetTopEdge(i); }
|
|
|
|
|
|
|
|
int GetNEPP(int pn) const {return geom.NTopEdgesPerPoint(pn); }
|
|
|
|
int GetEdgePP(int pn, int vi) const {return geom.TopEdgePerPoint(pn, vi);};
|
|
|
|
|
|
|
|
//void AddEdgePP(int pn, int vn) { } ;
|
|
|
|
|
|
|
|
void ResetAll();
|
|
|
|
void ChangeStatus(int status1, int status2);
|
|
|
|
|
|
|
|
int GetEdgeNum(int np1, int np2) const
|
|
|
|
{ return geom.GetTopEdgeNum (np1, np2); }
|
|
|
|
|
|
|
|
int GetNConfEdges() const;
|
|
|
|
|
|
|
|
void Write(ofstream& of) const;
|
|
|
|
void Read(ifstream& ifs);
|
|
|
|
|
2019-07-09 13:39:16 +05:00
|
|
|
void BuildLineWithEdge(int ep1, int ep2, NgArray<twoint>& line);
|
|
|
|
void BuildClusterWithEdge(int ep1, int ep2, NgArray<twoint>& line);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
int GetNEPPStat(int p, int status) const;
|
|
|
|
int GetNConfCandEPP(int p) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-17 22:37:29 +05:00
|
|
|
class STLGeometry : public NetgenGeometry, public STLTopology
|
2009-01-13 04:40:13 +05:00
|
|
|
{
|
|
|
|
// edges to be meshed:
|
2019-07-09 13:39:16 +05:00
|
|
|
NgArray<STLEdge> edges;
|
2009-01-13 04:40:13 +05:00
|
|
|
//edges per point
|
|
|
|
TABLE<int> edgesperpoint;
|
|
|
|
|
|
|
|
// line: a connection of edges
|
2019-07-09 13:39:16 +05:00
|
|
|
NgArray<STLLine*> lines;
|
|
|
|
NgArray<int> lineendpoints; //per geometrypoint, 1 = is endpoint; 0 = no endpoint,
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2019-07-09 13:39:16 +05:00
|
|
|
NgArray<Vec3d> normals; //normals belong to points!
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2019-07-09 13:39:16 +05:00
|
|
|
NgArray<twoint> externaledges;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
int undoexternaledges;
|
2019-07-09 13:39:16 +05:00
|
|
|
NgArray<twoint> storedexternaledges;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2019-09-21 05:04:35 +05:00
|
|
|
unique_ptr<STLEdgeDataList> edgedata;
|
2009-01-13 04:40:13 +05:00
|
|
|
// STLEdgeDataList edgedata_store;
|
|
|
|
int calcedgedataanglesnew;
|
|
|
|
|
|
|
|
int edgedatastored;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int facecnt;
|
|
|
|
//meshpoint is only set, if an edge is at this point!!!
|
|
|
|
|
2019-07-09 13:39:16 +05:00
|
|
|
NgArray<int> vicinity; //is one, if a triangle belongs to vicinity (eg. of selecttrig)
|
|
|
|
NgArray<int> markedtrigs; //is one, if a triangle belongs to marked triangles (calcdirtystrigs)
|
|
|
|
NgArray<Point3d> markedsegs; //every pointpair is a segment!!!
|
|
|
|
NgArray<twoint> selectedmultiedge;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
|
|
|
//spiralpoints:
|
2019-07-09 13:39:16 +05:00
|
|
|
NgArray<int> spiralpoints;
|
2009-01-13 04:40:13 +05:00
|
|
|
//
|
2019-09-21 01:21:39 +05:00
|
|
|
Array<unique_ptr<STLChart>, ChartId> atlas;
|
2009-01-13 04:40:13 +05:00
|
|
|
//marks all already charted trigs with chartnumber
|
2019-09-21 04:06:49 +05:00
|
|
|
Array<ChartId, STLTrigId> chartmark;
|
2009-01-13 04:40:13 +05:00
|
|
|
//outerchartspertrig, ascending sorted
|
|
|
|
TABLE<int> outerchartspertrig;
|
|
|
|
|
|
|
|
|
|
|
|
//for meshing and project:
|
2019-07-09 13:39:16 +05:00
|
|
|
NgArray<int> meshcharttrigs; //per trig: 1=belong to chart, 0 not
|
2019-10-03 13:45:09 +05:00
|
|
|
mutable int meshchart;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2019-07-09 13:39:16 +05:00
|
|
|
NgArray<int> ha_points; // help array, np long, filled with 0
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
|
|
|
// sharp geometric edges not declared as edges
|
|
|
|
// (not considered for spiral check)
|
|
|
|
INDEX_2_HASHTABLE<int> * smoothedges;
|
|
|
|
|
|
|
|
|
|
|
|
//transformation:
|
2019-10-03 13:45:09 +05:00
|
|
|
mutable Vec<3> meshtrignv;
|
2009-01-13 04:40:13 +05:00
|
|
|
Vec<3> ex, ey, ez;
|
|
|
|
Point<3> p1;
|
|
|
|
|
|
|
|
public:
|
|
|
|
int edgesfound;
|
|
|
|
int surfacemeshed;
|
|
|
|
int surfaceoptimized;
|
|
|
|
int volumemeshed;
|
|
|
|
|
|
|
|
int trigsconverted; //when STLTriangles exist -> 1
|
|
|
|
|
|
|
|
//for selecting nodes
|
|
|
|
//int selecttrig, nodeofseltrig;
|
|
|
|
|
|
|
|
//only for testing;
|
2019-07-09 13:39:16 +05:00
|
|
|
NgArray<STLLine*> meshlines;
|
|
|
|
NgArray<Point3d> meshpoints;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2012-10-22 19:13:57 +06:00
|
|
|
double area;
|
2009-01-13 04:40:13 +05:00
|
|
|
public:
|
|
|
|
STLGeometry();
|
|
|
|
virtual ~STLGeometry();
|
|
|
|
|
2019-08-06 23:03:17 +05:00
|
|
|
void DoArchive(Archive& ar) override
|
2018-12-14 16:01:58 +05:00
|
|
|
{
|
|
|
|
STLTopology::DoArchive(ar);
|
|
|
|
}
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
void Clear();
|
|
|
|
|
2019-08-06 23:03:17 +05:00
|
|
|
virtual void Save (string filename) const override;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2019-10-03 13:45:09 +05:00
|
|
|
bool CalcPointGeomInfo(int surfind, PointGeomInfo& gi, const Point<3> & p3) const override;
|
2019-10-31 21:08:29 +05:00
|
|
|
PointGeomInfo ProjectPoint(INDEX surfind, Point<3> & p) const override;
|
2019-10-03 13:45:09 +05:00
|
|
|
bool ProjectPointGI (int surfind, Point<3> & p, PointGeomInfo & gi) const override;
|
2019-11-04 15:27:01 +05:00
|
|
|
Vec<3> GetNormal(int surfind, const Point<3> & p, const PointGeomInfo* gi = nullptr) const override;
|
2019-10-03 13:45:09 +05:00
|
|
|
void PointBetween(const Point<3> & p1, const Point<3> & p2,
|
|
|
|
double secpoint, int surfi,
|
|
|
|
const PointGeomInfo & gi1,
|
|
|
|
const PointGeomInfo & gi2,
|
|
|
|
Point<3> & newp, PointGeomInfo & newgi) const override;
|
|
|
|
|
|
|
|
void PointBetweenEdge(const Point<3> & p1, const Point<3> & p2, double secpoint,
|
|
|
|
int surfi1, int surfi2,
|
|
|
|
const EdgePointGeomInfo & ap1,
|
|
|
|
const EdgePointGeomInfo & ap2,
|
|
|
|
Point<3> & newp, EdgePointGeomInfo & newgi) const override;
|
|
|
|
|
|
|
|
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void STLInfo(double* data);
|
2009-01-13 04:40:13 +05:00
|
|
|
//stldoctor:
|
2019-08-02 19:22:53 +05:00
|
|
|
DLL_HEADER void SmoothNormals(const STLParameters& stlparam);
|
|
|
|
DLL_HEADER void MarkNonSmoothNormals(const STLParameters& stlparam);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void CalcEdgeData();
|
|
|
|
DLL_HEADER void CalcEdgeDataAngles();
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
const STLEdgeDataList& EdgeDataList() const {return *edgedata;}
|
|
|
|
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void UndoEdgeChange();
|
|
|
|
DLL_HEADER void StoreEdgeData();
|
|
|
|
DLL_HEADER void RestoreEdgeData();
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
//void ClearSelectedMultiEdge() {selectedmultiedge.SetSize(0);}
|
|
|
|
//void AddSelectedMultiEdge(twoint ep) {selectedmultiedge.Append(ep);}
|
|
|
|
//int SelectedMultiEdgeSize() {return selectedmultiedge.Size();}
|
2019-07-09 13:39:16 +05:00
|
|
|
const NgArray<twoint>& SelectedMultiEdge() {return selectedmultiedge;}
|
2009-01-13 04:40:13 +05:00
|
|
|
twoint GetNearestSelectedDefinedEdge();
|
|
|
|
void BuildSelectedMultiEdge(twoint ep);
|
|
|
|
void BuildSelectedEdge(twoint ep);
|
|
|
|
void BuildSelectedCluster(twoint ep);
|
|
|
|
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void ImportEdges();
|
2019-07-09 13:39:16 +05:00
|
|
|
DLL_HEADER void AddEdges(const NgArray<Point<3> >& eps);
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void ExportEdges();
|
|
|
|
DLL_HEADER void LoadEdgeData(const char* file);
|
|
|
|
DLL_HEADER void SaveEdgeData(const char* file);
|
2009-01-13 04:40:13 +05:00
|
|
|
// void SetEdgeAtSelected(int mode);
|
|
|
|
|
|
|
|
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void STLDoctorConfirmEdge();
|
|
|
|
DLL_HEADER void STLDoctorCandidateEdge();
|
|
|
|
DLL_HEADER void STLDoctorExcludeEdge();
|
|
|
|
DLL_HEADER void STLDoctorUndefinedEdge();
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void STLDoctorSetAllUndefinedEdges();
|
|
|
|
DLL_HEADER void STLDoctorEraseCandidateEdges();
|
|
|
|
DLL_HEADER void STLDoctorConfirmCandidateEdges();
|
|
|
|
DLL_HEADER void STLDoctorConfirmedToCandidateEdges();
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void STLDoctorDirtyEdgesToCandidates();
|
|
|
|
DLL_HEADER void STLDoctorLongLinesToCandidates();
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void UndoExternalEdges();
|
|
|
|
DLL_HEADER void StoreExternalEdges();
|
|
|
|
DLL_HEADER void RestoreExternalEdges();
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void ImportExternalEdges(const char * filename); // Flame edges, JS
|
2009-01-13 04:40:13 +05:00
|
|
|
// void LoadExternalEdges();
|
|
|
|
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void BuildExternalEdgesFromEdges();
|
|
|
|
DLL_HEADER void SaveExternalEdges();
|
|
|
|
DLL_HEADER void AddExternalEdgeAtSelected();
|
|
|
|
DLL_HEADER void AddClosedLinesToExternalEdges();
|
|
|
|
DLL_HEADER void AddLongLinesToExternalEdges();
|
|
|
|
DLL_HEADER void AddAllNotSingleLinesToExternalEdges();
|
2019-08-02 19:22:53 +05:00
|
|
|
DLL_HEADER void STLDoctorBuildEdges(const STLParameters& stlparam);
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void AddExternalEdgesFromGeomLine();
|
|
|
|
DLL_HEADER void DeleteDirtyExternalEdges();
|
|
|
|
DLL_HEADER void DeleteExternalEdgeAtSelected();
|
|
|
|
DLL_HEADER void DeleteExternalEdgeInVicinity();
|
2009-01-13 04:40:13 +05:00
|
|
|
void AddExternalEdge(int p1, int p2);
|
|
|
|
void DeleteExternalEdge(int p1, int p2);
|
|
|
|
int IsExternalEdge(int p1, int p2);
|
|
|
|
int NOExternalEdges() const {return externaledges.Size();}
|
|
|
|
twoint GetExternalEdge(int i) const {return externaledges.Get(i);}
|
|
|
|
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void DestroyDirtyTrigs();
|
|
|
|
DLL_HEADER void CalcNormalsFromGeometry();
|
|
|
|
DLL_HEADER void MoveSelectedPointToMiddle();
|
|
|
|
DLL_HEADER void NeighbourAnglesOfSelectedTrig();
|
|
|
|
DLL_HEADER void PrintSelectInfo();
|
|
|
|
DLL_HEADER void ShowSelectedTrigChartnum();
|
|
|
|
DLL_HEADER void ShowSelectedTrigCoords();
|
|
|
|
DLL_HEADER void SmoothGeometry ();
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void LoadMarkedTrigs();
|
|
|
|
DLL_HEADER void SaveMarkedTrigs();
|
|
|
|
void ClearMarkedSegs() {markedsegs.SetSize(0);}
|
2009-01-13 04:40:13 +05:00
|
|
|
void AddMarkedSeg(const Point<3> & ap1, const Point<3> & ap2)
|
|
|
|
{
|
|
|
|
markedsegs.Append(ap1);markedsegs.Append(ap2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GetMarkedSeg(int i, Point<3> & ap1, Point<3> & ap2)
|
|
|
|
{
|
|
|
|
ap1=markedsegs.Get(i*2-1);
|
|
|
|
ap2=markedsegs.Get(i*2);
|
|
|
|
}
|
|
|
|
int GetNMarkedSegs() {return markedsegs.Size()/2;}
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void CalcVicinity(int starttrig);
|
2019-07-09 13:39:16 +05:00
|
|
|
DLL_HEADER void GetVicinity(int starttrig, int size, NgArray<int>& vic);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER int Vicinity(int trig) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void InitMarkedTrigs();
|
2019-08-02 19:22:53 +05:00
|
|
|
DLL_HEADER void MarkDirtyTrigs(const STLParameters& stlparam);
|
|
|
|
DLL_HEADER void SmoothDirtyTrigs(const STLParameters& stlparam);
|
|
|
|
DLL_HEADER void GeomSmoothRevertedTrigs(const STLParameters& stlparam);
|
|
|
|
DLL_HEADER void MarkRevertedTrigs(const STLParameters& stlparam);
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER double CalcTrigBadness(int i);
|
|
|
|
DLL_HEADER int IsMarkedTrig(int trig) const;
|
|
|
|
DLL_HEADER void SetMarkedTrig(int trig, int num);
|
|
|
|
DLL_HEADER void MarkTopErrorTrigs ();
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
//Selected triangle
|
2015-10-19 13:08:30 +05:00
|
|
|
DLL_HEADER void SetSelectTrig(int trig);
|
|
|
|
DLL_HEADER int GetSelectTrig() const;
|
|
|
|
DLL_HEADER void SetNodeOfSelTrig(int n);
|
|
|
|
DLL_HEADER int GetNodeOfSelTrig() const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
2016-12-11 22:22:07 +05:00
|
|
|
int AddNormal(const Vec3d& n) { normals.Append(n); return normals.Size(); }
|
2009-01-13 04:40:13 +05:00
|
|
|
const Vec3d & GetNormal(int nr) const {return normals.Get(nr);}
|
|
|
|
void SetNormal(int nr, const Vec3d& n) {normals.Elem(nr) = n;}
|
|
|
|
|
2016-12-11 22:22:07 +05:00
|
|
|
int AddEdge(const STLEdge& v) { edges.Append(v); return edges.Size(); }
|
2009-01-13 04:40:13 +05:00
|
|
|
int AddEdge(int p1, int p2);
|
|
|
|
|
|
|
|
STLEdge GetEdge(int nr) {return edges.Get(nr);}
|
|
|
|
int GetNE() {return edges.Size();}
|
|
|
|
|
|
|
|
double Area();
|
|
|
|
|
|
|
|
double GetAngle(int t1, int t2);
|
|
|
|
double GetGeomAngle(int t1, int t2);
|
|
|
|
//if triangles t1 and t2 touch, return 1 and in p1, p2 the touching points
|
|
|
|
//int TrigsTouch(int t1, int t2, int& p1, int& p2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
///ReadTriangle->STLTriangle, initialise some important variables, always after load!!!
|
2019-08-06 23:03:17 +05:00
|
|
|
virtual void InitSTLGeometry (const NgArray<STLReadTriangle> & readtrigs) override;
|
|
|
|
virtual void TopologyChanged() override; //do some things, if topology changed!
|
2009-01-13 04:40:13 +05:00
|
|
|
int CheckGeometryOverlapping();
|
|
|
|
|
|
|
|
//get NO edges per point
|
|
|
|
int GetEPPSize() const {return edgesperpoint.Size();};
|
|
|
|
int GetNEPP(int pn)
|
|
|
|
{
|
|
|
|
if (edgesperpoint.Size() == 0) {BuildEdgesPerPoint();}
|
|
|
|
return edgesperpoint.EntrySize(pn);
|
|
|
|
};
|
|
|
|
int GetEdgePP(int pn, int vi)
|
|
|
|
{
|
|
|
|
if (edgesperpoint.Size() == 0) {BuildEdgesPerPoint();}
|
|
|
|
return edgesperpoint.Get(pn,vi);
|
|
|
|
};
|
|
|
|
void AddEdgePP(int pn, int vn) {edgesperpoint.Add1(pn,vn);};
|
|
|
|
//von 2 punkten ermitteln, ob sie eine Kante sind
|
|
|
|
int IsEdge(int p1, int p2);
|
|
|
|
int IsEdgeNum(int p1, int p2);
|
|
|
|
|
|
|
|
///Build EdgeSegments
|
|
|
|
void ClearEdges();
|
2019-08-02 19:22:53 +05:00
|
|
|
void BuildEdges(const STLParameters& stlparam);
|
2009-01-13 04:40:13 +05:00
|
|
|
void BuildEdgesPerPoint();
|
|
|
|
void UseExternalEdges();
|
|
|
|
|
|
|
|
|
2019-08-02 19:22:53 +05:00
|
|
|
void FindEdgesFromAngles(const STLParameters& stlparam);
|
2009-01-13 04:40:13 +05:00
|
|
|
void CalcFaceNums();
|
|
|
|
int GetNOBodys();
|
|
|
|
int GetNOFaces() {return facecnt;}
|
2019-08-02 19:22:53 +05:00
|
|
|
void LinkEdges(const STLParameters& stlparam);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2019-08-02 19:22:53 +05:00
|
|
|
void AddConeAndSpiralEdges(const STLParameters& stlparam);
|
2009-01-13 04:40:13 +05:00
|
|
|
void AddFaceEdges(); //each face should have at least one starting edge (outherwise it won't be meshed)
|
|
|
|
|
2019-09-21 04:06:49 +05:00
|
|
|
void GetDirtyChartTrigs(int chartnum, STLChart& chart, const Array<ChartId, STLTrigId>& outercharttrigs,
|
2019-09-21 01:21:39 +05:00
|
|
|
NgArray<ChartId>& chartpointchecked, NgArray<int>& dirtytrigs);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
void ClearSpiralPoints();
|
|
|
|
void SetSpiralPoint(int pn) {spiralpoints.Elem(pn) = 1;};
|
|
|
|
int GetSpiralPoint(int pn) const {return spiralpoints.Get(pn);};
|
|
|
|
|
2019-09-21 05:04:35 +05:00
|
|
|
void GetSortedTrianglesAroundPoint(STLPointId p, STLTrigId starttrig, Array<STLTrigId>& trigs);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
// smooth edges: sharp geometric edges not declared as edges
|
|
|
|
void BuildSmoothEdges ();
|
2019-09-21 01:21:39 +05:00
|
|
|
bool IsSmoothEdge (int pi1, int pi2) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
|
|
|
//make charts with regions of a max. angle
|
2019-08-02 19:22:53 +05:00
|
|
|
void MakeAtlas(class Mesh & mesh, const MeshingParameters& mparam, const STLParameters& stlparam);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
//outerchartspertrig, sorted!
|
|
|
|
int GetOCPTSize() const {return outerchartspertrig.Size();};
|
|
|
|
int GetNOCPT(int tn) const {return outerchartspertrig.EntrySize(tn);};
|
|
|
|
int GetOCPT(int tn, int vi) const {return outerchartspertrig.Get(tn,vi);};
|
|
|
|
void SetOCPT(int tn, int vi, int ocn) {outerchartspertrig.Set(tn,vi,ocn);};
|
|
|
|
void AddOCPT(int tn, int ocn) {outerchartspertrig.Add1(tn, ocn);};
|
|
|
|
int TrigIsInOC(int tn, int ocn) const;
|
|
|
|
|
|
|
|
//get chart number of a trig or 0 if unmarked
|
2019-09-24 16:16:26 +05:00
|
|
|
DLL_HEADER ChartId GetChartNr(STLTrigId i) const;
|
2019-09-21 04:06:49 +05:00
|
|
|
ChartId GetMarker(STLTrigId i) const { return chartmark[i]; }
|
|
|
|
void SetMarker(STLTrigId nr, ChartId m);
|
|
|
|
size_t GetNOCharts() const { return atlas.Size(); }
|
2009-01-13 04:40:13 +05:00
|
|
|
//get a chart from atlas
|
2019-09-21 01:21:39 +05:00
|
|
|
const STLChart& GetChart(ChartId nr) const { return *atlas[nr];};
|
|
|
|
STLChart & GetChart(ChartId nr) { return *atlas[nr];};
|
2019-09-24 16:16:26 +05:00
|
|
|
DLL_HEADER int AtlasMade() const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2019-09-21 01:21:39 +05:00
|
|
|
void GetInnerChartLimes(NgArray<twoint>& limes, ChartId chartnum);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
//FOR MESHING
|
|
|
|
int GetMeshChartNr () { return meshchart; }
|
2019-09-30 13:19:35 +05:00
|
|
|
void GetMeshChartBoundary (NgArray<Point<2>> & points,
|
|
|
|
NgArray<Point<3>> & points3d,
|
2019-07-09 13:39:16 +05:00
|
|
|
NgArray<INDEX_2> & lines, double h);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
|
|
|
Point<3> PointBetween(const Point<3> & p1, int t1, const Point<3> & p2, int t2);
|
|
|
|
|
|
|
|
//select triangles in meshcharttrigs of actual (defined by trig) whole chart
|
|
|
|
void PrepareSurfaceMeshing();
|
|
|
|
//
|
|
|
|
void DefineTangentialPlane(const Point<3> & ap1, const Point<3> & ap2, int trig);
|
|
|
|
//
|
2019-10-03 13:45:09 +05:00
|
|
|
void SelectChartOfTriangle (int trignum) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
//
|
|
|
|
void SelectChartOfPoint (const Point<3> & p);
|
|
|
|
//
|
|
|
|
const Vec<3> & GetChartNormalVector () const { return meshtrignv; }
|
|
|
|
|
|
|
|
// list of trigs
|
|
|
|
void ToPlane (const Point<3> & locpoint, int * trigs, Point<2> & plainpoint,
|
|
|
|
double h, int& zone, int checkchart);
|
|
|
|
//return 0, wenn alles OK, 1 sonst
|
|
|
|
int FromPlane (const Point<2> & plainpoint, Point<3> & locpoint, double h);
|
|
|
|
|
|
|
|
//get nearest point in actual chart and return any triangle where it lies on
|
|
|
|
int ProjectNearest(Point<3> & p3d) const;
|
|
|
|
//project point with normal nv from last define tangential plane
|
|
|
|
|
|
|
|
int LastTrig() const;
|
|
|
|
int Project(Point<3> & p3d) const;
|
|
|
|
int ProjectOnWholeSurface (Point<3> & p3d) const;
|
|
|
|
|
|
|
|
int GetNLines() const {return lines.Size();}
|
2016-12-11 22:22:07 +05:00
|
|
|
int AddLine(STLLine* line) { lines.Append(line); return lines.Size(); }
|
2009-01-13 04:40:13 +05:00
|
|
|
STLLine* GetLine(int nr) const {return lines.Get(nr);}
|
|
|
|
int GetLineP(int lnr, int pnr) const {return lines.Get(lnr)->PNum(pnr);}
|
|
|
|
int GetLineNP(int nr) const {return lines.Get(nr)->NP();}
|
|
|
|
|
|
|
|
void SetLineEndPoint(int pn);
|
|
|
|
int IsLineEndPoint(int pn);
|
|
|
|
int LineEndPointsSet() const {return lineendpoints.Size() == GetNP();}
|
|
|
|
void ClearLineEndPoints();
|
|
|
|
|
2019-11-04 23:34:46 +05:00
|
|
|
DLL_HEADER void RestrictLocalH(class Mesh & mesh, double gh, const STLParameters& stlparam, const MeshingParameters& mparam);
|
2019-08-06 15:16:30 +05:00
|
|
|
void RestrictLocalHCurv(class Mesh & mesh, double gh, const STLParameters& stlparam);
|
2019-09-21 01:21:39 +05:00
|
|
|
void RestrictHChartDistOneChart(ChartId chartnum, NgArray<int>& acttrigs, class Mesh & mesh,
|
2019-08-06 15:16:30 +05:00
|
|
|
double gh, double fact, double minh, const STLParameters& stlparam);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
friend class MeshingSTLSurface;
|
2009-08-25 20:00:20 +06:00
|
|
|
|
2019-08-06 23:03:17 +05:00
|
|
|
int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam) override;
|
2009-08-25 20:00:20 +06:00
|
|
|
|
2019-09-24 16:09:49 +05:00
|
|
|
// Add additional Point to chart to close the surface and write the resulting stl to a file
|
2019-09-24 16:16:26 +05:00
|
|
|
DLL_HEADER void WriteChartToFile( ChartId chartnumber, string filename="chart.slb" );
|
2009-01-13 04:40:13 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#include "meshstlsurface.hpp"
|
|
|
|
|
|
|
|
|
2009-08-25 20:00:20 +06:00
|
|
|
|
2019-08-06 13:42:53 +05:00
|
|
|
extern int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr<Mesh> & mesh, const MeshingParameters & mparam,
|
|
|
|
const STLParameters& stlpar);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|