The foramen ovale and foramen rotundum of the skull base serve as critical anatomical approaches for percutaneous puncture of the trigeminal ganglion. Their three-dimensional orientation is crucial for designing surgical pathways and avoiding adjacent vital structures. However, this orientation exhibits significant individual variability, and its assessment currently lacks automated quantitative methods. To address this issue, the present study formulates the puncture foramina orientation estimation as a geometric optimization problem and proposes a coarse-to-fine solution framework: first, a coarse estimate is obtained through adaptive multi-stage random sampling to rapidly cover the feasible region, followed by a refined estimate using optimization techniques based on differentiable rendering. Experiments on 64 foraminal structures from 16 subjects demonstrated that the average angular error of the automatically estimated results was 2.21 °, which is smaller than the inter-observer variability among physicians 4.81 °. The method outperforms manual judgment in terms of accuracy, providing an objective anatomical reference for personalized puncture path planning and demonstrating clear potential for clinical translation.