Example #1
0
    //错误
    void AABBTransformAsAABB(AABBThreeD aabb, Matrix4x4 m)
    {
        //Vector3 newCenter = m.MulPos(aabb.CenterPoint());
        // center = m.MultiplyPoint(aabb.CenterPoint());
        Vector3 newDir;
        //Vector3 h = aabb.HalfSize();
        //halfSize
        Vector3 h = halfSize;

        //The following is equal to taking the absolute value of the whole matrix m.
        newDir.x      = MathFunc.ABSDOT3(m.GetRow(0), h);
        newDir.y      = MathFunc.ABSDOT3(m.GetRow(1), h);
        newDir.z      = MathFunc.ABSDOT3(m.GetRow(2), h);
        aabb.minPoint = center - newDir;
        aabb.maxPoint = center + newDir;
    }