1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#include <iostream>
#include <vector>
class Triangle {};
class Bbox {
public:
Bbox ( double, double, double, double, double, double, std::vector<Triangle>& );
private:
double min_x {};
double min_y {};
double min_z {};
double max_x {};
double max_y {};
double max_z {};
std::vector<Triangle> & tri_ref;
// friends:
friend std::ostream& operator << (std::ostream&, const Bbox&);
};
Bbox::Bbox ( double min_x_arg,
double min_y_arg,
double min_z_arg,
double max_x_arg,
double max_y_arg,
double max_z_arg,
std::vector<Triangle>& tri_ref_arg)
: min_x { min_x_arg }
, min_y { min_y_arg }
, min_z { min_z_arg }
, max_x { max_x_arg }
, max_y { max_y_arg }
, max_z { max_z_arg }
, tri_ref { tri_ref_arg }
{
}
std::ostream& operator <<(std::ostream& os, const Bbox& rhs)
{
os << "min_x: " << rhs.min_x << "; min_y: " << rhs.min_y << "; min_z: " << rhs.min_z
<< "\nmax_x: " << rhs.max_x << "; max_y: " << rhs.max_y << "; max_z: " << rhs.max_z
<< "\ntri_ref.size(): " << rhs.tri_ref.size();
return os;
}
int main()
{
std::vector<Triangle> v( 13 );
Bbox bbox( 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, v);
std::cout << bbox << '\n';
}
| |