因为暂时用的是二维坐标系转换,用简单示例仅试探了MathNet 中 CoordinateSystem类的使用。
1.RotateCoordSysAroundVector 以一个向量为轴旋转
CoordinateSystem orginCS = new CoordinateSystem();//初始一个笛卡尔坐标系
Console.WriteLine("orginCS" + orginCS);
Angle angle = Angle.FromRadians(Math.PI / 2);
CoordinateSystem rotationCS = orginCS.RotateCoordSysAroundVector(UnitVector3D.ZAxis, angle);
Console.WriteLine("orginCS.RotateCoordSysAroundVector: " + rotationCS);
//结果
orginCSCoordinateSystem 4x4-Double
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
orginCS.RotateCoordSysAroundVector: CoordinateSystem 4x4-Double
6.12303E-17 -1 0 0
1 6.12303E-17 0 0
0 0 1 0
0 0 0 1
2. OffsetBy原点偏移量
CoordinateSystem cs3 = rotationCS.OffsetBy(new Vector3D(5, 5, 0));
Console.WriteLine("cs3.OffsetBy: " + cs3);
//偏移后结果,其齐坐标矩阵为:
c