Terahertz (THz) links require a line-of-sight (LoS) connection, which is hard to be obtained in most scenarios. For THz communications, analyses based on LoS probability are not accurate, and a new real LoS model should be considered to determine the LoS status of the link in a real 3D environment. Considering unmanned aerial vehicle (UAV)-based THz networks, LoS coverage is analyzed in this work, where nodes are accurately determined to be in LoS or not. Specifically, by modeling an environment with 3D blocks, our target is to locate a set of UAVs equipped with directional THz links to provide LoS connectivity for the distributed users among the 3D obstacles. To this end, we first characterize and model the environment with 3D blocks. Then, we propose a user-friendly algorithm based on 3D spatial vectors, which determines the LoS status of nodes in the target area. In addition, using 3D modeling, several meta-heuristic algorithms are proposed for UAVs' positioning under 3D blocks in order to maximize the LoS coverage percentage. In the second part of the paper, for a UAV-based THz communication network, a geometrical analysis-based algorithm is proposed, which jointly clusters the distributed nodes and locates the set of UAVs to maximize average network capacity while ensuring the LoS state of distributed nodes among 3D obstacles. Moreover, we also propose a sub-optimal hybrid k-means-geometrical-based algorithm with a low computational complexity that can be used for networks where the topology continuously changes, and thus, users' clustering and UAVs' positioning need to be regularly updated. Finally, by providing various 3D simulations, we evaluate the effect of various system parameters such as the number and heights of UAVs, as well as the density and height of 3D obstacles on the LoS coverage.