private void calculateLocalNorthAndUpInCelestialCoords(boolean forceUpdate){
  long currentTime=clock.getTimeInMillisSinceEpoch();
  if (!forceUpdate && Math.abs(currentTime - celestialCoordsLastUpdated) < MINIMUM_TIME_BETWEEN_CELESTIAL_COORD_UPDATES_MILLIS) {
    return;
  }
  celestialCoordsLastUpdated=currentTime;
  updateMagneticCorrection();
  RaDec up=calculateRADecOfZenith(getTime(),location);
  upCelestial=GeocentricCoordinates.getInstance(up);
  Vector3 z=AXIS_OF_EARTHS_ROTATION;
  float zDotu=scalarProduct(upCelestial,z);
  trueNorthCelestial=addVectors(z,scaleVector(upCelestial,-zDotu));
  trueNorthCelestial.normalize();
  trueEastCelestial=Geometry.vectorProduct(trueNorthCelestial,upCelestial);
  Matrix33 rotationMatrix=Geometry.calculateRotationMatrix(magneticDeclinationCalculator.getDeclination(),upCelestial);
  Vector3 magneticNorthCelestial=Geometry.matrixVectorMultiply(rotationMatrix,trueNorthCelestial);
  Vector3 magneticEastCelestial=vectorProduct(magneticNorthCelestial,upCelestial);
  axesMagneticCelestialMatrix=new Matrix33(magneticNorthCelestial,upCelestial,magneticEastCelestial);
}

private void calculateLocalNorthAndUpInCelestialCoords ( boolean forceUpdate ) { long currentTime = clock . getTimeInMillisSinceEpoch ( ) ; if ( ! forceUpdate && Math . abs ( currentTime - celestialCoordsLastUpdated ) < MINIMUM_TIME_BETWEEN_CELESTIAL_COORD_UPDATES_MILLIS ) { return ; } celestialCoordsLastUpdated = currentTime ; updateMagneticCorrection ( ) ; RaDec up = calculateRADecOfZenith ( getTime ( ) , location ) ; upCelestial = GeocentricCoordinates . getInstance ( up ) ; Vector3 z = AXIS_OF_EARTHS_ROTATION ; float zDotu = scalarProduct ( upCelestial , z ) ; trueNorthCelestial = addVectors ( z , scaleVector ( upCelestial , - zDotu ) ) ; trueNorthCelestial . normalize ( ) ; trueEastCelestial = Geometry . vectorProduct ( trueNorthCelestial , upCelestial ) ; Matrix33 rotationMatrix = Geometry . calculateRotationMatrix ( magneticDeclinationCalculator . getDeclination ( ) , upCelestial ) ; Vector3 magneticNorthCelestial = Geometry . matrixVectorMultiply ( rotationMatrix , trueNorthCelestial ) ; Vector3 magneticEastCelestial = vectorProduct ( magneticNorthCelestial , upCelestial ) ; axesMagneticCelestialMatrix = new Matrix33 ( magneticNorthCelestial , upCelestial , magneticEastCelestial ) ; }
calculates local north , east and up vectors in terms of the celestial coordinate frame .
