The patella (kneecap) is a 'sesamoid bone'. A sesamoid bone is a bone that develops in a muscle tendon, rather than being attached by ligaments to another bone. The tendon in which the patella develops is the tendon of the quadriceps muscle, the big muscle that makes up the bulk of your 'lap'.
The quadriceps muscle at its upper end is actually comprised of four heads- hence the name quadri-ceps, and attach to the hip and the femur bone. It is at the lower end of the quadriceps muscle(s) that the four parts fuse into a common tendon, a strong and fibrous structure that attaches to the tibia bone about three centimetres below the bottom of the patella. It is in this tendon - the quadriceps tendon - that the patella develops.
This illustration shows just the one head of the quadriceps - the most superficial of the four muscles, and which is called the rectus femoris. You can see the sesamoid bone within its tendon.
The place on the tibia bone where the tendon attaches is called the tibial tubercle.