mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 22:20:35 +05:00
optimization
This commit is contained in:
parent
0c78fe56a7
commit
763f8f9660
@ -778,11 +778,13 @@ void STLChart :: SetNormal (const Point<3> & apref, const Vec<3> & anormal)
|
||||
t2 = Cross (normal, t1);
|
||||
}
|
||||
|
||||
/*
|
||||
Point<2> STLChart :: Project2d (const Point<3> & p3d) const
|
||||
{
|
||||
Vec<3> v = p3d-pref;
|
||||
return Point<2> (t1 * v, t2 * v);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@ -792,6 +794,8 @@ Point<2> STLChart :: Project2d (const Point<3> & p3d) const
|
||||
int i1, i2;
|
||||
public:
|
||||
*/
|
||||
|
||||
/*
|
||||
STLBoundarySeg ::
|
||||
STLBoundarySeg (int ai1, int ai2, const Array<Point<3> > & points,
|
||||
const STLChart * chart)
|
||||
@ -809,6 +813,7 @@ STLBoundarySeg (int ai1, int ai2, const Array<Point<3> > & points,
|
||||
boundingbox.Set (p2d1);
|
||||
boundingbox.Add (p2d2);
|
||||
}
|
||||
*/
|
||||
|
||||
void STLBoundarySeg :: Swap ()
|
||||
{
|
||||
@ -1104,6 +1109,15 @@ int STLBoundary :: TestSegChartNV(const Point3d & p1, const Point3d& p2,
|
||||
double eps = 1e-3;
|
||||
bool ok = true;
|
||||
|
||||
/*
|
||||
static long int cnt = 0;
|
||||
static long int totnseg = 0;
|
||||
totnseg += nseg;
|
||||
cnt++;
|
||||
if ( (cnt % 100000) == 0)
|
||||
cout << "avg nseg = " << double(totnseg)/cnt << endl;
|
||||
*/
|
||||
|
||||
for (int j = 1; j <= nseg; j++)
|
||||
{
|
||||
const STLBoundarySeg & seg = GetSegment(j);
|
||||
|
@ -100,7 +100,11 @@ private:
|
||||
public:
|
||||
void SetNormal (const Point<3> & apref, const Vec<3> & anormal);
|
||||
const Vec<3> & GetNormal () const { return normal; }
|
||||
Point<2> Project2d (const Point<3> & p3d) const;
|
||||
Point<2> Project2d (const Point<3> & p3d) const
|
||||
{
|
||||
Vec<3> v = p3d-pref;
|
||||
return Point<2> (t1 * v, t2 * v);
|
||||
}
|
||||
};
|
||||
|
||||
class STLBoundarySeg
|
||||
@ -116,7 +120,19 @@ class STLBoundarySeg
|
||||
public:
|
||||
STLBoundarySeg () { ; }
|
||||
STLBoundarySeg (int ai1, int ai2, const Array<Point<3> > & points,
|
||||
const STLChart * achart);
|
||||
const STLChart * chart)
|
||||
: p1(points.Get(ai1)), p2(points.Get(ai2)),
|
||||
i1(ai1), i2(ai2)
|
||||
{
|
||||
center = ::netgen::Center (p1, p2);
|
||||
rad = Dist (p1, center);
|
||||
|
||||
p2d1 = chart->Project2d (p1);
|
||||
p2d2 = chart->Project2d (p2);
|
||||
|
||||
boundingbox.Set (p2d1);
|
||||
boundingbox.Add (p2d2);
|
||||
}
|
||||
|
||||
int operator== (const STLBoundarySeg & s2) const
|
||||
{ return i1 == s2.i1 && i2 == s2.i2; }
|
||||
|
Loading…
Reference in New Issue
Block a user