Changeset 13670 in josm for trunk/test/unit
- Timestamp:
- 2018-04-23T23:13:03+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/tools/GeometryTest.java
r12656 r13670 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.tools; 3 4 import static org.junit.Assert.assertEquals; 3 5 4 6 import java.io.FileInputStream; … … 10 12 import org.openstreetmap.josm.TestUtils; 11 13 import org.openstreetmap.josm.data.coor.EastNorth; 14 import org.openstreetmap.josm.data.coor.LatLon; 12 15 import org.openstreetmap.josm.data.osm.DataSet; 16 import org.openstreetmap.josm.data.osm.Node; 13 17 import org.openstreetmap.josm.data.osm.Relation; 14 18 import org.openstreetmap.josm.data.osm.Way; … … 109 113 } 110 114 } 115 116 /** 117 * Test of {@link Geometry#getNormalizedAngleInDegrees(double)} method. 118 */ 119 @Test 120 public void testRightAngle() { 121 Node n1 = new Node(1); 122 Node n2 = new Node(2); 123 Node n3 = new Node(3); 124 n1.setCoor(new LatLon(10.22873540462851, 6.169719398316592)); 125 n2.setCoor(new LatLon(10.229332494162811, 6.16978130985785)); 126 n3.setCoor(new LatLon(10.22924937004949, 6.17060908367496)); 127 128 double angle = Geometry.getNormalizedAngleInDegrees(Geometry.getCornerAngle(n1.getEastNorth(), 129 n2.getEastNorth(), n3.getEastNorth())); 130 assertEquals(90, angle, 1e-8); 131 angle = Geometry.getNormalizedAngleInDegrees(Geometry.getCornerAngle(n1.getEastNorth(), 132 n2.getEastNorth(), n1.getEastNorth())); 133 assertEquals(0, angle, 1e-8); 134 135 n1.setCoor(new LatLon(10.2295011, 6.1693106)); 136 n2.setCoor(new LatLon(10.2294958, 6.16930635)); 137 n3.setCoor(new LatLon(10.2294895, 6.1693039)); 138 139 angle = Geometry.getNormalizedAngleInDegrees(Geometry.getCornerAngle(n1.getEastNorth(), 140 n2.getEastNorth(), n3.getEastNorth())); 141 assertEquals(162.66381817961337, angle, 1e-5); 142 143 angle = Geometry.getNormalizedAngleInDegrees(Geometry.getCornerAngle(n3.getEastNorth(), 144 n2.getEastNorth(), n1.getEastNorth())); 145 assertEquals(162.66381817961337, angle, 1e-5); 146 } 111 147 }
Note:
See TracChangeset
for help on using the changeset viewer.