The proper knee bend ( which equates to saddle height ) is measured with the pedal at top dead center. The below picture has the pedal at top dead center, the furthest position from ones hip.
The riders leg can never be completely straight while pedalling, this may cause cartilage damage if ones leg gets locked in the straight position. The below photo has the riders leg in a dangerous straight position with the pedal at top dead center. This rider should lower his saddle slightly.
Ones leg should not have too much of a bend while riding. A large bend at the knee will make riding hard, and will not be good for ones joints ( it is highly probable to cause knee pain ). The below photo shows a rider with too much bend in the knee with the pedal at top dead center. This rider should set his saddle higher.
The rider should have a 30 degree knee bend at the bone ( not at the surface of the skin ). The ride will be amazingly comfortable once the seatpost height is properly set. The below photo has a perfect knee bend with pedal at top dead center, hence a perfect saddle height.