using System; using System.Collections.Generic; using System.Numerics; public class MyVector { public float X { get; private set; } public float Y { get; private set; } public float Z { get; private set; } // this W component has only been included to make it easier to do Matrix multiplications public float W { get; private set; } public MyVector(float pX, float pY, float pZ, float pW = 1) { this.W = pW; this.X = pX; this.Y = pY; this.Z = pZ; } public MyVector Add(MyVector pVector) { Vector3 firstVector = new Vector3(X, Y, Z); Vector3 secondVector = new Vector3(pVector.X, pVector.Y,pVector.Z); Vector3 finishedVector = firstVector + secondVector; return new MyVector(finishedVector.X, finishedVector.Y, finishedVector.Z); } public MyVector Subtract(MyVector pVector) { Vector3 firstVector = new Vector3(X, Y, Z); Vector3 secondVector = new Vector3(pVector.X, pVector.Y, pVector.Z); Vector3 finishedVector = firstVector - secondVector; return new MyVector(finishedVector.X, finishedVector.Y, finishedVector.Z); } public MyVector Multiply(float pScalar) { Vector3 firstVector = new Vector3(X*pScalar, Y*pScalar, Z*pScalar); return new MyVector(firstVector.X,firstVector.Y,firstVector.Z); } public MyVector Divide(float pScalar) { Vector3 firstVector = new Vector3(X / pScalar, Y / pScalar, Z / pScalar); return new MyVector(firstVector.X, firstVector.Y, firstVector.Z); } public float Magnitude() { float squareSum = (float)Math.Pow(X, 2) + (float)Math.Pow(Y, 2) + (float)Math.Pow(Z, 2); float SquareRoot = (float)Math.Sqrt(squareSum); return SquareRoot; } public MyVector Normalise() { return null; } public float DotProduct(MyVector pVector) { return -1; } public MyVector Interpolate(MyVector pVector, float pInterpolation) { return null; } public float AngleBetween(MyVector pVector) { return -1; } public MyVector CrossProduct(MyVector pVector) { return null; } }