Turn[] turns = turns(points); WoundProjection projection = WoundProjection.ofTurns(turns);
@Test public void haworthClockwise() throws Exception { Assert.assertThat(CyclicCarbohydrateRecognition.turns(new Point2d[]{ new Point2d(4.1, 3.0), new Point2d(4.8, 2.6), new Point2d(4.8, 1.8), new Point2d(4.1, 1.4), new Point2d(3.3, 1.8), new Point2d(3.3, 2.6) }), is(new Turn[]{Right, Right, Right, Right, Right, Right})); }
@Test public void boatClockwise() throws Exception { Assert.assertThat(CyclicCarbohydrateRecognition.turns(new Point2d[]{ new Point2d(3.8, 4.8), new Point2d(3.1, 4.2), new Point2d(2.3, 4.2), new Point2d(1.6, 4.9), new Point2d(2.1, 3.8), new Point2d(3.3, 3.8) }), is(new Turn[]{Left, Right, Right, Left, Left, Left})); }
@Test public void chairClockwise() throws Exception { Assert.assertThat(CyclicCarbohydrateRecognition.turns(new Point2d[]{ new Point2d(1.7, 2.4), new Point2d(1.3, 3.1), new Point2d(0.5, 2.9), new Point2d(0.2, 3.1), new Point2d(0.1, 2.4), new Point2d(0.9, 2.6) }), is(new Turn[]{Left, Left, Right, Left, Left, Right})); }
@Test public void haworthAnticlockwise() throws Exception { Assert.assertThat(CyclicCarbohydrateRecognition.turns(new Point2d[]{ new Point2d(4.1, 3.0), new Point2d(3.3, 2.6), new Point2d(3.3, 1.8), new Point2d(4.1, 1.4), new Point2d(4.8, 1.8), new Point2d(4.8, 2.6), }), is(new Turn[]{Left, Left, Left, Left, Left, Left})); }
@Test public void chairAnticlockwise() throws Exception { Assert.assertThat(CyclicCarbohydrateRecognition.turns(new Point2d[]{ new Point2d(0.9, 2.6), new Point2d(0.1, 2.4), new Point2d(0.2, 3.1), new Point2d(0.5, 2.9), new Point2d(1.3, 3.1), new Point2d(1.7, 2.4) }), is(new Turn[]{Left, Right, Right, Left, Right, Right})); }
@Test public void boatAnticlockwise() throws Exception { Assert.assertThat(CyclicCarbohydrateRecognition.turns(new Point2d[]{ new Point2d(3.3, 3.8), new Point2d(2.1, 3.8), new Point2d(1.6, 4.9), new Point2d(2.3, 4.2), new Point2d(3.1, 4.2), new Point2d(3.8, 4.8) }), is(new Turn[]{Right, Right, Right, Left, Left, Right})); }