The geometry of discontinuities in a rock mass is one of the most important influences on the behavior and characteristics of that rock mass. The geometry of discontinuities largely determines the stability of the rock mass, as well as appropriate methods for reinforcing and stabilizing that mass. This study introduces the 3DDGM (three-dimensional discontinuity geometrical modeling) method, which is based on the 3DGM (three-dimensional geometrical modeling) algorithm that was developed using the Mathematica software package. The 3DDGM method provides essential input data for the stability analysis of a discontinuous rock mass using block stability assessment techniques or block modeling codes. The 3DDGM method developed in the present work was designed to model discontinuities in rock masses and to provide accurate values for discontinuity parameters (i.e., location, spacing, separation, system, orientation, etc.). This algorithm was developed to increase the accuracy of the discontinuity model based on the Heliot algorithm. The 3DDGM algorithm was tested by applying it to a real case, the sloping discontinuous rock mass at the phase 7 gas flare site in the South Pars Gas Complex in Assalouyeh, Iran, and the algorithm was successful in providing a three-dimensional model of the discontinuities in the rock mass at the site.