16 #include "msdevstudio/MSconfig.h" 22 #define std::isnan _std::isnan 27 #define _GLIBCPP_USE_C99 1 38 using std::std::isnan;
46 using std::replace_if;
52 : m_origin(), m_size()
57 Rect(
double x,
double y,
double width,
double height )
64 double width,
double height,
double depth )
67 setRect( x, y, z, width, height, depth );
77 double width,
double height,
double depth )
151 if ( std::isnan ( x1 ) || std::isnan ( y1 ) )
return false;
153 double x_lo =
getX ();
154 double y_lo =
getY ();
159 if( x1 < x_lo || x1 > x_hi ||
160 y1 < y_lo || y1 > y_hi )
return false;
167 double x_lo =
getX ();
168 double y_lo =
getY ();
169 double z_lo =
getZ ();
175 if( x1 < x_lo || x1 > x_hi ||
176 y1 < y_lo || y1 > y_hi ||
177 z1 < z_lo || z1 > z_hi )
return false;
196 else if ( x1 > x_hi ) {
202 else if ( y1 > y_hi ) {
219 x1 = max ( x1, x_lo );
220 x1 = min ( x1, x_hi );
222 y1 = max ( y1, y_lo );
223 y1 = min ( y1, y_hi );
225 z1 = max ( z1, z_lo );
226 z1 = min ( z1, z_hi );
232 std::vector< double > & y )
const 237 replace_if ( x.begin (), x.end (),
238 bind2nd ( less< double > (), lo ), lo );
240 replace_if ( x.begin (), x.end (),
241 bind2nd ( greater< double > (), hi ), hi );
246 replace_if ( y.begin (), y.end (),
247 bind2nd ( less< double > (), lo ), lo );
249 replace_if ( y.begin (), y.end (),
250 bind2nd ( greater< double > (), hi ), hi );
257 std::vector< double > & y,
258 std::vector< double > & z )
const 263 replace_if ( x.begin (), x.end (),
264 bind2nd ( less< double > (), lo ), lo );
266 replace_if ( x.begin (), x.end (),
267 bind2nd ( greater< double > (), hi ), hi );
272 replace_if ( y.begin (), y.end (),
273 bind2nd ( less< double > (), lo ), lo );
275 replace_if ( y.begin (), y.end (),
276 bind2nd ( greater< double > (), hi ), hi );
281 replace_if ( z.begin (), z.end (),
282 bind2nd ( less< double > (), lo ), lo );
284 replace_if ( z.begin (), z.end (),
285 bind2nd ( greater< double > (), hi ), hi );
const Point & getOrigin() const
Returns the origin.
bool isInBounds(double x1, double y1) const
Checks the coordinates to see if they are inside or on the boundary of the rectangle.
void moveBy(double x, double y)
Moves the Rectangle by specified amount.
double getDepth() const
The following function returns the depth.
double getX() const
The following function returns the X coordinate.
const Size & getSize() const
Returns the size.
void setZ(double)
Sets the Z dimension.
Class representing a two or three dimension size.
double getY() const
The following function returns the Y coordinate.
double getHeight() const
The following function returns the height.
double getX() const
A shortcut to get origin.X.
Rect()
Default constructor.
bool isInDepth(double z1) const
Checks the value against the depth to see if it is in bounds.
void setDepth(double)
Sets the depth dimenision of the size.
double getY() const
A shortcut to get origin.Y.
void setPoint(double x, double y)
Size m_size
The size of the Rectangle.
double getDepth() const
A shortcut to get size.depth.
double getWidth() const
The following function returns the width.
Point m_origin
The origin of the Rectangle.
void setDepth(double)
Sets the depth of the rectangle.
double getWidth() const
A shortcut to get size.width.
double getZ() const
The following function returns the Z coordinate.
void setZ(double)
Sets the Z component of the Rectangle.
Class representing a two or three dimension point.
void moveBy(double x, double y)
Moves the point by specified amount.
double getHeight() const
A shortcut to get size.height.
void setRect(double x, double y, double width, double height)
Set the parameters of 2D Rectangle.
hippodrw::Rect class interface
void makeInBounds(double &x, double &y) const
Changes the coordinates so that they are inside or on the boundary of the rectangle.
void setSize(double width, double height)
double getZ() const
A shortcut to get origin.Z.