#ifndef BOX_HH #define BOX_HH // // // Include files #include namespace dgs { class CartesianCoordinate; /// A box. class Box: public GeometryElement { public: /// Default constructor. Box(): _cvers("Revision:$") {} /// Construct a box with specified x,y,z half-lengths. Box(const double xhalf, const double yhalf, const double zhalf): _xhalf(xhalf), _yhalf(yhalf), _zhalf(zhalf), _cvers("Revision:$") {} /// Convert local point to global one. SpacePoint local_to_global(const CartesianCoordinate& lpt) const; /// Convert global point to local one. CartesianCoordinate global_to_local(const SpacePoint& gpt) const; /// Resize box by specified changes to x,y,z half-lengths. bool resize(const double dxhalf, const double dyhalf, const double dzhalf); /// Position child surface at specified local point. bool position_child_at(const CartesianCoordinate& lpt, GeometryElement& kid); bool position_child_at(const GeometryXform& xfm, GeometryElement& kid); /// Access x half-length. double get_xsize() const { return _xhalf; } /// Access y half-length. double get_ysize() const { return _yhalf; } /// Access z half-length. double get_zsize() const { return _zhalf; } /// Get source code version. Kept to allow following code changes const std::string& code_version() const { return _cvers; } /// Stream insertion operator. friend std::ostream& operator<<(std::ostream& os, const Box& me); private: /// x half-length. double _xhalf; /// y half-length. double _yhalf; /// z half-length. double _zhalf; /// Support for positioning children CartesianCoordinate xform_to_local(const GeometryXform& xf) const; /// Support for positioning children GeometryXform local_to_xform(const CartesianCoordinate& lpt) const; /// RCS version std::string _cvers; // Replaced at checkout public: D0_OBJECT_SETUP(Box); }; } #endif //BOX_HH