Vertical motions and added resistance of a rectangular and triangular cylinder in waves