diff -r 1cf21430ed4a -r 921f620577e8 svghmi/geometry.ysl2 --- a/svghmi/geometry.ysl2 Wed Oct 05 20:44:01 2022 +0200 +++ b/svghmi/geometry.ysl2 Thu Oct 06 10:02:46 2022 +0200 @@ -145,3 +145,16 @@ result """$candidates[(@Id = $groups/@id and (func:intersect($g, .) = 9)) or (not(@Id = $groups/@id) and (func:intersect($g, .) > 0 ))]"""; } + +def "func:offset" { + param "elt1"; + param "elt2"; + const "g1", "$geometry[@Id = $elt1/@id]"; + const "g2", "$geometry[@Id = $elt2/@id]"; + const "result" vector { + attrib "x" value "$g2/@x - $g1/@x"; + attrib "y" value "$g2/@y - $g1/@y"; + } + result "exsl:node-set($result)"; +} +