Reset platonic code.
[voro++.git] / branches / dynamic / src / wall.hh
blob7de7cfe7c7ea85fb541c424f49cac049fc9c11f1
1 // Voro++, a 3D cell-based Voronoi library
2 //
3 // Author : Chris H. Rycroft (LBL / UC Berkeley)
4 // Email : chr@alum.mit.edu
5 // Date : July 1st 2008
7 /** \file wall.hh
8 * \brief Header file for the derived wall classes. */
10 #ifndef VOROPP_WALL_HH
11 #define VOROPP_WALL_HH
13 /** \brief A class representing a spherical wall object.
15 * This class represents a spherical wall object. */
16 struct wall_sphere : public wall {
17 public:
18 /** Constructs a spherical wall object.
19 * \param[in] iw_id an ID number to associate with the wall for
20 * neighbor tracking.
21 * \param[in] (ixc,iyc,izc) a position vector for the sphere's
22 * center.
23 * \param[in] irc the radius of the sphere. */
24 wall_sphere(fpoint ixc,fpoint iyc,fpoint izc,fpoint irc,int iw_id=-99)
25 : w_id(iw_id), xc(ixc), yc(iyc), zc(izc), rc(irc) {};
26 bool point_inside(fpoint x,fpoint y,fpoint z);
27 template<class n_option>
28 inline bool cut_cell_base(voronoicell_base<n_option> &c,fpoint x,fpoint y,fpoint z);
29 bool cut_cell(voronoicell_base<neighbor_none> &c,fpoint x,fpoint y,fpoint z) {return cut_cell_base(c,x,y,z);}
30 bool cut_cell(voronoicell_base<neighbor_track> &c,fpoint x,fpoint y,fpoint z) {return cut_cell_base(c,x,y,z);}
31 void min_distance(fpoint x,fpoint y,fpoint z,fpoint &dx,fpoint &dy,fpoint &dz);
32 private:
33 const int w_id;
34 const fpoint xc,yc,zc,rc;
37 /** \brief A class representing a plane wall object.
39 * This class represents a single plane wall object. */
40 struct wall_plane : public wall {
41 public:
42 /** Constructs a plane wall object
43 * \param[in] (ixc,iyc,izc) a normal vector to the plane.
44 * \param[in] iac a displacement along the normal vector.
45 * \param[in] iw_id an ID number to associate with the wall for
46 * neighbor tracking. */
47 wall_plane(fpoint ixc,fpoint iyc,fpoint izc,fpoint iac,int iw_id=-99)
48 : w_id(iw_id), xc(ixc), yc(iyc), zc(izc), ac(iac) {};
49 bool point_inside(fpoint x,fpoint y,fpoint z);
50 template<class n_option>
51 inline bool cut_cell_base(voronoicell_base<n_option> &c,fpoint x,fpoint y,fpoint z);
52 bool cut_cell(voronoicell_base<neighbor_none> &c,fpoint x,fpoint y,fpoint z) {return cut_cell_base(c,x,y,z);}
53 bool cut_cell(voronoicell_base<neighbor_track> &c,fpoint x,fpoint y,fpoint z) {return cut_cell_base(c,x,y,z);}
54 void min_distance(fpoint x,fpoint y,fpoint z,fpoint &dx,fpoint &dy,fpoint &dz);
55 private:
56 const int w_id;
57 const fpoint xc,yc,zc,ac;
60 /** \brief A class representing a cylindrical wall object.
62 * This class represents a open cylinder wall object. */
63 struct wall_cylinder : public wall {
64 public:
65 /** Constructs a cylinder wall object.
66 * \param[in] (ixc,iyc,izc) a point on the axis of the
67 * cylinder.
68 * \param[in] (ixa,iya,iza) a vector pointing along the
69 * direction of the cylinder.
70 * \param[in] irc the radius of the cylinder
71 * \param[in] iw_id an ID number to associate with the wall for
72 * neighbor tracking. */
73 wall_cylinder(fpoint ixc,fpoint iyc,fpoint izc,fpoint ixa,fpoint iya,fpoint iza,fpoint irc,int iw_id=-99)
74 : w_id(iw_id), xc(ixc), yc(iyc), zc(izc), xa(ixa), ya(iya), za(iza),
75 asi(1/(ixa*ixa+iya*iya+iza*iza)), rc(irc) {};
76 bool point_inside(fpoint x,fpoint y,fpoint z);
77 template<class n_option>
78 inline bool cut_cell_base(voronoicell_base<n_option> &c,fpoint x,fpoint y,fpoint z);
79 bool cut_cell(voronoicell_base<neighbor_none> &c,fpoint x,fpoint y,fpoint z) {return cut_cell_base(c,x,y,z);}
80 bool cut_cell(voronoicell_base<neighbor_track> &c,fpoint x,fpoint y,fpoint z) {return cut_cell_base(c,x,y,z);}
81 void min_distance(fpoint x,fpoint y,fpoint z,fpoint &dx,fpoint &dy,fpoint &dz);
82 private:
83 const int w_id;
84 const fpoint xc,yc,zc,xa,ya,za,asi,rc;
88 /** \brief A class representing a conical wall object.
90 * This class represents a cone wall object. */
91 struct wall_cone : public wall {
92 public:
93 /** Constructs a cone wall object.
94 * \param[in] (ixc,iyc,izc) the apex of the cone.
95 * \param[in] (ixa,iya,iza) a vector pointing along the axis of
96 * the cone.
97 * \param[in] ang the angle (in radians) of the cone, measured
98 * from the axis.
99 * \param[in] iw_id an ID number to associate with the wall for
100 * neighbor tracking. */
101 wall_cone(fpoint ixc,fpoint iyc,fpoint izc,fpoint ixa,fpoint iya,fpoint iza,fpoint ang,int iw_id=-99)
102 : w_id(iw_id), xc(ixc), yc(iyc), zc(izc), xa(ixa), ya(iya), za(iza),
103 asi(1/(ixa*ixa+iya*iya+iza*iza)),
104 gra(tan(ang)), sang(sin(ang)), cang(cos(ang)) {};
105 bool point_inside(fpoint x,fpoint y,fpoint z);
106 template<class n_option>
107 inline bool cut_cell_base(voronoicell_base<n_option> &c,fpoint x,fpoint y,fpoint z);
108 bool cut_cell(voronoicell_base<neighbor_none> &c,fpoint x,fpoint y,fpoint z) {return cut_cell_base(c,x,y,z);}
109 bool cut_cell(voronoicell_base<neighbor_track> &c,fpoint x,fpoint y,fpoint z) {return cut_cell_base(c,x,y,z);}
110 void min_distance(fpoint x,fpoint y,fpoint z,fpoint &dx,fpoint &dy,fpoint &dz);
111 private:
112 const int w_id;
113 const fpoint xc,yc,zc,xa,ya,za,asi,gra,sang,cang;
116 #endif