Michael Steinberg

09-07-2008, 05:53 AM

Hello there!

Ever since, I used C-Funtions for my vector/vertex manipulation-code. I now decided to wrap my vectors up in C++ classes and ran across the problem of properly handling homogenous vectors. As the packing of vectors and vertices in 4-float manner is ideal, you essentially get a 4th component for free. In your math libraries, do you handle the 4th component (commonly named w) at all? I mean, the difference of two vertices (with w=1 per definition) yields a vector (w=0), which makes perfect sense, but how often would one really need this distinction in-data? You see, I want to handle things nice and correctly, but implementing the dot-product for four dimensions for example breaks nice packing for plane representations or I cannot use the standard operations in derived types. Did you ever come across occasions, which led you to set w to anything but 0 or 1, meaning you need mathematically correct handling of homogenous vectors?

I hope I explained my concerns understandably.

Best regards,

Michael

Ever since, I used C-Funtions for my vector/vertex manipulation-code. I now decided to wrap my vectors up in C++ classes and ran across the problem of properly handling homogenous vectors. As the packing of vectors and vertices in 4-float manner is ideal, you essentially get a 4th component for free. In your math libraries, do you handle the 4th component (commonly named w) at all? I mean, the difference of two vertices (with w=1 per definition) yields a vector (w=0), which makes perfect sense, but how often would one really need this distinction in-data? You see, I want to handle things nice and correctly, but implementing the dot-product for four dimensions for example breaks nice packing for plane representations or I cannot use the standard operations in derived types. Did you ever come across occasions, which led you to set w to anything but 0 or 1, meaning you need mathematically correct handling of homogenous vectors?

I hope I explained my concerns understandably.

Best regards,

Michael