main/src/georegression/geometry/ConvertCoordinates3D_F64.java
public static <T extends GeoTuple3D_F64<T>> T latlonToUnitVector(double lat , double lon , T vector ) {
		if( vector == null )
			vector = (T)new Vector3D_F64();

		vector.x = Math.cos(lat) * Math.cos(lon);
		vector.y = Math.cos(lat) * Math.sin(lon);
		vector.z = -Math.sin(lat);

		return vector;
	}
public static <T extends GeoTuple3D_F64<T>> T latlonToUnitVector(double lat , double lon , T vector ) {
		if( vector == null )
			vector = (T)new Vector3D_F64();

		vector.x = Math.cos(lat) * Math.cos(lon);
		vector.y = Math.cos(lat) * Math.sin(lon);
		vector.z = -Math.sin(lat);

		return vector;
	}
Converts latitude and longitude coordinates into a unit vector

@param lat Radian value from pi to -pi
@param lon Radian value from -pi/2 to pi/2
@param vector (output) Storage for unit vector.  If null is passed in a new instance will be created.
@return Unit vector