Modifier and Type | Class and Description |
---|---|
static class |
Geometry.AreaAndPerimeter
Data class to hold two double values (area and perimeter of a polygon).
|
static class |
Geometry.PolygonIntersection
The result types for a
polygonIntersection(Area, Area) test |
Modifier and Type | Field and Description |
---|---|
static double |
INTERSECTION_EPS_EAST_NORTH
threshold value for size of intersection area given in east/north space
|
Modifier | Constructor and Description |
---|---|
private |
Geometry() |
Modifier and Type | Method and Description |
---|---|
static Set<Node> |
addIntersections(List<Way> ways,
boolean test,
List<Command> cmds)
Will find all intersection and add nodes there for list of given ways.
|
static boolean |
angleIsClockwise(EastNorth commonNode,
EastNorth firstNode,
EastNorth secondNode)
This method tests if secondNode is clockwise to first node.
|
static <N extends INode> |
angleIsClockwise(N commonNode,
N firstNode,
N secondNode)
This method tests if secondNode is clockwise to first node.
|
static Path2D |
buildPath2DLatLon(List<? extends ILatLon> polygon,
Path2D path2d)
Builds a path from a list of nodes
|
private static boolean |
checkIntersection(Area inter,
double eps)
Check an intersection area which might describe multiple small polygons.
|
static double |
closedWayArea(Way way)
Returns area of a closed way in square meters.
|
private static EastNorth |
closestPointTo(EastNorth p1,
EastNorth p2,
EastNorth point,
boolean segmentOnly) |
static EastNorth |
closestPointToLine(EastNorth lineP1,
EastNorth lineP2,
EastNorth point)
Calculates closest point to a line.
|
static EastNorth |
closestPointToSegment(EastNorth segmentP1,
EastNorth segmentP2,
EastNorth point)
Calculates closest point to a line segment.
|
static Double |
computeArea(IPrimitive osm)
Computes the area of a closed way and multipolygon in square meters, or
null for other primitives |
static List<IPrimitive> |
filterInsideAnyPolygon(Collection<IPrimitive> primitives,
IPrimitive polygon)
Find all primitives in the given collection which are inside the given polygon.
|
static List<IPrimitive> |
filterInsideMultipolygon(Collection<IPrimitive> primitives,
Relation multiPolygon)
Find all primitives in the given collection which are inside the given multipolygon.
|
static List<IPrimitive> |
filterInsidePolygon(Collection<IPrimitive> primitives,
IWay<?> polygon)
Find all primitives in the given collection which are inside the given polygon.
|
static Area |
getArea(List<? extends INode> polygon)
Returns the Area of a polygon, from its list of nodes.
|
static Geometry.AreaAndPerimeter |
getAreaAndPerimeter(List<? extends ILatLon> nodes)
Calculate area and perimeter length of a polygon.
|
static Geometry.AreaAndPerimeter |
getAreaAndPerimeter(List<? extends ILatLon> nodes,
Projection projection)
Calculate area and perimeter length of a polygon in the given projection.
|
static Area |
getAreaEastNorth(IPrimitive p)
Calculate area in east/north space for given primitive.
|
static Area |
getAreaLatLon(Relation multipolygon)
Returns the Area of a polygon, from the multipolygon relation.
|
static EastNorth |
getCenter(List<? extends INode> nodes)
Compute the center of the circle closest to different nodes.
|
static EastNorth |
getCentroid(List<? extends INode> nodes)
Compute the centroid/barycenter of nodes
|
static EastNorth |
getCentroidEN(List<EastNorth> nodes)
Compute the centroid/barycenter of nodes
|
static <T extends OsmPrimitive> |
getClosestPrimitive(OsmPrimitive osm,
Collection<T> primitives)
Get the closest primitive to
osm from the collection of
OsmPrimitive primitives |
static <T extends OsmPrimitive> |
getClosestPrimitives(OsmPrimitive osm,
Collection<T> primitives)
Get the closest primitives to
osm from the collection of
OsmPrimitive primitives |
static WaySegment |
getClosestWaySegment(Way way,
OsmPrimitive primitive)
Get the closest
WaySegment from a way to a primitive. |
static double |
getCornerAngle(EastNorth p1,
EastNorth common,
EastNorth p3)
Returns angle of a corner defined with 3 point coordinates.
|
static double |
getDistance(OsmPrimitive one,
OsmPrimitive two)
Get the distance between different
OsmPrimitive s |
static double |
getDistanceSegmentSegment(Node ws1Node1,
Node ws1Node2,
Node ws2Node1,
Node ws2Node2)
Get the distance between different
WaySegment s |
static double |
getDistanceSegmentSegment(WaySegment ws1,
WaySegment ws2)
Get the distance between different
WaySegment s |
static double |
getDistanceWayNode(Way way,
Node node)
Get the distance between a way and a node
|
static double |
getDistanceWayWay(Way w1,
Way w2)
Get the distance between different ways.
|
static <T extends OsmPrimitive> |
getFurthestPrimitive(OsmPrimitive osm,
Collection<T> primitives)
Get the furthest primitive to
osm from the collection of
OsmPrimitive primitives |
static <T extends OsmPrimitive> |
getFurthestPrimitives(OsmPrimitive osm,
Collection<T> primitives)
Get the furthest primitives to
osm from the collection of
OsmPrimitive primitives |
static ILatLon |
getLatLonFrom(ILatLon original,
double angle,
double offset)
Create a new LatLon at a specified distance.
|
static EastNorth |
getLineLineIntersection(EastNorth p1,
EastNorth p2,
EastNorth p3,
EastNorth p4)
Finds the intersection of two lines of infinite length.
|
static double |
getNormalizedAngleInDegrees(double angle)
Get angles in radians and return its value in range [0, 180].
|
static double |
getSegmentAngle(EastNorth p1,
EastNorth p2)
Returns angle of a segment defined with 2 point coordinates.
|
private static double |
getSegmentNodeDistSq(EastNorth s1,
EastNorth s2,
EastNorth p)
Calculate closest distance between a line segment s1-s2 and a point p
|
private static double[] |
getSegmentSegmentIntersection(double x1,
double y1,
double x2,
double y2,
double x3,
double y3,
double x4,
double y4)
Get the segment-segment intersection of two line segments
|
static EastNorth |
getSegmentSegmentIntersection(EastNorth p1,
EastNorth p2,
EastNorth p3,
EastNorth p4)
Finds the intersection of two line segments.
|
static ILatLon |
getSegmentSegmentIntersection(ILatLon p1,
ILatLon p2,
ILatLon p3,
ILatLon p4)
Finds the intersection of two line segments.
|
static boolean |
isClockwise(List<? extends INode> nodes)
Determines whether path from nodes list is oriented clockwise.
|
static boolean |
isClockwise(Way w)
Determines whether a way is oriented clockwise.
|
static boolean |
isNodeInsideMultiPolygon(INode node,
Relation multiPolygon,
Predicate<Way> isOuterWayAMatch)
Tests if the
node is inside the multipolygon multiPolygon . |
static boolean |
isPolygonInsideMultiPolygon(List<? extends INode> nodes,
Pair<List<MultipolygonBuilder.JoinedPolygon>,List<MultipolygonBuilder.JoinedPolygon>> outerInner,
Predicate<Way> isOuterWayAMatch)
Tests if the polygon formed by
nodes is inside the multipolygon multiPolygon . |
static boolean |
isPolygonInsideMultiPolygon(List<? extends INode> nodes,
Relation multiPolygon,
Predicate<Way> isOuterWayAMatch)
Tests if the polygon formed by
nodes is inside the multipolygon multiPolygon . |
static <N extends INode> |
isToTheRightSideOfLine(N lineP1,
N lineP2,
N lineP3,
N testPoint)
Tests if given point is to the right side of path consisting of 3 points.
|
static double |
multipolygonArea(Relation multipolygon)
Returns area of a multipolygon in square meters.
|
static boolean |
nodeInsidePolygon(INode point,
List<? extends INode> polygonNodes)
Tests if point is inside a polygon.
|
static Geometry.PolygonIntersection |
polygonIntersection(Area a1,
Area a2)
Tests if two polygons intersect.
|
static Geometry.PolygonIntersection |
polygonIntersection(Area a1,
Area a2,
double eps)
Tests if two polygons intersect.
|
static Geometry.PolygonIntersection |
polygonIntersection(List<? extends INode> first,
List<? extends INode> second)
Tests if two polygons intersect.
|
static Pair<Geometry.PolygonIntersection,Area> |
polygonIntersectionResult(Area a1,
Area a2,
double eps)
Calculate intersection area and kind of intersection between two polygons.
|
static boolean |
segmentsParallel(EastNorth p1,
EastNorth p2,
EastNorth p3,
EastNorth p4)
Check if the segment p1 - p2 is parallel to p3 - p4
|
public static final double INTERSECTION_EPS_EAST_NORTH
private Geometry()
public static Set<Node> addIntersections(List<Way> ways, boolean test, List<Command> cmds)
Prerequisite: no two nodes have the same coordinates.
ways
- a list of ways to testtest
- if true, do not build list of Commands, just return nodescmds
- list of commands, typically empty when handed to this method.
Will be filled with commands that add intersection nodes to
the ways.public static <N extends INode> boolean isToTheRightSideOfLine(N lineP1, N lineP2, N lineP3, N testPoint)
(Imagine the path is continued beyond the endpoints, so you get two rays starting from lineP2 and going through lineP1 and lineP3 respectively which divide the plane into two parts. The test returns true, if testPoint lies in the part that is to the right when traveling in the direction lineP1, lineP2, lineP3.)
N
- type of nodelineP1
- first point in pathlineP2
- second point in pathlineP3
- third point in pathtestPoint
- point to testpublic static <N extends INode> boolean angleIsClockwise(N commonNode, N firstNode, N secondNode)
N
- type of nodecommonNode
- starting point for both vectorsfirstNode
- first vector end nodesecondNode
- second vector end nodepublic static EastNorth getSegmentSegmentIntersection(EastNorth p1, EastNorth p2, EastNorth p3, EastNorth p4)
p1
- the coordinates of the start point of the first specified line segmentp2
- the coordinates of the end point of the first specified line segmentp3
- the coordinates of the start point of the second specified line segmentp4
- the coordinates of the end point of the second specified line segmentgetSegmentSegmentIntersection(ILatLon, ILatLon, ILatLon, ILatLon)
public static ILatLon getSegmentSegmentIntersection(ILatLon p1, ILatLon p2, ILatLon p3, ILatLon p4)
p1
- the coordinates of the start point of the first specified line segmentp2
- the coordinates of the end point of the first specified line segmentp3
- the coordinates of the start point of the second specified line segmentp4
- the coordinates of the end point of the second specified line segmentgetSegmentSegmentIntersection(EastNorth, EastNorth, EastNorth, EastNorth)
private static double[] getSegmentSegmentIntersection(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
x1
- The x coordinate of the first point (first segment)y1
- The y coordinate of the first point (first segment)x2
- The x coordinate of the second point (first segment)y2
- The y coordinate of the second point (first segment)x3
- The x coordinate of the third point (second segment)y3
- The y coordinate of the third point (second segment)x4
- The x coordinate of the fourth point (second segment)y4
- The y coordinate of the fourth point (second segment)null
if no intersection was found, otherwise [x, y]public static EastNorth getLineLineIntersection(EastNorth p1, EastNorth p2, EastNorth p3, EastNorth p4)
p1
- first point on first linep2
- second point on first linep3
- first point on second linep4
- second point on second lineIllegalArgumentException
- if a parameter is null or without valid coordinatespublic static boolean segmentsParallel(EastNorth p1, EastNorth p2, EastNorth p3, EastNorth p4)
p1
- First point for first segmentp2
- Second point for first segmentp3
- First point for second segmentp4
- Second point for second segmenttrue
if they are parallel or close to parallelprivate static EastNorth closestPointTo(EastNorth p1, EastNorth p2, EastNorth point, boolean segmentOnly)
public static EastNorth closestPointToSegment(EastNorth segmentP1, EastNorth segmentP2, EastNorth point)
segmentP1
- First point determining line segmentsegmentP2
- Second point determining line segmentpoint
- Point for which a closest point is searched on line segment [P1,P2]closestPointToLine(org.openstreetmap.josm.data.coor.EastNorth, org.openstreetmap.josm.data.coor.EastNorth, org.openstreetmap.josm.data.coor.EastNorth)
public static EastNorth closestPointToLine(EastNorth lineP1, EastNorth lineP2, EastNorth point)
lineP1
- First point determining linelineP2
- Second point determining linepoint
- Point for which a closest point is searched on line (P1,P2)closestPointToSegment(org.openstreetmap.josm.data.coor.EastNorth, org.openstreetmap.josm.data.coor.EastNorth, org.openstreetmap.josm.data.coor.EastNorth)
public static boolean angleIsClockwise(EastNorth commonNode, EastNorth firstNode, EastNorth secondNode)
The line through the two points commonNode and firstNode divides the plane into two parts. The test returns true, if secondNode lies in the part that is to the right when traveling in the direction from commonNode to firstNode.
commonNode
- starting point for both vectorsfirstNode
- first vector end nodesecondNode
- second vector end nodepublic static Area getArea(List<? extends INode> polygon)
polygon
- List of nodes forming polygonpublic static Path2D buildPath2DLatLon(List<? extends ILatLon> polygon, Path2D path2d)
polygon
- Nodes, forming a closed polygonpath2d
- path to add to; can be null, then a new path is createdpublic static Area getAreaEastNorth(IPrimitive p)
MultipolygonCache
for multipolygon relations.p
- the primitivepublic static Area getAreaLatLon(Relation multipolygon)
multipolygon
- the multipolygon relationpublic static Geometry.PolygonIntersection polygonIntersection(List<? extends INode> first, List<? extends INode> second)
first
- List of nodes forming first polygonsecond
- List of nodes forming second polygonpublic static Geometry.PolygonIntersection polygonIntersection(Area a1, Area a2)
a1
- Area of first polygona2
- Area of second polygonpublic static Geometry.PolygonIntersection polygonIntersection(Area a1, Area a2, double eps)
a1
- Area of first polygona2
- Area of second polygoneps
- an area threshold, everything below is considered an empty intersectionpublic static Pair<Geometry.PolygonIntersection,Area> polygonIntersectionResult(Area a1, Area a2, double eps)
a1
- Area of first polygona2
- Area of second polygoneps
- an area threshold, everything below is considered an empty intersectionprivate static boolean checkIntersection(Area inter, double eps)
inter
- the intersection areaeps
- an area threshold, everything below is considered an empty intersectionpublic static boolean nodeInsidePolygon(INode point, List<? extends INode> polygonNodes)
polygonNodes
- list of nodes from polygon path.point
- the point to testpublic static double closedWayArea(Way way)
way
- Way to measure, should be closed (first node is the same as last node)public static double multipolygonArea(Relation multipolygon)
multipolygon
- the multipolygon to measurepublic static Double computeArea(IPrimitive osm)
null
for other primitivesosm
- the primitive to measurenull
public static boolean isClockwise(Way w)
Internals: Assuming a closed non-looping way, compute twice the area
of the polygon using the formula 2 * area = sum (X[n] * Y[n+1] - X[n+1] * Y[n])
.
If the area is negative the way is ordered in a clockwise direction.
w
- the way to be checked.IllegalArgumentException
- if way is not closed (see Way.isClosed()
).public static boolean isClockwise(List<? extends INode> nodes)
nodes
- Nodes list to be checked.IllegalArgumentException
- if way is not closed (see Way.isClosed()
).isClockwise(Way)
public static double getSegmentAngle(EastNorth p1, EastNorth p2)
p1
- first pointp2
- second pointpublic static double getCornerAngle(EastNorth p1, EastNorth common, EastNorth p3)
p1
- first pointcommon
- Common end pointp3
- third pointpublic static double getNormalizedAngleInDegrees(double angle)
angle
- the angle in radianspublic static EastNorth getCentroid(List<? extends INode> nodes)
nodes
- Nodes for which the centroid is wantedgetCenter(java.util.List<? extends org.openstreetmap.josm.data.osm.INode>)
public static EastNorth getCentroidEN(List<EastNorth> nodes)
nodes
- Coordinates for which the centroid is wantedpublic static EastNorth getCenter(List<? extends INode> nodes)
Ensure exact center computation in case nodes are already aligned in circle. This is done by least square method. Let be a_i x + b_i y + c_i = 0 equations of bisectors of each edges. Center must be intersection of all bisectors.
[ a1 b1 ] [ -c1 ] With A = [ ... ... ] and Y = [ ... ] [ an bn ] [ -cn ]An approximation of center of circle is (At.A)^-1.At.Y
nodes
- Nodes parts of the circle (at least 3)getCentroid(java.util.List<? extends org.openstreetmap.josm.data.osm.INode>)
public static boolean isNodeInsideMultiPolygon(INode node, Relation multiPolygon, Predicate<Way> isOuterWayAMatch)
node
is inside the multipolygon multiPolygon
. The nullable argument
isOuterWayAMatch
allows to decide if the immediate outer
way of the multipolygon is a match.
For repeated tests against multiPolygon
better use filterInsideMultipolygon(java.util.Collection<org.openstreetmap.josm.data.osm.IPrimitive>, org.openstreetmap.josm.data.osm.Relation)
.node
- nodemultiPolygon
- multipolygonisOuterWayAMatch
- allows to decide if the immediate outer
way of the multipolygon is a matchtrue
if the node is inside the multipolygonpublic static boolean isPolygonInsideMultiPolygon(List<? extends INode> nodes, Relation multiPolygon, Predicate<Way> isOuterWayAMatch)
nodes
is inside the multipolygon multiPolygon
. The nullable argument
isOuterWayAMatch
allows to decide if the immediate outer
way of the multipolygon is a match.
For repeated tests against multiPolygon
better use filterInsideMultipolygon(java.util.Collection<org.openstreetmap.josm.data.osm.IPrimitive>, org.openstreetmap.josm.data.osm.Relation)
.
If nodes
contains exactly one element, then it is checked whether that one node is inside the multipolygon.
nodes
- nodes forming the polygonmultiPolygon
- multipolygonisOuterWayAMatch
- allows to decide if the immediate outer
way of the multipolygon is a matchtrue
if the multipolygon is valid and the polygon formed by nodes is inside the multipolygonpublic static boolean isPolygonInsideMultiPolygon(List<? extends INode> nodes, Pair<List<MultipolygonBuilder.JoinedPolygon>,List<MultipolygonBuilder.JoinedPolygon>> outerInner, Predicate<Way> isOuterWayAMatch)
nodes
is inside the multipolygon multiPolygon
. The nullable argument
isOuterWayAMatch
allows to decide if the immediate outer
way of the multipolygon is a match.
For repeated tests against multiPolygon
better use filterInsideMultipolygon(java.util.Collection<org.openstreetmap.josm.data.osm.IPrimitive>, org.openstreetmap.josm.data.osm.Relation)
.
If nodes
contains exactly one element, then it is checked whether that one node is inside the multipolygon.
nodes
- nodes forming the polygonouterInner
- result of MultipolygonBuilder.joinWays(Relation)
isOuterWayAMatch
- allows to decide if the immediate outer
way of the multipolygon is a matchtrue
if the multipolygon is valid and the polygon formed by nodes is inside the multipolygonpublic static List<IPrimitive> filterInsideAnyPolygon(Collection<IPrimitive> primitives, IPrimitive polygon)
primitives
- the primitivespolygon
- the closed way or multipolygon relationfilterInsidePolygon(java.util.Collection<org.openstreetmap.josm.data.osm.IPrimitive>, org.openstreetmap.josm.data.osm.IWay<?>)
,
filterInsideMultipolygon(java.util.Collection<org.openstreetmap.josm.data.osm.IPrimitive>, org.openstreetmap.josm.data.osm.Relation)
public static List<IPrimitive> filterInsidePolygon(Collection<IPrimitive> primitives, IWay<?> polygon)
primitives
- the primitivespolygon
- the polygonList
of primitives
, 15730 for a Collection
of primitives
)public static List<IPrimitive> filterInsideMultipolygon(Collection<IPrimitive> primitives, Relation multiPolygon)
primitives
- the primitivesmultiPolygon
- the multipolygon relationpublic static Geometry.AreaAndPerimeter getAreaAndPerimeter(List<? extends ILatLon> nodes)
Uses current projection; units are that of the projected coordinates.
nodes
- the list of nodes representing the polygonpublic static Geometry.AreaAndPerimeter getAreaAndPerimeter(List<? extends ILatLon> nodes, Projection projection)
nodes
- the list of nodes representing the polygonprojection
- the projection to use for the calculation, null
defaults to ProjectionRegistry.getProjection()
public static <T extends OsmPrimitive> T getClosestPrimitive(OsmPrimitive osm, Collection<T> primitives)
osm
from the collection of
OsmPrimitive primitives
The primitives
should be fully downloaded to ensure accuracy.
Note: The complexity of this method is O(n*m), where n is the number of
children osm
has plus 1, m is the number of children the
collection of primitives have plus the number of primitives in the
collection.
T
- The return type of the primitiveosm
- The primitive to get the distances fromprimitives
- The collection of primitives to get the distance toOsmPrimitive
. This is not determinative.
To get all primitives that share the same distance, use
getClosestPrimitives(org.openstreetmap.josm.data.osm.OsmPrimitive, java.util.Collection<T>)
.public static <T extends OsmPrimitive> Collection<T> getClosestPrimitives(OsmPrimitive osm, Collection<T> primitives)
osm
from the collection of
OsmPrimitive primitives
The primitives
should be fully downloaded to ensure accuracy.
Note: The complexity of this method is O(n*m), where n is the number of
children osm
has plus 1, m is the number of children the
collection of primitives have plus the number of primitives in the
collection.
T
- The return type of the primitiveosm
- The primitive to get the distances fromprimitives
- The collection of primitives to get the distance toOsmPrimitive
s. May be empty.public static <T extends OsmPrimitive> T getFurthestPrimitive(OsmPrimitive osm, Collection<T> primitives)
osm
from the collection of
OsmPrimitive primitives
The primitives
should be fully downloaded to ensure accuracy.
It does NOT give the furthest primitive based off of the furthest part of that primitive
Note: The complexity of this method is O(n*m), where n is the number of
children osm
has plus 1, m is the number of children the
collection of primitives have plus the number of primitives in the
collection.
T
- The return type of the primitiveosm
- The primitive to get the distances fromprimitives
- The collection of primitives to get the distance toOsmPrimitive
. This is not determinative.
To get all primitives that share the same distance, use
getFurthestPrimitives(org.openstreetmap.josm.data.osm.OsmPrimitive, java.util.Collection<T>)
public static <T extends OsmPrimitive> Collection<T> getFurthestPrimitives(OsmPrimitive osm, Collection<T> primitives)
osm
from the collection of
OsmPrimitive primitives
The primitives
should be fully downloaded to ensure accuracy.
It does NOT give the furthest primitive based off of the furthest part of that primitive
Note: The complexity of this method is O(n*m), where n is the number of
children osm
has plus 1, m is the number of children the
collection of primitives have plus the number of primitives in the
collection.
T
- The return type of the primitiveosm
- The primitive to get the distances fromprimitives
- The collection of primitives to get the distance toOsmPrimitive
s. It may return an empty collection.public static double getDistance(OsmPrimitive one, OsmPrimitive two)
OsmPrimitive
sone
- The primitive to get the distance fromtwo
- The primitive to get the distance toProjection
).
May return Double.NaN
if one of the primitives is incomplete.
Note: The complexity is O(n*m), where (n,m) are the number of child
objects the OsmPrimitive
s have.
public static double getDistanceWayNode(Way way, Node node)
way
- The way to get the distance fromnode
- The node to get the distance toway
and the node
in
meters (or the unit of the current projection, see Projection
).
May return Double.NaN
if the primitives are incomplete.public static WaySegment getClosestWaySegment(Way way, OsmPrimitive primitive)
WaySegment
from a way to a primitive.way
- The Way
to get the distance from and the WaySegment
primitive
- The OsmPrimitive
to get the distance toWaySegment
that is closest to primitive
from way
.
If there are multiple WaySegment
s with the same distance, the last
WaySegment
with the same distance will be returned.
May return null
if the way has fewer than two nodes or one
of the primitives is incomplete.public static double getDistanceWayWay(Way w1, Way w2)
w1
- The first Way
w2
- The second Way
Projection
).
May return Double.NaN
.public static double getDistanceSegmentSegment(WaySegment ws1, WaySegment ws2)
WaySegment
sws1
- A WaySegment
ws2
- A WaySegment
WaySegment
s in meters
(or the unit of the current projection, see Projection
).
May return Double.NaN
.public static double getDistanceSegmentSegment(Node ws1Node1, Node ws1Node2, Node ws2Node1, Node ws2Node2)
WaySegment
sws1Node1
- The first node of the first WaySegmentws1Node2
- The second node of the second WaySegmentws2Node1
- The first node of the second WaySegmentws2Node2
- The second node of the second WaySegmentWaySegment
s in meters
(or the unit of the current projection, see Projection
).
May return Double.NaN
.public static ILatLon getLatLonFrom(ILatLon original, double angle, double offset)
original
- The originating pointangle
- The angle (from true north) in radiansoffset
- The distance to the new point in the current projection's unitsprivate static double getSegmentNodeDistSq(EastNorth s1, EastNorth s2, EastNorth p)
s1
- start of segments2
- end of segmentp
- the point