In the thigh, there are medial (adductor), anterior (extensor), and posterior (flexor) compartments:
Most muscles in the medial compartment act mainly on the hip joint.
The large muscles (hamstrings) in the posterior compartment act on the hip (extension) and knee (flexion) because they attach to both the pelvis and bones of the leg.
Muscles in the anterior compartment (quadriceps femoris) predominantly extend the knee.