public static Line ProjectionLine(Puck p, Line reference) { PointD ij = reference.IntersectionWith(reference.Perpendicular(p.Location)); double dist = p.Location.DistanceTo(ij); double scale = p.Radius / dist; PointD projection_line_point = ij.Offset((p.Location.X - ij.X) * scale, (p.Location.Y - ij.Y) * scale); return(reference.Parallel(projection_line_point)); }
public static Line ProjectionLine(Puck p, Line reference) { PointD ij = reference.IntersectionWith(reference.Perpendicular(p.Location)); double dist = p.Location.DistanceTo(ij); double scale = p.Radius / dist; PointD projection_line_point = ij.Offset((p.Location.X - ij.X) * scale, (p.Location.Y - ij.Y) * scale); return reference.Parallel(projection_line_point); }