[swift-users] Design and performance of Vector2/3/4 and Matrix

Jens Alfke jens at mooseyard.com
Fri Dec 18 16:28:45 CST 2015


> On Dec 18, 2015, at 12:07 PM, David Turnbull via swift-users <swift-users at swift.org> wrote:
> 
> In order to be performant, scalars, vectors, and matrices must all be values types aka structs. This way, for example, an Array<Vector3<Float>> can be passed directly to OpenGL without any copying. In my testing so far, Swift does this quite well.

What about using tuples? You can name the elements of a tuple, and IIRC you can access them using subscripts too.

—Jens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20151218/c97563ce/attachment.html>


More information about the swift-users mailing list