Hi, I am currently in the process of porting a DirectX application to a platform independent engine. My biggest time-eater are the D3DX Math functions. Does anybody have a math library that follows the D3DX math library in source? Currently I am stuck with

D3DXVec3TransformCoordArray()

Any help would be appreciated,

Wolf

Reedbeta
—
2005-10-11T03:34:25Z —
#2

It just takes two arrays of vectors, and transforms each one in the input by a given matrix and stores it in the output.

The only caveats are that the input and output strides may be specified (so when incrementing your pointers, you will need to typecast to unsigned char*, add the stride, and then typecast back to D3DXVECTOR3*); and the function is supposed to project back to w = 1, so divide each vector by its w component after transforming.

Hi Wolf, I want to know what r these EPS5, u8,u32.... Plz reply as soon as possible.

Nick
—
2007-09-03T12:33:36Z —
#6

@goyal_nitu22

I want to know what r these EPS5, u8,u32....

EPS5 is an 'epsilon' value; an extremely small value to compare to if you want to know whether a floating-point value should be treated as zero. In this case it's used to avoid division by zero. I'm not sure if Vec3TransformCoord should return NULL in this situation though. u8 is clearly an 8-bit unsigned integer (unsigned char) and u32 an unsigned 32-bit integer (unsigned int).

Plz reply as soon as possible.

Like in two years? (check the dates)

Seriously now, it is sometimes considered a bit rude to ask for an urgent reply. There are lots of professionals here who visit the forum in their free time and have no obligation to share their knowledge. So show a little patience. Else if there's a particular reason why it's urgent and we should care more about it than our own busy agenda's, please give us an incentive.

goyal_nitu22
—
2007-09-18T06:52:26Z —
#7

Thanks a lot Nick it helped me a lot.

goyal_nitu22
—
2007-09-26T11:05:30Z —
#8

Hi Nic Can this code be available in assembly language?If yes plz post it.I have to reduce the time taken by it.It takes somewhat less time than DirectX fn(D3DXVec3TransformCoordArray) but the difference in their time is negligible. So i want assembly code.I have written it in assembly code but this assembly code takes more time than the c++ code.Plz help me.

njdewit
—
2007-09-26T16:05:30Z —
#9

Try and optimize it using SIMD and take a look at the cache-friendliness of what you're doing. But perhaps it's wise to stick to C++, given the circumstances. And what's the reason you're performing so many transformations (otherwise the speed of this particular function would not be an issue)? Nothing to do about that?

That aside, you're being rather rude. You can ask for assistance but nobody's here to do your job.

Kenneth_Gorking
—
2007-09-26T18:22:00Z —
#10

I know of optimized code that can process each vector in \~17 cycles, but I am not gonna post post it because it is freely available on the internet. A simple search is all it takes.

Also, as you have proven yourself, translating a function to assembly does not necessarily make it faster, because you have consider memory alignment access, instruction pairing, cache access and so on. Is this function even a bottleneck? Couldn't you do some optimization at a higher level?