Skip to main content

coordinate_geometry

Features

  • Helps to perform various operations on points like calculate distance between them, write equation formed by them
  • Perform various tasks in equation of lines like calculate distance between point and line , find image of point in a line etc
  • find area of triangle formed by three points , incentre , circumcentre, orthocentre etc

Important things to know about equations

  • equation_type1(slope , y_intercept) --> Creates a line object with slope and y_intercept

  • equation_type2(a, b, c) --> Creates a line object in form ax + by + c = 0

  • equation_type3(x_intercept , y_intercept) --> Creates a line object with x_intercept and y_intercept

  • equation_type4(pt:point , slope) --> Creates a line object with pt ( a point object ) and slope

  • equation_type5(pt:point , pt2:point) --> Creates a line object with given two point objects , throws error if both points are same

  • These types can not be used to make lines parallel to y-axis

IMPORTS

from coordinate_geometry.point import *
from coordinate_geometry.equations import *
from coordinate_geometry.triangle import *

Examples

Point

Distance Formula

p1=point(3,0)
p2=point(0,4)
print(p1.distance(p2)) # --> 5.0

Section Formula

Internal division

p1=point(4,4)
p2=point(8,8)
print(p1.section(p2,m=1,n=3)) # --> ( 5.0 , 5.0 )

External division

p1=point(4,4)
p2=point(8,8)
print(p1.section(p2,m=1,n=3,external=True)) # --> ( 2.0 , 2.0 )

Slope

p1=point(1,1)
p2=point(3,3)
print(p1.slope(p2)) # --> 1.0

Triangles

A=point(0,0)
B=point(5,0)
C=point(5math.cos(math.pi/3),5math.sin(math.pi/3))
t1=Triangle(A,B,C) # NOTE : THIS IS A EQUILATERAL TRIANGLE , SO IT MUST HAVE SAME INCENTRE, ORHTOCENTRE , CENTROID and CIRCUMCENTRE
print(t1.area()) # --> 10.82532
print(t1.incenter()) --> ( 2.5 , 1.4433757 )
print(t1.centroid()) --> ( 2.5 , 1.4433757 )
print(t1.circumcenter()) --> ( 2.5 , 1.4433757 )
print(t1.orthocenter()) --> ( 2.5 , 1.4433757 )

Line

Solving Two Lines

l1=equation_type2(a=3,b=4,c=-5)
l2=equation_type2(a=3,b=-4,c=-7)
print(l1.solve(l2)) # --> ( 2.0 , -0.25 )

Angle Between two lines

l1=equation_type5(point(1,1),point(2,2))
l2=equation_type5(point(-1,1),point(-3,3))
print(l1.slope) # --> 1.0
print(l2.slope) # --> -1.0
print(l1.angle(l2)) # --> 1.5707963267948966 (PI/2)
print(l1.is_perpendicular(l2)) # --> True
print(l1.is_parallel(l2)) # --> False

Distance Between point and line

l1=equation_type4(point(0,0),0) # X axis
pt=point(3,0)
pt1=point(0,3)
print(l1.distance(pt)) # --> 0.0
print(l1.distance(pt1)) # --> 3.0

Image of a point and foot of perpendicular in a line

l1=equation_type4(point(0,0),1)
pt=point(1,2)
print(l1.foot_of_perpendicular(pt)) # --> ( 1.5 , 1.5 )
print(l1.image_of_point(pt)) # --> ( 2.0 , 1.0 )

LICENSE

© 2021 Deepak Kumar Dash

This repository is licensed under MIT license.
See LICENSE for details

Metadata

Release files for coordinate-geometry 1.0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coordinate-geometry 1.0.0.2
File Size Uploaded Provenance Actions
coordinate_geometry-1.0.0.2.tar.gz 7.2 kB Without provenance Details for coordinate_geometry-1.0.0.2.tar.gz

Release files / coordinate_geometry-1.0.0.2.tar.gz

Download URL coordinate_geometry-1.0.0.2.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d342cb3ffac1ba6e60694ed72911a1df596740fc6c75b1fe38cb585bc3c50716
BLAKE2b-256 checksum
How to use checksums
796933891298dbccf4c0109ad4fbb0c646fcf8d00611677ca9761260280ac2d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

Security for coordinate-geometry 1.0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page