Endovascular coiling is a primary treatment for intra-cranial aneurysm, which deploys a thin and detachable metal wire inside the aneurysm so as to prevent its rupture. Emerging evidence from medical research and clinical practice has suggested that the coil configuration inside the aneurysm plays a vital role in properly treating aneurysm and predicting its outcome. In this paper, we propose a novel virtual coiling technique, called Ball Winding, for generating a coil configuration with ensured blocking ability. It can be used as an automatic tool for virtually simulating coiling before its implantation and thus optimizes such treatments. Our approach is based on integer linear programming and computational geometry techniques, and takes into consideration the packing density and coil distribution as the performance measurements. The resulting coiling is deployable (with the help of coil pre-shaping) and with minimized energy. Experimental results on both random and real aneurysm data suggest that our proposed method yields near optimal solution.