cormullion / Thebes.jl

Thebes.jl is a simple little package that provides 3D services to Luxor.jl.
https://cormullion.github.io/Thebes.jl/
Other
31 stars 3 forks source link

Queuing gfunction calls based on eyepoint distance #6

Open schneiderfelipe opened 3 years ago

schneiderfelipe commented 3 years ago

pin calls gfunction right away, which leads to unordered faces by default (if I understood this correctly). sortfaces! resolves that, but I think this can be automated by (priority) queuing. Instead of calling gfunction, its call could be queued and that queue stored in a struct. A final pin call on that object then draws everything. Something like:

# queues based on distance from eyepoint
pq = SomeQueue(eyepoint)

# queues gfunction calls - both functions and parameters - instead of actually calling
pin.(pq, [Point3D(randn() * 50, randn() * 50, randn() * 50)
      for x in 1:75, y in 1:75, z in 1:75])

# call all gfunctions in order of priority
pin.(pq)

A drawback would be that the eyepoint has to stay fixed for the queue's whole lifetime, but that's not too bad.