
Vector?.One
Posted Tuesday, 26 May, 2009 - 12:28 by stereo inI propose to add to the math library:
to a Vector2 struc:
/// Defines a one-length Vector2
public static readonly Vector2 One = new Vector2(1, 1);
to a Vector3 struc:
/// Defines a one-length Vector3
public static readonly Vector3 One = new Vector3(1, 1, 1);
to a Vector4 struc:
/// Defines a one-length Vector4
public static readonly Vector4 One = new Vector4(1, 1, 1, 1);
This is helpfuly in many cases.


Comments
Re: Vector?.One
Since we are on the topic, it might be worth while to add negative unit vectors.
Re: Vector?.One
And finally rename these to:
which are slightly more readable.
Re: Vector?.One
I wouldn't mind those names, but they do imply an understanding of OpenGL's right handed bias.
Just playing devils advocate, do you think it would be too confusing to someone trying to use OpenGL with left handed coordinates?
Re: Vector?.One
I don't think that would be a problem when using a left-hand coordinate system:
We should probably make it clear that the default (right-hand) system is assumed.
Re: Vector?.One
BTW OpenTK does make a judgement call on using OpenGL, right..? So assuming OpenGL coordinate system is not a problem.
Re: Vector?.One
Personally, I prefer UnitX/Y/Z(Neg), as they are somewhat more general, in a mathematical sense.
I agree that the Math and OpenGL namespaces should interface well with each other, but I think there's a lot to be said for keeping the Math library "pure", in a sense.
Perhaps the XML documentation should clarify the coordinate system?
Or something like that.
Re: Vector?.One
@Entropy: I think you mean Right == (1,0,0), at least that is how I visualize OpenGLs coordinate system.
Re: Vector?.One
Whoops!
Yes, I do. Never could get the hang of left & right...
Maybe that's the real reason I prefer UnitX! ;-)