From 8994049f1bf23f5a33a3a300cb41178a83ed77b7 Mon Sep 17 00:00:00 2001 From: Yucheng Zhang Date: Sun, 4 Feb 2018 16:36:42 +0800 Subject: [PATCH] fix the custom merge sort It may requires sorting when "InHalf1[-1]->Y == InHalf1[0]->Y". --- MPE_fastpoly2tri.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MPE_fastpoly2tri.h b/MPE_fastpoly2tri.h index c310b96..047d1bb 100644 --- a/MPE_fastpoly2tri.h +++ b/MPE_fastpoly2tri.h @@ -1879,7 +1879,7 @@ void MPE_PolySort(MPEPolyPoint** Points, MPEPolyPoint** Temp, u32 Count) MPEPolyPoint** ReadHalf1 = InHalf1; //NOTE: Don't merge if two halves are already sorted - if (InHalf1[-1]->Y > InHalf1[0]->Y) + if (InHalf1[-1]->Y >= InHalf1[0]->Y) { MPEPolyPoint** Out = Temp; for (u32 WriteIndex = 0; WriteIndex < Count; ++WriteIndex)