Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 15 Jul 2012
Offline Last Active Mar 28 2013 03:48 PM

Posts I've Made

In Topic: Rotate 4x4 matrix formula

23 February 2013 - 05:04 AM

Thanks Geometrian for posting that code. I haven't worked in C++ for about a year so I will have to take a bit of time to dig into that and see what I can glean from it.

Since my post I have found a few more examples and articles but I am still a bit off on my calculatios. I am sure some will laugh but the formula I found that cracked everything open was not a formula to create the matrix but a formula that allowed one to pull the degrees of rotation out of the matrix. I took it and just reversed it, then from there I knew where to place the results and I figured out matrix multiplicaion.


But like I said things are bit off. There are some built in functions for simplifing rotation (they are limiting what I can do), and I am comparing my numbers to them. If I just rotate on one axis the numbers are fine it is when I rotate on more than one that things get messed up.


I have my code outputing the numbers from the built in rotation fuctions (first matrix below) and from my calculations (second matrix below), here's what I am seeing

X: 2deg
Y: 2deg

0.9993908270190958, 0.001217974870087876, -0.03487823687206265, 0,
0, 0.9993908270190958, 0.03489949670250097, 0,
0.03489949670250097, -0.03487823687206265, 0.9987820251299122, 0,
99.93908270190957, 100.06088018891836, 0.002125983043832047, 1

X cosine: 0.9993908270190958
X sine: 0.03489949670250097
Y cosine: 0.9993908270190958
Y sine: 0.03489949670250097

0.9993908270190958, 0, -0.03489949670250097, 0,
0.001217974870087876, 0.9993908270190958, 0.03487823687206265, 0,
0.03487823687206265, -0.03489949670250097, 0.9987820251299122, 0,
100, 100, 0, 1

Note that there is a 100 translate on both the X and Y axis so I can throughtly test my numbers.

I looks like the X and Y cosine and sine calculations are correct but something is not being calculated correctly after that. Nor is the calculation being applies to the translate values (I suspect I need to just research a bit to solve this). Hmm, as I look a little closer it looks like maybe some numbers are in the wrong spot ... but why?


Here is a pseudo version of the code I currently have

basematrix = [
    [1, 0, 0, 0],
    [0, 1, 0, 0],
    [0, 0, 1, 0],
    [100, 100, 0, 1]

function RotateMatrix(y, x)
    halfrot = 3.141592653589793 / 180;	// pi divided by 180

    xcos = cos(x * halfrot);
    xsin = sin(x * halfrot);

    ycos = cos(y * halfrot);
    ysin = sin(y * halfrot);

    ymatrix = [
        [ycos, 0, -ysin, 0],
        [0, 1, 0, 0],
        [ysin, 0, ycos, 0], 
        [0, 0, 0, 1]

    xmatrix = [
        [1, 0, 0, 0],
        [0, xcos, xsin, 0],
        [0, -xsin, xcos, 0], 
        [0, 0, 0, 1]

    calcmatrix = MatrixMultiply(ymatrix, basematrix);

    calcmatrix = MatrixMultiply(xmatrix, calcmatrix);

    for (i = 0; i < 4; i++)
        for (j = 0; j < 4; j++)
            //output calcmatrix[i][j]

function MatrixMultiply(matrixa, matrixb)
    newmatrix = [];
    for (i = 0; i < 4; ++i)
        for (j = 0; j < 4; ++j)
            newmatrix[i][j] = matrixa[i][0] * matrixb[0][j] 
                            + matrixa[i][1] * matrixb[1][j] 
                            + matrixa[i][2] * matrixb[2][j] 
                            + matrixa[i][3] * matrixb[3][j];
    return newmatrix;

Maybe someone can see what I did wrong.

In Topic: Can I avoid the hassle of these IDE's?

19 July 2012 - 02:48 PM

Your machine is heavily broken and all your fixes are only going to make your life worse. Visual Studio 2010 works with MSBuild 4.0, and shoehorning in 3.5 is just asking for trouble.
Visual Studio is as close as it comes to "It just works" as development tools get, especially one of it's complexity. It sounds like you have a bad .NET install. I would uninstall everything and reinstall Visual Studio from scratch.

Yep did that, twice. The second time I made sure all coresponding folders were removed and I spent about 3 hours manually removing all Visual Studio, MSBuild, and .NET Frame work registry entries I could find. It's amazing even Microsoft doesn't know how to clean the registry (that they made) when you uninstall their software.

Maybe later when I am burnt out form reading up on CMake and makefiles I'll think about trying one last time to get Visual Studio installed. I will have to revert back to a restore point prior to the first install. Unfortunately that is going to wipe out some software and several updates I did after installing Visual Studio.

Kill the gremlins living in your PC.

Wish I could, I would have sworn gremlins was a system requirement for using Microsoft products... Posted Image No wait, gremlins is one of the support packages they install. Posted Image

In Topic: Can I avoid the hassle of these IDE's?

19 July 2012 - 09:36 AM

Yea, Visual Studio would make my life easier if I could get it to work, to start with. I have tried everything I can find to get it to work. And after a couple reinstalls it is looking on drive d for the MSBuld which without it won't even let you start a new project, I solved that by moving MSBuild to drive D. But then it cannot find .NET Framework 4.0 even though I have confirmed it is installed and working. To solve this requires I add a line to the .vcxproj files in every project to look to version 3.5 and then edit "Platform Tools" (I think thats what its called, can't recall were the setting is, at the moment) from v90 to v100. And this has to be done with every project both new and imported. So right now I look at a lot of example code and it takes a fair amount of time just to see how someone elses code works. And even after all that there is still a bug that randomly shows up, when I go to debug, I get a compile error that has some long negative (-) number, which I accidentally found I just need to exit Visual Studio and restart, and everything will work again. And oh and then there is the fact that all this some how is causing it to think my projects are out of date so every time I run the debugging it asks if I still what to compile the project.

Visual Studio will making my life easier??? Its been a week getting it to work so not from where I am standing, it has made my life more difficult. In reality Eclipse is easier and it requires that you figure out how to configure MinGW to work with it, and even then the Debugging is very awkward to work with. I am half inclined to use Eclispe but I have yet to find a tutorial on how to get 3rd party libraries to work with it. Of course I may have given up on that bit early as the hassle with Visual Studio has me quite put out with IDE's. I have tried using Eclipse in the past with PHP and it had some idiosyncrasies that made it awkward to use so I am not set on making it work either.

Found a tutorial on makefiles http://oreilly.com/c.../book/index.csp and I am also looking at GNU's documentation http://www.gnu.org/s...node/index.html. Probably a little later I will be figuring out how to use CMake.

I guess if I find building my own makefiles and batch files some how horrible difficult (which right now is not looking to be the case) I will give Visual Studio another shot. But to do that will require I wipe my C drive and reinstall, which for the way I like things Windows 7 needs heavy modification to work, half, right and reinstalling everything takes the better part of day to get done, and not one I look forward to.

In Topic: Can I avoid the hassle of these IDE's?

18 July 2012 - 10:19 PM

If you don't want to look into CMake, just make a batch file that saves the libraries you link to and just add the extra files. Then you go to the command line where the batch file is, type "Compile" or "Compile.bat" and it runs the same. This could handle that include issue you have and wanting them to be hard coded as well.

I've seen CMake referred to in some of my other research, may take a look at it. I have to ask, are these batch files anything like the old school batch files from the Windows 3.1, 95 and 98 days? If so I just need to remember how to work with them again and I am set.

so going all command-line commando probably isn't going to make your life magically easier.

Actually I don't mind command line, I come form the old days of DOS and Windows 3.1, when to setup new software required that you knew how to use command line. I still on occasion use command line to fix PC's that won't boot to windows. I also worked with Linux back in the 1990's, when it was still very much a command line based OS. I even remember using an 8086 PC (and no that is not is MHz) from the early 1980's, you had to use the command line to configure the print drivers. My programing experience goes back to writing code in Q-Basic, so command line and bat files were at one point old hat for me. I would rather edit ini, bat, dat, and now xml files than try to figure out where some software is hiding some setting. It amazes me how often after using some piece of software for several years I learn it has features I have been wanting for almost as long as I have had the software. If I had been able to look at a configuration file I likely would have spotted it much sooner, you should have seen what I did with Windows 3.1.

If I can use batch files like Dragonsoulj is suggesting this may solve much of my headaches. I would much rather type code than learn to use some poorly made software.

Also one other thing I ran into while doing my own research was "Preprocessor Directives". I am not sure if there is anything of use in them but they do look to have some potential. Its funny how all the programing books and tutorials just completely skip over these, even though they are used (#include, #define, #pragma, and several others). I am temped to call it the "IDE effect", if it is all taken care of for you why go into any detail of learning how it works.

In Topic: Can I avoid the hassle of these IDE's?

18 July 2012 - 05:15 PM

You'll still have to deal with the linker which is the cause of your IDE problems

Is there really no way to hard code the path to an "include" library?

since crashes caused by Module X can appear to occur in function Y

That happens a fair amount when working with objects oriented programing in PHP. I have had to many times work my backwords through classes trying to catch exceptions, so thats nothing really unusual to myself. That is one thing nice about PHP a good "var_dump" can output the entire object and you can see if you're calling the information you need correctly and if the information is making its way to where it should be in the object. Of course some IDE's have an object browser not entirely sure how it compares with "var_dump", seems to have some info anyway. Have thought about building a var_dump equivilent for c++, based on what I have read, not an easy prospect to say the least.

For quick and dirty solutions I use vc10 from the commandline and notepad++ as the editor.

Notepad++ is my prefered IDE for building web apps currently. I assume vc10 is Visual Studio 10, is there a good tutorial or documentation on using it from the command line?