You first determine the left and right points of the funnel as the left and right points of the closest portal, then correct these points every time you find a point inside the funnel.
To determine the apex you also need to find a point that produces a turn. It either a left point of a portal that happens to be on the right side of the funnel or vice versa a right point of a portal that is on the left side of the funnel.
The steps below show how to determine the first apex from your example.
- Considering that we enumerated points this way, we first set A as the tightest point from the right side and B as the tightest point from the left side.
- We check the next portal. The left point of it (C) is on the left side of the funnel. So we ignore C.
- We check the third portal. The right point (D) is on the right side of the funnel. Skip D as well.
- We check the fourth portal. Its left point (E) is on the right side of the funnel. That means we have a turn to the right.
At this point, we restart the algorithm from the tightest right point of the funnel (A) and also add A to our smoothed path.
This answer provides a step-by-step demonstration that covers the general solution in more detail.