Exemplo n.º 1
0
        // [TODO] we have handled corner cases, but not edge cases!
        //   those are 2D, so it would be like (dx > width && dy > height)
        //public double Distance(Vector3d v)
        //{
        //    double dx = (double)Math.Abs(v.x - Center.x);
        //    double dy = (double)Math.Abs(v.y - Center.y);
        //    double dz = (double)Math.Abs(v.z - Center.z);
        //    double fWidth = Width * 0.5;
        //    double fHeight = Height * 0.5;
        //    double fDepth = Depth * 0.5;
        //    if (dx < fWidth && dy < fHeight && dz < Depth)
        //        return 0.0f;
        //    else if (dx > fWidth && dy > fHeight && dz > fDepth)
        //        return (double)Math.Sqrt((dx - fWidth) * (dx - fWidth) + (dy - fHeight) * (dy - fHeight) + (dz - fDepth) * (dz - fDepth));
        //    else if (dx > fWidth)
        //        return dx - fWidth;
        //    else if (dy > fHeight)
        //        return dy - fHeight;
        //    else if (dz > fDepth)
        //        return dz - fDepth;
        //    return 0.0f;
        //}


        //! relative translation
        public void Translate(Vector3d vTranslate)
        {
            Min.Add(vTranslate);
            Max.Add(vTranslate);
        }