#ifndef _SeparatingPlanesBox3_H__ #define _SeparatingPlanesBox3_H__ #include "AxisAlignedBox3.h" #include "Matrix4x4.h" #include "Vector3.h" #include "Plane3.h" #include "Containers.h" namespace GtpVisibilityPreprocessor { // Written by Vlastimil Havran, May 2008, in the scope // of Progressive Visibility Sampling project. // This class given two axis aligned boxes can construct all the // separating planes between two boxes. It gets the boxes as 'origBox' // containing ray origin, and 'shadBox', containing shadowing object, // to which the ray is aimed at. The constructed planes can found if a // 'testBox' cannot be intersected by a ray starting from the origBox // and intersecting the 'shadBox'. class CSeparatingAxisTester { // the number of separating planes int cntPlanes; Plane3 planes[32]; AxisAlignedBox3 origBox; AxisAlignedBox3 shadBox; void InsertPlane(const Plane3 &pl); void OnePhase(const AxisAlignedBox3 &origBox, const AxisAlignedBox3 &shadBox, const Vector3 &pointBACKSIDE); public: CSeparatingAxisTester(); // Initialize with two boxe, the 'origBox' contains // origin of the ray, 'shadBox' is the shadowing // box, which contains new position of the object // and to which a ray aims at. void Init(const AxisAlignedBox3 &origBox, const AxisAlignedBox3 &shadBox); // This function returns true if a ray starting // in the 'origBox' and intersecting 'shadBox' // can intersect the box as input of this function bool TestIsInsideShaft(const AxisAlignedBox3 &testBox); // returns number of separating planes int CntPlanes() const { return cntPlanes;} }; // Testing code void TestSepAxis(); } #endif