Пример #1
0
 public static Direction2D?To2D(this Direction direction)
 {
     if (Math.Abs(direction.Z) > ZeroDotProductTolerance)
     {
         throw new Exception("Expected direction to be zero in the z coordinate.");
     }
     if (direction.HasDirection())
     {
         return(Direction2D.Create(direction.X, direction.Y));
     }
     return(null);
 }
 /// <summary>
 /// Construct the angle from the positive x-axis to the specified point.
 /// </summary>
 public static DecomposedAngle?FromPositiveX(Distance x, Distance y) =>
 Direction2D.Create(x, y)?.AngleFromPositiveX();
 /// <summary>
 /// Construct the counterclockwise angle from the positive x-axis to the specified point, or throw an
 /// <see cref="Exception"/> if the point is too close to the origin.
 /// </summary>
 public DecomposedAngle(double x, double y)
     : this(Direction2D.Create(x, y))
 {
 }