On 6 Sep 2020, at 07:49, Mark Heath <silic...@gmail.com> wrote:
This is the code I use to produce a polygon from a cell.
S2Cell cell;
S2Loop cellLoop = new S2Loop(cell);
return new S2Polygon(cellLoop);
I then perform an intersection between this and the target polygon, hopefully you can do something similar with a line segment.
I'm also not 100% sure what your code is doing but I am concerned that you are only getting 2 cell vertices. Cells are not square and need more than 2 points to correctly define them. Also a cell, no matter how small, occupies 2d space on the sphere (even if it's 2mm^2 area). So any intersection with it and a line will result in a sub section of that line, not a point, so not quite sure what your logic is.