Index: /applications/editors/josm/plugins/NanoLog/nbproject/project.xml
===================================================================
--- /applications/editors/josm/plugins/NanoLog/nbproject/project.xml	(revision 30836)
+++ /applications/editors/josm/plugins/NanoLog/nbproject/project.xml	(revision 30836)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.ant.freeform</type>
+    <configuration>
+        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
+            <name>NanoLog</name>
+        </general-data>
+        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/2">
+            <!-- Не используйте средство настройки свойств проекта при редактировании файла вручную. 
+ Чтобы средство настройки не отображалось, создайте файл nbproject/project.properties и добавьте в него свойство 
+auxiliary.show.customizer=false. 
+Если добавлено свойство 
+auxiliary.show.customizer.message=<message>,
+ при попытке открытия средства настройки любым пользователем будет отображаться заданное сообщение.  -->
+            <name>NanoLog</name>
+            <properties/>
+            <folders>
+                <source-folder>
+                    <label>src</label>
+                    <type>java</type>
+                    <location>src</location>
+                    <encoding>UTF-8</encoding>
+                </source-folder>
+                <source-folder>
+                    <label>NanoLog</label>
+                    <location>.</location>
+                    <encoding>UTF-8</encoding>
+                </source-folder>
+            </folders>
+            <ide-actions>
+                <action name="build">
+                    <target>compile</target>
+                </action>
+                <action name="clean">
+                    <target>clean</target>
+                </action>
+                <action name="run">
+                    <target>runjosm</target>
+                </action>
+                <action name="test">
+                    <target>test</target>
+                </action>
+                <action name="rebuild">
+                    <target>clean</target>
+                    <target>compile</target>
+                </action>
+            </ide-actions>
+            <view>
+                <items>
+                    <source-folder style="packages">
+                        <label>src</label>
+                        <location>src</location>
+                    </source-folder>
+                    <source-file>
+                        <location>build.xml</location>
+                    </source-file>
+                </items>
+                <context-menu>
+                    <ide-action name="build"/>
+                    <ide-action name="rebuild"/>
+                    <ide-action name="clean"/>
+                    <ide-action name="run"/>
+                    <ide-action name="test"/>
+                </context-menu>
+            </view>
+        </general-data>
+        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/3">
+            <compilation-unit>
+                <package-root>src</package-root>
+                <classpath mode="compile">../../core/dist/josm-custom.jar</classpath>
+                <source-level>1.7</source-level>
+            </compilation-unit>
+        </java-data>
+    </configuration>
+</project>
Index: /applications/editors/josm/plugins/NanoLog/src/nanolog/Correlator.java
===================================================================
--- /applications/editors/josm/plugins/NanoLog/src/nanolog/Correlator.java	(revision 30835)
+++ /applications/editors/josm/plugins/NanoLog/src/nanolog/Correlator.java	(revision 30836)
@@ -234,5 +234,5 @@
                                 EastNorth c2 = Main.getProjection().latlon2eastNorth(curWp.getCoor());
                                 if( !c1.equals(c2) ) {
-                                    EastNorth middle = Geometry.getSegmentAltituteIntersection(c1, c2, en);
+                                    EastNorth middle = getSegmentAltitudeIntersection(c1, c2, en);
                                     if( middle != null && en.distance(middle) < 1 ) {
                                         // found our point, no further search is neccessary
@@ -264,3 +264,34 @@
         return 0;
     }
+
+    /**
+     * Returns the coordinate of intersection of segment p1-p2 and an altitude
+     * to it starting at point p. If the line defined with p1-p2 intersects
+     * its altitude out of p1-p2, null is returned.
+     * @param p1
+     * @param p2
+     * @param point
+     * @return Intersection coordinate or null
+     **/
+     public static EastNorth getSegmentAltitudeIntersection(EastNorth p1, EastNorth p2, EastNorth point) {
+        double ldx = p2.getX() - p1.getX();
+        double ldy = p2.getY() - p1.getY();
+
+        if (ldx == 0 && ldy == 0) //segment zero length
+            return p1;
+
+        double pdx = point.getX() - p1.getX();
+        double pdy = point.getY() - p1.getY();
+
+        double offset = (pdx * ldx + pdy * ldy) / (ldx * ldx + ldy * ldy);
+
+        if (offset < -1e-8 || offset > 1+1e-8) return null;
+        if (offset < 1e-8)
+            return p1;
+        else if (offset > 1-1e-8)
+            return p2;
+        else
+            return new EastNorth(p1.getX() + ldx * offset, p1.getY() + ldy * offset);
+     }
+
 }
