In this project, we consider the shape optimization of a dielectric scatterer aiming at efficient directional routing of light. In the studied setting, light interacts with a penetrable scatterer with dimension comparable to the wavelength of an incoming planar wave. The design objective is to maximize the scattering efficiency inside a target angle window. For this, a Helmholtz problem with a piecewise constant refractive index medium models the wave propagation, and an accurate Dirichlet-to-Neumann map models an exterior domain. The strategy consists of using a high-order finite element (FE) discretization combined with gradient-based numerical optimization. The latter consists of a quasi-Newton (BFGS) with backtracking line search. A discrete adjoint method is used to compute the sensitivities with respect to the design variables. Particularly, for the FE representation of the curved shape, we use a bilinear transfinite interpolation formula, which admits explicit differentiation with respect to the design variables. We exploit this fact and show in detail how sensitivities are obtained in the discrete setting. We test our strategy for a variety of target angles, different wave frequencies, and refractive indexes. In all cases, we efficiently reach designs featuring high scattering efficiencies that satisfy the required criteria.