public VoronoiDiagram(int generatorCapacity) { m_generatorBuffer = new Generator[generatorCapacity]; for (int i = 0; i < generatorCapacity; i++) { m_generatorBuffer[i] = new Generator(); } m_generatorCount = 0; m_countX = 0; m_countY = 0; m_diagram = null; }
/** * Query the world for all particles that potentially overlap the provided AABB. * * @param particleCallback callback for particles. * @param aabb the query box. */ public void queryAABB(ParticleQueryCallback particleCallback, AABB aabb) { m_particleSystem.queryAABB(particleCallback, aabb); }
/** * Get the world particle group list. With the returned group, use ParticleGroup::GetNext to get * the next group in the world list. A NULL group indicates the end of the list. * * @return the head of the world particle group list. */ public ParticleGroup[] getParticleGroupList() { return m_particleSystem.getParticleGroupList(); }
public void destroyParticlesInGroup(ParticleGroup group, boolean callDestructionListener) { for (int i = group.m_firstIndex; i < group.m_lastIndex; i++) { destroyParticle(i, callDestructionListener); } }
/** * Get the number of particles. * * @return */ public int getParticleCount() { return m_particleSystem.getParticleCount(); }
/** * Get the maximum number of particles. * * @return */ public int getParticleMaxCount() { return m_particleSystem.getParticleMaxCount(); }
/** * Get the particle gravity scale. * * @return */ public float getParticleGravityScale() { return m_particleSystem.getParticleGravityScale(); }
/** * Get the particle radius. * * @return */ public float getParticleRadius() { return m_particleSystem.getParticleRadius(); }
/** * Ray-cast the world for all particles in the path of the ray. Your callback controls whether you * get the closest point, any point, or n-points. * * @param particleCallback the particle callback class. * @param point1 the ray starting point * @param point2 the ray ending point */ public void raycast(ParticleRaycastCallback particleCallback, Vec2 point1, Vec2 point2) { m_particleSystem.raycast(particleCallback, point1, point2); }
/** * Set the maximum number of particles. * * @param count */ public void setParticleMaxCount(int count) { m_particleSystem.setParticleMaxCount(count); }
/** * Change the particle density. * * @param density */ public void setParticleDensity(float density) { m_particleSystem.setParticleDensity(density); }
/** * Damping is used to reduce the velocity of particles. The damping parameter can be larger than * 1.0f but the damping effect becomes sensitive to the time step when the damping parameter is * large. * * @param damping */ public void setParticleDamping(float damping) { m_particleSystem.setParticleDamping(damping); }
/** * Get the particle data. @return the pointer to the head of the particle data. * * @return */ public int[] getParticleFlagsBuffer() { return m_particleSystem.getParticleFlagsBuffer(); }
/** * Compute the kinetic energy that can be lost by damping force * * @return */ public float computeParticleCollisionEnergy() { return m_particleSystem.computeParticleCollisionEnergy(); } }
/** * Get the particle density. * * @return */ public float getParticleDensity() { return m_particleSystem.getParticleDensity(); }
/** * Get damping for particles * * @return */ public float getParticleDamping() { return m_particleSystem.getParticleDamping(); }
/** * Change the particle radius. You should set this only once, on world start. If you change the * radius during execution, existing particles may explode, shrink, or behave unexpectedly. * * @param radius */ public void setParticleRadius(float radius) { m_particleSystem.setParticleRadius(radius); }
/** * Set a buffer for particle data. * * @param buffer is a pointer to a block of memory. * @param size is the number of values in the block. */ public void setParticleFlagsBuffer(int[] buffer, int capacity) { m_particleSystem.setParticleFlagsBuffer(buffer, capacity); }
protected VoronoiDiagram.Generator[] getInitializedArray(int length) { final VoronoiDiagram.Generator[] ray = new VoronoiDiagram.Generator[length]; for (int i = 0; i < ray.length; i++) { ray[i] = new VoronoiDiagram.Generator(); } return ray; } }
/** * Destroy a particle. The particle is removed after the next step. * * @param Index of the particle to destroy. * @param Whether to call the destruction listener just before the particle is destroyed. */ public void destroyParticle(int index, boolean callDestructionListener) { m_particleSystem.destroyParticle(index, callDestructionListener); }