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