30 # include <vcl_msvc_warnings.h> 88 Type
const corner2[2]);
95 vgl_box_2d(Type xmin, Type xmax, Type ymin, Type ymax);
178 inline bool contains(Type
const& x, Type
const& y)
const {
229 std::ostream&
print(std::ostream&)
const;
232 std::ostream&
write(std::ostream&)
const;
235 std::istream&
read(std::istream&);
246 template <
class Type>
251 template <
class Type>
255 template <
class T,
class ITER>
258 for (; begin != end; ++begin)
259 bounding_box.
add(*begin);
262 #define VGL_BOX_2D_INSTANTIATE(T) extern "please include vgl/vgl_box_2d.hxx first" 264 #endif // vgl_box_2d_h void setmax_position(Type const max_position[2])
Modify top right. Bottom left only changed if necessary to avoid empty box.
bool contains(Type const &x, Type const &y) const
Return true if (x,y) inside box, ie x_min <= x <= x_max etc.
void scale_about_origin(double s)
Scale width and height, keeping scaled position of origin unchanged.
Type min_x() const
Get min x.
void expand_about_centroid(Type expand)
Add to width and height, centroid unchanged.
void vgl_box_2d_bounds(ITER begin, ITER end, vgl_box_2d< T > &bounding_box)
Calculate the bounding box of a sequence of points or boxes.
void set_width(Type width)
Modify width, retaining centroid at current position.
vgl_point_2d< Type > max_point() const
Return upper right corner of box.
void setmin_position(Type const min_position[2])
Modify bottom left. Top right only changed if necessary to avoid empty box.
Type centroid_y() const
Get y component of centroid.
void set_max_point(vgl_point_2d< Type > const &max_pt)
Modify top right. Bottom left only changed if necessary to avoid empty box.
std::ostream & operator<<(std::ostream &s, vgl_orient_box_3d< Type > const &p)
Write box to stream.
bool contains(vgl_point_2d< Type > const &p) const
Return true iff the point p is inside this box.
std::ostream & print(std::ostream &) const
Write "<vgl_box_2d x0,y0 to x1,y1>" to stream.
Type width() const
Get width of this box (= x dimension).
void set_max_y(Type m)
Set top (other side ordinates unchanged).
void set_centroid_y(Type cy)
Move box so centroid lies at cy (width and height unchanged).
std::istream & read(std::istream &)
Read x0,y0,x1,y1 from stream.
void set_centroid_x(Type cx)
Move box so centroid lies at cx (width and height unchanged).
Represents a cartesian 2D box.
void empty()
Make the box empty.
std::ostream & write(std::ostream &) const
Write "x0 y0 x1 y1(endl)" to stream.
void set_centroid(Type const c[2])
Move box so centroid lies at c (width, height unchanged).
Type volume() const
Get "volume" (=area) of this box.
bool operator==(vgl_box_2d< Type > const &b) const
Equality test.
vgl_point_2d< Type > centroid() const
Get the centroid point.
void set_max_x(Type m)
Set right side (other side ordinates unchanged).
void set_centroid(vgl_point_2d< Type > const &c)
Move box so centroid lies at c (width, height unchanged).
std::istream & operator>>(std::istream &is, vgl_orient_box_3d< Type > &p)
Read box from stream.
Type min_y() const
Get min y.
Type height() const
Get height of this box (= y dimension).
vgl_box_2d()
Default constructor (creates empty box).
void add(vgl_point_2d< Type > const &p)
Add a point to this box.
void set_min_point(vgl_point_2d< Type > const &min_pt)
Modify bottom left. Top right only changed if necessary to avoid empty box.
void scale_about_centroid(double s)
Scale width and height, centroid unchanged.
Represents a cartesian 2D point.
vgl_point_2d< Type > min_point() const
Return lower left corner of box.
void set_height(Type height)
Modify height, retaining centroid at current position.
void set_min_x(Type m)
Set left side of box (other side ordinates unchanged).
Type max_y() const
Get max y.
Type max_x() const
Get max x.
bool is_empty() const
Return true if this box is empty.
void set_min_y(Type m)
Set bottom of box (other side ordinates unchanged).
Type centroid_x() const
Get x component of centroid.