netgen/libsrc/csg/polyhedra.hpp

113 lines
3.2 KiB
C++
Raw Normal View History

2009-01-13 04:40:13 +05:00
#ifndef FILE_POLYHEDRA
#define FILE_POLYHEDRA
/**************************************************************************/
/* File: polyhedra.hh */
/* Author: Joachim Schoeberl */
/* Date: 19. Mar. 2000 */
/**************************************************************************/
2009-09-07 17:50:13 +06:00
namespace netgen
{
/*
2009-01-13 04:40:13 +05:00
Polyhedral primitive
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 Polyhedra : public Primitive
{
class Face {
public:
int pnums[3];
int planenr;
2009-01-13 04:40:13 +05:00
2009-09-07 17:50:13 +06:00
int inputnr;
2009-01-13 04:40:13 +05:00
2009-09-07 17:50:13 +06:00
Box<3> bbox;
// Point<3> center;
Vec<3> v1, v2; // edges
Vec<3> w1, w2; // pseudo-inverse
Vec<3> n; // normal to face
Vec<3> nn; // normed normal
2009-01-13 04:40:13 +05:00
2009-09-07 17:50:13 +06:00
Face () { ; }
Face (int pi1, int pi2, int pi3,
2019-07-09 13:39:16 +05:00
const NgArray<Point<3> > & points,
2009-09-07 17:50:13 +06:00
int ainputnr);
};
2009-01-13 04:40:13 +05:00
2019-07-09 13:39:16 +05:00
NgArray<Point<3> > points;
NgArray<Face> faces;
NgArray<Plane*> planes;
2009-09-07 17:50:13 +06:00
Box<3> poly_bbox;
double eps_base1;
public:
Polyhedra ();
virtual ~Polyhedra ();
static Primitive * CreateDefault ();
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
virtual INSOLID_TYPE PointInSolid (const Point<3> & p,
double eps) const;
2020-10-15 12:29:36 +05:00
virtual INSOLID_TYPE VecInSolidNew (const Point<3> & p,
const Vec<3> & v,
double eps, bool printing = false) const;
virtual INSOLID_TYPE VecInSolidOld (const Point<3> & p,
const Vec<3> & v,
double eps) const;
2009-09-07 17:50:13 +06:00
virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
const Vec<3> & v,
2009-01-13 04:40:13 +05:00
double eps) const;
2020-10-15 12:29:36 +05:00
2009-09-07 17:50:13 +06:00
// checks if lim s->0 lim t->0 p + t(v1 + s v2) in solid
virtual INSOLID_TYPE VecInSolid2 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const;
2009-01-13 04:40:13 +05:00
2009-09-07 17:50:13 +06:00
virtual void GetTangentialSurfaceIndices (const Point<3> & p,
2019-07-09 13:39:16 +05:00
NgArray<int> & surfind, double eps) const;
2009-01-13 04:40:13 +05:00
2009-09-07 17:50:13 +06:00
virtual void GetTangentialVecSurfaceIndices2 (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
2019-07-09 13:39:16 +05:00
NgArray<int> & surfind, double eps) const;
2009-01-13 04:40:13 +05:00
2019-07-09 13:39:16 +05:00
virtual void CalcSpecialPoints (NgArray<Point<3> > & pts) const;
2009-09-07 17:50:13 +06:00
virtual void AnalyzeSpecialPoint (const Point<3> & pt,
2019-07-09 13:39:16 +05:00
NgArray<Point<3> > & specpts) const;
2009-09-07 17:50:13 +06:00
virtual Vec<3> SpecialPointTangentialVector (const Point<3> & p, int s1, int s2) const;
2009-01-13 04:40:13 +05:00
2009-09-07 17:50:13 +06:00
virtual int GetNSurfaces() const
2009-01-13 04:40:13 +05:00
{ return planes.Size(); }
2009-09-07 17:50:13 +06:00
virtual Surface & GetSurface (int i)
2009-01-13 04:40:13 +05:00
{ return *planes[i]; }
2009-09-07 17:50:13 +06:00
virtual const Surface & GetSurface (int i) const
2009-01-13 04:40:13 +05:00
{ return *planes[i]; }
2019-07-09 13:39:16 +05:00
virtual void GetPrimitiveData (const char *& classname, NgArray<double> & coeffs) const;
virtual void SetPrimitiveData (NgArray<double> & coeffs);
2009-01-13 04:40:13 +05:00
2009-09-07 17:50:13 +06:00
virtual void Reduce (const BoxSphere<3> & box);
virtual void UnReduce ();
2009-01-13 04:40:13 +05:00
2009-09-07 17:50:13 +06:00
int AddPoint (const Point<3> & p);
int AddFace (int pi1, int pi2, int pi3, int inputnum);
2009-01-13 04:40:13 +05:00
2019-07-09 13:39:16 +05:00
void GetPolySurfs(NgArray < NgArray<int> * > & polysurfs);
2009-01-13 04:40:13 +05:00
2009-09-07 17:50:13 +06:00
protected:
int FaceBoxIntersection (int fnr, const BoxSphere<3> & box) const;
// void CalcData();
};
}
2009-01-13 04:40:13 +05:00
#endif