Accepted practice has you placing your heel on the pedal and rotating said pedal to the bottom of it's stroke. With it there and your heel in place your leg should be at full extension but your hips should be level i.e. your haven't had to 'rock' them to one side to get your leg straight. This should produce the optimum leg extension when the ball of your foot replaces your heel.
If you're like me and have a slight diffference in the length of your legs, you'll have to come to a 'best fit' compromise position.
As above for knee joint.
Oh, and you'll fanny about for ages trying to get it 'perfect'!!!
Dunno about fannying around for ages , but i do understand the odd length leg problem