MathNet 中CoordinateSystem坐标系初探

本文介绍了如何使用MathNet库进行坐标系的转换,包括以向量为轴的旋转(RotateCoordSysAroundVector),原点偏移(OffsetBy),基变换(BaseChangeMatrix和GetRotationSubMatrix)以及创建两个坐标系间的映射矩阵(CreateMappingCoordinateSystem)。还探讨了坐标系下点坐标的转换过程。
摘要由CSDN通过智能技术生成

因为暂时用的是二维坐标系转换,用简单示例仅试探了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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值