Exemple #1
0
 /// <summary>
 /// Возвращает точку пересечения луча и круга параллельного плоскости z = 0
 /// </summary>
 /// <param name="center">Вершина</param>
 /// <param name="radius">Радиус</param>
 /// <param name="ray">Луч</param>
 /// <returns></returns>
 public static Point3D? IntersectCircle(Point3D center, double radius, Ray ray)
 {
     var p1 = new Point3D(center.X - radius, center.Y, center.Z);
     var p2 = new Point3D(center.X, center.Y - radius, center.Z);
     var plane = new ePlane(center, p1, p2);
     
     Point3D? point1 = IntersectPlane(plane, ray);
     
     if ((point1 != null) &&
         (center.Hypot(point1.Value) <= radius))
     {
         return point1;
     }
     else
     {
         return null;
     }
 }