code: public Location<T> calculateDriftOffset (Location<T> centerOfMass, Array<SlotAssignment<T>> slotAssignments,
  		FormationPattern<T> pattern) {
  
  		// Clear the center of mass
  		centerOfMass.getPosition().setZero();
  		float centerOfMassOrientation = 0;
  
  		// Make sure tempLocation is instantiated
  		if (tempLocation == null) tempLocation = centerOfMass.newLocation();
  
  		T centerOfMassPos = centerOfMass.getPosition();
  		T tempLocationPos = tempLocation.getPosition();
  
  		// Go through each assignment and add its contribution to the center
  		float numberOfAssignments = slotAssignments.size;
  		for (int i = 0; i < numberOfAssignments; i++) {
  			pattern.calculateSlotLocation(tempLocation, slotAssignments.get(i).slotNumber);
  			centerOfMassPos.add(tempLocationPos);
  			centerOfMassOrientation += tempLocation.getOrientation();
  		}
  
  		// Divide through to get the drift offset.
  		centerOfMassPos.scl(1f / numberOfAssignments);
  		centerOfMassOrientation /= numberOfAssignments;
  		centerOfMass.setOrientation(centerOfMassOrientation);
  
  		return centerOfMass;
  	}
docs: Calculates the drift offset when members are in the given set of slots for the specified pattern.
  @param centerOfMass the output location set to the calculated drift offset
  @param slotAssignments the set of slots
  @param pattern the pattern
  @return the given location for chaining.