| jyk March 17, 2005, 07:10 PM |
|
Hi arctwelve,
At first glance, your code doesn't look right to me. I haven't examined it carefully though, so perhaps it's an equivalent method - I'm not sure. In any case, it's not the approach I'm familiar with. Also, I can tell you that the general algorithm requires no sqrts() or length computations, so even if your version works you might want to convert to the more 'standard' approach.
My first suggestion is to go to Dave Eberly's site geometrictools.com, go to the 'documentation' section, and look for a .pdf called 'The Method of Separating Axes' (or something close to that). It explains the general algorithm quite clearly.
If you're still having trouble after that, I'll be glad to help. I don't want to make any assumptions about what you do or don't understand, but I'm a little confused by a couple of things in your code. For example, I'm not sure what 'axis.center' means, since an axis is a vector and doesn't really have a position per se. Also, I think I see what you're trying to do with the project() function, but even if it works it's sort of a roundabout way of doing it. Suffice to say, there are better, or at least more standard, ways of doing it.
Again, I'll be glad to help further if I can, so please ask if you need any further clarification.
|