-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from NHLStenden-ISAL/refactor
added const correctness, references where possible, removed some bugs…
- Loading branch information
Showing
10 changed files
with
133 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,38 @@ | ||
#include "pch.h" | ||
#include "aabb.h" | ||
#include "aabb.h" | ||
|
||
AABB AABB::operator+(const AABB& other) const { return {min + other.min, max + other.max}; } | ||
AABB AABB::operator-(const AABB& other) const { return {min - other.min, max - other.max}; } | ||
AABB AABB::operator*(const Float scalar) const { return {min * scalar, max * scalar}; } | ||
AABB AABB::operator/(const Float scalar) const { return {min / scalar, max / scalar}; } | ||
|
||
AABB AABB::operator-() const { return {-min, -max}; } | ||
|
||
AABB& AABB::operator+=(const AABB& other) | ||
{ | ||
min += other.min; | ||
max += other.max; | ||
return *this; | ||
} | ||
|
||
AABB& AABB::operator-=(const AABB& other) | ||
{ | ||
min -= other.min; | ||
max -= other.max; | ||
return *this; | ||
} | ||
|
||
AABB& AABB::operator*=(const Float scalar) | ||
{ | ||
min *= scalar; | ||
max *= scalar; | ||
return *this; | ||
} | ||
|
||
AABB& AABB::operator/=(const Float scalar) | ||
{ | ||
//TODO: perhaps check for division by zero? | ||
min /= scalar; | ||
max /= scalar; | ||
return *this; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.