On Tue, 21 Sep 2010 11:59:51 +0300, Don <[email protected]> wrote:

bearophile wrote:
ponce:

Vibrant has been open source'd (again):
http://bitbucket.org/ponce/vibrant
Very good. I have seen 2D vectors implemented something like ten times in D code, so I think it's time to stop this. They need to go in the standard library:
http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/vec2.d
http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/vec3.d
http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/vec4.d
http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/vectorop.d

Definitely we need vectors in Phobos.

You know vectors are one of the hardest things to implement if you want everything. In D2 it should possible to have it all!

My ideal vector design :

- one struct for all dimensions.
- swizzling
- after a limit (dimension) you have a choice to use either unwrapping or plain for.
- avoid temporaries as much as possible.
- policy to use sse. etc...

Can't think of anything more now.

First 3 is very easy to implement, 4 wasn't possible on C++ because of aliasing, didn't give much of a thought in D, 5 also shouldn't be that hard.

alias vector!(3, float) vec3;
alias vector!(4, float) vec4;
...

There we solved everything! in theory :)

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Reply via email to