Beispiel #1
0
 /// <summary>
 /// 球面坐标转直角坐标
 /// </summary>
 /// <param name="coord"></param>
 /// <returns></returns>
 public static RectangularCoordinatePoint ToRectangularCoordinatePoint(SphericalCoordinatePoint coord)
 {
     var x = GetXFromSphericalCoord(coord);
     var y = GetYFromSphericalCoord(coord);
     var z = GetZFromSphericalCoord(coord);
     return new RectangularCoordinatePoint(x, y, z);
 }
Beispiel #2
0
 private static double GetZFromSphericalCoord(SphericalCoordinatePoint coord)
 {
     return coord.Radius * Math.Cos(coord.Theta);
 }
Beispiel #3
0
 private static double GetYFromSphericalCoord(SphericalCoordinatePoint coord)
 {
     return coord.Radius * Math.Sin(coord.Theta) * Math.Sin(coord.Phi);
 }
 /// <summary>
 /// 复制坐标值到目标点
 /// </summary>
 /// <param name="target"></param>
 public void CopyTo(SphericalCoordinatePoint target)
 {
     target.Radius = this.Radius;
     target.Theta = this.Theta;
     target.Phi = this.Phi;
 }
 /// <summary>
 /// 从源点复制坐标值
 /// </summary>
 /// <param name="source"></param>
 public void CopyFrom(SphericalCoordinatePoint source)
 {
     this.Radius = source.Radius;
     this.Theta = source.Theta;
     this.Phi = source.Phi;
 }