Archived

This topic is now archived and is closed to further replies.

How to calculate texture coords?

This topic is 5800 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, this question is related to geometry that may dynamically change. for example: a polygon like this +--------+ | | | | | | | | +--------+ mutates to a polygon like this: +- | - | - | - | - + - - - - + - | - | - | - | + sorry for the inconvenienca i have thought which algorithm could do this... lets assume the former polygon had coordinates like (0, 0) (1, 0) and so on how then compute the new ones?? thanks, gammastrahler

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
well.. if you want 2d polygon (x1,y1),(x2,y2),(x3,y3) morph to a new shape (dx1,dy1),(dx2,dy2),(dx3,dy3) in 5 steps:

1. interpolate (to get adding values)
deltax1 = (dx1 - x1) / 5
deltay1 = (dy1 - y1) / 5
deltax2 = (dx2 - x2) / 5
deltay2 = (dy2 - y2) / 5
deltax3 = (dx3 - x3) / 5
deltay3 = (dy3 - y3) / 5

2. morph
for (i=0;i<5;i++) {
x1 += deltax1;
y1 += deltay1;
x2 += deltax2;
y2 += deltay2;
x3 += deltax3;
y3 += deltay3;
}

Share this post


Link to post
Share on other sites