This goes onto thedailywtf.com

    public Matrix4f transpose() {
       Matrix4f mat = new Matrix4f();
       
       mat.m01 = m10;
       mat.m02 = m20;
       mat.m03 = m30;
       
       mat.m12 = m21;
       mat.m13 = m31;
       
       mat.m23 = m32;
       
       return mat;
    }


oops



guess it ain't used that often. Eclipse only reported one reference, so guess it has slipped thru :X

Or: why unit testing your basic building blocks is a good idea.

And: how I got to waste two evenings on a bug in an underlying library :frowning:

it's very late, probably making me blind, but what's the big WTF/oops about it?

Think you kindof need to copy



m00, m11, m22 and m33…



:slight_smile:



In Matrix3f it seems transpose is same as transposeLocal, dunno what's intended.

There are no references to Matrix3f's transpose() within jme. But changing it might break something using jme.

The matrix has 16 elements. Only 6 of them are copied to the new matrix.



I'm submitting a patch to the issue tracker, btw. Turns out, scale() was broken as well. I haven't looked at the other functions; I just happened to see scale() was broken when putting in the unit test for transpose().



https://jme.dev.java.net/issues/show_bug.cgi?id=272

gotcha :slight_smile: appearantly i was blind…



scale though, is commonly done as a non uniform scaling applying only to the diagonal, as we do. are you thinking about mult perhaps?



also, we use xxx, and xxxLocal for creating new instance vs applying locally…we usually have yet another method with a store/result variable to allow the users to supply one…

We're programmers and bugs happen…lets try to be at least somewhat conscientious to those of us that don't write perfect code…and no, I didn't write that method.  :stuck_out_tongue:

I've seen worse (yes, in jme code… yes, in my own code too). There is nothing WTF about it, just a regular run down the mill kind of bug.

MrCoder said:

gotcha :) appearantly i was blind..

scale though, is commonly done as a non uniform scaling applying only to the diagonal, as we do. are you thinking about mult perhaps?

also, we use xxx, and xxxLocal for creating new instance vs applying locally..we usually have yet another method with a store/result variable to allow the users to supply one..


MrCoder: Scale cannot possibly be implemented only along the diagonal, in my opinion, unless you only apply it to the identity matrix. However, there is nothing in the documentation or preconditions of the "scale" function that requires only identity (or diagonal) matrices to be passed in. If there was a "fromScale()" function, then only dealing with the diagonal would be reasonable in there. If you look at the examples in the unit tests, those matrices wouldn't consider any scale unless you applied it to the entire rows. Similary, if you multiply the matrix with a diagonal scaling matrix, you will get a correctly scaling matrix out. However, that's not what the implementation did -- it ONLY multiplied the diagonal; it didn't multiply the matrix by a diagonal scaling matrix.

I have noticed that you use xxx() and xxxLocal() for doing it with a return value, versus in-place. Unfortunately, transpose() and transposeLocal() in the existing Matrix3f class both did it locally -- there was no function to return a new instance. Rather than breaking possible users relying on this bug, I chose to preserve the interface bug, and create a new function (transposeNew()) for those who need the value return. If you want to possibly break users of Matrix3f.transpose() that depend on that function being in-place (contrary to convention), then feel free to move transposeNew() to transpose() (that would be the righteous fix).

@lex: I don't think it's a run-of-the-mill common bug. Even the simplest test case would have immediately found the bug. Anybody just reading it, and being familiar with linear algebra would see it. There are 16 elements in the input matrix. There are only 6 elements assigned to in the output matrix. If that's not a WTF (in the context of 3D math) then I don't know what is :)

Again, I'm not complaining about any particular person; just expressing surprise at some frustrating bottlenecks that cause me to waste time when what I'm trying to do is to get to the core of jMonkey to figure out what makes it tick. And wasting two evenings on what turns out to be a bug in the core 3D math library qualifies as a WTF, no matter what the language/platform, in my opinion. You may hold an opposing viewpoint.

Complete laziness on my part leading to this. You're right, never should have happened. Caused from cut and paste from Matrix3f's local method making its way to all the other places without actually finishing the implementation. Should have been caught if we weren't so bad about our unit testing or I took five seconds to go over it. Sorry this lead to you losing so much time. Most interesting aspect, I wondered why this hasn't been caught, Matrix4f is so rarely used (never transposed) and transposeLocal on Matrix3f… so, no code coverage. JUnit and Emma… where art thou?



Again, apologies.

I really like that bugs are being found… but even more than that I am really enjoying the tactful way you present them.  ;)  "WTF ftw!!!1!"

Sorry. Someone could "fix me" and explain me what  does that WTF means?



I am Italian and for me it does not mean anything. But looking at your reactions I feel as if there is something wrong (offensive?) with it. Then I found "What the freak!" on the internet. But I am not able to translate it in a meaningfull way.



Edit:

Oh! Ok I just found a translation/explanation! It says that it is an expression that can be translated in a similar way like other "What a …!" exclamations.

If so i fully quote renanse.

haha, man, you can't have many friends left :wink: i appreciate all your valuable input, but the way you put it is really surprising to see, in this otherwise always extremely friendly forum… :roll:


I try to give room for kindness, but some things just exceed the threshold.


you must have a really small room! *s*
if there is something i've learned after using open source projects all these years, it is to be very accepting when it comes to bugs etc, feeling greatful that the creators didnt put it out as a licenced project. hell, even when using the unreal engine and other commercial ones back in my xbox dev days(or looking at the leaked HL2 source), there were tons of weird bugs and spagetti code :)

you've worked in stockholm by the way?

Well I can understand the frustration when losing time trying to pinpoint weird behaviour  :expressionless:



wtf would probably be my reaction to when noticing that bug if it had eluded me for sometime. I would probably be more of a diplomat tho and do a bug report and went my frustration by playing ut3 for an hour instead of writing a post in the forum  :smiley:



If I had written the code I wouldn't take it personally since I know the frustration when you find your own bugs. I would be happy to have some fresh experienced eyes scanning my code that might help improve it.



Personally I just want to have some fun with jmonkey and I am! Hopefully I contribute some when I get into it more. Just wanna thank all the monkey developers for its existence  :wink:

Perhaps instead of actually wasting your time posting this:



http://forums.thedailywtf.com/forums/thread/140568.aspx



…and in turn doing a pretty good job of bashing jME to a large audience of people that know nothing about the project and that this is one small bug amidst a massive project that works very well, you could have simply posted the fix and gone about your work.  No wonder you’ve wasted two nights bug fixing if you feel you have to post to thedailywtf every time you find anything that needs fixing.



If you can’t take the time to step over your ego and be a little more tactful on this forum you can take your backhanded bug fixes elsewhere for all I care.  You seem like a decently knowledgeable guy, but seem to lack the people skills to actually work in a community, which seems to explain why you keep project jumping.  We all appreciate your bug fixes, but essentially publicly bashing jME crosses a line in my opinion and I personally don’t appreciate it.



NOTE The views expressed in this post are those of the individual poster and do not necessarily reflect the views of the jME community or project developers.

Btw to maby get a bit offtopic, but when we are talking about matrices.



I used this online resource to brush up on my matrix math



http://ocw.mit.edu/OcwWeb/Mathematics/18-06Spring-2005/VideoLectures/index.htm



got to love the internet :slight_smile:

@darkfrog: You're right: for most of the problems, I just post the diff and move on (or develop an alternative solution). For example, the bug in the BinaryCapsule, or the ASE importer, or the matrix scaling bug. However, for some reason, this particular bug evoked a deep emotional response. I'm sorry if you don't like it; feel free to let me know if there's something else you have an issue with as well.

It's certainly unfortunate… Our library mostly uses Quaternions for everything, so a bug in the Matrix classes was easy to overlook…  Especially a copy/paste issue.  Yes, we would be well served by code coverage and unit testing.  Yes, if you don't realize how it got in there it would look like a dummy mistake.  But not really worthy of a denigrating post on another forum…