Switch-Toolbox/File_Format_Library/GUI/Byaml/TurboCourseMuunt/Matrix2DHelper.cs
2019-11-23 16:06:33 -05:00

24 lines
848 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenTK;
namespace FirstPlugin.Turbo.CourseMuuntStructs
{
public class Matrix2DHelper
{
public static Vector3 RotatePoint(Vector3 translate, float X, float Y, float Z, Vector3 rotate)
{
Matrix4 rotationX = Matrix4.CreateRotationX(rotate.X);
Matrix4 rotationY = Matrix4.CreateRotationY(rotate.Z);
Matrix4 rotationZ = Matrix4.CreateRotationZ(-rotate.Y);
Matrix4 transMat = Matrix4.CreateTranslation(new Vector3(translate.X, translate.Z, -translate.Y));
Matrix4 comb = (rotationX * rotationY * rotationZ) * transMat;
Vector3 pos = new Vector3(X, Y, Z);
return Vector3.TransformPosition(pos, comb);
}
}
}