Question: what is the formula of calculating the centroid?
Answer: The coordinates of the centroid are simply the average of the coordinates of the vertices. So to find the x coordinate of the orthocenter, add up the three vertex x coordinates and divide by three. Repeat for the y coordinate.