Skip to content

StructArrays interface for points #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
asinghvi17 opened this issue May 5, 2020 · 8 comments
Open

StructArrays interface for points #29

asinghvi17 opened this issue May 5, 2020 · 8 comments

Comments

@asinghvi17
Copy link
Contributor

When calling into C functions with large arrays of points, it would be useful to have mutable StructArrays of points. As far as I understand it, this would just involve defining a static schema for Points.

Would this be a wanted feature? Also, how would we handle vectors of n-dimensional Points?

@SimonDanisch
Copy link
Member

it would be useful to have mutable StructArrays of point

Why? Can you give a concrete example?

@asinghvi17
Copy link
Contributor Author

Transformations with the Proj library come to mind - it accepts separate arrays of x, y, and z, and the most efficient mode of operation is to operate in place. Having 3 arrays of x, y, and z which could be transformed in place would be pretty useful, especially when you get into >500K points.

@SimonDanisch
Copy link
Member

I thought this was trivially supported, but can't find the correct constructor right now :D Evidence, that this should be made easier & documented...

@SimonDanisch
Copy link
Member

After talking with @piever it may be a bug:
JuliaArrays/StructArrays.jl#126

@asinghvi17
Copy link
Contributor Author

Well I tried it a while ago...the issue is that we store the data in a tuple, so StructArrays just makes an array of tuples, which is useless for this. We need to define our own static schema which takes, for example, a Point3f0, and maps it to x, y, and z (or x1, x2 and x3, but that's uglier)...

@SimonDanisch
Copy link
Member

Yeah, but this is supposed to "just work"... So lets see if we can have this fixed ;)

@piever
Copy link
Contributor

piever commented May 5, 2020

I've commented over at JuliaArrays/StructArrays.jl#126 (comment). It can be made to work already if one calls the constructor in a slightly different way, and one gets a

StructArray(data::StructArray(::Array{Float32,1}, ::Array{Float32,1}, ::Array{Float32,1}))

@SimonDanisch
Copy link
Member

Alright, that's fair! I think GeometryBasics should just support a convenience constructor for this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants