Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using DJMatrix;
- namespace Model1
- {
- public class Transformation
- {
- public static Matrix Translate(Vector v)
- {
- float[] temp = v.GetVector();
- float[,] tempF = {
- {1, 0, 0, temp[0]},
- {0, 1, 0, temp[1]},
- {0, 0, 1, temp[2]},
- {0, 0, 0, 1}
- };
- Matrix m = new Matrix(tempF);
- return m;
- }
- public static Matrix RotateX(double theta)
- {
- float[,] tempF = {
- {1, 0, 0, 0},
- {0, (float)Math.Cos(theta), -(float)(Math.Sin(theta)), 0},
- {0, (float)Math.Sin(theta), (float)Math.Cos(theta), 0},
- {0, 0, 0, 1}
- };
- Matrix m = new Matrix(tempF);
- return m;
- }
- public static Matrix RotateY(double theta)
- {
- float[,] tempF = {
- {(float)Math.Cos(theta), 0, (float)Math.Sin(theta), 0},
- {0, 1, 0, 0},
- {-(float)Math.Sin(theta), 0, (float)Math.Cos(theta), 0},
- {0, 0, 0, 1}
- };
- Matrix m = new Matrix(tempF);
- return m;
- }
- public static Matrix RotateZ(double theta)
- {
- float[,] tempF = {
- {(float)Math.Cos(theta), -(float)Math.Sin(theta), 0, 0},
- {(float)(Math.Sin(theta)), (float)Math.Cos(theta), 0, 0},
- {0, 0, 1, 0},
- {0, 0, 0, 1}
- };
- Matrix m = new Matrix(tempF);
- return m;
- }
- }
- }
Add Comment
Please, Sign In to add comment