Beispiel #1
0
        /// <summary>
        /// Gets a vector with the minimum x and y values of both vectors.
        /// </summary>
        /// <param name="value1">The first value.</param>
        /// <param name="value2">The second value.</param>
        /// <returns>A vector with the minimum x and y values of both vectors.</returns>
        #region public static JVector Min(JVector value1, JVector value2)

        public static JVector Min(JVector value1, JVector value2)
        {
            JVector result;

            JVector.Min(ref value1, ref value2, out result);
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new box containing the two given ones.
        /// </summary>
        /// <param name="original">First box.</param>
        /// <param name="additional">Second box.</param>
        /// <param name="result">A JBBox containing the two given boxes.</param>
        public static void CreateMerged(ref JBBox original, ref JBBox additional, out JBBox result)
        {
            JVector vector;
            JVector vector2;

            JVector.Min(ref original.Min, ref additional.Min, out vector2);
            JVector.Max(ref original.Max, ref additional.Max, out vector);
            result.Min = vector2;
            result.Max = vector;
        }
Beispiel #3
0
        /// <summary>
        /// Expands a bounding box with the volume 0 by all points
        /// given.
        /// </summary>
        /// <param name="points">A array of JVector.</param>
        /// <returns>The resulting bounding box containing all points.</returns>
        #region public static JBBox CreateFromPoints(JVector[] points)

        public static JBBox CreateFromPoints(JVector[] points)
        {
            JVector vector3 = new JVector(float.MaxValue);
            JVector vector2 = new JVector(float.MinValue);

            for (int i = 0; i < points.Length; i++)
            {
                JVector.Min(ref vector3, ref points[i], out vector3);
                JVector.Max(ref vector2, ref points[i], out vector2);
            }
            return(new JBBox(vector3, vector2));
        }
Beispiel #4
0
 public void AddPoint(ref JVector point)
 {
     JVector.Max(ref this.Max, ref point, out this.Max);
     JVector.Min(ref this.Min, ref point, out this.Min);
 }