Changeset 3939 in josm for trunk/src/org/openstreetmap/josm
- Timestamp:
- 2011-03-02T12:12:03+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
r3919 r3939 303 303 //find if the new points overlap existing segments (in case of 90 degree angles) 304 304 Node prevNode = getPreviousNode(selectedSegment.lowerIndex); 305 boolean nodeOverlapsSegment = prevNode != null && Geometry.segmentsPar ralel(initialN1en, prevNode.getEastNorth(), initialN1en, newN1en);305 boolean nodeOverlapsSegment = prevNode != null && Geometry.segmentsParallel(initialN1en, prevNode.getEastNorth(), initialN1en, newN1en); 306 306 boolean hasOtherWays = this.hasNodeOtherWays(selectedSegment.getFirstNode(), selectedSegment.way); 307 307 … … 320 320 //find if the new points overlap existing segments (in case of 90 degree angles) 321 321 Node nextNode = getNextNode(selectedSegment.lowerIndex + 1); 322 nodeOverlapsSegment = nextNode != null && Geometry.segmentsPar ralel(initialN2en, nextNode.getEastNorth(), initialN2en, newN2en);322 nodeOverlapsSegment = nextNode != null && Geometry.segmentsParallel(initialN2en, nextNode.getEastNorth(), initialN2en, newN2en); 323 323 hasOtherWays = hasNodeOtherWays(selectedSegment.getSecondNode(), selectedSegment.way); 324 324 -
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r3650 r3939 290 290 } 291 291 292 public static boolean segmentsPar ralel(EastNorth p1, EastNorth p2, EastNorth p3, EastNorth p4) {292 public static boolean segmentsParallel(EastNorth p1, EastNorth p2, EastNorth p3, EastNorth p4) { 293 293 // Convert line from (point, point) form to ax+by=c 294 294 double a1 = p2.getY() - p1.getY(); … … 300 300 // Solve the equations 301 301 double det = a1 * b2 - a2 * b1; 302 return Math.abs(det) < 1e-13; 302 // remove influence of of scaling factor 303 det /= Math.sqrt(a1*a1 + b1*b1) * Math.sqrt(a2*a2 + b2*b2); 304 return Math.abs(det) < 1e-3; 303 305 } 304 306
Note:
See TracChangeset
for help on using the changeset viewer.