Hemesh : voronoi example

voronoi example

//requires hemesh 1.2.3
import wblut.hemesh.*;
import wblut.hemesh.modifiers.*;
import wblut.hemesh.creators.*;
import wblut.geom.*;

float[][] points;
int numpoints;
HE_Mesh container;
HE_Mesh[] cells;
int numcells;
WB_Plane P1,P2;

void setup() {
  //create a sphere
  HEC_Geodesic geo=new HEC_Geodesic(this);
  container=new HE_Mesh(geo);
  //slice off most of both hemispheres
  P1=new WB_Plane(new WB_Point(0,0,-10), new WB_Vector(0,0,1));
  P2=new WB_Plane(new WB_Point(0,0,10), new WB_Vector(0,0,-1));
  HEM_Slice s=new HEM_Slice().setPlane(P1);
  s=new HEM_Slice().setPlane(P2);
  //generate points
  points=new float[numpoints][3];
  for(int i=0;i<numpoints;i++) {
  //generate voronoi cells
  HEMC_VoronoiCells vcmc=new HEMC_VoronoiCells(this);

void draw() {

void drawEdges(){
  for(int i=0;i<numcells;i++) {

void drawFaces(){
  for(int i=0;i<numcells;i++) {

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>