-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVector.cs
49 lines (48 loc) · 852 Bytes
/
Vector.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using Symbolism;
namespace TMISolver{
public class Vector
{
public MathObject[] vec;
public Vector(MathObject _x, MathObject _y)
{
vec = new MathObject[]{_x, _y, 0};
}
public Vector(MathObject _x, MathObject _y, MathObject _z)
{
vec = new MathObject[]{_x, _y, _z};
}
public MathObject x(){
return this.vec[0];
}
public MathObject y(){
return this.vec[1];
}
public MathObject z(){
return this.vec[2];
}
public MathObject Index(int index){
switch (index) {
case 0: {
return this.x();
}
case 1: {
return this.y();
}
case 2: {
return this.z();
}
default:
throw new Exception("Index out of bounds!");
}
}
public void Print()
{
Console.WriteLine(this.x()
+ " , " +
this.y()
+ " , " +
this.z());
}
}
}