TwiceAsNice
2019-02-18
|
The Nice::Point class defines a point in the plane using floating point precision. More...
#include <Point.h>
Friends | |
class | WMatrix |
bool | operator== (const Point &, const Point &) |
bool | operator!= (const Point &, const Point &) |
const Point | operator+ (const Point &, const Point &) |
const Point | operator- (const Point &, const Point &) |
const Point | operator* (double, const Point &) |
const Point | operator* (const Point &, double) |
const Point | operator- (const Point &) |
const Point | operator/ (const Point &, double) |
bool | operator== (const Point &, const Point &) |
bool | operator!= (const Point &, const Point &) |
const Point | operator+ (const Point &, const Point &) |
const Point | operator- (const Point &, const Point &) |
const Point | operator* (double, const Point &) |
const Point | operator* (const Point &, double) |
const Point | operator- (const Point &) |
const Point | operator/ (const Point &, double) |
Additional Inherited Members | |
![]() | |
::Ice::Double | xp |
::Ice::Double | yp |
The Nice::Point class defines a point in the plane using floating point precision.
A point is specified by a x coordinate and an y coordinate which can be accessed using the x() and y() functions. The coordinates of the point are specified using floating point numbers for accuracy. The isNull() function returns true if both x and y are set to 0.0. The coordinates can be set (or altered) using the setX() and setY() functions, or alternatively the rx() and ry() functions which return references to the coordinates (allowing direct manipulation).
Given a point p, the following statements are all equivalent:
A Nice::Point object can also be used as a vector: Addition and subtraction are defined as for vectors (each component is added separately). A Nice::Point object can also be divided or multiplied by an int
or a double
.
In addition, the Nice::Point class provides a constructor converting a QPointVar object into a Nice::Point object, and a corresponding toPointVar() function which returns a QPointVar copy of this point. Finally, Nice::Point objects can be streamed as well as compared.
|
inline |
|
inline |
|
inline |
Nice::Point::Point | ( | ) |
Nice::Point::Point | ( | double | xpos, |
double | ypos | ||
) |
Nice::Point::Point | ( | const Nice::PointVar & | p | ) |
|
inline |
distance of point to the origin.
double Nice::Point::distance | ( | ) | const |
distance of point to the origin.
|
inline |
Returns true if both the x and y coordinates are set to 0.0, otherwise returns false.
bool Nice::Point::isNull | ( | ) | const |
|
inline |
Multiplies this point's coordinates by the given factor, and returns a reference to this point. For example:
Point& Nice::Point::operator*= | ( | double | c | ) |
Adds the given point to this point and returns a reference to this point. For example:
Subtracts the given point from this point and returns a reference to this point. For example:
|
inline |
Divides both x and y by the given divisor, and returns a reference to this point. For example:
Point& Nice::Point::operator/= | ( | double | c | ) |
double& Nice::Point::rx | ( | ) |
|
inline |
double& Nice::Point::ry | ( | ) |
|
inline |
void Nice::Point::setX | ( | double | x | ) |
|
inline |
void Nice::Point::setY | ( | double | y | ) |
|
inline |
double Nice::Point::x | ( | ) | const |
double Nice::Point::y | ( | ) | const |
|
related |
Returns true if p1 is not equal to p2; otherwise returns false.
|
related |
Returns true if p1 is not equal to p2; otherwise returns false.
|
related |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns a copy of the given point, multiplied by the given factor.
|
related |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns a copy of the given point, multiplied by the given factor.
|
related |
Returns a copy of the given point, multiplied by the given factor.
|
related |
Returns a copy of the given point, multiplied by the given factor.
|
related |
Returns a Nice::Point object that is the sum of the given points, p1 and p2; each component is added separately.
|
related |
Returns a Nice::Point object that is the sum of the given points, p1 and p2; each component is added separately.
|
related |
Returns a Nice::Point object that is formed by subtracting p2 from p1; each component is subtracted separately.
|
related |
Returns a Nice::Point object that is formed by subtracting p2 from p1; each component is subtracted separately.
|
related |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns a Nice::Point object that is formed by changing the sign of both components of the given point.
Equivalent to {Nice::Point(0,0)
- point}.
|
related |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns a Nice::Point object that is formed by changing the sign of both components of the given point.
Equivalent to {Nice::Point(0,0)
- point}.
|
related |
Returns the Nice::Point object formed by dividing both components of the given point by the given divisor.
|
related |
Returns the Nice::Point object formed by dividing both components of the given point by the given divisor.
|
related |
Returns true if p1 is equal to p2; otherwise returns false.
|
related |
Returns true if p1 is equal to p2; otherwise returns false.
|
friend |