Triangle centres

 I wanted to depict the centroid, incentre and orthocentre of an arbitrary triangle using python311 and matplotlib. The goal was to make the image seen in the Wikipedia image below.



https://en.wikipedia.org/wiki/File:Triangle_centers2.svg


So, here was the starting version below.

Just a start.
Code to do this consists of 4 files. One each for the three centres and a third one dotri3.py that does the actual matplotlib drawing. A lot was learned, especially about Python, editors including IDLE and Thonny and arrangements of functions with imports.
The programs are:
dotri3.py <script src="https://pastebin.com/embed_js/cqjsdxcb"></script>
cntroid7.py <script src="https://pastebin.com/embed_js/C14Ns3aS"></script>
incentre7.py <script src="https://pastebin.com/embed_js/wnjirfCE"></script>
ortho6.py <script src="https://pastebin.com/embed_js/XvekbJPf"></script>

Further
 Further work on this project includes:
  • Adding labels for diagram and axes
  • A legend for colour meaning. For example centroid and medians are green
  • Circumcircle
  • Incircle
  • Coordinates
  • Labels A,B,C for vertices.
  • An associated Tkinter GUI to select triangle vertices with display options
  • Some sort of animation
  • Display of Euler line (see below)
  • An associated text file for listing all the line equations and other data





 

Comments

Popular posts from this blog

Reading LittleFS file into buffer for sending

ESP32 buttons and bouncing