bool NX::ViewFrustum::Visible(const NX::Ellipse &ellipse, const unsigned int mask){ const NX::vector<float, 3> R = ellipse.GetLongAxis() * ellipse.GetLongAxisLength(); const NX::vector<float, 3> S = ellipse.GetShortAxis() * ellipse.GetShortAxisLength(); const NX::vector<float, 3> C = ellipse.GetCenter(); #undef NX_VIEWFRUSTUM_POSITIVE_SIDE_TEST #define NX_VIEWFRUSTUM_POSITIVE_SIDE_TEST(plane) \ const NX::vector<float, 3> N = plane.GetNormal();\ const float rn = NX::Dot(R, N);\ const float rs = NX::Dot(S, N);\ const float RRef = std::sqrt(rn * rn + rs * rs);\ if(NX::Dot(N, C) + plane.GetDistFromOriginal() < -RRef){\ return false;\ } if(mask & NX::VF_VT_LEFT){ NX_VIEWFRUSTUM_POSITIVE_SIDE_TEST(GetLeftPlane()); } if(mask & NX::VF_VT_RIGHT){ NX_VIEWFRUSTUM_POSITIVE_SIDE_TEST(GetRightPlane()); } if(mask & NX::VF_VT_FRONT){ NX_VIEWFRUSTUM_POSITIVE_SIDE_TEST(GetFrontPlane()); } if(mask & NX::VF_VT_BACK){ NX_VIEWFRUSTUM_POSITIVE_SIDE_TEST(GetBackPlane()); } if(mask & NX::VF_VT_TOP){ NX_VIEWFRUSTUM_POSITIVE_SIDE_TEST(GetTopPlane()); } if(mask & NX::VF_VT_BOTTOM){ NX_VIEWFRUSTUM_POSITIVE_SIDE_TEST(GetBottomPlane()); } return true; #undef NX_VIEWFRUSTUM_POSITIVE_SIDE_TEST }