• Content count

  • Joined

  • Last visited

Community Reputation

286 Neutral

About SunTzu

  • Rank
  1. Quaternion Basics

    Quote:Original post by adder_noir 1)What is a degree of freedom and why is it important that we elminate them from a calculation? Is it something to do with accumulating numerical error? A degree of freedom is (in this context) a movement you can apply to something... for example, total freedom of 3D movement is sometimes called 6DOF or Six Degrees of Freedom, because you can move forwards, sideways, or up and down, and yaw, pitch, and roll. I'm not sure that it is often important to eliminate them... maybe in some cases, because if you can ignore sideways movement it might be faster or simpler to calculate forwards movement, or something. Or perhaps if you ignore roll, you can know that you'll never suffer from gimbal lock considering only yaw and pitch. Quote:2)Why are quaternions favoured over rotation matrices? Firstly, they're smaller (four floats not nine or sixteen), which also means operations with them are often faster, which is very useful in animation for example; and you can multiply them together (ie. modify one rotation in terms of another rotation) without suffering from gimbal lock, which is very useful in cameras for example. Quote:3)What are boundary problems in rotations and why are they so crucial? Um, don't know. Not heard the expression. Probably relates to gimbal lock, which you can look up on Wikipaedia or something, and is just plain nasty.
  2. Quote:Original post by Zahlman Out of curiousity, does anyone know why C++ behaves this way by default? I can't think of a situation where it would be useful... It's a question of what overriding and overloading mean. Overriding means, "I'm still doing the same thing but in a more specific way." Overloading means, "I'm doing a different thing, just using the same name for it." If you override something that is itself overloaded, which are you trying to say? Meyers explains this much more eloquently than I can in More Effective C++.
  3. .net - a bit confused

    No, not unless you've been writing managed C++ using the .NET assemblies. Typically ".NET experience" means C# .NET or Visual Basic .NET; technically Managed C++ with .NET counts, but isn't usually what's really being asked.
  4. Also, it is possible to say extremely brutally offensive things without using a single obscene word. One of the most offensive things I ever saw typed was "Don't you wish you had." In context, that was savage. Personally I'd just stick with making a list of known obscene words. It can always be beaten by someone determined enough, so make a token gesture to show willing and have done with it.
  5. Getting quaternion from forward and up

    Brilliant. Rate++. Especially easy as the .NET framework provides Matrix.Forward, Matrix.Up and Matrix.Right as properties, and Quaternion.CreateFromRotationMatrix as well. It was just a question of taking the step from "transform (0,1,0) into the up vector" etc., into "transform (0,1,0) into (d,e,f)... then your matrix is..." etc. Many thanks!
  6. I have a (unit) forward vector and a (unit) up vector (known to be orthogonal to one another). How do I get the quaternion that rotates to such an orientation? In other words: there is some quaternion that would transform (0,1,0) into the up vector and (0,0,1) into the forward vector. How do I calculate what that quaternion is? I'm actually implementing this in C#/XNA so have all the .NET and XMA framework functions available (none of them appear to provide this automatically), but I can easily translate from other languages or straight mathematics if required. Quaternions confuse the heck out of me. :-)
  7. If you don't provide any publicly accessible mechanism to delete it, the only way for someone to delete it would be to edit the code for the class itself and deliberately add code to delete it. If someone is able to do that (ie. they have access to your source code), nothing you can do will stop them! Usually making the destructor private, commenting it with "prevent deletion of this object", and not providing a static Release() or similar function covers everything. If someone is still determined to find a way to delete it, well, I'd spend your time on something more useful if I were you... ...and this is of course assuming you stick with the decision to use a singleton, which I'm rarely convinced by personally.
  8. Non-Standard Constructors

    I did not claim that they were the same. Merely that placement new can be used to construct objects in an array with a non-default constructor, which the previous poster had said was impossible (in fact it's the only way to have objects that do not have a default constructor in an array); at no time did I say or imply that this meant you could construct such objects wholesale. In fact, the fact you still can't do that is exactly what I meant when I said that it's not an elegant solution to the initial problem.
  9. Non-Standard Constructors

    Quote:Array elements are initialized with the default constructor; there is no away around that. Technically untrue; see placement new. But, well, I don't consider placement new "elegant" as the initial post requested and the vector solution is better anyway, so, </pedantry> and on your way...
  10. XNA in AAA games

    Quote:just out of curiousity why did choose C instead of going with C++ and taking advantage of classes Don't work at Bungie myself but do work at another Microsoft Game Studio, and I think I can field this one... if your company has been around for 25 years, you've probably got a lot of old C code (maybe millions of lines) that you still use, and a lot of C programmers who aren't that hot at C++. So any change to C++ will be gradual and very much one step at a time. I know of at least three companies for absolute certainty who are still using a lot of C code for exactly this reason, though in all three cases the move to C++ is well underway.
  11. Code Efficiency

    I think the point King of Men is trying to make is that in 1/30th of a second computers can move a zillion polygons, draw a brazillian texels and perform nine gadrillion AI calculations. 19 hexes? Really not going to be a problem. Unless you have actually observed such a problem for yourself already? Furthermore, even if it happens, the user might notice a switch from 30Hz to 20Hz in a fast-paced first person shooter, but in a turn-based board game? It's very likely that they won't.
  12. Wrong language to start with?

    Quote:Original post by gharen2 *Insert the usual recommendation for c# here* (I won't bother wasting valuable minutes typing more as there's a million posts about c# already). Quoted for truth. C# and XNA is IMO the way to go for new programmers, nowadays.
  13. Is XNA worth it?

    Very much depends on your target audience, if you want your auntie to play it maybe not. If you want your friends to play it, won't they be updating DirectX etc. at some point anyway? For me, XNA is definitely worth it, though I admit the games I write at home are mainly for my own pleasure and I'm not really bothered if anyone else sees them. Only you can make this call really.
  14. Classes & headers (C++)

    Very simple. Put the class definition in a header file instead, and the functions in the class in a CPP file. Something like: // globals.h #pragma once // If you're using Visual Studio, otherwise #ifndef etc. class globals { //... }; //-------------------------------- // globals.cpp #include "globals.h" globals::globals() { //... }
  15. the freedom of xna express?

    XNA will let you do almost anything you want to do, only with a whole heap of stuff provided for you.