The code (as well as to get proper draft) says the chimney must be at least 3 feet from where it passes the high roofline. As well the termination needs to be 2 feet higher than anything within a 10-foot radius.