0

I'm trying to get an array of weights that represent the influence a polygon's vertices have on an arbitrary position inside of it. With which I can interpolate the vertices of a deformed version of the polygon and get the corresponding deformed position.

Mean Value and Harmonic warping:

img

It seems that Harmonic coordinates would do this? My mesh goal:

img

I don't have easy time reading math papers. I found this Mathlab article, but still not grasping how to process each sampled position relative to the polygon's vertices

Meshlab article

Thanks!

pb_stack
  • 9
  • 2
  • 1
    is there any question in there? What is the specific problem ? – Spektre Aug 26 '18 at 06:56
  • @Spektre Yes, how to calculate this in C? – pb_stack Aug 26 '18 at 23:19
  • 1
    In such case add `[C]` tag and add more specifics like what is the input and output (sample case is the best) and what exactly is the problem preventing you from finishing. In current state of your question you are just asking us to study/develope and do all for you which is off topic here ... Also you are mention weights did you mean UV mapping instead? – Spektre Aug 27 '18 at 06:35
  • Are you aware that the harmonic scheme may lead to foldovers and exceeding the boundary? Is this acceptable for your application? – Nico Schertler Aug 27 '18 at 06:37
  • @Spektre Added. Inputs = position being processed and array of positions of the polygon output = array of weights per point to that are to be used to map the the equivalent position on a deformed version of the polygon. Thanks – pb_stack Aug 27 '18 at 08:03
  • @NicoSchertler Yes, I'm already checking if the point is inside the polygon using this: https://stackoverflow.com/questions/217578/how-can-i-determine-whether-a-2d-point-is-within-a-polygon/2922778#2922778 Thanks – pb_stack Aug 27 '18 at 08:05
  • @pb_stack I do not see the sample input anywhere (image does not count as you have vector input). That means anyone who would try to code/test/help with this would need to prepare its own set so most of the potential answerers will give it up as too much work to do and or too low effort (as you still did not show what have you tried and what is wrong) from your side to even bother with answer. Also absence of code means do all from scratch which discourages too. Put all of this together and you got no answers as the lazy one dont bother and the others do not want to guess all your conditions – Spektre Aug 27 '18 at 08:09
  • btw the definition of the "weight" purpose is so vague at least to me ... thats another reason for sample in/out request as such stuff is usually verifiable from it (especially if wrong terminology is used) but without we can only guess ... – Spektre Aug 27 '18 at 08:22

1 Answers1

0

You could try to create a Delaunay triangulation of the polygon and then use Barycentric coordinates within each triangle. This mapping is well defined and continuous, but in most cases probably not smooth (i.e. the derivative is not continuous).

coproc
  • 6,027
  • 2
  • 20
  • 31