2009-01-13 04:40:13 +05:00
|
|
|
#ifndef _EXTRUSION_HPP
|
|
|
|
#define _EXTRUSION_HPP
|
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
namespace netgen
|
|
|
|
{
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
class Extrusion;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
class ExtrusionFace : public Surface
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
const SplineSeg<2> * profile;
|
|
|
|
const SplineGeometry<3> * path;
|
|
|
|
Vec<3> glob_z_direction;
|
2021-04-15 22:02:05 +05:00
|
|
|
Array<double> angles;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
bool deletable;
|
2021-04-15 22:02:05 +05:00
|
|
|
int tangential_plane_seg;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2019-07-09 13:39:16 +05:00
|
|
|
NgArray< const SplineSeg3<3> * > spline3_path;
|
|
|
|
NgArray< const LineSeg<3> * > line_path;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2019-07-09 13:39:16 +05:00
|
|
|
mutable NgArray < Vec<3> > x_dir, y_dir, z_dir, loc_z_dir;
|
|
|
|
mutable NgArray < Point<3> > p0;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
mutable Vec<3> profile_tangent;
|
|
|
|
mutable double profile_par;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
mutable Vector profile_spline_coeff;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
mutable int latest_seg;
|
|
|
|
mutable double latest_t;
|
|
|
|
mutable Point<2> latest_point2d;
|
|
|
|
mutable Point<3> latest_point3d;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
private:
|
|
|
|
void Orthogonalize(const Vec<3> & v1, Vec<3> & v2) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
void Init(void);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
public:
|
|
|
|
double CalcProj(const Point<3> & point3d, Point<2> & point2d,
|
|
|
|
int seg) const;
|
|
|
|
void CalcProj(const Point<3> & point3d, Point<2> & point2d,
|
|
|
|
int & seg, double & t) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
public:
|
|
|
|
ExtrusionFace(const SplineSeg<2> * profile_in,
|
|
|
|
const SplineGeometry<3> * path_in,
|
|
|
|
const Vec<3> & z_direction);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2019-07-09 13:39:16 +05:00
|
|
|
ExtrusionFace(const NgArray<double> & raw_data);
|
2018-12-06 21:53:44 +05:00
|
|
|
// default constructor for archive
|
|
|
|
ExtrusionFace() {}
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
~ExtrusionFace();
|
2018-12-06 21:53:44 +05:00
|
|
|
|
2021-04-17 19:27:30 +05:00
|
|
|
void DoArchive(Archive& ar) override
|
2018-12-06 21:53:44 +05:00
|
|
|
{
|
|
|
|
Surface::DoArchive(ar);
|
|
|
|
ar & profile & path & glob_z_direction & deletable & spline3_path & line_path &
|
|
|
|
x_dir & y_dir & z_dir & loc_z_dir & p0 & profile_tangent & profile_par &
|
|
|
|
profile_spline_coeff & latest_seg & latest_t & latest_point2d & latest_point3d;
|
|
|
|
}
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2021-04-17 19:27:30 +05:00
|
|
|
int IsIdentic (const Surface & s2, int & inv, double eps) const override;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2021-04-17 19:27:30 +05:00
|
|
|
double CalcFunctionValue (const Point<3> & point) const override;
|
|
|
|
void CalcGradient (const Point<3> & point, Vec<3> & grad) const override;
|
|
|
|
void CalcHesse (const Point<3> & point, Mat<3> & hesse) const override;
|
|
|
|
double HesseNorm () const override;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2021-04-17 19:27:30 +05:00
|
|
|
double MaxCurvature () const override;
|
2009-09-07 17:50:13 +06:00
|
|
|
//virtual double MaxCurvatureLoc (const Point<3> & /* c */ ,
|
|
|
|
// double /* rad */) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2021-04-17 19:27:30 +05:00
|
|
|
void Project (Point<3> & p) const override;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2021-04-17 19:27:30 +05:00
|
|
|
Point<3> GetSurfacePoint () const override;
|
|
|
|
void Print (ostream & str) const override;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2021-04-17 19:27:30 +05:00
|
|
|
void GetTriangleApproximation (TriangleApproximation & tas,
|
2009-09-07 17:50:13 +06:00
|
|
|
const Box<3> & boundingbox,
|
2021-04-17 19:27:30 +05:00
|
|
|
double facets) const override;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
const SplineGeometry<3> & GetPath(void) const {return *path;}
|
|
|
|
const SplineSeg<2> & GetProfile(void) const {return *profile;}
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
bool BoxIntersectsFace(const Box<3> & box) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
void LineIntersections ( const Point<3> & p,
|
|
|
|
const Vec<3> & v,
|
|
|
|
const double eps,
|
|
|
|
int & before,
|
|
|
|
int & after,
|
|
|
|
bool & intersecting ) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2020-07-05 14:15:39 +05:00
|
|
|
|
|
|
|
bool PointInFace (const Point<3> & p, const double eps) const;
|
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
INSOLID_TYPE VecInFace ( const Point<3> & p,
|
|
|
|
const Vec<3> & v,
|
|
|
|
const double eps ) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
const Vec<3> & GetYDir ( void ) const {return y_dir[latest_seg];}
|
|
|
|
const Vec<3> & GetProfileTangent (void) const {return profile_tangent;}
|
|
|
|
double GetProfilePar(void) const {return profile_par;}
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2019-07-09 13:39:16 +05:00
|
|
|
void GetRawData(NgArray<double> & data) const;
|
2009-04-20 03:15:26 +06:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
void CalcLocalCoordinates (int seg, double t,
|
|
|
|
Vec<3> & ex, Vec<3> & ey, Vec<3> & ez) const;
|
2009-04-20 03:15:26 +06:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
void CalcLocalCoordinatesDeriv (int seg, double t,
|
|
|
|
Vec<3> & ex, Vec<3> & ey, Vec<3> & ez,
|
|
|
|
Vec<3> & dex, Vec<3> & dey, Vec<3> & dez) const;
|
2009-04-20 03:15:26 +06:00
|
|
|
|
2021-04-15 22:02:05 +05:00
|
|
|
void DefineTangentialPlane(const Point<3>& ap1,
|
|
|
|
const Point<3>& ap2) override;
|
|
|
|
void ToPlane(const Point<3>& p3d, Point<2>& p2d,
|
|
|
|
double h, int& zone) const override;
|
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
};
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
class Extrusion : public Primitive
|
|
|
|
{
|
|
|
|
private:
|
2021-04-12 18:51:40 +05:00
|
|
|
shared_ptr<SplineGeometry<3>> path;
|
|
|
|
shared_ptr<SplineGeometry<2>> profile; // closed, clockwise oriented curve
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2018-12-06 21:53:44 +05:00
|
|
|
Vec<3> z_direction;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2019-07-09 13:39:16 +05:00
|
|
|
NgArray<ExtrusionFace*> faces;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
mutable int latestfacenum;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
public:
|
2021-04-12 18:51:40 +05:00
|
|
|
Extrusion(shared_ptr<SplineGeometry<3>> path_in,
|
|
|
|
shared_ptr<SplineGeometry<2>> profile_in,
|
2009-09-07 17:50:13 +06:00
|
|
|
const Vec<3> & z_dir);
|
2018-12-06 21:53:44 +05:00
|
|
|
// default constructor for archive
|
|
|
|
Extrusion() {}
|
2009-09-07 17:50:13 +06:00
|
|
|
~Extrusion();
|
2018-12-06 21:53:44 +05:00
|
|
|
|
2021-04-17 19:27:30 +05:00
|
|
|
void DoArchive(Archive& ar) override
|
2018-12-06 21:53:44 +05:00
|
|
|
{
|
|
|
|
Primitive::DoArchive(ar);
|
|
|
|
ar & path & profile & z_direction & faces & latestfacenum;
|
|
|
|
}
|
2021-04-17 19:27:30 +05:00
|
|
|
INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const override;
|
|
|
|
INSOLID_TYPE PointInSolid (const Point<3> & p,
|
|
|
|
double eps) const override;
|
2009-09-07 17:50:13 +06:00
|
|
|
INSOLID_TYPE PointInSolid (const Point<3> & p,
|
|
|
|
double eps,
|
2019-07-09 13:39:16 +05:00
|
|
|
NgArray<int> * const facenums) const;
|
2020-07-05 14:15:39 +05:00
|
|
|
|
2021-04-17 19:27:30 +05:00
|
|
|
void GetTangentialSurfaceIndices (const Point<3> & p,
|
|
|
|
NgArray<int> & surfind, double eps) const override;
|
2020-07-05 14:15:39 +05:00
|
|
|
|
2021-04-17 19:27:30 +05:00
|
|
|
INSOLID_TYPE VecInSolid (const Point<3> & p,
|
|
|
|
const Vec<3> & v,
|
|
|
|
double eps) const override;
|
2009-09-07 17:50:13 +06:00
|
|
|
|
|
|
|
// checks if lim s->0 lim t->0 p + t(v1 + s v2) in solid
|
2021-04-17 19:27:30 +05:00
|
|
|
INSOLID_TYPE VecInSolid2 (const Point<3> & p,
|
|
|
|
const Vec<3> & v1,
|
|
|
|
const Vec<3> & v2,
|
|
|
|
double eps) const override;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
2021-04-17 19:27:30 +05:00
|
|
|
int GetNSurfaces() const override;
|
|
|
|
Surface & GetSurface (int i = 0) override;
|
|
|
|
const Surface & GetSurface (int i = 0) const override;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
2021-04-17 19:27:30 +05:00
|
|
|
void Reduce (const BoxSphere<3> & box) override;
|
|
|
|
void UnReduce () override;
|
2009-09-07 17:50:13 +06:00
|
|
|
};
|
2009-01-13 04:40:13 +05:00
|
|
|
|
2009-09-07 17:50:13 +06:00
|
|
|
}
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
#endif //_EXTRUSION_HPP
|