Examples of Voronoi


Examples of com.nr.cg.Voronoi

    Ran myran=new Ran(17);
    for (i=0;i<N;i++) {
      pvec[i].x[0]=myran.doub();
      pvec[i].x[1]=myran.doub();
    }
    Voronoi vor=new Voronoi(pvec);

    int m,nsite,jfirst;
    Voronoi.Voredge edge; // = new Voronoi.Voredge();
    Point end1=new Point(2),end2=new Point(2);
    Triel tt;
View Full Code Here

Examples of net.royawesome.jlibnoise.module.source.Voronoi

*/
public class VoronoiNoise extends JLibNoiseGenerator<Voronoi> {

    @Override
    protected Voronoi createModule() {
        return new Voronoi();
    }
View Full Code Here

Examples of org.openquark.gems.client.internal.effects.Voronoi

     * @param g2d
     */
    private void paintCrazyPaving(DisplayedGem displayedGem, Graphics2D g2d) {
        // If this Gem is 'broken' draw the 'crazy paving'
        if (displayedGem.getGem().isBroken()) {
            Voronoi cachedCrazyPaving = crazyPavingCache.get(displayedGem);

            if (cachedCrazyPaving == null) {
                // Generate an appropriate crazy paving effect
                cachedCrazyPaving = Voronoi.makeRandomAreaVoronoi(displayedGem.getDisplayedBodyPart().getBounds(), DisplayConstants.CRACK_POINTS_PER_QTR);
                crazyPavingCache.put(displayedGem, cachedCrazyPaving);
            }  
           
            // Clip to triangle region
            Shape oldClip = g2d.getClip();
            g2d.setClip(displayedGem.getBodyShape());
           
            // Draw the crazy paving!
            g2d.setColor(getCrackColour(displayedGem));
            cachedCrazyPaving.show(g2d, true, false);

            // Restore clipping
            g2d.setClip(oldClip);
        }  
    }
View Full Code Here

Examples of toxi.geom.mesh2d.Voronoi

    public List<Triangle2D> tesselatePolygon(Polygon2D poly) {
        List<Triangle2D> triangles = new ArrayList<Triangle2D>();
        Rect bounds = poly.getBounds();
        // a Voronoi diagram relies on a Delaunay triangulation behind the
        // scenes
        Voronoi voronoi = new Voronoi(rootSize);
        // add perimeter points
        for (Vec2D v : poly.vertices) {
            voronoi.addPoint(v);
        }
        // add random inliers
        for (Vec2D v : createInsidePoints(poly, bounds)) {
            voronoi.addPoint(v);
        }
        // get filtered delaunay triangles:
        // ignore any triangles which share a vertex with the initial root
        // triangle or whose centroid is outside the polygon
        for (Triangle2D t : voronoi.getTriangles()) {
            if (MathUtils.abs(t.a.x) != Voronoi.DEFAULT_SIZE
                    && MathUtils.abs(t.a.y) != Voronoi.DEFAULT_SIZE) {
                if (poly.containsPoint(t.computeCentroid())) {
                    triangles.add(t);
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.