File: is_clockwise.cpp

package info (click to toggle)
mapnik 3.0.12%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 17,084 kB
  • ctags: 18,454
  • sloc: cpp: 142,516; python: 1,416; sh: 769; makefile: 170; xml: 140; lisp: 13
file content (27 lines) | stat: -rw-r--r-- 1,081 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "catch.hpp"

#include <mapnik/geometry.hpp>
#include <mapnik/util/is_clockwise.hpp>

TEST_CASE("Ring is_clockwise") {

    // Input is rather thin triangle to test precision issues aren't getting in the way.
    SECTION("Clockwise")
    {
        mapnik::geometry::linear_ring<double> ring;
        ring.emplace_back(-13499697.0366658326, 4698431.85179749783);
        ring.emplace_back(-13499697.1113113686, 4698431.85179749783);
        ring.emplace_back(-13499697.0366658326, 4698431.92644303292);
        ring.emplace_back(-13499697.0366658326, 4698431.85179749783);
        REQUIRE(mapnik::util::is_clockwise(ring) == true);
    }
    SECTION("Anti-Clockwise")
    {
        mapnik::geometry::linear_ring<double> ring;
        ring.emplace_back(-13499697.0366658326, 4698431.85179749783);
        ring.emplace_back(-13499697.0366658326, 4698431.92644303292);
        ring.emplace_back(-13499697.1113113686, 4698431.85179749783);
        ring.emplace_back(-13499697.0366658326, 4698431.85179749783);
        REQUIRE(mapnik::util::is_clockwise(ring) == false);
    }
}