Min() public static method

Returns a vector containing the smallest components of the specified vectors.
public static Min ( Vec3 left, Vec3 right ) : Vec3
left Vec3 The first source vector.
right Vec3 The second source vector.
return Vec3
コード例 #1
0
ファイル: BoundingBox.cs プロジェクト: yonder/CryMono
        /// <summary>
        /// Constructs a <see cref="CryEngine.BoundingBox"/> that is as large as the total combined area of the two specified boxes.
        /// </summary>
        /// <param name="value1">The first box to merge.</param>
        /// <param name="value2">The second box to merge.</param>
        /// <returns>The newly constructed bounding box.</returns>
        public static BoundingBox Merge(BoundingBox value1, BoundingBox value2)
        {
            BoundingBox box;

            Vec3.Min(ref value1.Minimum, ref value2.Minimum, out box.Minimum);
            Vec3.Max(ref value1.Maximum, ref value2.Maximum, out box.Maximum);
            return(box);
        }
コード例 #2
0
ファイル: BoundingBox.cs プロジェクト: yonder/CryMono
        /// <summary>
        /// Constructs a <see cref="CryEngine.BoundingBox"/> that fully contains the given points.
        /// </summary>
        /// <param name="points">The points that will be contained by the box.</param>
        /// <returns>The newly constructed bounding box.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="points"/> is <c>null</c>.</exception>
        public static BoundingBox FromPoints(Vec3[] points)
        {
#if !(RELEASE && RELEASE_DISABLE_CHECKS)
            if (points == null)
            {
                throw new ArgumentNullException("points");
            }
#endif

            var min = new Vec3(float.MaxValue);
            var max = new Vec3(float.MinValue);

            for (int i = 0; i < points.Length; ++i)
            {
                Vec3.Min(ref min, ref points[i], out min);
                Vec3.Max(ref max, ref points[i], out max);
            }

            return(new BoundingBox(min, max));
        }
コード例 #3
0
ファイル: BoundingBox.cs プロジェクト: yonder/CryMono
 /// <summary>
 /// Constructs a <see cref="CryEngine.BoundingBox"/> that is as large as the total combined area of the two specified boxes.
 /// </summary>
 /// <param name="value1">The first box to merge.</param>
 /// <param name="value2">The second box to merge.</param>
 /// <param name="result">When the method completes, contains the newly constructed bounding box.</param>
 public static void Merge(ref BoundingBox value1, ref BoundingBox value2, out BoundingBox result)
 {
     Vec3.Min(ref value1.Minimum, ref value2.Minimum, out result.Minimum);
     Vec3.Max(ref value1.Maximum, ref value2.Maximum, out result.Maximum);
 }