Transversality Condition for a Variable Endpoint Constrained to a Curve