1
#ifndef SEEN_NR_POINT_L_H
2
#define SEEN_NR_POINT_L_H
5
#include <libnr/nr-i-coord.h>
6
#include <libnr/nr-point.h>
19
IPoint(ICoord x, ICoord y) {
24
IPoint(NRPointL const &p) {
29
IPoint(IPoint const &p) {
30
for (unsigned i = 0; i < 2; ++i) {
35
IPoint &operator=(IPoint const &p) {
36
for (unsigned i = 0; i < 2; ++i) {
43
return Point(_pt[X], _pt[Y]);
46
ICoord operator[](unsigned i) const throw(std::out_of_range) {
48
throw std::out_of_range("index out of range");
53
ICoord &operator[](unsigned i) throw(std::out_of_range) {
55
throw std::out_of_range("index out of range");
60
ICoord operator[](Dim2 d) const throw() { return _pt[d]; }
61
ICoord &operator[](Dim2 d) throw() { return _pt[d]; }
63
IPoint &operator+=(IPoint const &o) {
64
for ( unsigned i = 0 ; i < 2 ; ++i ) {
70
IPoint &operator-=(IPoint const &o) {
71
for ( unsigned i = 0 ; i < 2 ; ++i ) {
77
bool operator==(IPoint const &other) const {
78
return _pt[X] == other[X] && _pt[Y] == other[Y];
81
bool operator!=(IPoint const &other) const {
82
return _pt[X] != other[X] || _pt[Y] != other[Y];
92
#endif /* !SEEN_NR_POINT_L_H */
97
c-file-style:"stroustrup"
98
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
103
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :