コード例 #1
0
    public static List <Vector2> GetSquaresToCheck(Vector2 xy, Vector3 spin)
    {
        // List<Vector2> circle = Rotator.MidpointCenterAlgorithm(xy, spin);
        // Debug.LogFormat("checking {0}", xy);
        double         xt     = (double)spin[0] - (double)xy[0];
        double         yt     = (double)spin[1] - (double)xy[1];
        double         radius = Math.Sqrt(xt * xt + yt * yt);
        Vector2        center = new Vector2(spin[0], spin[1]);
        List <Vector2> circle = Rotator.MakeCircle(center, radius);
        // Debug.LogFormat("xy:{0}, center: {1}", xy, center);
        // Debug.Log("logging circle");
        // foreach(Vector2 p in circle) {
        // Debug.LogFormat("--{0}",p);
        // }

        Vector2 target = Rotator.RotateVector(xy, spin);
        bool    ccw    = (spin[2] == 1) ? true : false;

        // Debug.LogFormat("xy: {0}, target: {1}, ccw: {2}", xy, target, ccw);
        List <Vector2> a = Rotator.InclusiveSlice(circle, xy, target, ccw);

        // return circle;

        return(a);
    }