/// <summary>
 /// Returns the parameter value of point.
 /// </summary>
 /// <param name="pt">The Point 2d whose get the PolylineSegment parameter at.</param>
 /// <returns>A double between 0.0 and 1.0, or -1.0 if the point does not lie on the segment.</returns>
 public double GetParameterOf(Point2d pt)
 {
     if (IsLinear)
     {
         LineSegment2d line = ToLineSegment();
         return(line.IsOn(pt) ? _startPoint.GetDistanceTo(pt) / line.Length : -1.0);
     }
     else
     {
         CircularArc2d arc = ToCircularArc();
         return(arc.IsOn(pt) ?
                arc.GetLength(arc.GetParameterOf(_startPoint), arc.GetParameterOf(pt)) /
                arc.GetLength(arc.GetParameterOf(_startPoint), arc.GetParameterOf(_endPoint)) :
                -1.0);
     }
 }