neworigin static method
List<GeoCoordinate2D>
neworigin(
- GeoCoordinate2D origin,
- List<
GeoCoordinate2D> coords, [ - bool bInPlace = false
Shift coordinates to a new origin by subtracting each coordinates (x,y) with the new origin.
If bInPlace
is true, the coords
array values will be updated, otherwise a new coordinate array will be returned.
Implementation
static List<GeoCoordinate2D> neworigin(
GeoCoordinate2D origin, List<GeoCoordinate2D> coords,
[bool bInPlace = false]) {
if (bInPlace) {
for (GeoCoordinate2D coord in coords) {
coord.x = coord.x - origin.x;
coord.y = coord.y - origin.y;
}
return coords;
} else {
List<GeoCoordinate2D> newcoords = <GeoCoordinate2D>[];
for (GeoCoordinate2D coord in coords) {
newcoords.add(GeoCoordinate2D(coord.x - origin.x, coord.y - origin.y));
}
return newcoords;
}
}