Re: Points and Vectors in 3D

2011-03-13 Thread Spacen Jasset
On 13/03/2011 00:06, Bekenn wrote: On 3/12/2011 2:20 PM, Simon wrote: I've done lots of 3d over the years and used quite a lot of different libraries and I've come to prefer code that makes a distinction between points and vectors. Agreed. This has some nice benefits with operator

Re: Ranges

2011-03-13 Thread spir
On 03/13/2011 01:05 AM, Jonathan M Davis wrote: If you were to try and iterate over a char[] by char, then you would be looking at code units rather than code points which is _rarely_ what you want. If you're dealing with anything other than pure ASCII, you _will_ have bugs if you do that.

Re: Points and Vectors in 3D

2011-03-13 Thread Simen kjaeraas
Spacen Jasset spacenjas...@yahoo.co.uk wrote: On 13/03/2011 00:06, Bekenn wrote: On 3/12/2011 2:20 PM, Simon wrote: I've done lots of 3d over the years and used quite a lot of different libraries and I've come to prefer code that makes a distinction between points and vectors. Agreed. This

Re: Points and Vectors in 3D

2011-03-13 Thread Simon
On 13/03/2011 14:11, Simen kjaeraas wrote: Spacen Jasset spacenjas...@yahoo.co.uk wrote: On 13/03/2011 00:06, Bekenn wrote: On 3/12/2011 2:20 PM, Simon wrote: I've done lots of 3d over the years and used quite a lot of different libraries and I've come to prefer code that makes a distinction

Re: Points and Vectors in 3D

2011-03-13 Thread Simen kjaeraas
On Sun, 13 Mar 2011 15:43:09 +0100, Simon s.d.hamm...@gmail.com wrote: On 13/03/2011 14:11, Simen kjaeraas wrote: Spacen Jasset spacenjas...@yahoo.co.uk wrote: On 13/03/2011 00:06, Bekenn wrote: On 3/12/2011 2:20 PM, Simon wrote: I've done lots of 3d over the years and used quite a lot of

Re: Points and Vectors in 3D

2011-03-13 Thread Caligo
On Sun, Mar 13, 2011 at 9:11 AM, Simen kjaeraas simen.kja...@gmail.comwrote: Spacen Jasset spacenjas...@yahoo.co.uk wrote: Can't see a fitting operator in D. Multiplication (*) is ambiguous at best and no other operator seems fitting. I agree. It's just better do define 'dot' and 'cross'.

Re: Points and Vectors in 3D

2011-03-13 Thread Simon
On 13/03/2011 15:29, Simen kjaeraas wrote: On Sun, 13 Mar 2011 15:43:09 +0100, Simon s.d.hamm...@gmail.com wrote: Convention is to use ^ as cross product and * as dot product. Really? I've never heard of it. Rather, everyone I've talked to about it has said exactly what I did.

foo.bar !in baz not allowed?

2011-03-13 Thread Magnus Lie Hetland
For some reason, it seems like expressions of the form foo.bar !in baz aren't allowed. I suspect this is a grammar/parser problem -- the bang is interpreted as a template argument operator, rather than a negation operator, and there's really no need to make that interpretation when it is

Re: foo.bar !in baz not allowed?

2011-03-13 Thread spir
On 03/13/2011 07:58 PM, Magnus Lie Hetland wrote: For some reason, it seems like expressions of the form foo.bar !in baz aren't allowed. I suspect this is a grammar/parser problem -- the bang is interpreted as a template argument operator, rather than a negation operator, and there's really no

Re: foo.bar !in baz not allowed?

2011-03-13 Thread Magnus Lie Hetland
On 2011-03-13 21:27:27 +0100, spir said: On 03/13/2011 07:58 PM, Magnus Lie Hetland wrote: For some reason, it seems like expressions of the form foo.bar !in baz aren't allowed. I suspect this is a grammar/parser problem -- the bang is interpreted as a template argument operator, rather than a

Semi-const methods?

2011-03-13 Thread Magnus Lie Hetland
I have a data structure that's generally static (const, or even immutable), but it has some utility storage, which caches certain results during use. This caching etc. doesn't really affect the semantics of the main object, and are reset between operations, so I think it still would be useful

Re: Semi-const methods?

2011-03-13 Thread Magnus Lie Hetland
On 2011-03-13 23:27:14 +0100, Magnus Lie Hetland said: Any other ideas on how to handle this sort of mostly const or const where it counts stuff? Perhaps my design intentions here are off to begin with?-) OK -- a *little* quick on the trigger there. My solution: Declare the method const,

Re: Semi-const methods?

2011-03-13 Thread Magnus Lie Hetland
On 2011-03-13 23:32:34 +0100, Magnus Lie Hetland said: (Still open to schooling on the design part of this, though. Perhaps declaring a method as const is no good when it's not *really* const? For now, I'm just doing it to check that I don't inadvertently change things I don't want to

Re: Semi-const methods?

2011-03-13 Thread Jonathan M Davis
On Sunday 13 March 2011 15:32:34 Magnus Lie Hetland wrote: On 2011-03-13 23:27:14 +0100, Magnus Lie Hetland said: Any other ideas on how to handle this sort of mostly const or const where it counts stuff? Perhaps my design intentions here are off to begin with?-) OK -- a *little* quick

Dependencies file format

2011-03-13 Thread Bekenn
After some searching, I found the documentation here: http://d.puremagic.com/issues/show_bug.cgi?id=3122 Shouldn't this be on the web site somewhere?

Help passing D strings to C libs

2011-03-13 Thread Gene P. Cross
Hi, I'm fairly new to D and I'm writing a Space Invaders clone to get myself acquainted with the language. I'm having trouble passing D strings (char[]) to SDL, in particular SDL_LoadBMP(), I keep receiving a segfault. Heres the code: void setImg(string path) { // concat null terminating

Re: Help passing D strings to C libs

2011-03-13 Thread Andrej Mitrovic
Use toStringz from std.string, ala: SDL_LoadBMP(toStringz(path)); Do not embed nulls before calling toStringz, so remove 'path ~= \0;'

Re: Help passing D strings to C libs

2011-03-13 Thread Andrej Mitrovic
Wait, actually I'm not sure if there's toStringz for D1, it is there for D2. Try it out, I guess.

Re: Help passing D strings to C libs

2011-03-13 Thread Gene P. Cross
toStringz is in D1 but still no luck, I still get the same error Thanks for the suggestion though

Re: Help passing D strings to C libs

2011-03-13 Thread Jonathan M Davis
On Sunday 13 March 2011 21:32:49 Gene P. Cross wrote: Hi, I'm fairly new to D and I'm writing a Space Invaders clone to get myself acquainted with the language. I'm having trouble passing D strings (char[]) to SDL, in particular SDL_LoadBMP(), I keep receiving a segfault. Heres the code:

Re: Help passing D strings to C libs

2011-03-13 Thread Gene P. Cross
I've amended the source to pass the strings pointer (path.ptr) after adding a null but the problem still persists. I lost for what it could be and I'm certain this is where the problem is, because if I remove the method call, the program runs fine. I've noticed that calling SDL_LoadBMP and