CreateLerp() public static method

public static CreateLerp ( Vec3 p, Vec3 q, float t ) : Vec3
p Vec3
q Vec3
t float
return Vec3
Ejemplo n.º 1
0
        /// <summary>
        /// Constructs a <see cref="CryEngine.BoundingSphere"/> from a given box.
        /// </summary>
        /// <param name="box">The box that will designate the extents of the sphere.</param>
        /// <param name="result">When the method completes, the newly constructed bounding sphere.</param>
        public static void FromBox(ref BoundingBox box, out BoundingSphere result)
        {
            result.Center = Vec3.CreateLerp(box.Minimum, box.Maximum, 0.5f);

            float x = box.Minimum.X - box.Maximum.X;
            float y = box.Minimum.Y - box.Maximum.Y;
            float z = box.Minimum.Z - box.Maximum.Z;

            var distance = (Math.Sqrt((x * x) + (y * y) + (z * z)));

            result.Radius = (float)distance * 0.5f;
        }