From fc46d20e8411fe4b67269733f69d8a9dded4a42f Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Tue, 10 Nov 2015 13:39:56 +0100 Subject: Add angle sets (disjoint ranges) - initial support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By adding a new angleset class, things get much easier to read. Also, the part of the previous commit that dealt with combining the individual ranges was kind of stupid. Things missing: o) functions to remove angle ranges from a set o) deferred add functions, that allow adding multiple ranges without calling the O(n²) function angleset::combine() in between. --- angleclass.cpp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'angleclass.cpp') diff --git a/angleclass.cpp b/angleclass.cpp index e1981d1..8f30d69 100644 --- a/angleclass.cpp +++ b/angleclass.cpp @@ -52,58 +52,58 @@ void angleclass::setval(const double setme) value=shiftinrange(setme); } -double angleclass::getval() +double angleclass::getval() const { return(value); } -angleclass angleclass::operator *(angleclass other) +angleclass angleclass::operator *(const angleclass other) const { - return(angleclass(value*other.getval())); + return(angleclass(value*other.value)); } -angleclass angleclass::operator-(angleclass other) +angleclass angleclass::operator-(const angleclass other) const { - return(angleclass(value-other.getval())); + return(angleclass(value-other.value)); } -angleclass angleclass::operator+(angleclass other) +angleclass angleclass::operator+(const angleclass other) const { - return(angleclass(value+other.getval())); + return(angleclass(value+other.value)); } -angleclass angleclass::operator/(angleclass other) +angleclass angleclass::operator/(const angleclass other) const { - return(angleclass(value/other.getval())); + return(angleclass(value/other.value)); } -bool angleclass::operator<(angleclass other) +bool angleclass::operator<(const angleclass other) const { - return(value(angleclass other) +bool angleclass::operator>(const angleclass other) const { - return(value>other.getval()); + return(value>other.value); } -bool angleclass::operator<=(angleclass other) +bool angleclass::operator<=(const angleclass other) const { - return(value<=other.getval()); + return(value<=other.value); } -bool angleclass::operator>=(angleclass other) +bool angleclass::operator>=(const angleclass other) const { - return(value>=other.getval()); + return(value>=other.value); } -bool angleclass::operator==(angleclass other) +bool angleclass::operator==(const angleclass other) const { - return(value==other.getval()); + return(value==other.value); } -bool angleclass::operator!=(angleclass other) +bool angleclass::operator!=(const angleclass other) const { - return(value!=other.getval()); + return(value!=other.value); } -- cgit v1.2.3