L4B/Box.cpp

26 lines
531 B
C++
Raw Normal View History

2024-11-06 16:53:50 -07:00
#include "Box.h"
Box::Box() {
// initialize to unit cube by default
_size = 1.0;
}
Box::Box(const double SIZE) {
// if desired size is positive, assign
if(SIZE > 0) _size = SIZE;
// otherwise default to one
else _size = 1.0;
}
double Box::getBoxSize() const {
return _size;
}
void Box::setBoxSize(const double SIZE) {
// if desired size is positive, assign
if(SIZE > 0) _size = SIZE;
}
std::ostream& operator<<(std::ostream& os, const Box& BOX) {
os << BOX.getBoxSize();
return os;
}