/** * Change a vector into a vector with magnitude of one. * * @param vector 3d vector */ static double[] unitVector(double[] vector) { if (vector.length != 3) throw new IllegalArgumentException("Argument not a 3-D vector <dim=" + vector.length + ">."); double magnitude = vectorMagnitude(vector); return (new double[]{vector[0] / magnitude, vector[1] / magnitude, vector[2] / magnitude}); }
scratchVec[2] = sinLat; subSatPoint = VectorMath.vectorScalarMultiplication(scratchVec, earthRadius); north[2] = EllipsoidalEarthModel.earthRadiusKm(PI / 2.0) - subSatPoint[2]; projectMag = VectorMath.vectorDotProduct(north, surfaceNormal) / Math.pow(VectorMath.vectorMagnitude(surfaceNormal), 2.0); north[2] = north[2] - projectMag * surfaceNormal[2]; north = VectorMath.unitVector(north); west = VectorMath.vectorCrossProduct(surfaceNormal, north); west = VectorMath.unitVector(west); scanLine = VectorMath.vectorCrossProduct(surfaceNormal, satHeading); geolocatedPoint[1] = lineOfSightSlope[1] * lineParameter + satPoint[1]; geolocatedPoint[2] = lineOfSightSlope[2] * lineParameter + satPoint[2]; double[] unitVecGeolocatedPoint = VectorMath.unitVector(geolocatedPoint);
scratchVec[2] = sinLat; subSatPoint = VectorMath.vectorScalarMultiplication(scratchVec, earthRadius); north[2] = EllipsoidalEarthModel.earthRadiusKm(PI / 2.0) - subSatPoint[2]; projectMag = VectorMath.vectorDotProduct(north, surfaceNormal) / Math.pow(VectorMath.vectorMagnitude(surfaceNormal), 2.0); north[2] = north[2] - projectMag * surfaceNormal[2]; north = VectorMath.unitVector(north); west = VectorMath.vectorCrossProduct(surfaceNormal, north); west = VectorMath.unitVector(west); scanLine = VectorMath.vectorCrossProduct(surfaceNormal, satHeading); geolocatedPoint[1] = lineOfSightSlope[1] * lineParameter + satPoint[1]; geolocatedPoint[2] = lineOfSightSlope[2] * lineParameter + satPoint[2]; double[] unitVecGeolocatedPoint = VectorMath.unitVector(geolocatedPoint);
scratchVec[2] = sinLat; subSatPoint = VectorMath.vectorScalarMultiplication(scratchVec, earthRadius); north[2] = EllipsoidalEarthModel.earthRadiusKm(PI / 2.0) - subSatPoint[2]; projectMag = VectorMath.vectorDotProduct(north, surfaceNormal) / Math.pow(VectorMath.vectorMagnitude(surfaceNormal), 2.0); north[2] = north[2] - projectMag * surfaceNormal[2]; north = VectorMath.unitVector(north); west = VectorMath.vectorCrossProduct(surfaceNormal, north); west = VectorMath.unitVector(west); scanLine = VectorMath.vectorCrossProduct(surfaceNormal, satHeading); geolocatedPoint[1] = lineOfSightSlope[1] * lineParameter + satPoint[1]; geolocatedPoint[2] = lineOfSightSlope[2] * lineParameter + satPoint[2]; double[] unitVecGeolocatedPoint = VectorMath.unitVector(geolocatedPoint);
/** * Change a vector into a vector with magnitude of one. * * @param vector 3d vector */ static double[] unitVector(double[] vector) { if (vector.length != 3) throw new IllegalArgumentException("Argument not a 3-D vector <dim=" + vector.length + ">."); double magnitude = vectorMagnitude(vector); double[] resultingVector = {vector[0] / magnitude, vector[1] / magnitude, vector[2] / magnitude}; return (resultingVector); }
/** * Change a vector into a vector with magnitude of one. * * @param vector 3d vector */ static double[] unitVector(double[] vector) { if (vector.length != 3) throw new IllegalArgumentException("Argument not a 3-D vector <dim=" + vector.length + ">."); double magnitude = vectorMagnitude(vector); double[] resultingVector = {vector[0] / magnitude, vector[1] / magnitude, vector[2] / magnitude}; return (resultingVector); }