Skip to main content

Posts

Showing posts from November, 2009

Cross-compiling windows applications under linux with wine and DevC++

This post has the same title as this , from Violin Iliev because it is almost a "repost". I had an old post on compiling win32 binaries on linux , but the technique I had shown lack the windows resource file compiling. Violin had written his wrapper to the windres resource compiler, but one good "emergency option" if one couldn't, or don't want, or hasn't time to, write a wrapper or compile Violin'd wrapper, is to follow what was commented on Violin's blog by someone who signed as Andy. Andy said: "I had the same problems with windres and mingw32-make under wine 1.0.1 I solved the problems by putting an original copy of msvcrt.dll in the bin subfolder of mingw32 and telling wine to load it first instead of its own msvcrt emulation. hope it can be useful Andy"

All my avatars until now

These are the avatars I use for instant messaging. They were all made with inkscape

Quadrilateral Centroid Algorithm

Oh men... This time google wasn't helping much... I was looking for an algorithm to find the centroid from a quadrilateral polygon. It wasn't necessary to be a general, any polygon, centroid algorithm... just one which give me the centroid of a regular convex quadrilateral. It was hard to find something that simple. But finally, here is. The following code is a C example on how to compute the area and the centroid from a regular convex quadrilateral polygon: #include<stdio.h> int main(void){ float verticesX[5]; float verticesY[5]; float centroidX = 0; float centroidY = 0; verticesX[0] = 3.58; verticesY[0] = 1.90; verticesX[1] = 4.48; verticesY[1] = 1.88; verticesX[2] = 4.56; verticesY[2] = 2.71; verticesX[3] = 3.64; verticesY[3] = 2.74; verticesX[4] = 3.58; verticesY[4] = 1.90; // Repeat the first vertex int i, k; float area = 0.0f; float tmp = 0.0f; for (i = 0; i <= 4; i++){ k = (i + 1) % (4 + 1); tmp = verticesX[i] * verticesY[k] -