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 )
58 : m_origin(), m_size()
64 double width,
double height,
double depth )
65 : m_origin(), m_size()
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 );
double getY() const
A shortcut to get origin.Y.
Size m_size
The size of the Rectangle.
double getDepth() const
The following function returns the depth.
double getY() const
The following function returns the Y coordinate.
double getWidth() const
The following function returns the width.
void setSize(double width, double height)
double getX() const
A shortcut to get origin.X.
double getWidth() const
A shortcut to get size.width.
Class representing a two or three dimension size.
bool isInBounds(double x1, double y1) const
Checks the coordinates to see if they are inside or on the boundary of the rectangle.
double getX() const
The following function returns the X coordinate.
void makeInBounds(double &x, double &y) const
Changes the coordinates so that they are inside or on the boundary of the rectangle.
bool isInDepth(double z1) const
Checks the value against the depth to see if it is in bounds.
Point m_origin
The origin of the Rectangle.
void setRect(double x, double y, double width, double height)
Set the parameters of 2D Rectangle.
void setDepth(double)
Sets the depth dimenision of the size.
double getZ() const
The following function returns the Z coordinate.
hippodrw::Rect class interface
void setZ(double)
Sets the Z component of the Rectangle.
const Point & getOrigin() const
Returns the origin.
void moveBy(double x, double y)
Moves the point by specified amount.
double getHeight() const
A shortcut to get size.height.
void setDepth(double)
Sets the depth of the rectangle.
void setZ(double)
Sets the Z dimension.
double getZ() const
A shortcut to get origin.Z.
Class representing a two or three dimension point.
void moveBy(double x, double y)
Moves the Rectangle by specified amount.
void setPoint(double x, double y)
Rect()
Default constructor.
double getDepth() const
A shortcut to get size.depth.
double getHeight() const
The following function returns the height.
const Size & getSize() const
Returns the size.