mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-11 21:50:34 +05:00
geometry info for elliptic-cylinder
This commit is contained in:
parent
84fda5f10b
commit
aa805dfafe
@ -79,8 +79,12 @@ namespace netgen
|
||||
|
||||
p = ap;
|
||||
n = an;
|
||||
n.Normalize();
|
||||
CalcData();
|
||||
}
|
||||
|
||||
void Plane :: CalcData()
|
||||
{
|
||||
n.Normalize();
|
||||
cxx = cyy = czz = cxy = cxz = cyz = 0;
|
||||
cx = n(0); cy = n(1); cz = n(2);
|
||||
c1 = - (cx * p(0) + cy * p(1) + cz * p(2));
|
||||
@ -100,9 +104,7 @@ namespace netgen
|
||||
p = hp;
|
||||
n = hn;
|
||||
|
||||
cxx = cyy = czz = cxy = cxz = cyz = 0;
|
||||
cx = n(0); cy = n(1); cz = n(2);
|
||||
c1 = - (cx * p(0) + cy * p(1) + cz * p(2));
|
||||
CalcData();
|
||||
}
|
||||
|
||||
|
||||
@ -129,11 +131,7 @@ namespace netgen
|
||||
n(1) = coeffs.Elem(5);
|
||||
n(2) = coeffs.Elem(6);
|
||||
|
||||
n.Normalize();
|
||||
|
||||
cxx = cyy = czz = cxy = cxz = cyz = 0;
|
||||
cx = n(0); cy = n(1); cz = n(2);
|
||||
c1 = - (cx * p(0) + cy * p(1) + cz * p(2));
|
||||
CalcData();
|
||||
}
|
||||
|
||||
Primitive * Plane :: CreateDefault ()
|
||||
@ -158,27 +156,21 @@ namespace netgen
|
||||
}
|
||||
else
|
||||
{
|
||||
//(*testout) << "pos1" << endl;
|
||||
if (fabs (s2.CalcFunctionValue(p)) > eps) return 0;
|
||||
Vec<3> hv1, hv2;
|
||||
hv1 = n.GetNormal ();
|
||||
hv2 = Cross (n, hv1);
|
||||
|
||||
Point<3> hp = p + hv1;
|
||||
//(*testout) << "pos2" << endl;
|
||||
//(*testout) << "eps " << eps << " s2.CalcFunctionValue(hp) " << s2.CalcFunctionValue(hp) << endl;
|
||||
if (fabs (s2.CalcFunctionValue(hp)) > eps) return 0;
|
||||
//(*testout) << "pos3" << endl;
|
||||
hp = p + hv2;
|
||||
if (fabs (s2.CalcFunctionValue(hp)) > eps) return 0;
|
||||
}
|
||||
|
||||
//(*testout) << "pos4" << endl;
|
||||
Vec<3> n1, n2;
|
||||
n1 = GetNormalVector (p);
|
||||
n2 = s2.GetNormalVector (p);
|
||||
inv = (n1 * n2 < 0);
|
||||
//(*testout) << "inv " << inv << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -205,14 +197,6 @@ namespace netgen
|
||||
|
||||
void Plane :: FromPlane (const Point<2> & pplane, Point<3> & p3d, double h) const
|
||||
{
|
||||
/*
|
||||
Vec<3> p1p;
|
||||
Point<2> pplane2 = pplane;
|
||||
|
||||
pplane2 *= h;
|
||||
p1p = pplane2(0) * ex + pplane2(1) * ey;
|
||||
p3d = p1 + p1p;
|
||||
*/
|
||||
p3d = p1 + (h * pplane(0)) * ex + (h * pplane(1)) * ey;
|
||||
}
|
||||
|
||||
@ -1124,9 +1108,46 @@ namespace netgen
|
||||
}
|
||||
|
||||
CalcData();
|
||||
// Print (cout);
|
||||
}
|
||||
|
||||
EllipticCylinder :: EllipticCylinder (Array<double> & coeffs)
|
||||
{
|
||||
SetPrimitiveData(coeffs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void EllipticCylinder :: GetPrimitiveData (const char *& classname, Array<double> & coeffs) const
|
||||
{
|
||||
classname = "ellipticcylinder";
|
||||
coeffs.SetSize (9);
|
||||
coeffs[0] = a(0);
|
||||
coeffs[1] = a(1);
|
||||
coeffs[2] = a(2);
|
||||
coeffs[3] = vl(0);
|
||||
coeffs[4] = vl(1);
|
||||
coeffs[5] = vl(2);
|
||||
coeffs[6] = vs(0);
|
||||
coeffs[7] = vs(1);
|
||||
coeffs[8] = vs(2);
|
||||
}
|
||||
|
||||
void EllipticCylinder :: SetPrimitiveData (Array<double> & coeffs)
|
||||
{
|
||||
a(0) = coeffs[0];
|
||||
a(1) = coeffs[1];
|
||||
a(2) = coeffs[2];
|
||||
vl(0) = coeffs[3];
|
||||
vl(1) = coeffs[4];
|
||||
vl(2) = coeffs[5];
|
||||
vs(0) = coeffs[6];
|
||||
vs(1) = coeffs[7];
|
||||
vs(2) = coeffs[8];
|
||||
|
||||
CalcData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void EllipticCylinder :: CalcData ()
|
||||
{
|
||||
|
@ -109,7 +109,8 @@ namespace netgen
|
||||
virtual void GetTriangleApproximation
|
||||
(TriangleApproximation & tas,
|
||||
const Box<3> & boundingbox, double facets) const;
|
||||
|
||||
protected:
|
||||
void CalcData();
|
||||
};
|
||||
|
||||
// typedef Plane Plane;
|
||||
@ -238,12 +239,13 @@ namespace netgen
|
||||
///
|
||||
EllipticCylinder (const Point<3> & aa,
|
||||
const Vec<3> & avl, const Vec<3> & avs);
|
||||
EllipticCylinder (Array<double> & coeffs);
|
||||
|
||||
|
||||
// static Primitive * CreateDefault ();
|
||||
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
|
||||
/*
|
||||
static Primitive * CreateDefault ();
|
||||
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
|
||||
virtual void SetPrimitiveData (Array<double> & coeffs);
|
||||
*/
|
||||
///
|
||||
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
|
||||
///
|
||||
|
@ -434,6 +434,16 @@ namespace netgen
|
||||
delete_them.Append(cylinder);
|
||||
}
|
||||
|
||||
else if(classname == "ellipticcylinder")
|
||||
{
|
||||
EllipticCylinder * cylinder = new EllipticCylinder(coeffs);
|
||||
AddSurface(cylinder);
|
||||
delete_them.Append(cylinder);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
else if(classname == "cone")
|
||||
{
|
||||
Cone * cone = new Cone(dummypoint,dummypoint,dummydouble,dummydouble);
|
||||
|
Loading…
Reference in New Issue
Block a user