Ludii Forum
Is there a way to find the edge location half-way ... - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Problems (https://ludii.games/forums/forumdisplay.php?fid=5)
+--- Forum: Game Problems (https://ludii.games/forums/forumdisplay.php?fid=17)
+--- Thread: Is there a way to find the edge location half-way ... (/showthread.php?tid=602)



Is there a way to find the edge location half-way ... - dale walton - 06-09-2021

Is there a way to find the edge location half-way between two vertices at knight's distance from each other?


RE: Is there a way to find the edge location half-way ... - Eric Piette - 06-10-2021

Hi,

if you have the two cells indices yes you can get the half way edge between these sites.
Here is a define example to do that:



Code:
(define "SharedCells" (intersection (sites Around #1) (sites Around #2)))

(define "HalfWayEdge" 
    (intersection
      (sites Incident Edge of:Cell at:(regionSite ("SharedCells" #1 #2) index:0))
      (sites Incident Edge of:Cell at:(regionSite ("SharedCells" #1 #2) index:1))
    )

)


You can for example call it with ("HalfWayEdge" (last From) (last To))

Regards,
Eric


RE: Is there a way to find the edge location half-way ... - dale walton - 06-10-2021

Thanks, That is very helpful, indeed.