Ant and honey on the prism and cylinder – part 2

After an interesting concept of a mathematical game in which it is necessary to determine: “What is the shortest path between an ant and a drop of honey?”, the author encounters more mathematical secrets…

It turns out that on a square and a triangular prism there are sometimes two paths that are shorter than the “obvious” path. But only one is minimal.

How to choose the right path?