将一个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