test_that("signed area / direction", {
poly_cw = cbind(x=c(0,0,1,1,0), y=c(0,1,1,0,0))
poly_ccw = cbind(x=c(0,1,1,0,0), y=c(0,0,1,1,0))
poly_bad = cbind(x=c(0,1,1,0), y=c(0,0,1,1))
expect_equal(ring_signed_area(poly_cw), -1)
expect_equal(ring_signed_area(poly_ccw), 1)
expect_error(ring_signed_area(poly_bad))
expect_true(is_cw(poly_cw))
expect_false(is_cw(poly_ccw))
expect_error(is_cw(poly_bad))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.