I am working with WorldWind Java. I want to rotate a Vec4 on x,y and z-axis on Earth's Sphere. I found a function calculating the north pointing tangent. My question is how can I rotate this vector. After rotation, I want to find the coordinates of the edge of the lines as shown on the pictures
https://drive.google.com/open?id=1NAWlP3GdipJ1TtrpRRBDKrF6DfrDMcxU
public Vec4 computeNorthPointingTangentAtLocation(Angle latitude, Angle longitude)
{
// Latitude is treated clockwise as rotation about the X-axis. We flip the latitude value so that a positive
// rotation produces a clockwise rotation (when facing the axis).
latitude = latitude.multiply(-1.0);
double cosLat = latitude.cos();
double sinLat = latitude.sin();
double cosLon = longitude.cos();
double sinLon = longitude.sin();
// The north-pointing tangent is derived by rotating the vector (0, 1, 0) about the Y-axis by longitude degrees,
// then rotating it about the X-axis by -latitude degrees. This can be represented by a combining two rotation
// matrices Rlat, and Rlon, then transforming the vector (0, 1, 0) by the combined transform:
//
// NorthTangent = (Rlon * Rlat) * (0, 1, 0)
//
// Since the input vector only has a Y coordinate, this computation can be simplified. The simplified
// computation is shown here as NorthTangent = (x, y, z).
//
double x = sinLat * sinLon;
double y = cosLat;
double z = sinLat * cosLon;
return new Vec4(x, y, z).normalize3();
}