Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/netgen/libsrc/csg/polyhedra.hpp
3206 views
1
#ifndef FILE_POLYHEDRA
2
#define FILE_POLYHEDRA
3
4
5
/**************************************************************************/
6
/* File: polyhedra.hh */
7
/* Author: Joachim Schoeberl */
8
/* Date: 19. Mar. 2000 */
9
/**************************************************************************/
10
11
/*
12
13
Polyhedral primitive
14
15
*/
16
17
class Polyhedra : public Primitive
18
{
19
class Face {
20
public:
21
int pnums[3];
22
int planenr;
23
24
int inputnr;
25
26
Box<3> bbox;
27
// Point<3> center;
28
Vec<3> v1, v2; // edges
29
Vec<3> w1, w2; // pseudo-inverse
30
Vec<3> n; // normal to face
31
Vec<3> nn; // normed normal
32
33
Face () { ; }
34
Face (int pi1, int pi2, int pi3,
35
const ARRAY<Point<3> > & points,
36
int ainputnr);
37
};
38
39
ARRAY<Point<3> > points;
40
ARRAY<Face> faces;
41
ARRAY<Plane*> planes;
42
Box<3> poly_bbox;
43
44
double eps_base1;
45
46
public:
47
Polyhedra ();
48
virtual ~Polyhedra ();
49
static Primitive * CreateDefault ();
50
51
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
52
virtual INSOLID_TYPE PointInSolid (const Point<3> & p,
53
double eps) const;
54
virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
55
const Vec<3> & v,
56
double eps) const;
57
58
// checks if lim s->0 lim t->0 p + t(v1 + s v2) in solid
59
virtual INSOLID_TYPE VecInSolid2 (const Point<3> & p,
60
const Vec<3> & v1,
61
const Vec<3> & v2,
62
double eps) const;
63
64
virtual void GetTangentialSurfaceIndices (const Point<3> & p,
65
ARRAY<int> & surfind, double eps) const;
66
67
68
virtual void GetTangentialVecSurfaceIndices2 (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
69
ARRAY<int> & surfind, double eps) const;
70
71
virtual void CalcSpecialPoints (ARRAY<Point<3> > & pts) const;
72
virtual void AnalyzeSpecialPoint (const Point<3> & pt,
73
ARRAY<Point<3> > & specpts) const;
74
virtual Vec<3> SpecialPointTangentialVector (const Point<3> & p, int s1, int s2) const;
75
76
virtual int GetNSurfaces() const
77
{ return planes.Size(); }
78
virtual Surface & GetSurface (int i)
79
{ return *planes[i]; }
80
virtual const Surface & GetSurface (int i) const
81
{ return *planes[i]; }
82
83
virtual void GetPrimitiveData (const char *& classname, ARRAY<double> & coeffs) const;
84
virtual void SetPrimitiveData (ARRAY<double> & coeffs);
85
86
virtual void Reduce (const BoxSphere<3> & box);
87
virtual void UnReduce ();
88
89
int AddPoint (const Point<3> & p);
90
int AddFace (int pi1, int pi2, int pi3, int inputnum);
91
92
void GetPolySurfs(ARRAY < ARRAY<int> * > & polysurfs);
93
94
protected:
95
int FaceBoxIntersection (int fnr, const BoxSphere<3> & box) const;
96
// void CalcData();
97
};
98
99
#endif
100
101