Skip to main content

utnamgeo

Python library to solve 2d/3d coordinate geometry

utnamtte

Installation

pip install utnamgeo

Requirements

pip install utnamtte

Documentation

Ways to import

Method 1

import utnamgeo
print(utnamgeo.area_3d(...))

Method 2

from utnamgeo import area_3d
print(area_3d(...))

Method 3

from utnamgeo import area_3d as xy
print(xy(...))

Method 4 ( my favourite)

from utnamgeo import *
print(area_3d(...))

Useful functions

area_2d

 #returns area of triangle with vertices (x1, y1) (x2, y2) and (x3, y3)
 area = area_2d(x1, y1, x2, y2, x3, y3)

area_3d

#returns area of triangle in 3d space with vertices (x1, y1, z1) (x2, y2, z2) and (x3, y3, z3)
area = area_3d(x1, y1, z1, x2, y2, z2, x3, y3, z3)

fop

# returns the x, y, z coordinates of the foot of perpendicular drawn from the point (x3, y3, z3) to the line joining (x1, y1, z1) and  (x2, y2, z2) 
xn, xd, yn, yd, zn, zd = fop(x1, y1, z1, x2, y2, z2, x3, y3, z3)
#returns numerator and denominator of the coordinates

gcd

# returns the HCF(highest common factor) or GCD( Greatest common divisor) {both meaning the same} of two numbers
hcf = gcd(a, b)

intersect

# returns the x, y, z, x(as fraction), y(as fraction), z(as fraction) coordinates of the point of intersection of two lines, 
# line 1: x-x1/(a1n/a1d) = y-y1/(b1n/b1d) = z-z1/(c1n/c1d)
# line 2: x-x2/(a2n/a2d) = y-y/2(b2n/b2d) = z-z2/(c2n/c2d)
xn, xd, yn, yd, zn, zd = intersect(x1, y1, z1, x2, y2, z2, x3, y3, z3)

iscollinear

# returns whether the three points in 2d space are collinear or not
value = iscollinear(x1, y1, x2, y2, x3, y3)
# returns True if collinear and False if not

iscollinear_3d

# returns whether the three points in 3d space are collinear or not
value = iscollinear_3d(x1, y1, z1, x2, y2, z2, x3, y3, z3)
# returns True if collinear and False if not

perimeter_2d

 #returns perimeter of triangle with vertices (x1, y1) (x2, y2) and (x3, y3)
 peri = peri_2d(x1, y1, x2, y2, x3, y3)

perimeter_3d

#yreturns perimeter of triangle in 3d space with vertices (x1, y1, z1) (x2, y2, z2) and (x3, y3, z3)
peri = perimeter_3d(x1, y1, z1, x2, y2, z2, x3, y3, z3)

Centres

Centroid_2d

# Centroid_2d(x1, y1, x2, y2, x3, y3)
a = utnamgeo.Centroid_2d(0, 2,  3, 7, 6, 3)
print("x coordinate:", a.x)
print("y coordinate:", a.y)
Output: 
x coordinate: 3

y coordinate: 4

Centroid_3d

# Centroid_3d(x1, y1, z1, x2, y2, z2, x3, y3, z3)
a = utnamgeo.Centroid_3d(0, 2, 11, 3, 7, 4, 6, 3, 6)
print("x coordinate:", a.x)
print("y coordinate:", a.y)
print("z coordinate:", a.z)
Output:
x coordinate: 3

y coordinate: 4

z coordinate: 7

Circumcentre_2d

# Circumcentre_2d(x1, y1, x2, y2, x3, y3)
a = utnamgeo.Circumcentre_2d(2, -5, 2, 7, 14, -5)
print("x coordinate:", a.x)
print("y coordinate:", a.y)
Output: 
x coordinate:  8

y coordinate:  1

Circumcentre_3d

# Circumcentre_3d(x1, y1, z1, x2, y2, z2, x3, y3, z3)
a = utnamgeo.Circumcentre_3d(2, -5, -3, 2, 7, -3, 14, -5, 6)
print("x coordinate:", a.x)
print("y coordinate:", a.y)
print("z coordinate:", a.z)
Output: 
x coordinate:  8

y coordinate:  1

z coordinate:  5

Excentre_2d

# Excentre_2d(x1, y1, x2, y2, x3, y3)
a = utnamgeo.Excentre_2d(2, -5, 2, 7, 14, -5)
print("x coordinate:", a.xa)
print("y coordinate:", a.ya)
Output: 
x coordinate:  5.11625...

y coordinate: -1.1046...  

Excentre_3d

# Excentre_3d(x1, y1, z1, x2, y2, z2, x3, y3, z3)
a = utnamgeo.Excentre_3d(2, -5, -3, 2, 7, -3, 14, -5, 6)
print("x coordinate:", a.xa)
print("y coordinate:", a.ya)
print("z coordinate:", a.za)
Output: 
x coordinate:  5.11625...

y coordinate: -1.1046...

z coordinate: -0.6628...  

Incentre_2d

# Incentre_2d(x1, y1, x2, y2, x3, y3)
a = utnamgeo.Incentre_2d(2,-5,2,7,14,-5)
print("x coordinate:", a.x)
print("y coordinate:", a.y)
Output:
x coordinate:  5.1162...

y coordinate: -1.1046...

z coordinate: -0.6628...

Incentre_3d

# Incentre_3d(x1, y1, z1, x2, y2, z2, x3, y3, z3)
a = utnamgeo.Incentre_3d(2, -5, -3, 2, 7, -3, 14, -5, 6)
print("x coordinate:", a.x)
print("y coordinate:", a.y)
print("z coordinate:", a.z)
print("In-radius: ", a.radius)
Output:
x coordinate:  5.1162...

y coordinate: -1.1046...

z coordinate: -0.6628...

In-radius:     3.8953...

Orthocentre_2d

# Orthocentre_2d(x1, y1, x2, y2, x3, y3)
a = utnamgeo.Orthocentre_2d(2,5,2,8,14,5)
print("x coordinate:", a.x)
print("y coordinate:", a.y)
Output:
x coordinate: 2

y coordinate: 5

Orthocentre_3d

# Orthocentre_3d(x1, y1, z1, x2, y2, z2, x3, y3, z3)
a = utnamgeo.Orthocentre_3d(2, -5, -3, 2, 7, -3, 14, -5, 6)
print("x coordinate:", a.x)
print("y coordinate:", a.y)
print("z coordinate:", a.z)
Output:
x coordinate: 2

y coordinate: -5

z coordinate: -3 

▶️ Package's YouTube tutorial here

Change Log

0.0.2 (17/06/2023)

  • Fixed Circumcentre_3d function

Metadata

Release files for utnamgeo 0.0.3

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

Source distribution (sdist)

Source distribution for utnamgeo 0.0.3
File Size Uploaded Provenance Actions
utnamgeo-0.0.3.tar.gz 8.7 kB Without provenance Details for utnamgeo-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for utnamgeo 0.0.3
File Interpreter ABI Platform Actions
utnamgeo-0.0.3-py3-none-any.whl Python 3 none any Details for utnamgeo-0.0.3-py3-none-any.whl

Total release size: 15.7 kB

Release files / utnamgeo-0.0.3.tar.gz

Download URL utnamgeo-0.0.3.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cded8695a092c5a387cf84df5721fe58000d58075763327b972d8ca95653140a
BLAKE2b-256 checksum
How to use checksums
64104b3c51ffcbe9d67dd6021ce1bcabfc7a7417e7c741ee1af6338c490f9912
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.10

Release files / utnamgeo-0.0.3-py3-none-any.whl

Download URL utnamgeo-0.0.3-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0e070bf8f42a8bb4cde8fe98c9bd5daa703ef02773c7903b6771b9f56563033
BLAKE2b-256 checksum
How to use checksums
8749356e3c6af73f87d904468f8eaf5a08a2fc22b37ba563c7506960711bad94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.10

Security for utnamgeo 0.0.3

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