mirror of
https://github.com/Leonmmcoset/CMLeonOS.git
synced 2026-04-21 19:24:00 +00:00
OSGraphicDraw
This commit is contained in:
39
OSGraphicDraw/Vec3.cs
Normal file
39
OSGraphicDraw/Vec3.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
|
||||
namespace CMLeonOS.OSGraphicDraw
|
||||
{
|
||||
internal struct Vec3
|
||||
{
|
||||
internal double X;
|
||||
internal double Y;
|
||||
internal double Z;
|
||||
|
||||
internal Vec3(double x, double y, double z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
internal static Vec3 RotateX(Vec3 v, double radians)
|
||||
{
|
||||
double c = Math.Cos(radians);
|
||||
double s = Math.Sin(radians);
|
||||
return new Vec3(v.X, (v.Y * c) - (v.Z * s), (v.Y * s) + (v.Z * c));
|
||||
}
|
||||
|
||||
internal static Vec3 RotateY(Vec3 v, double radians)
|
||||
{
|
||||
double c = Math.Cos(radians);
|
||||
double s = Math.Sin(radians);
|
||||
return new Vec3((v.X * c) + (v.Z * s), v.Y, (-v.X * s) + (v.Z * c));
|
||||
}
|
||||
|
||||
internal static Vec3 RotateZ(Vec3 v, double radians)
|
||||
{
|
||||
double c = Math.Cos(radians);
|
||||
double s = Math.Sin(radians);
|
||||
return new Vec3((v.X * c) - (v.Y * s), (v.X * s) + (v.Y * c), v.Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user