teichgraf's picture

Extend OpenTK


Is it okay to extend the Vector* / Box2d structs and post a SVN patch here? I need some functionality , which I would like to implement directly and contribute to the project.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
georgwaechter's picture

@teichgraf There is already the property 'Perpendicular' .. i think this is want you want (but without the distinction between right an left normal)

A few days ago a added a Rotate function to Vector2. There is already a Rotate function in Vector2d, but there is one big difference: Functions within Vector2d and Vector3d always expect angles (in degrees), but imo the angle parameters should always expect it to be in radians. This is the standard approch for math libraries. In any case this should be consistent.

Then i added the functions RotateX, RotateZ and RotateY to Vector3. All functions have a static alternative.

New is the method CalculateAngle for Vector3 ...

here are the changes: http://trackplanner.de/files/Math.patch

teichgraf's picture

Thanks for the info and the extension.
I agree, that all angles should be handled consistent in radians.

For my project I am using the binaries of OTK 0.9.0 and there was no Perpendicular property. The comment for this prop should be more obviously

/// <summary>
/// Gets the perpendicular vector on the right side of this vector.
/// </summary>
public Vector2 Perpendicular

instead of

/// <summary>
/// Gets the perpendicular vector.
/// </summary>
public Vector2 Perpendicular

To avoid double stuff, I'll wait with my patch until you managed to add georgs patches. Please give me an info when you commited it to the repository.

the Fiddler's picture