diff -r 83adf8859c55 -r 022db76c3bff svghmi/geometry.ysl2 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svghmi/geometry.ysl2 Tue Mar 17 07:39:50 2020 +0100 @@ -0,0 +1,145 @@ +// geometry.ysl2 +// +// Geometry (bounding box intersection) definitions + +// This retrieves geometry obtained through "inkscape -S" +// already parsed by python and presented as a list of +// +const "geometry", "ns:GetSVGGeometry()"; + +// Debug data +function "debug_geometry" { + | GEOMETRY : ID, x, y, w, h + foreach "$geometry[@Id = $hmi_elements/@id]" + | «@Id» «@x» «@y» «@w» «@h» +} +!debug_output_calls.append("debug_geometry") + +// Rates 1D intersection of 2 segments A and B +// described respectively with a0,a1 and b0,b1 +def "func:intersect_1d" { + // it is assumed that a1 > a0 and b1 > b0 + param "a0"; + param "a1"; + param "b0"; + param "b1"; + + const "d0", "$a0 >= $b0"; + const "d1", "$a1 >= $b1"; + choose { + when "not($d0) and $d1" + // b contained in a + // a0 0 ))]"""; +}