Solved Ellipse and points rotation

Discussion in 'Spigot Plugin Development' started by cocoraid, Aug 3, 2018.

  1. Hey as you can see I have made an ellipse:
    [​IMG]

    And I have placed 26 points with an ellipse of 208 points
    208 / 26 = 8 ,incrementation of 8
    I would like to position items of white circle to the center like the red circles whithout ellipse rotation (only points), and I do not know how to do that after multiple tries.

    Here is my code to create the ellipse:

    Code (Java):
     private static LinkedList<Vector> vecs =  new LinkedList<>();
        static {
            double a = 6;
            double b = 9;
            double amount = 208;
            double inc = (2 * Math.PI) / amount;
            for (int i = 0 ; i < amount ; i++) {
                double x = a * Math.cos(i * inc);
                double z = b * Math.sin(i * inc);
                Vector v = new Vector(x, 0, z);

                vecs.add(v);
            }

        }
    and my code to spawn armorstand:

    Code (Text):
         

    vecs.forEach(v -> {
        Vector vec = v.clone();
        Location l = location.clone().add(vec);
        locs.add(l);
    });


           int index = 0;
            for (ItemStack item : torotate) {

                Location loc = locs.get(index);
                loc.setYaw(location.getYaw());
                double height = 0.7;
                ReflectedArmorStand as = new ReflectedArmorStand(loc.clone().subtract(0, height, 0));
                as.setVisible(false);
                as.setDisplayName(item.getItemMeta().getDisplayName());
                as.setEquipment(5, item);

                as.setSmall(true);
                as.spawnArmorStand();
                loc.getWorld().playSound(loc, Sound.BLOCK_NOTE_PLING, 1f, (float) index * 0.1F);
                UtilParticle.sendParticle(loc, Particle.CLOUD, 3, new Vector(0.1, 0.1, 0.1), 0.05F);
                index+= locs.size() / (torotate.size() - 1);
                items.put(as, index);
            }
    Thank you !