private Map particles=new HashMap(); private Vector anchor=new Vector(0,0,0); private double ratio=0.2; private BufferedImage image; private int clearence=300; /** * Create a new object * @param image of the particles structure you want * @param scanQuality is the quality of the scanned image in particles (1 for default 2 for half etc) */ public Image(BufferedImage image,int scanQuality) { this.image=image; renderParticles(Math.abs(scanQuality)); } /** * Set the anchor point for the particles structure * by default the anchor will be the bottom right * @param x (the x axis of the image or width) * @param y (the y axis of the image or height */ public void setAnchor(int x,int y) { anchor=new Vector(x, y, 0); } /** * Sets the ratio between blocks & pixels i.e block/pixel (0.1 means 10 pixels in 1 block space) * @param ratio */ public void setDisplayRatio(double ratio) { this.ratio=ratio; } /** * Get a map of locations & colors on which particles are to be displayed * @param location of the anchor point * @param pitch (if you want picture to be rotated) * @param yaw (if you want picture to be rotated) * @return map of the locations & color */ public Map getParticles(Location location,double pitch,double yaw) { Map map=new HashMap(); for(Vector vector:particles.keySet()) { Vector difference=vector.clone().subtract(anchor).multiply(ratio); Vector v=rotateAroundAxisX(difference,pitch); v=rotateAroundAxisY(v, yaw); Location spot=location.clone().add(difference); map.put(spot, particles.get(vector)); } return map; } /** * Get a map of locations & colors on which particles are to be displayed * @param location * @return */ public Map getParticles(Location location) { return getParticles(location, location.getPitch(), location.getYaw()); } private void renderParticles(int sensitivity) { int height=image.getHeight(); int width=image.getWidth(); for(int x=0;x