Git Product home page Git Product logo

triangle_centers's Introduction

Triangle Center Program in Python

by: Lachi Balabanski

Information:

Two important centers of triangles are the circumcenter and centroid. The circumcenter is found by constructng perpindicular bisectors from two or more sides of the triangle and finding their intersection. The circumcenter of a triangle is found by creating medians form two or more sides of the triangle and finding their intersections. Medians are lines that pass through the midpoint of two of the triangle's points and opposite vertex of a triangle

The circumcenter is important, because it is equidistant from all points on the triangle. For instance, a park owner would want to place the bathrooms equidistant from his three rides. He would need to locate the circumcenter for the exact location of his bathroom.

The centroid is important, because it is the center of mass or center of gravity for a triangle of uniform density.

This repo was created as an exercise in matplotlib and numpy

Use:

The parameters are:

  • Point1(-p1): The first point of the triangle. Give as a comma seperated string of numbers i.e. "2,3"
  • Point2(-p2): The second point of the triange. Same as point one
  • Point3(-p3): The third point of the triangle. Same as points two and one
  • Show(-s): Displays the graph. Give as a python boolean i.e. "True" *Only not required field*
  • Type(-t): The type of center you want to calculate. Give as string either "circ" or "cent" where circ is the circumcenter and cent is the centroid

IMPORTANT: When giving negative numbers replace the negative sign '-' with '~'

An example for generating a graph of the triangle and circumcenter for the triangle with points (2,3), (-1,0), (4,1):

$python main.py -p1 2,3 -p2 ~1,0 -p3 4,1 -s True -t circ

If done correctly, the program should output:

====================

circumcenter: (1.5, 0.5)

circumcircle radius: 4.949747

====================

Thank you for using Lachi Balabanski's triangle program

Thank you for using my triangle centers repository!

triangle_centers's People

Contributors

lachibal2 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.