Interpolates a z value (linearly) between the two coordinates.

@param firstCoordinate
@param lastCoordinate
@param toBeInterpolated
@return
507603
public static double interpolate(Coordinate firstCoordinate, Coordinate lastCoordinate, Coordinate toBeInterpolated) {
        if (Double.isNaN(firstCoordinate.z)) {
            return Double.NaN;
        }
        if (Double.isNaN(lastCoordinate.z)) {
            return Double.NaN;
        }
        return firstCoordinate.z + (lastCoordinate.z - firstCoordinate.z) * firstCoordinate.distance(toBeInterpolated)
                / (firstCoordinate.distance(toBeInterpolated) + toBeInterpolated.distance(lastCoordinate));
    }
1059293
public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) {
    // Read the number of elements from the first 8 bytes.
    final long numElements = Platform.getLong(baseObject, baseOffset);
    assert numElements >= 0 : "numElements (" + numElements + ") should >= 0";
    assert numElements <= Integer.MAX_VALUE :
      "numElements (" + numElements + ") should <= Integer.MAX_VALUE";

    this.numElements = (int)numElements;
    this.baseObject = baseObject;
    this.baseOffset = baseOffset;
    this.sizeInBytes = sizeInBytes;
    this.elementOffset = baseOffset + calculateHeaderPortionInBytes(this.numElements);
  }
1344830
void setCoordinator(LocalTranCoordImpl ltc)
    {
        _coord = ltc;
        if (tc.isDebugEnabled()) Tr.debug(tc, "setCoordinator: LTC="+ltc);
    }
1027927
public static CmsRectangle fromPoints(CmsPoint topLeft, CmsPoint bottomRight) {

        CmsRectangle result = new CmsRectangle();
        result.m_left = topLeft.getX();
        result.m_top = topLeft.getY();
        result.m_width = bottomRight.getX() - topLeft.getX();
        result.m_height = bottomRight.getY() - topLeft.getY();
        return result;
    }
397922
public static Coordinate[] removeRepeatedCoordinates(Coordinate[] coords, double tolerance, boolean duplicateFirstLast) {
        ArrayList<Coordinate> finalCoords = new ArrayList<Coordinate>();        
        Coordinate prevCoord = coords[0];
        finalCoords.add(prevCoord);
        Coordinate firstCoord =prevCoord;        
        int nbCoords = coords.length;
        for (int i = 1; i < nbCoords; i++) {
            Coordinate currentCoord = coords[i];
            if (currentCoord.distance(prevCoord) <= tolerance) {
                continue;
            }
            finalCoords.add(currentCoord);
            prevCoord = currentCoord;

        }
        if (!duplicateFirstLast) {
            if (firstCoord.distance(prevCoord) <= tolerance) {
                finalCoords.remove(finalCoords.size()-1);
            }
        }
        else{
            finalCoords.add(firstCoord);
        }
        return finalCoords.toArray(new Coordinate[0]);
        }
1214824
public static boolean isCircularBoundary(
			CompoundLocation<Location> location, long sequenceLength) {
		if (location.getLocations().size() == 1) {
			return false;// cant be if there is only 1 location element
		}

		boolean lastLocation = false;
		List<Location> locationList = location.getLocations();
		for (int i = 0; i < locationList.size(); i++) {
			if (i == locationList.size() - 1) {
				lastLocation = true;
			}

			Long position = location.getLocations().get(i).getEndPosition();
			if (position == sequenceLength && !lastLocation) {
				return true;
			}
		}
		return false;
	}
403706
public Point3d getCoordinatesFromGridPoint(int gridPoint) {
        int dimCounter = 0;
        Point3d point = new Point3d(0, 0, 0);
        for (int z = 0; z < grid[0][0].length; z++) {
            for (int y = 0; y < grid[0].length; y++) {
                for (int x = 0; x < grid.length; x++) {
                    if (dimCounter == gridPoint) {
                        point.x = minx + latticeConstant * x;
                        point.y = miny + latticeConstant * y;
                        point.z = minz + latticeConstant * z;
                        return point;
                    }
                    dimCounter++;
                }
            }
        }
        return point;
    }
1152862
function ListView_convertCoordinatesByCanvasMargins(coordinates, conversionCallback) {
                    function fix(field, offset) {
                        if (coordinates[field] !== undefined) {
                            coordinates[field] = conversionCallback(coordinates[field], offset);
                        }
                    }

                    var offset;
                    if (this._horizontal()) {
                        offset = this._getCanvasMargins()[this._rtl() ? "right" : "left"];
                        fix("left", offset);
                    } else {
                        offset = this._getCanvasMargins().top;
                        fix("top", offset);
                    }
                    fix("begin", offset);
                    fix("end", offset);

                    return coordinates;
                }
1053771
function(points, firstPoint, lastPoint, tolerance){
                var maxDistance = 0;
                var indexFarthest = 0;
    
                for (var index = firstPoint, distance; index < lastPoint; index++) {
                    distance = perpendicularDistance(points[firstPoint], points[lastPoint], points[index]);
                    if (distance > maxDistance) {
                        maxDistance = distance;
                        indexFarthest = index;
                    }
                }
    
                if (maxDistance > tolerance && indexFarthest != firstPoint) {
                    //Add the largest point that exceeds the tolerance
                    pointIndexsToKeep.push(indexFarthest);
                    douglasPeuckerReduction(points, firstPoint, indexFarthest, tolerance);
                    douglasPeuckerReduction(points, indexFarthest, lastPoint, tolerance);
                }
            }
527382
public void transfToOriginCell(Tuple3d pt) {
		transfToCrystal(pt);

		// convert all coordinates to [0,1) interval
		pt.x = pt.x<0 ? (pt.x%1.0 + 1.0)%1.0 : pt.x%1.0;
		pt.y = pt.y<0 ? (pt.y%1.0 + 1.0)%1.0 : pt.y%1.0;
		pt.z = pt.z<0 ? (pt.z%1.0 + 1.0)%1.0 : pt.z%1.0;

		transfToOrthonormal(pt);
	}
961488
private void firstWalk(TreeNode v, TreeNode leftSibling) {
		if (tree.isLeaf(v)) {
			// No need to set prelim(v) to 0 as the getter takes care of this.

			TreeNode w = leftSibling;
			if (w != null) {
				// v has left sibling

				setPrelim(v, getPrelim(w) + getDistance(v, w));
			}

		} else {
			// v is not a leaf

			TreeNode defaultAncestor = tree.getFirstChild(v);
			TreeNode previousChild = null;
			for (TreeNode w : tree.getChildren(v)) {
				firstWalk(w, previousChild);
				defaultAncestor = apportion(w, defaultAncestor, previousChild,
						v);
				previousChild = w;
			}
			executeShifts(v);
			double midpoint = (getPrelim(tree.getFirstChild(v)) + getPrelim(tree
					.getLastChild(v))) / 2.0;
			TreeNode w = leftSibling;
			if (w != null) {
				// v has left sibling

				setPrelim(v, getPrelim(w) + getDistance(v, w));
				setMod(v, getPrelim(v) - midpoint);

			} else {
				// v has no left sibling

				setPrelim(v, midpoint);
			}
		}
	}
764544
public static Point detectEnd(List<Location> subLocations, boolean isCircular) {
		int end = 0;
		Point lastPoint = null;
		if(isCircular) {
			for (Location sub : subLocations) {
				lastPoint = sub.getEnd();
				end += lastPoint.getPosition();
			}
		}
		else {
			lastPoint = subLocations.get(subLocations.size()-1).getEnd();
			end = lastPoint.getPosition();
		}
		return new SimplePoint(end, lastPoint.isUnknown(), lastPoint.isUncertain());
	}
1082899
@Override
	public void setFirstAxis(double x, double y, double z, double extent) {
		setFirstAxis(x, y, z, extent, CoordinateSystem3D.getDefaultCoordinateSystem());
	}
404979
private int trPivot(int ISAd, int first, int last) {
        int middle;
        int t;

        t = last - first;
        middle = first + t / 2;

        if (t <= 512) {
            if (t <= 32) {
                return trMedian3(ISAd, first, middle, last - 1);
            } else {
                t >>= 2;
                return trMedian5(ISAd, first, first + t, middle, last - 1 - t, last - 1);
            }
        }
        t >>= 3;
        first = trMedian3(ISAd, first, first + t, first + (t << 1));
        middle = trMedian3(ISAd, middle - t, middle, middle + t);
        last = trMedian3(ISAd, last - 1 - (t << 1), last - 1 - t, last - 1);
        return trMedian3(ISAd, first, middle, last);
    }
651694
boolean isCloseTo(final GeoPoint pPoint, final double tolerance,
					  final Projection pProjection, final boolean pClosePath) {
		return getCloseTo(pPoint, tolerance, pProjection, pClosePath) != null;
	}
212939
public static Coordinate[] getFurthestCoordinate(Coordinate base, Coordinate[] coords) {
                double distanceMax = Double.MIN_VALUE;
                Coordinate farCoordinate = null;
                for (Coordinate coord : coords) {
                        double distance = coord.distance(base);
                        if (distance > distanceMax) {
                                distanceMax = distance;
                                farCoordinate = coord;
                        }
                }

                if (farCoordinate != null) {
                        return new Coordinate[]{base, farCoordinate};
                } else {
                        return null;
                }
        }
1023850
public static double setDistanceEpsilon(double newPrecisionValue) {
		if ((newPrecisionValue >= 1) || (newPrecisionValue <= 0)) {
			throw new IllegalArgumentException();
		}
		final double old = distancePrecision;
		distancePrecision = newPrecisionValue;
		return old;
	}