Mix together sugar, vanilla and butter until light and fluffy. Mix in the egg yolks. Add in the flour and baking powder and knead with hands until the dough is smooth.
Pack the dough in plastic wrap and chill in refrigerator for at least 30 minutes.
Almond filling
Run the almonds and sugar together in a food processor until the almonds are finely ground (you can decide for yourself how coarse or fine you want them).
Stir in the butter, egg, cognac and/or almond extract (if using).
Assembly
Line the bottom of your cake form with baking paper and grease the sides of the form.
Preheat oven to 350°F (175°C).
Cut 2/3 of the crust dough into slices and press down into the cake form. Cover the bottom of the cake form with the dough and bring the dough 2-3 cm (1 inch) up the sides of the form, pressing until even.
Scoop the almond filling on top of the crust, spreading it evenly across the cake form.
Roll out of the rest of the dough and slice into long strips. Lay the strips of dough across the cake in a grid. Don't worry of the strips break - simply press them back together on the cake.
Gently brush the dough with egg wash.
Bake for about 45 minutes. The top of the cake should be golden brown while the almond filling will remain soft.