KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
kjb::qd::PixPoint::Is_inbounds Struct Reference

Predicate functor tests whether a PixPoint is in a bounding box. More...

#include <pixpoint.h>

Inheritance diagram for kjb::qd::PixPoint::Is_inbounds:

Public Member Functions

 Is_inbounds (PixPoint min_min, PixPoint width_height)
 Establish the boundaries of the box: LL corner and size. More...
 
bool operator() (PixPoint querypoint) const
 Predicate test: is it inside the established boundaries? More...
 
bool operator!= (const Is_inbounds &that_functor) const
 test whether this functor differs from another More...
 

Public Attributes

const PixPoint m_min_min
 minimum in-bounds x and y coordinates More...
 
const PixPoint m_width_height
 dimensions of bounding box More...
 

Detailed Description

Predicate functor tests whether a PixPoint is in a bounding box.

Bounding box must be an axis-aligned rectangle.

This is a particularly useful functor if you must verify a container full of PixPoints is inbounds: instantiate once, test on everyone. There is example code here: Testing using PixPoint functor.

Constructor & Destructor Documentation

kjb::qd::PixPoint::Is_inbounds::Is_inbounds ( PixPoint  min_min,
PixPoint  width_height 
)
inline

Establish the boundaries of the box: LL corner and size.

Parameters
min_minThe point just barely within bounds, with the smallest legitimate x coordinate and y coordinate.
width_heightWidth of the box as x coordinate, height of the box as y coordinate.
  • min_min is just barely in bounds
    • For example, (min_min - PixPoint(1,0)) is out of bounds.
  • the point min_min + width_height is just barely out of bounds.
    • For example, ( min_min + width_height - PixPoint(1,1) ) is inbounds provided width_height.x and width_height.y are positive.

If either dimension of width_height is zero or negative, then the predicate will always return false.

Member Function Documentation

bool kjb::qd::PixPoint::Is_inbounds::operator!= ( const Is_inbounds that_functor) const
inline

test whether this functor differs from another

bool kjb::qd::PixPoint::Is_inbounds::operator() ( PixPoint  querypoint) const
inline

Predicate test: is it inside the established boundaries?

Member Data Documentation

const PixPoint kjb::qd::PixPoint::Is_inbounds::m_min_min

minimum in-bounds x and y coordinates

const PixPoint kjb::qd::PixPoint::Is_inbounds::m_width_height

dimensions of bounding box


The documentation for this struct was generated from the following file: