Optimizing the trajectory of directional wellbores is essential to minimize drilling costs and the impacts of potential drilling problems. It poses multi-objective optimization challenges. Well-design optimization models initially focus on wellborelength minimization, but ideally also need to consider minimizing the surface torque during drilling and address, among other constraints, collision avoidance with offset wells. A novel trajectory-optimization model is described that computes the separation factor along the wellbore. It employs a genetic optimization algorithm with an objective function that maximizes the minimum separation factor along the entire length of a wellbore. Plausible well trajectories are identified within a feasible solution space defined by user-identified constraints. The simplicity and effectiveness of the proposed model are demonstrated using a case study involving real well data from the Reshadat oil field offshore southern Iran. In the case considered, a proposed well trajectory is identified as unsafe in terms of its minimum separation factor with an offset well and is re-planned with the proposed model to achieve a safer trajectory.