// intersect a box bool TXDualEdge::Touch(const CVector3f& minp, const CVector3f& maxp) const { int m = 4; CVector3f step; step.Sub(m_dp[1], m_dp[0]); step.ScaleInPlace(1/4); CVector3f A = m_dp[0]; CVector3f B; B.Add(m_dp[0],step); for (int i = 0; i < m; i++) { CVector3f bmin(MIN(A.GetX(),B.GetX()),MIN(A.GetY(),B.GetY()),MIN(A.GetZ(),B.GetZ())); CVector3f bmax(MAX(A.GetX(),B.GetX()),MAX(A.GetY(),B.GetY()),MAX(A.GetZ(),B.GetZ())); if (bmin.GetX() <= maxp.GetX() && minp.GetX() <= bmax.GetX() && bmin.GetY() <= maxp.GetY() && minp.GetY() <= bmax.GetY() && bmin.GetZ() <= maxp.GetZ() && minp.GetZ() <= bmax.GetZ()) return true; A = B; B += step; } return false; }