edouard@2873: // geometry.ysl2 edouard@2872: // edouard@2873: // Geometry (bounding box intersection) definitions edouard@2873: edouard@2873: // This retrieves geometry obtained through "inkscape -S" edouard@2873: // already parsed by python and presented as a list of edouard@2873: // Edouard@3199: const "all_geometry", "ns:GetSVGGeometry()"; Edouard@3199: const "defs", "//svg:defs/descendant-or-self::svg:*"; Edouard@3199: const "geometry", "$all_geometry[not(@Id = $defs/@id)]"; edouard@2873: edouard@2873: // Debug data edouard@2940: emit "debug:geometry" { edouard@2875: | ID, x, y, w, h Edouard@2879: foreach "$geometry" edouard@2873: | «@Id» «@x» «@y» «@w» «@h» edouard@2873: } Edouard@2779: edouard@2872: // Rates 1D intersection of 2 segments A and B edouard@2872: // described respectively with a0,a1 and b0,b1 edouard@2872: def "func:intersect_1d" { edouard@2872: // it is assumed that a1 > a0 and b1 > b0 edouard@2872: param "a0"; edouard@2872: param "a1"; edouard@2872: param "b0"; edouard@2872: param "b1"; Edouard@2792: edouard@2872: const "d0", "$a0 >= $b0"; edouard@2872: const "d1", "$a1 >= $b1"; edouard@2872: choose { edouard@2872: when "not($d0) and $d1" edouard@2872: // b contained in a edouard@2872: // a0 0 ))]"""; edouard@2873: }