Colezy 4 Light Poster

Hi all,

Ok, a little bit of background before I start. I am working on some 2D visualisation software to show a cross-section of a magnet yoke with colour coded sections showing the force. The diagram has 10 discrete colour sections, not a continuous blend of colour.

The data I get from the experiment is formatted awkwardly and unfortunately this cannot be changed. I get an array of facets each with 8 x,y points. Each point has a force intensity value.
The facet is formatted like this:

0 7 6
1   5
2 3 4

However the mesh is not regular, as in, it is not a uniform axis-aligned grid. Most facets are near square though.

I started out by colouring the facets based on an average force value of the 8 points, but as the facets are relatively large this looked terrible.

I then implemented linear interpolation to more accurately locate the colour boundaries based on breaking each facet into 6 small triangles, then I split each of these triangular facets along a line calculated from the interpolation. This still looks a bit rubbish to be honest though, but far better that the average of 8 approach.

My aim:
I would like to use a bi-cubic interpolation algorithm to reference many (8 - 16) close points in this facet and surrounding ones and get a much more accurate estimation of the value at a given location and thus find the colour boundary more accurately. From this I can produce many curved lines across the mesh which I can make into polygons and shade accordingly.

I kinda understand how bi-cubic interpolation works but I have no clue how to implement it with an irregular mesh. I will need to somehow weight each point and derive a value from that.

I really have no clue where to even start with this problem.

Any help would be greatly appreciated.

Best regards,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.