Wireless sensor networks can be widely used in the field of complicated large-scale monitoring and tracking, and self-localization of every sensor is a key enabling technology for wireless sensor networks. Based on 2D-Centroid localization algorithm, 3D-Centroid localization algorithm is proposed, Simulation results by using C++ show that the promotion of 2D-Centroid localization algorithm to 3D-Centroid localization algorithm has not obviously increased the complexity of the algorithm, also not affected the coverage, the number of messages exchanged and 2D localization ...