Suggestion Generic 2d/3d vectors?

Holzchopf

Moderator
3rd Party Module Dev
Tutorial Author
Joined
Jul 31, 2017
Messages
496
Hi there

Have you ever had the need for "primitive" vectors being passed to or from functions and didn't want to pass them as arrays? Well I did. Crazy me ^_^ And for that I wrote classes like...

Cerberus:
Class VecXY<T>
    Field x:T, y:T

    Method New(pX:T, pY:T)
        x = pX
        y = pY
    End
End

... and I thought "maybe others use similar types to this and everyone is just writing the same code over and over again?"

Would it make sense to provide them as a standard feature in CX? I don't know if it even makes sense performance-wise (e.g. is accessing a member worse than indexing an array).

Cheers
 
Top Bottom