What Logic Program when Raising The Altitude

Gentlemen, First I’m so sorry because i’m really bad at explaining things, so I’ll use pictures as illustrations :slightly_smiling_face:

let say i have situation like this

(#H)home point is at an altitude of 1450meters
the target destination (#2) is at an altitude of 2200meters
so the plane must rise to an altitude of 900 meters

sometimes my experience is when between point 1 to point 2 with different altitudes, the plane sometimes goes up with two methods like this picture

alt

my question is
what causes the condition to be different?
what is the logic of the program?

I ask because sometimes when the ardupilot chooses to use method number two it can cause the plane to stall :sleepy: