What is the best way to store coordinates so that I can access them via some sort of an index? I'd like to mess with both x, y coordinates as well as x, y and z coordinates. It'd be great if the solution would allow for direct access to any coordinate based on any of those axis'
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Now if you store a loooot of coordinates, then you might omit the structure and store the components directly in slices, but do that only if you're confident you really need the performance over the complexity :)
--
do they?
I'd expect (w/o having looked at any assembly) that the former *may*
-depending on the compiler optimizations (or lack thereof)- copy the
whole struct{X,Y} before extracting the X data member.
ie:
// x := a[2].X
tmp := a[2]
x := tmp.X
(but it may as well just be my C++ injured brain...)