Query about Morph program in this site
i was wondering if anybody knows any of the details regarding the morph program available at
i would like to know which algorithm is being used and possibly some other details.
Looks like tweening to me. Bascially you have two shapes (start and end) and the tweening algorithm slowly (or fast if you want but it won't look as nice) converts each point in the start shape to the end shape. Here is a basic tween i made in openGL over a year ago.
Originally Posted by AK_47
Basically my drawTween function takes 2 array of points (A represents the start figure, B the end figure). Int n determines how many frames between the start and end, and float t is how much each frame differs from the last. There may be more complex Tweening/Morph methods but i'm not really sure. Anyways, do a google search and i'm sure you'll find some stuff.
Point2 Canvas::Tween(Point2 A, Point2 B, float t)
float difX = B.getX() - A.getX();
float difY = B.getY() - A.getY();
float tX = A.getX() + (difX*t);
float tY = A.getY() + (difY*t);
void Canvas::drawTween(Point2 A, Point2 B, int n, float t)
for(int i=0; i<n; i++)
P= Tween(A[i], B[i], t);
cout << P.getX() << "," << P.getY() << endl;
cout << "----------------" << endl;
EDIT: Also note this is a 2 dimensional tween, although it wouldn' be hard to convert to 3D. Also if your confused why the code looks weird thats because it's C++, not Java. As far as i know openGL is not supported in Java? However, you can still do it in Java (obviously, the applet did it) with their native 2D and 3D graphics.
Last edited by customwoodtek; 04-04-2005 at 09:16 PM.
Java has 99 problems but a pointer ain't one
Though the applet flickered a lot, and I barely saw any image, I can tell you the algorithm used. It's simple linear interpolation.
Result = A + (B-A)*k
Where 'A' is picture 1 and 'B' is picture 2, and 'K' is the set[0,1] (between 0 and 1)
A value of 0 would give the full picture of 'A', and 1 would give the full picture of 'B'.
Would you would actually do is get the color of each pixel in the two images for 'A' and 'B' and create a new image.
I need this code for a university project and was told its using the
cross -dissolve algorithm, but is that definitely not the case?
this program also allows more than one image to be morphed.
Originally Posted by Phaelax
Is tweening another name for mesh warping if not can you tell me what the difference is.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center