コード例 #1
0
    /** Returns > 0 if the points are a counterclockwise turn, < 0 if clockwise, and 0 if colinear. */
    private float ccw(float p3x, float p3y)
    {
        FloatArray hull = this.hull;
        int        size = hull.size;
        float      p1x  = hull.get(size - 4);
        float      p1y  = hull.get(size - 3);
        float      p2x  = hull.get(size - 2);
        float      p2y  = hull.peek();

        return((p2x - p1x) * (p3y - p1y) - (p2y - p1y) * (p3x - p1x));
    }
コード例 #2
0
ファイル: FloatArray.cs プロジェクト: Arcant1/Genetic
    /** Removes from this array all of elements contained in the specified array.
     * @return true if this array was modified. */
    public bool removeAll(FloatArray array)
    {
        int size      = this.size;
        int startSize = size;

        float[] items = this.items;
        for (int i = 0, n = array.size; i < n; i++)
        {
            float item = array.get(i);
            for (int ii = 0; ii < size; ii++)
            {
                if (item == items[ii])
                {
                    removeIndex(ii);
                    size--;
                    break;
                }
            }
        }
        return(size != startSize);
    }