首页
中国名著
中国文学
外国名著
影视作品
水浒传
道德经
易经
礼记
老子他说
学习字词典
我的日志
字号++
字号--
这里可以复制文本,然后在下面粘贴。
using System; using System.Numerics; public class RotationMatrix { public static Vector3 RotateAroundAxis(Vector3 point, Vector3 axis, float angleDegrees) { // 将角度转换为弧度 float angleRadians = MathF.PI / 180 * angleDegrees; // 计算旋转矩阵 axis = Vector3.Normalize(axis); float cos = MathF.Cos(angleRadians); float sin = MathF.Sin(angleRadians); float oneMinusCos = 1 - cos; float xx = axis.X * axis.X * oneMinusCos + cos; float xy = axis.X * axis.Y * oneMinusCos - axis.Z * sin; float xz = axis.X * axis.Z * oneMinusCos + axis.Y * sin; float yx = axis.Y * axis.X * oneMinusCos + axis.Z * sin; float yy = axis.Y * axis.Y * oneMinusCos + cos; float yz = axis.Y * axis.Z * oneMinusCos - axis.X * sin; float zx = axis.Z * axis.X * oneMinusCos - axis.Y * sin; float zy = axis.Z * axis.Y * oneMinusCos + axis.X * sin; float zz = axis.Z * axis.Z * oneMinusCos + cos; // 创建旋转矩阵 Matrix4x4 rotationMatrix = new Matrix4x4( xx, xy, xz, 0, yx, yy, yz, 0, zx, zy, zz, 0, 0, 0, 0, 1 ); // 使用矩阵旋转点 return Vector3.Transform(point, rotationMatrix); } } public class Program { public static void Main() { // 定义要旋转的点 Vector3 point = new Vector3(1, 0, 0); // 定义旋转轴(如绕Z轴旋转) Vector3 axis = new Vector3(0, 0, 1); // 定义旋转角度(例如90度) float angle = 90f; // 进行旋转 Vector3 rotatedPoint = RotationMatrix.RotateAroundAxis(point, axis, angle); // 输出旋转后的坐标 Console.WriteLine($"旋转后的坐标: ({rotatedPoint.X}, {rotatedPoint.Y}, {rotatedPoint.Z})"); } } using System; using System.Numerics; public class Rotation { // 绕任意轴旋转的函数 public static Vector3 RotateAroundAxis(Vector3 point, Vector3 axis, float angleDegrees) { // 将角度转换为弧度 float angleRadians = MathF.PI / 180 * angleDegrees; // 将轴向量标准化 axis = Vector3.Normalize(axis); // 创建旋转四元数 Quaternion rotation = Quaternion.CreateFromAxisAngle(axis, angleRadians); // 旋转点 Vector3 rotatedPoint = Vector3.Transform(point, rotation); return rotatedPoint; } } public class Program { public static void Main() { // 定义要旋转的点 Vector3 point = new Vector3(1, 0, 0); // 定义旋转轴(如绕Y轴旋转) Vector3 axis = new Vector3(0, 1, 0); // 定义旋转角度(例如45度) float angle = 45f; // 进行旋转 Vector3 rotatedPoint = Rotation.RotateAroundAxis(point, axis, angle); // 输出旋转后的坐标 Console.WriteLine($"旋转后的坐标: ({rotatedPoint.X}, {rotatedPoint.Y}, {rotatedPoint.Z})"); } }
文本定期保存哦
居中
百度意思
百度图片
缓存数据
最近查询记录
2025-01-28读书
我的笔记-2024-12-23_读书
我的笔记-2024-12-22_读书
我的笔记-2024-12-18_读书
2024-11-02读书
我的笔记-2024-10-25_读书
2024-10-24读书
我的笔记-2024-10-24_读书
我的笔记-2024-10-23_读书
我的笔记-2024-10-19_读书
我的笔记-2024-10-18_读书
我的笔记-2024-10-17_读书
我的笔记-2024-10-16_读书
2024-10-16_读书读书
2024-10-15_读书读书
我的笔记-2024-10-15_读书
我的笔记-2024-10-13_读书
我的笔记-2024-10-12_读书
我的笔记-2024-10-11_读书
我的笔记-2024-10-10_读书
我的笔记-2024-10-08_读书
我的笔记-2024-10-07_读书
2024-10-07读书
我的笔记-2024-10-06_读书
2024-10-06读书
2024-10-05读书
我的笔记-2024-10-05_读书
我的笔记-2024-10-01_读书
2024-10-01读书
2024-09-28读书
我的笔记-2024-09-29_读书
2024-09-27读书
我的笔记-2024-09-27_读书
2024-09-26读书
我的笔记-2024-09-22_读书
2024-09-22读书
我的笔记-2024-09-16_读书
2024-09-16读书
我的笔记-2024-09-10_读书
2024-09-10读书
我的笔记-2024-09-08_读书
我的笔记-2024-09-07_读书
我的笔记-2024-09-03_读书
我的笔记-2024-08-22_读书
我的笔记-2024-08-18_读书
我的笔记-2024-08-12_读书
我的笔记-2024-08-11_读书
我的笔记-2024-08-10_读书
2024-08-10读书
我的笔记-2024-08-08_读书
2024-08-08读书
我的笔记-2024-07-30_读书
2024-07-30读书
我的笔记-2024-07-29_读书
我的笔记-2024-07-14_读书
我的笔记-2024-07-12_读书
我的笔记-2024-07-11_读书
我的笔记-2024-07-08_读书
2024-07-08读书
我的笔记-2024-07-06_读书
我的笔记-2024-06-30_读书
我的笔记-2024-06-26_读书
我的笔记-2024-06-25_读书
2024-06-25读书
我的笔记-2024-06-24_读书
我的笔记-2024-06-23_读书
我的笔记-2024-06-22_读书
我的笔记-2024-06-21_读书
2024-06-21读书
我的笔记-2024-06-20_读书
我的笔记-2024-06-19_读书
我的笔记-2024-06-16_读书
我的笔记-2024-06-14_读书
我的笔记-2024-06-13_读书
我的笔记-2024-06-12_读书
我的笔记-2024-06-11_读书
我的笔记-2024-06-08_读书
我的笔记-2024-06-05_读书
我的笔记-2024-06-03_读书
2024-06-03读书
我的笔记-2024-06-02_读书
我的笔记-2024-06-01_读书
我的笔记-2024-05-31_读书
2024-05-31读书
我的笔记-2024-05-28_读书
我的笔记-2024-05-26_读书
2024-05-26读书
我的笔记-2024-05-24_读书
我的笔记-2024-05-14_读书
我的笔记-2024-05-13_读书
2024-05-13读书
我的笔记-2024-05-10_读书
我的笔记-2024-05-07_读书
我的笔记-2024-05-04_读书
我的笔记-2024-05-03_读书
我的笔记-2024-05-02_读书
我的笔记-2024-05-01_读书
我的笔记-2024-04-21_读书
2024-04-21读书
我的笔记-2024-04-15_读书
反义词
近义词
词组
谜语
造句