pub fn new(verts: &[Vec2]) -> Poly {
        let len = verts.len();
        let mut index = 0;

        let mut topmost_y = Fp::MIN;
        for (i, v) in verts.iter().enumerate() {
            if v.y > topmost_y {
                index = i;
                topmost_y = v.y;
            }
        }

        let mut order = vec![];
        order.extend(0..len);
        order[0] = index;
        order[index] = 0;

        // giftwrap
        let mut a = Vec2::new(1.0, 0.0);
        for v in 0..(len - 1) {
            let vert = verts[order[v]];
            let mut best = Fp::MIN;
            for i in (v + 1)..len {
                let dot = a.dot((verts[order[i]] - vert).normalize());
                if dot > best {
                    index = i;
                    best = dot;
                }
            }
            a = verts[order[index]] - vert;
            order.swap(v + 1, index);
        }

        let mut ordered_and_duped = Vec::with_capacity(len + 1);
        for i in 0..len {
            ordered_and_duped.push(verts[order[i]]);
        }
        ordered_and_duped.push(verts[order[0]]);
        Poly::new_from_wound(ordered_and_duped)
    }
/// `verts` must form a convex polygon. `verts` must not contain duplicate or interior vertices.
`verts` must form a convex polygon. `verts` must not contain duplicate or interior vertices.
` verts ` must form a convex polygon . ` verts ` must not contain duplicate or interior vertices .
pub fn new(verts: &[Vec2]) -> Poly {
        let len = verts.len();
        let mut index = 0;
        let mut topmost_y = Fp::MIN;
        for (i, v) in verts.iter().enumerate() {
            if v.y > topmost_y {
                index = i;
                topmost_y = v.y;
            }
        }
        let mut order = vec![];
        order.extend(0..len);
        order[0] = index;
        order[index] = 0;
        // giftwrap
        let mut a = Vec2::new(1.0, 0.0);
        for v in 0..(len - 1) {
            let vert = verts[order[v]];
            let mut best = Fp::MIN;
            for i in (v + 1)..len {
                let dot = a.dot((verts[order[i]] - vert).normalize());
                if dot > best {
                    index = i;
                    best = dot;
                }
            }
            a = verts[order[index]] - vert;
            order.swap(v + 1, index);
        }
        let mut ordered_and_duped = Vec::with_capacity(len + 1);
        for i in 0..len {
            ordered_and_duped.push(verts[order[i]]);
        }
        ordered_and_duped.push(verts[order[0]]);
        Poly::new_from_wound(ordered_and_duped)
    }
pub fn new ( verts : & [ Vec2 ] ) -> Poly { let len = verts . len ( ) ; let mut index = 0 ; let mut topmost_y = Fp :: MIN ; for ( i , v ) in verts . iter ( ) . enumerate ( ) { if v . y > topmost_y { index = i ; topmost_y = v . y ; } } let mut order = vec ! [ ] ; order . extend ( 0 .. len ) ; order [ 0 ] = index ; order [ index ] = 0 ; // giftwrap let mut a = Vec2 :: new ( 1.0 , 0.0 ) ; for v in 0 .. ( len - 1 ) { let vert = verts [ order [ v ] ] ; let mut best = Fp :: MIN ; for i in ( v + 1 ) .. len { let dot = a . dot ( ( verts [ order [ i ] ] - vert ) . normalize ( ) ) ; if dot > best { index = i ; best = dot ; } } a = verts [ order [ index ] ] - vert ; order . swap ( v + 1 , index ) ; } let mut ordered_and_duped = Vec :: with_capacity ( len + 1 ) ; for i in 0 .. len { ordered_and_duped . push ( verts [ order [ i ] ] ) ; } ordered_and_duped . push ( verts [ order [ 0 ] ] ) ; Poly :: new_from_wound ( ordered_and_duped ) }
`verts` must form a convex polygon.
` verts ` must form a convex polygon .
verts
&[Vec2]
verts
&[Vec2]