1 // Voro++, a 3D cell-based Voronoi library
3 // Author : Chris H. Rycroft (LBL / UC Berkeley)
4 // Email : chr@alum.mit.edu
5 // Date : August 30th 2011
8 * \brief Header file for the derived wall classes. */
10 #ifndef VOROPP_WALL_HH
11 #define VOROPP_WALL_HH
14 #include "container.hh"
18 /** \brief A class representing a spherical wall object.
20 * This class represents a spherical wall object. */
21 struct wall_sphere
: public wall
{
23 /** Constructs a spherical wall object.
24 * \param[in] w_id_ an ID number to associate with the wall for
26 * \param[in] (xc_,yc_,zc_) a position vector for the sphere's
28 * \param[in] rc_ the radius of the sphere. */
29 wall_sphere(double xc_
,double yc_
,double zc_
,double rc_
,int w_id_
=-99)
30 : w_id(w_id_
), xc(xc_
), yc(yc_
), zc(zc_
), rc(rc_
) {}
31 bool point_inside(double x
,double y
,double z
);
32 template<class v_cell
>
33 bool cut_cell_base(v_cell
&c
,double x
,double y
,double z
);
34 bool cut_cell(voronoicell
&c
,double x
,double y
,double z
) {return cut_cell_base(c
,x
,y
,z
);}
35 bool cut_cell(voronoicell_neighbor
&c
,double x
,double y
,double z
) {return cut_cell_base(c
,x
,y
,z
);}
38 const double xc
,yc
,zc
,rc
;
41 /** \brief A class representing a plane wall object.
43 * This class represents a single plane wall object. */
44 struct wall_plane
: public wall
{
46 /** Constructs a plane wall object.
47 * \param[in] (xc_,yc_,zc_) a normal vector to the plane.
48 * \param[in] ac_ a displacement along the normal vector.
49 * \param[in] w_id_ an ID number to associate with the wall for
50 * neighbor tracking. */
51 wall_plane(double xc_
,double yc_
,double zc_
,double ac_
,int w_id_
=-99)
52 : w_id(w_id_
), xc(xc_
), yc(yc_
), zc(zc_
), ac(ac_
) {}
53 bool point_inside(double x
,double y
,double z
);
54 template<class v_cell
>
55 bool cut_cell_base(v_cell
&c
,double x
,double y
,double z
);
56 bool cut_cell(voronoicell
&c
,double x
,double y
,double z
) {return cut_cell_base(c
,x
,y
,z
);}
57 bool cut_cell(voronoicell_neighbor
&c
,double x
,double y
,double z
) {return cut_cell_base(c
,x
,y
,z
);}
60 const double xc
,yc
,zc
,ac
;
63 /** \brief A class representing a cylindrical wall object.
65 * This class represents a open cylinder wall object. */
66 struct wall_cylinder
: public wall
{
68 /** Constructs a cylinder wall object.
69 * \param[in] (xc_,yc_,zc_) a point on the axis of the
71 * \param[in] (xa_,ya_,za_) a vector pointing along the
72 * direction of the cylinder.
73 * \param[in] rc_ the radius of the cylinder
74 * \param[in] w_id_ an ID number to associate with the wall for
75 * neighbor tracking. */
76 wall_cylinder(double xc_
,double yc_
,double zc_
,double xa_
,double ya_
,double za_
,double rc_
,int w_id_
=-99)
77 : w_id(w_id_
), xc(xc_
), yc(yc_
), zc(zc_
), xa(xa_
), ya(ya_
), za(za_
),
78 asi(1/(xa_
*xa_
+ya_
*ya_
+za_
*za_
)), rc(rc_
) {}
79 bool point_inside(double x
,double y
,double z
);
80 template<class v_cell
>
81 bool cut_cell_base(v_cell
&c
,double x
,double y
,double z
);
82 bool cut_cell(voronoicell
&c
,double x
,double y
,double z
) {return cut_cell_base(c
,x
,y
,z
);}
83 bool cut_cell(voronoicell_neighbor
&c
,double x
,double y
,double z
) {return cut_cell_base(c
,x
,y
,z
);}
86 const double xc
,yc
,zc
,xa
,ya
,za
,asi
,rc
;
90 /** \brief A class representing a conical wall object.
92 * This class represents a cone wall object. */
93 struct wall_cone
: public wall
{
95 /** Constructs a cone wall object.
96 * \param[in] (xc_,yc_,zc_) the apex of the cone.
97 * \param[in] (xa_,ya_,za_) a vector pointing along the axis of
99 * \param[in] ang the angle (in radians) of the cone, measured
101 * \param[in] w_id_ an ID number to associate with the wall for
102 * neighbor tracking. */
103 wall_cone(double xc_
,double yc_
,double zc_
,double xa_
,double ya_
,double za_
,double ang
,int w_id_
=-99)
104 : w_id(w_id_
), xc(xc_
), yc(yc_
), zc(zc_
), xa(xa_
), ya(ya_
), za(za_
),
105 asi(1/(xa_
*xa_
+ya_
*ya_
+za_
*za_
)),
106 gra(tan(ang
)), sang(sin(ang
)), cang(cos(ang
)) {}
107 bool point_inside(double x
,double y
,double z
);
108 template<class v_cell
>
109 bool cut_cell_base(v_cell
&c
,double x
,double y
,double z
);
110 bool cut_cell(voronoicell
&c
,double x
,double y
,double z
) {return cut_cell_base(c
,x
,y
,z
);}
111 bool cut_cell(voronoicell_neighbor
&c
,double x
,double y
,double z
) {return cut_cell_base(c
,x
,y
,z
);}
114 const double xc
,yc
,zc
,xa
,ya
,za
,asi
,gra
,sang
,cang
;