Midpoint representation of fuzzy-valued functions and applications