-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTriMat.cs
39 lines (36 loc) · 1.01 KB
/
TriMat.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
namespace _3D_Renderer
{
class TriMat
{
//Triangle of matrices
public Matrix[] Verts { get; }
public TriMat(Matrix Vert1, Matrix Vert2, Matrix Vert3)
{
Verts = new Matrix[] { Vert1, Vert2, Vert3 };
}
public Matrix Vert1
{
get { return Verts[0]; }
}
public Matrix Vert2
{
get { return Verts[1]; }
}
public Matrix Vert3
{
get { return Verts[2]; }
}
public TriMat Multiply(Matrix Transformation)
{
return new TriMat(Matrix.Multiply(Transformation, Vert1), Matrix.Multiply(Transformation, Vert2), Matrix.Multiply(Transformation, Vert3));
}
public TriVec3D ToTriVec3D()
{
return new TriVec3D(Vert1.ToVec3D(), Vert2.ToVec3D(), Vert3.ToVec3D());
}
public TriVec2D ToTriVec2D()
{
return new TriVec2D(Vert1.ToVec2D(), Vert2.ToVec2D(), Vert3.ToVec2D());
}
}
}