MathNet Ray3D坐标系下转换

本文探讨了在MathNet库中如何进行Ray3D对象的坐标转换,尤其是在不同笛卡尔坐标系之间的转换。作者遇到了CoordinateSystem.Transform方法未达到预期效果的问题,因此选择了手动使用坐标系映射对象分别转换Ray3D的ThroughPoint和Direction。
摘要由CSDN通过智能技术生成

将一个Ray3D对象在两个笛卡尔坐标下进行转换初探。尝试了用CoordinateSystem.Transform(Ray3D ray) 的方法,但没有得到期待结果,这块应该还有问题。所以依然采用了两个坐标系的mapping 对象将Ray中的 ThroughPoint 和Direction对象分别进行了转换。

            CoordinateSystem originCS = new CoordinateSystem();//初始一个笛卡尔坐标系
            Console.WriteLine("originCS" + originCS);
            Angle angle = Angle.FromRadians(Math.PI/2);
            CoordinateSystem rotationCS = originCS.RotateCoordSysAroundVector(UnitVector3D.ZAxis, angle);
            Console.WriteLine("orginCS.RotateCoordSysAroundVector: " + rotationCS);
            CoordinateSystem cs3 = rotationCS.OffsetBy(new Vector3D(5, 5, 0)); //转换后的坐标系

//实际是两个坐标系下转换Matrix
            CoordinateSystem mappingCS3ToOrigin = CoordinateSystem.CreateMappingCoordinateSystem(cs3, originCS);
            CoordinateSystem mappingOriginToCS3 = CoordinateSystem.CreateMappingCoordinateSystem(originCS, cs3);

//点在两坐标系下的转换
            Point3D por = new Poin
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值