Solution:
Let P(A,B,C) be the problem assertion. First consider a non-right triangle ABC with orthocenter H. Note that in the set {A,B,C,H}, the last point is the orthocenter of the other three. Thus, we can assume WLOG f(A)≤f(B)≤f(C)≤f(H).
By considering P(A,B,C), this implies f(A)+f(C)=f(B)+f(H). Since f(A)≤f(B) and f(C)≤f(H), this implies equality must hold in both inequalities, and so f(A)=f(B) and f(C)=f(H).
Denote by ΩBC the circle with diameter BC. We prove the following claim.
Claim: If f(B)=f(C), then for all D∈ΩBC, we have 2f(D)=f(B)+f(C). In particular, f is constant on ΩBC.
Proof: We split into cases. If f(D)∈/[f(B),f(C)], then P(B,C,D) implies
f(D)+f(C)=f(B)+f(D)
which implies f(B)=f(C), contradiction. Thus, f(D)∈[f(B),f(C)], from which P(B,C,D) implies
f(B)+f(C)=2f(D)
The claim then follows.
Now we claim that f(B)=f(C). Assume for the sake of contradiction that this was not the case. Consider ΩAC, and let D=AH∩BC∈ΩAC. Let ΩBD′ intersect ΩAC at a second point D′′=D′. Then since f(A)=f(C), from the claim we get 2f(D′)=f(A)+f(C).
Now we have two cases. In the first case, suppose f(B)=f(D′). Then 2f(B)=f(A)+f(C), implying f(B)=f(C), contradiction. In the second case, we have f(B)+f(D′)=2f(D′′)=f(C)+f(A). This implies f(C)=f(D′), and so
2f(C)=2f(D′)=f(C)+f(A)
implying f(C)=f(A)=f(B), another contradiction. Thus our assumption was wrong, and f(B)=f(C). This implies f(A)=f(B)=f(C)=f(H) for any nondegenerate non-right triangle ABC, and so f is constant everywhere (by considering two segments whose diameter circles do not intersect). It is clear that these solutions work.