SortBodiesBottomTop

arcade.SortBodiesBottomTop (Class)

Provides a stable merge sort implementation for sorting Body arrays from bottom to top (by y coordinate). This implementation maintains the order of equal elements and is optimized specifically for arcade.Body instances.

Static Members

arcade
sort(a: Array<Body>): Void

Sorts the array of bodies from left to right based on their x position. This operation modifies the array in place and preserves the order of bodies with equal x positions.

Name Type Description
a Array<Body> The array of bodies to sort.

Private Members

arcade
cmp(a: Body, b: Body): Int
Name Type
a Body
b Body
Returns
Int

arcade
rec(a: Array<Body>, from: Int, to: Int): Void
Name Type
a Array<Body>
from Int
to Int

arcade
doMerge(a: Array<Body>, from: Int, pivot: Int, to: Int, len1: Int, len2: Int): Void
Name Type
a Array<Body>
from Int
pivot Int
to Int
len1 Int
len2 Int

arcade
rotate(a: Array<Body>, from: Int, mid: Int, to: Int): Void
Name Type
a Array<Body>
from Int
mid Int
to Int

arcade
gcd(m: Int, n: Int): Int
Name Type
m Int
n Int
Returns
Int

arcade
upper(a: Array<Body>, from: Int, to: Int, val: Int): Int
Name Type
a Array<Body>
from Int
to Int
val Int
Returns
Int

arcade
lower(a: Array<Body>, from: Int, to: Int, val: Int): Int
Name Type
a Array<Body>
from Int
to Int
val Int
Returns
Int

arcade
swap(a: Array<Body>, i: Int, j: Int): Void
Name Type
a Array<Body>
i Int
j Int

arcade
compare(a: Array<Body>, i: Int, j: Int): Int
Name Type
a Array<Body>
i Int
j Int
Returns
Int