|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <base/primitive.hpp>
|
|
|
|
|
#include <subface/simple/plane.hpp>
|
|
|
|
|
|
|
|
|
|
namespace internal
|
|
|
|
|
{
|
|
|
|
|
struct box_t final : public primitive {
|
|
|
|
|
box_t(primitive_data_center_t *data_center_ptr) : primitive(data_center_ptr)
|
|
|
|
|
{
|
|
|
|
|
initialize({trans_by_target_axis_matrices_ptr<model_matrix::axis::x, true, 1>,
|
|
|
|
|
trans_by_target_axis_matrices_ptr<model_matrix::axis::x, false, 1>,
|
|
|
|
|
trans_by_target_axis_matrices_ptr<model_matrix::axis::y, true, 1>,
|
|
|
|
|
trans_by_target_axis_matrices_ptr<model_matrix::axis::y, false, 1>,
|
|
|
|
|
trans_by_target_axis_matrices_ptr<model_matrix::axis::z, true, 1>,
|
|
|
|
|
trans_by_target_axis_matrices_ptr<model_matrix::axis::z, false, 1>},
|
|
|
|
|
{{}, {}, {}, {}, {}, {}},
|
|
|
|
|
k_aabb_unit);
|
|
|
|
|
|
|
|
|
|
for(auto s : get_subfaces())
|
|
|
|
|
{
|
|
|
|
|
std::cout << (s->world_to_local * Eigen::Vector4d{0, 0, 0, 1}).transpose() << std::endl;
|
|
|
|
|
// std::cout << s->local_to_world.matrix() << std::endl;
|
|
|
|
|
// std::cout << (s->local_to_world * Eigen::Vector4d{0, 0, 0, 1}).transpose() << std::endl;
|
|
|
|
|
// std::cout << s.get_mark() << std::endl;
|
|
|
|
|
s.set_mark(~s.get_mark());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
primitive_type get_type() const override { return PRIMITIVE_TYPE_BOX; };
|
|
|
|
|
|
|
|
|
|
span<marked_subface_ptr_t<subface>> get_subfaces() const override
|
|
|
|
|
{
|
|
|
|
|
return {const_cast<marked_subface_ptr_t<subface> *>(subfaces.data()), subfaces.size()};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<surface_type> get_subface_types() const override
|
|
|
|
|
{
|
|
|
|
|
return {surface_type::plane,
|
|
|
|
|
surface_type::plane,
|
|
|
|
|
surface_type::plane,
|
|
|
|
|
surface_type::plane,
|
|
|
|
|
surface_type::plane,
|
|
|
|
|
surface_type::plane};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::array<marked_subface_ptr_t<subface>, 6> subfaces{};
|
|
|
|
|
};
|
|
|
|
|
} // namespace internal
|