Monday, February 25, 2013

Quickhull experiment in html5 - part1

More experiments on Javascript and html5 rendering..
Implementing the Quickhull algorithm. This will find out a fast optimal bounding volume encapsulating all the points.

Steps:

  1. Find the bounding box
  2. Find the points lying on the box, they form a quad..
  3. Eliminate the points lying inside the formed boundary
  4. Find the farthest point away from each edges and form a triangle of that edge with the point.
  5. Eliminate the points lying inside the triangle and add the two new edges to the hull
  6. Repeat the steps 3-5 till no points are found outside the hull.


So far, being able to capture points on canvas, was able to compute AABB and the inside quad, need to create a javascript datastructure for storing edges, and inserting edges in between. Remaining tomorrow...


The interactive canvas below (requires google chrome):

No comments: