Example #1
0
		/// <summary>
		/// <para>Returns the sum of two vectors.</para>
		/// <para>Original signature is 'GLKVector3 GLKVector3Add ( GLKVector3 vectorLeft, GLKVector3 vectorRight ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vectorLeft">MISSING</param>
		/// <param name="vectorRight">MISSING</param>
		/// <returns>A new vector whose components each represent the sum of the two components found in the same positions of the two source vectors.</returns>
		public static GLKVector3 Add (GLKVector3 vectorLeft, GLKVector3 vectorRight)
		{
			GLKVector3 v = new GLKVector3 (vectorLeft.x + vectorRight.x,
				vectorLeft.y + vectorRight.y,
				vectorLeft.z + vectorRight.z);
			return v;
		}
Example #2
0
		/// <summary>
		/// <para>Returns a new vector created by adding a scalar value to each component of a vector.</para>
		/// <para>Original signature is 'GLKVector3 GLKVector3AddScalar ( GLKVector3 vector, float value ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vector">MISSING</param>
		/// <param name="value">MISSING</param>
		/// <returns>A new vector.</returns>
		public static GLKVector3 AddScalar (GLKVector3 vector, float value)
		{
			GLKVector3 v = new GLKVector3 (vector.x + value,
				vector.y + value,
				vector.z + value);
			return v;
		}
Example #3
0
		/// <summary>
		/// <para>Returns a Boolean value that states whether all the components of the source vector are equal to a scalar value.</para>
		/// <para>Original signature is 'bool GLKVector3AllEqualToScalar ( GLKVector3 vector, float value ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vector">MISSING</param>
		/// <param name="value">MISSING</param>
		/// <returns>YES if all of the vector’s components are equal to value, NO otherwise.</returns>
		public static bool AllEqualToScalar (GLKVector3 vector, float value)
		{
			bool compare = false;
			if (vector.x == value &&
				vector.y == value &&
				vector.z == value)
				compare = true;
			return compare;
		}
Example #4
0
		/// <summary>
		/// <para>Retrieves a column from a 3x3 matrix.</para>
		/// <para>Original signature is 'GLKVector3 GLKMatrix3GetColumn ( GLKMatrix3 matrix, int column );'</para>
		/// <para>Available in OS X x0.8 and later.</para>
		/// </summary>
		/// <param name="matrix">MISSING</param>
		/// <param name="column">MISSING</param>
		/// <returns>A vector representing the column retrieved from the matrix.</returns>
		public static GLKVector3 GetColumn (GLKMatrix3 matrix, int column)
		{
			GLKVector3 v = new GLKVector3 (
				 matrix [column * 3 + 0],
				 matrix [column * 3 + 1],
				 matrix [column * 3 + 2]
			);
			return v;
		}
Example #5
0
		/// <summary>
		/// <para>Returns a new vector created by multiplying each component of a vector by a scalar value.</para>
		/// <para>Original signature is 'GLKVector3 GLKVector3MultiplyScalar ( GLKVector3 vector, float value ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vector">MISSING</param>
		/// <param name="value">MISSING</param>
		/// <returns>A new vector.</returns>
		public static GLKVector3 MultiplyScalar (GLKVector3 vector, float value)
		{
			GLKVector3 v = new GLKVector3 (vector.x * value,
				vector.y * value,
				vector.z * value);
			return v;   
		}
Example #6
0
		/// <summary>
		/// <para>Returns a new vector whose component value at each position is the smallest component value at the same position in the source vectors.</para>
		/// <para>Original signature is 'GLKVector3 GLKVector3Minimum ( GLKVector3 vectorLeft, GLKVector3 vectorRight ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vectorLeft">MISSING</param>
		/// <param name="vectorRight">MISSING</param>
		/// <returns>A new vector.</returns>
		public static GLKVector3 Minimum (GLKVector3 vectorLeft, GLKVector3 vectorRight)
		{
			GLKVector3 min = vectorLeft;
			if (vectorRight.x < vectorLeft.x)
				min.x = vectorRight.x;
			if (vectorRight.y < vectorLeft.y)
				min.y = vectorRight.y;
			if (vectorRight.z < vectorLeft.z)
				min.z = vectorRight.z;
			return min;
		}
Example #7
0
		/// <summary>
		/// <para>Returns the product of two vectors.</para>
		/// <para>Original signature is 'GLKVector3 GLKVector3Multiply ( GLKVector3 vectorLeft, GLKVector3 vectorRight ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vectorLeft">MISSING</param>
		/// <param name="vectorRight">MISSING</param>
		/// <returns>A new vector whose components each represent the product of the components found in the same positions of the two source vectors.</returns>
		public static GLKVector3 Multiply (GLKVector3 vectorLeft, GLKVector3 vectorRight)
		{
			GLKVector3 v = new GLKVector3 (vectorLeft.x * vectorRight.x,
				vectorLeft.y * vectorRight.y,
				vectorLeft.z * vectorRight.z);
			return v;
		}
Example #8
0
		/// <summary>
		/// <para>Multiplies a 4x4 matrix by a 3-component vector, applying translation.</para>
		/// <para>Original signature is 'GLKVector3 GLKMatrix4.MultiplyVector3WithTranslation ( GLKMatrix4 matrixLeft, GLKVector3 vectorRight );'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="matrixLeft">MISSING</param>
		/// <param name="vectorRight">MISSING</param>
		/// <returns>A new vector created by multiplying the matrix by the vector.</returns>
		public static GLKVector3 MultiplyVector3WithTranslation (GLKMatrix4 matrixLeft, GLKVector3 vectorRight)
		{
			GLKVector4 v4 = GLKMatrix4.MultiplyVector4 (matrixLeft, GLKVector4.Make (vectorRight.x, vectorRight.y, vectorRight.z, 1.0f));
			return GLKVector3.Make (v4.x, v4.y, v4.z);
		}
Example #9
0
		/// <summary>
		/// <para>Returns a new 4x4 matrix created by concatenating a matrix with a translation transform defined by a vector.</para>
		/// <para>Original signature is 'GLKMatrix4 GLKMatrix4TranslateWithVector3 ( GLKMatrix4 matrix, GLKVector3 translationVector );'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="matrix">MISSING</param>
		/// <param name="translationVector">MISSING</param>
		/// <returns>A new matrix.</returns>
		public static GLKMatrix4 TranslateWithVector3 (GLKMatrix4 matrix, GLKVector3 translationVector)
		{
			GLKMatrix4 m = new GLKMatrix4 (matrix [0], matrix [1], matrix [2], matrix [3],
				matrix [4], matrix [5], matrix [6], matrix [7],
				matrix [8], matrix [9], matrix [10], matrix [11],
				matrix [0] * translationVector.x + matrix [4] * translationVector.y + matrix [8] * translationVector.z + matrix [12],
				matrix [1] * translationVector.x + matrix [5] * translationVector.y + matrix [9] * translationVector.z + matrix [13],
				matrix [2] * translationVector.x + matrix [6] * translationVector.y + matrix [10] * translationVector.z + matrix [14],
				matrix [15]);
			return m;
		}
Example #10
0
		/// <summary>
		/// <para>Returns a new vector created by normalizing the input vector to a length of 1.0.</para>
		/// <para>Original signature is 'GLKVector3 GLKVector3Normalize ( GLKVector3 vector ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vector">MISSING</param>
		/// <returns>A new vector.</returns>
		public static GLKVector3 Normalize (GLKVector3 vector)
		{
			float scale = 1.0f / GLKVector3.Length (vector);
			GLKVector3 v = new GLKVector3 (vector.x * scale, vector.y * scale, vector.z * scale);
			return v;
		}
Example #11
0
		/// <summary>
		/// <para>Returns the difference between two vectors.</para>
		/// <para>Original signature is 'GLKVector3 GLKVector3Subtract ( GLKVector3 vectorLeft, GLKVector3 vectorRight ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vectorLeft">MISSING</param>
		/// <param name="vectorRight">MISSING</param>
		/// <returns>A new vector whose components each represent the difference between the components found in the same positions of the two source vectors.</returns>
		public static GLKVector3 Subtract (GLKVector3 vectorLeft, GLKVector3 vectorRight)
		{
			GLKVector3 v = new GLKVector3 (vectorLeft.x - vectorRight.x,
				vectorLeft.y - vectorRight.y,
				vectorLeft.z - vectorRight.z);
			return v;
		}
Example #12
0
		/// <summary>
		/// <para>Returns a new vector created by dividing each component of a vector by a scalar value.</para>
		/// <para>Original signature is 'GLKVector3 GLKVector3DivideScalar ( GLKVector3 vector, float value ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vector">MISSING</param>
		/// <param name="value">MISSING</param>
		/// <returns>A new vector.</returns>
		public static GLKVector3 DivideScalar (GLKVector3 vector, float value)
		{
			GLKVector3 v = new GLKVector3 (vector.x / value,
				vector.y / value,
				vector.z / value);
			return v;
		}
Example #13
0
		/// <summary>
		/// <para>Returns the dot product of two vectors.</para>
		/// <para>Original signature is 'float GLKVector3DotProduct ( GLKVector3 vectorLeft, GLKVector3 vectorRight ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vectorLeft">MISSING</param>
		/// <param name="vectorRight">MISSING</param>
		/// <returns>The dot product of the two vectors.</returns>
		public static float DotProduct (GLKVector3 vectorLeft, GLKVector3 vectorRight)
		{
			return vectorLeft.x * vectorRight.x + vectorLeft.y * vectorRight.y + vectorLeft.z * vectorRight.z;
		}
Example #14
0
		/// <summary>
		/// <para>Returns the distance between two points.</para>
		/// <para>Original signature is 'float GLKVector3Distance ( GLKVector3 vectorStart, GLKVector3 vectorEnd ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vectorStart">MISSING</param>
		/// <param name="vectorEnd">MISSING</param>
		/// <returns>The distance between the two points.</returns>
		public static float Distance (GLKVector3 vectorStart, GLKVector3 vectorEnd)
		{
			return GLKVector3.Length (GLKVector3.Subtract (vectorEnd, vectorStart));
		}
Example #15
0
		/// <summary>
		/// <para>Returns a new vector created by dividing one vector by another.</para>
		/// <para>Original signature is 'GLKVector3 GLKVector3Divide ( GLKVector3 vectorLeft, GLKVector3 vectorRight ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vectorLeft">MISSING</param>
		/// <param name="vectorRight">MISSING</param>
		/// <returns>A new vector whose components are each calculated by dividing the component found in same position of the first vector by the component found in the same position of the second vector.</returns>
		public static GLKVector3 Divide (GLKVector3 vectorLeft, GLKVector3 vectorRight)
		{
			GLKVector3 v = new GLKVector3 (vectorLeft.x / vectorRight.x,
				vectorLeft.y / vectorRight.y,
				vectorLeft.z / vectorRight.z);
			return v;
		}
Example #16
0
		/// <summary>
		/// <para>Returns the cross product of two vectors.</para>
		/// <para>Original signature is 'GLKVector3 GLKVector3CrossProduct ( GLKVector3 vectorLeft, GLKVector3 vectorRight ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vectorLeft">MISSING</param>
		/// <param name="vectorRight">MISSING</param>
		/// <returns>A new vector.</returns>
		public static GLKVector3 CrossProduct (GLKVector3 vectorLeft, GLKVector3 vectorRight)
		{
			GLKVector3 v = new GLKVector3 (vectorLeft.y * vectorRight.z - vectorLeft.z * vectorRight.y,
				vectorLeft.z * vectorRight.x - vectorLeft.x * vectorRight.z,
				vectorLeft.x * vectorRight.y - vectorLeft.y * vectorRight.x);
			return v;
		}
Example #17
0
		/// <summary>
		/// <para>Returns a Boolean value that indicates whether each component of the first vector is greater than the corresponding component of a second vector.</para>
		/// <para>Original signature is 'bool GLKVector3AllGreaterThanVector3 ( GLKVector3 vectorLeft, GLKVector3 vectorRight ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vectorLeft">MISSING</param>
		/// <param name="vectorRight">MISSING</param>
		/// <returns>YES if each component in the first vector is greater than the corresponding component of the second vector, NO otherwise.</returns>
		public static bool AllGreaterThanVector3 (GLKVector3 vectorLeft, GLKVector3 vectorRight)
		{
			bool compare = false;
			if (vectorLeft.x > vectorRight.x &&
				vectorLeft.y > vectorRight.y &&
				vectorLeft.z > vectorRight.z)
				compare = true;
			return compare;
		}
Example #18
0
		/// <summary>
		/// <para>Returns a Boolean value that states whether all the components of the source vector are greater than a scalar value.</para>
		/// <para>Original signature is 'bool GLKVector3AllGreaterThanScalar ( GLKVector3 vector, float value ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vector">MISSING</param>
		/// <param name="value">MISSING</param>
		/// <returns>YES if all of the vector’s components are greater than the scalar value, NO otherwise.</returns>
		public static bool AllGreaterThanScalar (GLKVector3 vector, float value)
		{
			bool compare = false;
			if (vector.x > value &&
				vector.y > value &&
				vector.z > value)
				compare = true;
			return compare;
		}
Example #19
0
		/// <summary>
		/// <para>Returns a new 4x4 matrix created by concatenating a matrix with a rotation around a vector.</para>
		/// <para>Original signature is 'GLKMatrix4 GLKMatrix4RotateWithVector3 ( GLKMatrix4 matrix, float radians, GLKVector3 axisVector );'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="matrix">MISSING</param>
		/// <param name="radians">MISSING</param>
		/// <param name="axisVector">MISSING</param>
		/// <returns>A new matrix.</returns>
		public static GLKMatrix4 RotateWithVector3 (GLKMatrix4 matrix, float radians, GLKVector3 axisVector)
		{
			GLKMatrix4 rm = GLKMatrix4.MakeRotation (radians, axisVector.x, axisVector.y, axisVector.z);
			return GLKMatrix4.Multiply (matrix, rm);
		}
Example #20
0
		/// <summary>
		/// <para>Returns the length of a vector.</para>
		/// <para>Original signature is 'float GLKVector3Length ( GLKVector3 vector ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vector">MISSING</param>
		/// <returns>The length of the vector.</returns>
		public static float Length (GLKVector3 vector)
		{
			return (float)Math.Sqrt (vector.x * vector.x + vector.y * vector.y + vector.z * vector.z);
		}
Example #21
0
		/// <summary>
		/// <para>Returns a new vector created by negating the component values of another vector.</para>
		/// <para>Original signature is 'GLKVector3 GLKVector3Negate ( GLKVector3 vector ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vector">MISSING</param>
		/// <returns>A new vector.</returns>
		public static GLKVector3 Negate (GLKVector3 vector)
		{
			GLKVector3 v = new GLKVector3 (-vector.x, -vector.y, -vector.z);
			return v;
		}
Example #22
0
		/// <summary>
		/// <para>Returns a Boolean value that indicates whether each component of the first vector is equal to the corresponding component of a second vector.</para>
		/// <para>Original signature is 'bool GLKVector3AllEqualToVector3 ( GLKVector3 vectorLeft, GLKVector3 vectorRight ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vectorLeft">MISSING</param>
		/// <param name="vectorRight">MISSING</param>
		/// <returns>YES if all of the vectors’ components are equal , NO otherwise.</returns>
		public static bool AllEqualToVector3 (GLKVector3 vectorLeft, GLKVector3 vectorRight)
		{
			bool compare = false;
			if (vectorLeft.x == vectorRight.x &&
				vectorLeft.y == vectorRight.y &&
				vectorLeft.z == vectorRight.z)
				compare = true;
			return compare;
		}
Example #23
0
		/// <summary>
		/// <para>Returns a new vector created by projecting a vector onto another vector.</para>
		/// <para>Original signature is 'GLKVector3 GLKVector3Project ( GLKVector3 vectorToProject, GLKVector3 projectionVector ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vectorToProject">MISSING</param>
		/// <param name="projectionVector">MISSING</param>
		/// <returns>A new vector.</returns>
		public static GLKVector3 Project (GLKVector3 vectorToProject, GLKVector3 projectionVector)
		{
			float scale = GLKVector3.DotProduct (projectionVector, vectorToProject) / GLKVector3.DotProduct (projectionVector, projectionVector);
			GLKVector3 v = GLKVector3.MultiplyScalar (projectionVector, scale);
			return v;
		}
Example #24
0
		/// <summary>
		/// <para>Multiplies a 4x4 matrix by a position vector to create a vector in homogenous coordinates, then projects the result to a 3-component vector.</para>
		/// <para>Original signature is 'GLKVector3 GLKMatrix4.MultiplyAndProjectVector3 ( GLKMatrix4 matrixLeft, GLKVector3 vectorRight );'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="matrixLeft">MISSING</param>
		/// <param name="vectorRight">MISSING</param>
		/// <returns>A new vector created by first multiplying the matrix by the vector and then performing perspective division on the result vector.</returns>
		public static GLKVector3 MultiplyAndProjectVector3 (GLKMatrix4 matrixLeft, GLKVector3 vectorRight)
		{
			GLKVector4 v4 = GLKMatrix4.MultiplyVector4 (matrixLeft, GLKVector4.Make (vectorRight.x, vectorRight.y, vectorRight.z, 1.0f));
			return GLKVector3.MultiplyScalar (GLKVector3.Make (v4.x, v4.y, v4.z), 1.0f / v4.w);
		}
Example #25
0
		/// <summary>
		/// <para>Returns a new vector created by subtracting a scalar value from each component of a vector.</para>
		/// <para>Original signature is 'GLKVector3 GLKVector3SubtractScalar ( GLKVector3 vector, float value ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vector">MISSING</param>
		/// <param name="value">MISSING</param>
		/// <returns>A new vector.</returns>
		public static GLKVector3 SubtractScalar (GLKVector3 vector, float value)
		{
			GLKVector3 v = new GLKVector3 (vector.x - value,
				vector.y - value,
				vector.z - value);
			return v;    
		}
Example #26
0
		/// <summary>
		/// <para>Returns a new vector whose component value at each position is the largest component value at the same position in the source vectors.</para>
		/// <para>Original signature is 'GLKVector3 GLKVector3Maximum ( GLKVector3 vectorLeft, GLKVector3 vectorRight ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vectorLeft">MISSING</param>
		/// <param name="vectorRight">MISSING</param>
		/// <returns>A new vector.</returns>
		public static GLKVector3 Maximum (GLKVector3 vectorLeft, GLKVector3 vectorRight)
		{
			GLKVector3 max = vectorLeft;
			if (vectorRight.x > vectorLeft.x)
				max.x = vectorRight.x;
			if (vectorRight.y > vectorLeft.y)
				max.y = vectorRight.y;
			if (vectorRight.z > vectorLeft.z)
				max.z = vectorRight.z;
			return max;
		}
Example #27
0
		/// <summary>
		/// <para>Returns a new vector created by linearly interpreting between two vectors.</para>
		/// <para>Original signature is 'GLKVector3 GLKVector3Lerp ( GLKVector3 vectorStart, GLKVector3 vectorEnd, float t ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vectorStart">MISSING</param>
		/// <param name="vectorEnd">MISSING</param>
		/// <param name="t">MISSING</param>
		/// <returns>A new vector.</returns>
		public static GLKVector3 Lerp (GLKVector3 vectorStart, GLKVector3 vectorEnd, float t)
		{
			GLKVector3 v = new GLKVector3 (vectorStart.x + ((vectorEnd.x - vectorStart.x) * t),
				vectorStart.y + ((vectorEnd.y - vectorStart.y) * t),
				vectorStart.z + ((vectorEnd.z - vectorStart.z) * t));
			return v;
		}
Example #28
0
		/// <summary>
		/// <para>Returns a new 4x4 matrix created by concatenating a matrix with a scaling transform defined by a vector.</para>
		/// <para>Original signature is 'GLKMatrix4 GLKMatrix4ScaleWithVector3 ( GLKMatrix4 matrix, GLKVector3 scaleVector );'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="matrix">MISSING</param>
		/// <param name="scaleVector">MISSING</param>
		/// <returns>A new matrix.</returns>
		public static GLKMatrix4 ScaleWithVector3 (GLKMatrix4 matrix, GLKVector3 scaleVector)
		{
			GLKMatrix4 m = new GLKMatrix4 (matrix [0] * scaleVector.x, matrix [1] * scaleVector.x, matrix [2] * scaleVector.x, matrix [3] * scaleVector.x,
				matrix [4] * scaleVector.y, matrix [5] * scaleVector.y, matrix [6] * scaleVector.y, matrix [7] * scaleVector.y,
				matrix [8] * scaleVector.z, matrix [9] * scaleVector.z, matrix [10] * scaleVector.z, matrix [11] * scaleVector.z,
				matrix [12], matrix [13], matrix [14], matrix [15]);
			return m;
		}
Example #29
0
		/// <summary>
		/// <para>Returns a new four-component vector created by combining a three-component vector with a scalar value.</para>
		/// <para>Original signature is 'GLKVector4 GLKVector4MakeWithVector3 ( GLKVector3 vector, float w ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="vector">MISSING</param>
		/// <param name="w">MISSING</param>
		/// <returns>A new vector.</returns>
		public static GLKVector4 MakeWithVector3 (GLKVector3 vector, float w)
		{
			GLKVector4 v = new GLKVector4 (vector.x, vector.y, vector.z, w);
			return v;
		}
Example #30
0
		/// <summary>
		/// <para>Returns a new three-component vector created from individual component values.</para>
		/// <para>Original signature is 'GLKVector3 GLKVector3Make ( float x, float y, float z ) {}'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="x">MISSING</param>
		/// <param name="y">MISSING</param>
		/// <param name="z">MISSING</param>
		/// <returns>An initialized vector.</returns>
		public static GLKVector3 Make (float x, float y, float z)
		{
			GLKVector3 v = new GLKVector3 (x, y, z);
			return v;
		}