hello,
I want to add 2 spherical vector.
It's possible to do an abstraction with 2 "sph2cart", adding cartesian value, and then a "cart2sph".
but I'm looking for an external (or abstraction) using less cpu : it's an operation that I need to aply on many vectors...
maybe someone know...
Thanks, Cyrille
Zitiere Cyrille Henry cyrille.henry@la-kitchen.fr:
hello,
I want to add 2 spherical vector.
It's possible to do an abstraction with 2 "sph2cart", adding cartesian
value, and then a "cart2sph".
yes of course, but this is how you add a spherical to a cartesian vector. if you want to add 2 spherical vectors, just add them element-by-element...
but I'm looking for an external (or abstraction) using less cpu : it's an operation that I need to aply on many vectors...
what machine are you running ? how "many" vectors ? on modern machines you really shouldn't notice (if you don't have 100 millions of vectors each second, but then you will have to wait for faster hardware rather than faster abstractions/externals)
mfg.dra.vfr IOhannes
zmoelnig@iem.at wrote:
yes of course, but this is how you add a spherical to a cartesian vector. if you want to add 2 spherical vectors, just add them element-by-element...
hum,
[R phy Theta< | [sph2cart ] | | | | [R phy Theta< | | [sph2cart] / / |
[+ ] [+ ] [+ ] | / / [cart2sph]
is all right.
adding 2 spherical vector element by elements does not output the same result.
what machine are you running ? how "many" vectors ?
I'm mostly on a P3 850Mhz, win2K. I need minimum 500 addition, 5000 would be good, lot's more would be interesting...
computing all this addition 25 times per seconde.
I use this with gem, for surface rendering, using [primtri]. This patch sould not use more than 20% cpu, because I have lot's of other things runnig on the same time.
on modern machines you really shouldn't notice (if you don't have 100 millions of vectors each second, but then you will have to wait for faster hardware rather than faster abstractions/externals)
ok, I'll try this one for now.
Thanks for the reply
Cyrille
On Thu, 26 Jun 2003, Cyrille Henry wrote:
adding 2 spherical vector element by elements does not output the same result.
No, it certainly does not. Adding spherical vectors like that has a different meaning from usual addition, and frankly, I don't see how that can be useful anywhere. If you want to do linear (cartesian) addition, you have to get back into linear coordinates, add, and convert back to spherical coordinates; or else, if there is a shortcut, it's quite complicated.
The opposite, assuming linear coordinates, and then making a switch to spherical/cylindric when necessary, is what makes most sense to me. Especially because _then_ there are many shortcuts that you can take: e.g. you can do rotation in linear coordinates using almost only multiplications and additions.
From personal experience, I'd say that spherical coordinates aren't so
useful, but linear coordinates are *very* much so.
Mathieu Bouchard http://artengine.ca/matju