Optimal curvature-constrained paths for general directional-cost functions