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