mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
change more PointNd to Point<N>
This commit is contained in:
parent
656b0e0539
commit
030d8c8523
@ -193,8 +193,8 @@ namespace netgen
|
||||
}
|
||||
|
||||
void Meshing2 ::
|
||||
GetChartBoundary (NgArray<Point2d> & points,
|
||||
NgArray<Point3d> & points3d,
|
||||
GetChartBoundary (NgArray<Point<2>> & points,
|
||||
NgArray<Point<3>> & points3d,
|
||||
NgArray<INDEX_2> & lines, double h) const
|
||||
{
|
||||
points.SetSize (0);
|
||||
@ -279,8 +279,8 @@ namespace netgen
|
||||
|
||||
StartMesh();
|
||||
|
||||
NgArray<Point2d> chartboundpoints;
|
||||
NgArray<Point3d> chartboundpoints3d;
|
||||
NgArray<Point<2>> chartboundpoints;
|
||||
NgArray<Point<3>> chartboundpoints3d;
|
||||
NgArray<INDEX_2> chartboundlines;
|
||||
|
||||
// illegal points: points with more then 50 elements per node
|
||||
@ -519,7 +519,7 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
Point2d p12d, p22d;
|
||||
// Point2d p12d, p22d;
|
||||
|
||||
if (found)
|
||||
{
|
||||
@ -571,8 +571,8 @@ namespace netgen
|
||||
*testout << "2d points: " << endl << plainpoints << endl;
|
||||
|
||||
|
||||
p12d = plainpoints.Get(1);
|
||||
p22d = plainpoints.Get(2);
|
||||
// p12d = plainpoints.Get(1);
|
||||
// p22d = plainpoints.Get(2);
|
||||
|
||||
/*
|
||||
// last idea on friday
|
||||
|
@ -126,8 +126,8 @@ protected:
|
||||
/*
|
||||
get (projected) boundary of current chart
|
||||
*/
|
||||
virtual void GetChartBoundary (NgArray<Point2d> & points,
|
||||
NgArray<Point3d> & points3d,
|
||||
virtual void GetChartBoundary (NgArray<Point<2>> & points,
|
||||
NgArray<Point<3>> & points3d,
|
||||
NgArray<INDEX_2> & lines, double p) const;
|
||||
|
||||
virtual double Area () const;
|
||||
|
@ -79,10 +79,10 @@ void netrule :: SetFreeZoneTransformation (const Vector & devp, int tolclass)
|
||||
|
||||
for (int i = 0; i < fzs; i++)
|
||||
{
|
||||
Point2d p1 = transfreezone[i];
|
||||
Point2d p2 = transfreezone[(i+1) % fzs];
|
||||
const auto& p1 = transfreezone[i];
|
||||
const auto& p2 = transfreezone[(i+1) % fzs];
|
||||
|
||||
Vec2d vn (p2.Y() - p1.Y(), p1.X() - p2.X());
|
||||
Vec<2> vn = { p2[1] - p1[1], p1[0] - p2[0] };
|
||||
|
||||
double len2 = vn.Length2();
|
||||
|
||||
@ -96,9 +96,9 @@ void netrule :: SetFreeZoneTransformation (const Vector & devp, int tolclass)
|
||||
{
|
||||
vn /= sqrt (len2); // scaling necessary ?
|
||||
|
||||
freesetinequ(i,0) = vn.X();
|
||||
freesetinequ(i,1) = vn.Y();
|
||||
freesetinequ(i,2) = -(p1.X() * vn.X() + p1.Y() * vn.Y());
|
||||
freesetinequ(i,0) = vn[0];
|
||||
freesetinequ(i,1) = vn[1];
|
||||
freesetinequ(i,2) = -(p1[0] * vn[0] + p1[1] * vn[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -110,37 +110,37 @@ int netrule :: IsInFreeZone2 (const Point2d & p) const
|
||||
for (int i = 0; i < transfreezone.Size(); i++)
|
||||
{
|
||||
if (freesetinequ(i, 0) * p.X() +
|
||||
freesetinequ(i, 1) * p.Y() +
|
||||
freesetinequ(i, 1) * p[1] +
|
||||
freesetinequ(i, 2) > 0) return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
int netrule :: IsLineInFreeZone2 (const Point2d & p1, const Point2d & p2) const
|
||||
int netrule :: IsLineInFreeZone2 (const Point<2> & p1, const Point<2> & p2) const
|
||||
{
|
||||
if ( (p1.X() > fzmaxx && p2.X() > fzmaxx) ||
|
||||
(p1.X() < fzminx && p2.X() < fzminx) ||
|
||||
(p1.Y() > fzmaxy && p2.Y() > fzmaxy) ||
|
||||
(p1.Y() < fzminy && p2.Y() < fzminy) ) return 0;
|
||||
if ( (p1[0] > fzmaxx && p2[0] > fzmaxx) ||
|
||||
(p1[0] < fzminx && p2[0] < fzminx) ||
|
||||
(p1[1] > fzmaxy && p2[1] > fzmaxy) ||
|
||||
(p1[1] < fzminy && p2[1] < fzminy) ) return 0;
|
||||
|
||||
for (int i = 1; i <= transfreezone.Size(); i++)
|
||||
{
|
||||
if (freesetinequ.Get(i, 1) * p1.X() + freesetinequ.Get(i, 2) * p1.Y() +
|
||||
if (freesetinequ.Get(i, 1) * p1[0] + freesetinequ.Get(i, 2) * p1[1] +
|
||||
freesetinequ.Get(i, 3) > -1e-8 && // -1e-6
|
||||
freesetinequ.Get(i, 1) * p2.X() + freesetinequ.Get(i, 2) * p2.Y() +
|
||||
freesetinequ.Get(i, 1) * p2[0] + freesetinequ.Get(i, 2) * p2[1] +
|
||||
freesetinequ.Get(i, 3) > -1e-8 // -1e-6
|
||||
) return 0;
|
||||
}
|
||||
|
||||
double nx = (p2.Y() - p1.Y());
|
||||
double ny = -(p2.X() - p1.X());
|
||||
double nx = (p2[1] - p1[1]);
|
||||
double ny = -(p2[0] - p1[0]);
|
||||
double nl = sqrt (nx * nx + ny * ny);
|
||||
if (nl > 1e-8)
|
||||
{
|
||||
nx /= nl;
|
||||
ny /= nl;
|
||||
double c = - (p1.X() * nx + p1.Y() * ny);
|
||||
double c = - (p1[0] * nx + p1[1] * ny);
|
||||
|
||||
bool allleft = true;
|
||||
bool allright = true;
|
||||
|
@ -98,13 +98,13 @@ public:
|
||||
///
|
||||
const NgArray<int> & GetDelLines() const { return dellines; }
|
||||
///
|
||||
void GetFreeZone (NgArray<Point2d> & afreearea);
|
||||
void GetFreeZone (NgArray<Point<2>> & afreearea);
|
||||
///
|
||||
|
||||
double CalcPointDist (int pi, const Point2d & p) const
|
||||
double CalcPointDist (int pi, const Point<2> & p) const
|
||||
{
|
||||
double dx = p.X() - points.Get(pi)[0];
|
||||
double dy = p.Y() - points.Get(pi)[1];
|
||||
double dx = p[0] - points.Get(pi)[0];
|
||||
double dy = p[1] - points.Get(pi)[1];
|
||||
const threefloat * tfp = &tolerances.Get(pi);
|
||||
return tfp->f1 * dx * dx + tfp->f2 * dx * dy + tfp->f3 * dy * dy;
|
||||
}
|
||||
@ -116,31 +116,31 @@ public:
|
||||
void SetFreeZoneTransformation (const Vector & u, int tolclass);
|
||||
|
||||
///
|
||||
bool IsInFreeZone (const Point2d & p) const
|
||||
bool IsInFreeZone (const Point<2> & p) const
|
||||
{
|
||||
if (p.X() < fzminx || p.X() > fzmaxx ||
|
||||
p.Y() < fzminy || p.Y() > fzmaxy) return 0;
|
||||
if (p[0] < fzminx || p[0] > fzmaxx ||
|
||||
p[1] < fzminy || p[1] > fzmaxy) return 0;
|
||||
|
||||
for (int i = 0; i < transfreezone.Size(); i++)
|
||||
{
|
||||
if (freesetinequ(i, 0) * p.X() +
|
||||
freesetinequ(i, 1) * p.Y() +
|
||||
if (freesetinequ(i, 0) * p[0] +
|
||||
freesetinequ(i, 1) * p[1] +
|
||||
freesetinequ(i, 2) > 0) return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
///
|
||||
int IsLineInFreeZone (const Point2d & p1, const Point2d & p2) const
|
||||
int IsLineInFreeZone (const Point<2> & p1, const Point<2> & p2) const
|
||||
{
|
||||
if ( (p1.X() > fzmaxx && p2.X() > fzmaxx) ||
|
||||
(p1.X() < fzminx && p2.X() < fzminx) ||
|
||||
(p1.Y() > fzmaxy && p2.Y() > fzmaxy) ||
|
||||
(p1.Y() < fzminy && p2.Y() < fzminy) ) return 0;
|
||||
if ( (p1[0] > fzmaxx && p2[0] > fzmaxx) ||
|
||||
(p1[0] < fzminx && p2[0] < fzminx) ||
|
||||
(p1[1] > fzmaxy && p2[1] > fzmaxy) ||
|
||||
(p1[1] < fzminy && p2[1] < fzminy) ) return 0;
|
||||
return IsLineInFreeZone2 (p1, p2);
|
||||
}
|
||||
///
|
||||
int IsLineInFreeZone2 (const Point2d & p1, const Point2d & p2) const;
|
||||
int IsLineInFreeZone2 (const Point<2> & p1, const Point<2> & p2) const;
|
||||
///
|
||||
int ConvexFreeZone () const;
|
||||
///
|
||||
|
@ -1003,8 +1003,8 @@ IsLineVertexOnChart (const Point3d & p1, const Point3d & p2,
|
||||
}
|
||||
|
||||
void MeshingSTLSurface ::
|
||||
GetChartBoundary (NgArray<Point2d > & points,
|
||||
NgArray<Point3d > & points3d,
|
||||
GetChartBoundary (NgArray<Point<2>> & points,
|
||||
NgArray<Point<3>> & points3d,
|
||||
NgArray<INDEX_2> & lines, double h) const
|
||||
{
|
||||
points.SetSize (0);
|
||||
|
@ -52,8 +52,8 @@ protected:
|
||||
int IsLineVertexOnChart (const Point3d & p1, const Point3d & p2,
|
||||
int endpoint, const PointGeomInfo & gi) override;
|
||||
|
||||
void GetChartBoundary (NgArray<Point2d > & points,
|
||||
NgArray<Point3d > & poitns3d,
|
||||
void GetChartBoundary (NgArray<Point<2>> & points,
|
||||
NgArray<Point<3>> & poitns3d,
|
||||
NgArray<INDEX_2> & lines, double h) const override;
|
||||
|
||||
///
|
||||
|
@ -407,8 +407,8 @@ namespace netgen
|
||||
|
||||
//FOR MESHING
|
||||
int GetMeshChartNr () { return meshchart; }
|
||||
void GetMeshChartBoundary (NgArray<Point2d > & points,
|
||||
NgArray<Point3d > & points3d,
|
||||
void GetMeshChartBoundary (NgArray<Point<2>> & points,
|
||||
NgArray<Point<3>> & points3d,
|
||||
NgArray<INDEX_2> & lines, double h);
|
||||
|
||||
|
||||
|
@ -300,8 +300,8 @@ void STLGeometry :: PrepareSurfaceMeshing()
|
||||
meshcharttrigs = 0;
|
||||
}
|
||||
|
||||
void STLGeometry::GetMeshChartBoundary (NgArray<Point2d > & apoints,
|
||||
NgArray<Point3d > & points3d,
|
||||
void STLGeometry::GetMeshChartBoundary (NgArray<Point<2>> & apoints,
|
||||
NgArray<Point<3>> & points3d,
|
||||
NgArray<INDEX_2> & alines, double h)
|
||||
{
|
||||
twoint seg, newseg;
|
||||
@ -520,14 +520,9 @@ void STLGeometry :: ToPlane (const Point<3> & locpoint, int * trigs,
|
||||
int STLGeometry :: FromPlane (const Point<2> & plainpoint,
|
||||
Point<3> & locpoint, double h)
|
||||
{
|
||||
Point2d plainpoint2 (plainpoint);
|
||||
|
||||
plainpoint2.X() *= h;
|
||||
plainpoint2.Y() *= h;
|
||||
Vec3d p1p = plainpoint2.X() * ex + plainpoint2.Y() * ey;
|
||||
Vec<3> p1p = h * plainpoint[0] * ex + h * plainpoint[1] * ey;
|
||||
locpoint = p1 + p1p;
|
||||
|
||||
|
||||
int rv = Project(locpoint);
|
||||
if (!rv) {return 1;} //project nicht gegangen
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user