Closed mostaphaRoudsari closed 5 years ago
the projection idea worked smoothly. now is the time to try merging paths into a single path for outgoing hemisphere:
Quite stunning!
Would you like to see a Three.js version?
@theo-armour thanks!
Would you like to see a Three.js version?
I would love to but once we have #3 figured out. It will change the geometry and hence the Three.js model. It can actually be quite interesting to see it in 3D. 👍
This is related to #3 but I thought I should start a new issue for this specific topic.
I did re-wrote @andyrew's implementation for drawing incident patches last night. The way the script works is that it draws the patches as line segments and circles. It works but it has a number of limitation - specially when it is used for outgoing hemisphere:
lack of data binding: since every patch is drawn as unconnected segments there is no data-binding. For the incident hemisphere it will be fine as we can use the mouse cursor position to calculate theta and phi but with data-binding it will be much more elegant. It will also make interaction between two charts much easier.
intensive boolean union process: another result of this approach is inability to use inbuilt boolean union methods for merging the patches with the same value for outgoing hemisphere. Right now Andy tries to find all the neighboring patches with the same value and draw the boundary line for them. It works but it would be much nicer to just use clipper.js or other available options: http://bl.ocks.org/nitaku/8751669/d2c51d092ae45d42037dfcd611aa312d359abcfd
I think we should implement this projection as a D3 Projection (https://github.com/d3/d3-geo/blob/master/README.md#projections) and then just use the projection to draw the patches like a champ! This will address both of the above issues and it can potentially make the second one much easier. We can run the Boolean operations before the projection on square shapes and then project the final shape in one go!
There is only one challenge: As of now I have no idea how to implement a new projection for D3 and I'm not sure when I get some quality free time to learn about it and implement it. Meanwhile I hope someone else figures this out!