Volumes/include/Block/block.h
2024-07-07 22:23:54 +02:00

44 lines
1.4 KiB
C++

//
// Created by nb on 07.07.24.
//
#ifndef BLOCK_BLOCK_H
#define BLOCK_BLOCK_H
#include <Vector/vector3.h>
namespace Volumes{
class Block{
public:
Block(const Vector::Vector3& v1, double x, double y, double z):corners{v1,
v1+Vector::Vector3(x,0,0),
v1+Vector::Vector3(x,y,0),
v1+Vector::Vector3(0,y,z),v1,
v1+Vector::Vector3(x,y,z),
v1+Vector::Vector3(x,0,z),
v1+Vector::Vector3(0,0,z)}{};
virtual ~Block() = default;
double getVolume();
friend std::ostream& operator<<(std::ostream& os, const Block& v){
os<<"[";
short count=0;
for(Vector::Vector3 corner:v.corners){
count++;
os<<corner;
if(count<8) {
os << std::endl;
}
}
os<<"]";
return os;
}
private:
Vector::Vector3 corners[8];
};
}
#endif //BLOCK_BLOCK_H