1/* 2 * Copyright 2014 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * John Scipione, jscipione@gmail.com 7 * 8 * Corresponds to: 9 * headers/os/interface/Point.h hrev47234 10 * src/kits/interface/Point.cpp hrev47234 11 */ 12 13 14/*! 15 \file Point.h 16 \ingroup interface 17 \ingroup libbe 18 \brief BPoint class definition. 19*/ 20 21 22/*! 23 \var B_ORIGIN 24 \brief The origin point, equivalent to BPoint(0, 0). 25*/ 26 27 28/*! 29 \class BPoint 30 \ingroup interface 31 \ingroup libbe 32 \brief A point on a two-dimensional Cartesian coordinate system. 33*/ 34 35 36/*! 37 \var BPoint::x 38 \brief The horizontal coordinate. 39*/ 40 41 42/*! 43 \var BPoint::y 44 \brief The vertical coordinate. 45*/ 46 47 48/*! 49 \fn inline BPoint::BPoint() 50 \brief Initializes a BPoint object at the origin, (0, 0). 51 52 \see BPoint::Set() 53*/ 54 55 56/*! 57 \fn inline BPoint::BPoint(float x, float y) 58 \brief Initializes a BPoint object at the specified \a x and 59 \a y coordinates. 60 61 \param x The \a x coordinate. 62 \param y The \a y coordinate. 63*/ 64 65 66/*! 67 \fn inline BPoint::BPoint(const BPoint& other) 68 \brief Initializes a BPoint object from another BPoint. 69 70 \param other The BPoint object to copy from. 71*/ 72 73 74/*! 75 \fn inline BPoint& BPoint::operator=(const BPoint& other) 76 \brief Initializes a BPoint object from another BPoint by overloading 77 the = operator. 78 79 \param other The BPoint object to copy from. 80*/ 81 82 83/*! 84 \fn inline void BPoint::Set(float x, float y) 85 \brief Sets the \a x and \a y coordinates of a BPoint object. 86 87 \param x The \a x coordinate to set. 88 \param y The \a y coordinate to set. 89*/ 90 91 92/*! 93 \fn void BPoint::ConstrainTo(BRect rect) 94 \brief Moves the BPoint so that it is contained within \a rect. 95 96 If the BPoint is already contained within \a rect this method has no 97 effect. 98 99 \param rect The BRect to constrain the BPoint within. 100*/ 101 102 103/*! 104 \fn void BPoint::PrintToStream() const 105 \brief Print the x and y coordinates to standard output. 106 107 Prints in the following format: 108 109\verbatim 110BPoint(x:%.0f, y:%.0f) 111\endverbatim 112*/ 113 114 115/*! 116 \fn BPoint BPoint::operator-() const 117 \brief Returns a BPoint object with the x and y coordinates negated. 118 119 \return A new BPoint object. 120*/ 121 122 123/*! 124 \fn BPoint BPoint::operator+(const BPoint& other) const 125 \brief Returns a BPoint where the x-coordinate is the sum of the x values 126 and the y-coordinate is the sum of the y values. 127 128 \param other The BPoint object to use in the addition. 129 130 \return A new BPoint object. 131*/ 132 133 134/*! 135 \fn BPoint BPoint::operator-(const BPoint& other) const 136 \brief Returns a BPoint where the x-coordinate is the difference of the 137 x values and the y-coordinate is the difference of the y values. 138 139 \param other The BPoint object to use in the subtraction. 140 141 \return A new BPoint object. 142*/ 143 144 145/*! 146 \fn BPoint& BPoint::operator+=(const BPoint& other) 147 \brief Uses the BPoint as an accumulator storing the sum of the x values 148 and the sum of the y values. 149 150 \param other The BPoint object to use in the addition. 151 152 \return The address of the BPoint object. 153*/ 154 155 156/*! 157 \fn BPoint& BPoint::operator-=(const BPoint& other) 158 \brief Uses the BPoint as an accumulator storing the difference of the x 159 values and the difference of the y values. 160 161 \param other The BPoint object to use in the subtraction. 162 163 \return The address of the BPoint object. 164*/ 165 166 167/*! 168 \fn bool BPoint::operator!=(const BPoint& other) const 169 \brief Returns whether or not the x and y coordinates of the BPoint 170 objects differ. 171 172 \return \c true if the x or y coordinates differ, \c false otherwise. 173*/ 174 175 176/*! 177 \fn bool BPoint::operator==(const BPoint& other) const 178 \brief Returns whether or not the x and y coordinates of the BPoint 179 objects are equal. 180 181 \return \c true if the x and y coordinates are equal, \c false otherwise. 182*/ 183