R Under development (unstable) (2024-07-15 r86902 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(s2) > > u = s2_union( + "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))", + "POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))", + s2_options(snap = s2_snap_level(30)) + ) > s2_area(u, radius = 1) [1] 0.05284581 > s2_area("POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))", radius = 1) + + s2_area("POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))", radius = 1) - + s2_area("POLYGON ((5 5, 10 5, 10 15, 5 10, 5 5))", radius = 1) [1] 0.04910511 > s2_area("POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))", radius = 1) [1] 0.03038216 > s2_area("POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))", radius = 1) [1] 0.03002974 > s2_area("POLYGON ((5 5, 10 5, 10 15, 5 10, 5 5))", radius = 1) [1] 0.01130679 > > df = s2_difference( + "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))", + "POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))", + s2_options(snap = s2_snap_level(30)) + ) > s2_area(df, radius = 1) - + (s2_area("POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))", radius = 1) - + s2_area("POLYGON ((5 5, 10 5, 10 15, 5 10, 5 5))", radius = 1)) [1] 0.003740703 > > proc.time() user system elapsed 0.26 0.06 0.31