Program: 45436
Project: 45436
Buggy source:
/** 
 * Returns a vector that represents the origin of a Cell placed optimally, given the bounding volume of the Cell and the "view" Cell Tranform. Also takes the server session, if null, uses the primary session. The origin returned is in world coordinates.
 * @param session The server session
 * @param bounds The bounding volume of the Cell
 * @param viewTransform The transform of the view Cell
 */
public static Vector3f getCellOrigin(ServerSessionManager session,BoundingVolume bounds,CellTransform viewTransform){
  ViewManager vm=ViewManager.getViewManager();
  if (session == null) {
    session=LoginManager.getPrimary();
  }
  Vector3f viewPosition=viewTransform.getTranslation(null);
  Quaternion viewRotation=viewTransform.getRotation(null);
  Vector3f lookAt=CellPlacementUtils.getLookDirection(viewRotation,null);
  logger.info("String_Node_Str" + viewPosition);
  logger.info("String_Node_Str" + lookAt);
  JMECollisionSystem system=(JMECollisionSystem)ClientContextJME.getCollisionSystem(session,"String_Node_Str");
  float minDistance=-1.0f;
  float fov=vm.getViewProperties().getFieldOfView();
  float distance=CellPlacementUtils.getDistance(bounds,fov,MIN_DISTANCE,minDistance);
  logger.info("String_Node_Str" + fov + "String_Node_Str");
  logger.info("String_Node_Str" + distance);
  Vector3f origin=lookAt.mult(distance);
  float yDown=CellPlacementUtils.getVectorToGround(system,viewPosition);
  if (yDown == -1) {
    logger.warning("String_Node_Str" + "String_Node_Str" + viewPosition.y);
    yDown=0;
  }
  float height=CellPlacementUtils.getBoundsHeight(bounds);
  origin.y=height - yDown;
  origin=origin.add(viewPosition);
  logger.info("String_Node_Str" + origin);
  return origin;
}

Fixed version (ground truth):
/** 
 * Returns a vector that represents the origin of a Cell placed optimally, given the bounding volume of the Cell and the "view" Cell Tranform. Also takes the server session, if null, uses the primary session. The origin returned is in world coordinates.
 * @param session The server session
 * @param bounds The bounding volume of the Cell
 * @param viewTransform The transform of the view Cell
 */
public static Vector3f getCellOrigin(ServerSessionManager session,BoundingVolume bounds,CellTransform viewTransform){
  ViewManager vm=ViewManager.getViewManager();
  if (session == null) {
    session=LoginManager.getPrimary();
  }
  Vector3f viewPosition=viewTransform.getTranslation(null);
  Quaternion viewRotation=viewTransform.getRotation(null);
  Vector3f lookAt=CellPlacementUtils.getLookDirection(viewRotation,null);
  logger.info("String_Node_Str" + viewPosition);
  logger.info("String_Node_Str" + lookAt);
  JMECollisionSystem system=(JMECollisionSystem)ClientContextJME.getCollisionSystem(session,"String_Node_Str");
  float minDistance=-1.0f;
  float fov=vm.getViewProperties().getFieldOfView();
  float distance=CellPlacementUtils.getDistance(bounds,fov,MIN_DISTANCE,minDistance);
  logger.info("String_Node_Str" + fov + "String_Node_Str");
  logger.info("String_Node_Str" + distance);
  Vector3f origin=lookAt.mult(distance);
  origin=origin.add(viewPosition);
  float yDown=CellPlacementUtils.getVectorToGround(system,origin);
  if (yDown == -1) {
    logger.warning("String_Node_Str" + "String_Node_Str" + viewPosition.y);
    yDown=0;
  }
  float height=CellPlacementUtils.getBoundsHeight(bounds);
  origin.y+=height - yDown;
  logger.info("String_Node_Str" + origin);
  return origin;
}