2024-07-07 17:32:34 +02:00
|
|
|
//
|
|
|
|
// Created by nb on 07.07.24.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef BLOCK_BLOCK_H
|
|
|
|
#define BLOCK_BLOCK_H
|
|
|
|
|
2024-07-21 14:26:59 +02:00
|
|
|
#include <LinAlg/vector3.h>
|
2024-07-07 20:42:39 +02:00
|
|
|
|
2024-07-07 17:32:34 +02:00
|
|
|
namespace Volumes{
|
2024-07-07 20:42:39 +02:00
|
|
|
class Block{
|
|
|
|
public:
|
2024-07-07 22:47:47 +02:00
|
|
|
Block(const LinAlg::Vector3& v1, double x, double y, double z): corners{v1,
|
|
|
|
v1 + LinAlg::Vector3(x, 0, 0),
|
|
|
|
v1 + LinAlg::Vector3(x, y, 0),
|
|
|
|
v1 + LinAlg::Vector3(0, y, z), v1,
|
|
|
|
v1 + LinAlg::Vector3(x, y, z),
|
|
|
|
v1 + LinAlg::Vector3(x, 0, z),
|
|
|
|
v1 + LinAlg::Vector3(0, 0, z)}{};
|
2024-07-07 20:42:39 +02:00
|
|
|
virtual ~Block() = default;
|
2024-07-07 17:32:34 +02:00
|
|
|
|
2024-07-07 20:54:14 +02:00
|
|
|
double getVolume();
|
|
|
|
|
2024-07-07 22:23:54 +02:00
|
|
|
friend std::ostream& operator<<(std::ostream& os, const Block& v){
|
|
|
|
os<<"[";
|
|
|
|
short count=0;
|
2024-07-07 22:47:47 +02:00
|
|
|
for(LinAlg::Vector3 corner:v.corners){
|
2024-07-07 22:23:54 +02:00
|
|
|
count++;
|
|
|
|
os<<corner;
|
|
|
|
if(count<8) {
|
|
|
|
os << std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
os<<"]";
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
|
2024-07-07 20:42:39 +02:00
|
|
|
private:
|
2024-07-07 22:47:47 +02:00
|
|
|
LinAlg::Vector3 corners[8];
|
2024-07-07 17:32:34 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //BLOCK_BLOCK_H
|