private static int[] FindExtremePoints(List <JVector> points, ref JVector dirX, ref JVector dirY, ref JVector dirZ) { int[] indices = new int[6]; float[] current = new float[6]; JVector point; float value; for (int i = 0; i < points.Count; i++) { point = points[i]; value = JVector.Dot(ref point, ref dirX); if (value > current[0]) { current[0] = value; indices[0] = i; } if (value < current[1]) { current[1] = value; indices[1] = i; } value = JVector.Dot(ref point, ref dirY); if (value > current[2]) { current[2] = value; indices[2] = i; } if (value < current[3]) { current[3] = value; indices[3] = i; } value = JVector.Dot(ref point, ref dirZ); if (value > current[4]) { current[4] = value; indices[4] = i; } if (value < current[5]) { current[5] = value; indices[5] = i; } } return(indices); }
private static int FindExtremePoint(List <JVector> points, ref JVector dir) { int index = 0; float current = float.MinValue; JVector point; float value; for (int i = 1; i < points.Count; i++) { point = points[i]; value = JVector.Dot(ref point, ref dir); if (value > current) { current = value; index = i; } } return(index); }
/// <summary> /// Calculates the dot product of two vectors. /// </summary> /// <param name="value1">The first vector.</param> /// <param name="value2">The second vector.</param> /// <returns>Returns the dot product of both.</returns> #region public static float operator *(JVector value1, JVector value2) public static float operator *(JVector value1, JVector value2) { return(JVector.Dot(ref value1, ref value2)); }
/// <summary> /// Calculates the dot product of two vectors. /// </summary> /// <param name="vector1">The first vector.</param> /// <param name="vector2">The second vector.</param> /// <returns>Returns the dot product of both vectors.</returns> #region public static float Dot(JVector vector1, JVector vector2) public static float Dot(JVector vector1, JVector vector2) { return(JVector.Dot(ref vector1, ref vector2)); }
/// <summary> /// Calculates the dot product of two vectors. /// </summary> /// <param name="vector1">The first vector.</param> /// <param name="vector2">The second vector.</param> /// <returns>Returns the dot product of both vectors.</returns> #region public static double Dot(JVector vector1, JVector vector2) public static double Dot(JVector vector1, JVector vector2) { return(JVector.Dot(ref vector1, ref vector2)); }