Пример #1
0
        public void ToBounds(out BoundsF result)
        {
            Vector3F a    = Point2 - Point1;
            var      dotA = Vector3F.Dot(a, a);

            if (dotA == 0)
            {
                dotA = MathEx.Epsilon;
            }

            Vector3F e = new Vector3F(
                Radius * MathEx.Sqrt(1.0f - a.X * a.X / dotA),
                Radius * MathEx.Sqrt(1.0f - a.Y * a.Y / dotA),
                Radius * MathEx.Sqrt(1.0f - a.Z * a.Z / dotA));

            result = new BoundsF(Vector3F.Min(Point1 - e, Point2 - e), Vector3F.Max(Point1 + e, Point2 + e));
        }