public void op_AdditionTest() { ThreeVector a = new ThreeVector(1, 0, 2); ThreeVector b = new ThreeVector(0, 1, 1); ThreeVector expected = new ThreeVector(1, 1, 3); ThreeVector actual = a + b; Assert.AreEqual(expected.ToString(), actual.ToString()); }
private IEnumerable<List<double>> getAllComponentsForEachDimension(ThreeVector b) { for (int i = 0; i < 3; i++) { List<double> componentsToReturn = new List<double>(); componentsToReturn.Add(this.ci); componentsToReturn.Add(b.ci); componentsToReturn.Add(this.cj); componentsToReturn.Add(b.cj); componentsToReturn.Add(this.ck); componentsToReturn.Add(b.ck); yield return componentsToReturn; } }
public ThreeVector VectorProduct(ThreeVector vec) { return new ThreeVector(this.cj * vec.ck - this.ck * vec.cj, this.ck * vec.ci - this.ci * vec.ck, this.ci * vec.cj - this.cj * vec.ci); }
public ThreeVector ReflectOverLineThroughOrigin(ThreeVector lineToReflectOver) { return 2 * ((((this * lineToReflectOver) / (lineToReflectOver * lineToReflectOver)) * lineToReflectOver) - this); }
public ThreeVector Derivate(string withRespectTo, ThreeVector vec) { double x = 0, y = 0, z = 0; if(x_t_i.Contains("t", "x")) x = x_t_i.Relate("x", "t").Derivative(vec.ci); if (y_t_j.Contains("y", "t")) y = y_t_j.Relate("t", "y").Derivative(vec.cj); if (z_t_k.Contains("t", "z")) z = z_t_k.Relate("z", "t").Derivative(vec.ck); return new ThreeVector(x, y, z); }
public Angle AngleBetweenVectors(ThreeVector vec) { double a = (this * vec) / (this.Magnitude() * vec.Magnitude()); return new Angle(Math.Acos(a)); }