timohausmann / quadtree-ts

Quadtree Typescript Implementation
https://timohausmann.github.io/quadtree-ts/
MIT License
131 stars 15 forks source link

lines laying perfectly betwen quads are "lost" #13

Open SirStisx opened 11 months ago

SirStisx commented 11 months ago

using the quadtree to store edges of a mesh. in the nature of the mesh and the "perfect" sizing makes some edges laying directly on the edge between 2 quads. this results in no query returning this edge. i have tryed changeing max levels to confirm.

image

lines are aded with the insert method ''' ts this.tree.insert(new Line({ x1, y1, x2, y2, data })) ''' im doing a intersec point on the red point. getting the red lines as result but missing the blue line under the red dot

to me it looks like its lost since its not inside any quad. it may also be the case that the x1,y1 and the x2,y2 point is in the intersection between the quads

timohausmann commented 11 months ago

Thanks for bringing this up, we should add a test for this case where lines lie directly on edges.

The current Line.getIndex has another flaw I know of (I just added https://github.com/timohausmann/quadtree-ts/issues/14). I will investigate during the holidays.