3using namespace Tempest;
10 float clip[16] = {}, t=0;
11 std::copy(m.data(), m.data()+16,
clip );
18 t = std::sqrt(
f[0][0]*
f[0][0] +
f[0][1]*
f[0][1] +
f[0][2]*
f[0][2]);
32 t = std::sqrt(
f[1][0]*
f[1][0] +
f[1][1]*
f[1][1] +
f[1][2]*
f[1][2]);
46 t = std::sqrt(
f[2][0]*
f[2][0] +
f[2][1]*
f[2][1] +
f[2][2]*
f[2][2]);
60 t = std::sqrt(
f[3][0]*
f[3][0] +
f[3][1]*
f[3][1] +
f[3][2]*
f[3][2]);
74 t = std::sqrt(
f[4][0]*
f[4][0] +
f[4][1]*
f[4][1] +
f[4][2]*
f[4][2]);
88 t = std::sqrt(
f[5][0]*
f[5][0] +
f[5][1]*
f[5][1] +
f[5][2]*
f[5][2]);
100 std::memset(
f,0,
sizeof(
f));
101 f[0][3] = -std::numeric_limits<float>::infinity();
112 for(
size_t i=0; i<6; i++) {
113 if(
f[i][0]*x+
f[i][1]*y+
f[i][2]*z+
f[i][3]<=-R)
124 for(
size_t i=0; i<5; i++) {
125 if(
f[i][0]*p.x+
f[i][1]*p.y+
f[i][2]*p.z+
f[i][3]<=-R)
129 dist =
f[5][0]*p.x+
f[5][1]*p.y+
f[5][2]*p.z+
f[5][3];
138 for(
int i=0; i<6; i++) {
140 std::max(min.x *
f[i][0], max.x *
f[i][0])
141 + std::max(min.y *
f[i][1], max.y *
f[i][1])
142 + std::max(min.z *
f[i][2], max.z *
f[i][2])
145 std::min(min.x *
f[i][0], max.x *
f[i][0])
146 + std::min(min.y *
f[i][1], max.y *
f[i][1])
147 + std::min(min.z *
f[i][2], max.z *
f[i][2])
bool testPoint(float x, float y, float z) const
void make(const Tempest::Matrix4x4 &m, int32_t w, int32_t h)
Ret testBbox(const Tempest::Vec3 &min, const Tempest::Vec3 &max) const
static T clip(T v, T low, T hi)