Need help create circle not filled !

Discussion in 'Plugin Development' started by RdN2507, Apr 9, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    RdN2507

    Hello guys , I have a function that return a filled circle , can you say me how I can transform this code to return a not filled circle ? With the same form !

    Show Spoiler

    public ArrayList<Location> createCircleFilled(Location loc, int r) {
    ArrayList<Location> loc2 = new ArrayList<Location>();
    int cx = loc.getBlockX();
    int cy = loc.getBlockY() - 1;
    int cz = loc.getBlockZ();
    World w = loc.getWorld();
    int rSquared = r * r;
    for (int x = cx - r; x <= cx + r; x++) {
    for (int z = cz - r; z <= cz + r; z++) {
    if ((cx - x) * (cx - x) + (cz - z) * (cz - z) <= rSquared) {
    Location cylBlock = new Location(w, x, cy, z);
    loc2.add(cylBlock);
    }
    }
    }

    return loc2;
    }
     
  2. Offline

    Loogeh

    RdN2507 This is just a guess but what happens if you change <=rSquared to ==rSquared. I have a feeling it will leave some blocks out but it's worth a try.
    If you really can't find it anywhere on here, go look at the WorldEdit source
     
  3. Offline

    RdN2507

    I will try and say if it works ! I've already searched in WorldEdit but no answer :(

    It works just how I want thanks very much guys !

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  4. Offline

    Loogeh

    RdN2507 Not sure what you mean by 'guys' but no worries :)
     
Thread Status:
Not open for further replies.

Share This Page