Skip to main content

# Geometrify

Geometrify is a Python package for working with 2D coordinate geometry. It provides a comprehensive set of tools for performing operations such as distance calculation, angle measurement, rotation, translation, and scaling of geometries. With Geometrify, you can easily create, manipulate, and analyze complex 2D geometries with ease.

Usage

  • Make sure you have installed Python in your system.

  • Run the following command in Command Prompt.

pip install Geometrify

Example

from Geometrify.geometry import Coordinate

# Create two coordinate points
point1 = Coordinate(1, 2)
point2 = Coordinate(4, 5)

Basic Operations

# Basic operations such as addition, subtraction, multiplication and division of the coordinates
added_point = point1 + point2 # Coordinate(5, 7)
substracted_point = point1 - point2 # Coordinate(-3, -3)
multiplied_point = point1 * point2 # Coordinate(4, 10)
divided_point = point1 / point2 # Coordinate(0.25, 0.4)

Distance calculation

distance = point1.distance(point2) # 4.243

Midpoint calculation

midpoint = point1.midpoint(point2) # Coordinate(2.5, 3.5)

Slope calculation

slope = point1.slope(point2) # 1.0

Angle calculation with respect to positive X-axis

point2.angle_with_positive_x(point3) # 18.435

Angle calculation with respect to positive Y-axis

point2.angle_with_positive_y(point3) # 71.565

Angle between two lines given their slopes

angle = Coordinate.angle_between_slopes(1.75,0.27) # 45.146

Calculates the area of a triangle formed by three coordinates

point3 = Coordinate(7, 6)
triangle_area = point1.triangle_area(point2, point3) # 3.0

Reflect a point about a line

line_start = Coordinate(0, 0)
line_end = Coordinate(1, 1)
reflected_point = point1.reflect(line_start, line_end) # Coordinate(2.0, 1.0)

Translate a point

translated_point = point1.translate(2, 3) # Coordinate(3, 5)

Scale a point

scaled_point = point1.scale(2) # Coordinate(2, 4)

Intersection point of two lines

point4 = Coordinate(23,12)
intersection = Coordinate.line_intersection(point1,point2,point3,point4) # Coordinate(3.8,4.8)

Distance between a point and a line

# Create two Coordinate objects to represent the start and end points of a line
line_start = Coordinate(1, 1)
line_end = Coordinate(4, 5)

# Create a third Coordinate object to represent a point
point = Coordinate(2, 3)

# Use the distance_to_line method to calculate the distance between the point and the line
distance = point.distance_to_line(line_start, line_end) # 0.4

Equation of the line passing through two points

equation = line_start.line_equation(line_end) # y = 1.333x + (-0.333)

Metadata

Release files for Geometrify 1.0.4

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

Built distribution (wheel)

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

Release files / Geometrify-1.0.4-py3-none-any.whl

Download URL Geometrify-1.0.4-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
21a74ece88a5dafcb4c8c85b519ccf52184638c0e4239cdad9f01c10b9c85f39
BLAKE2b-256 checksum
How to use checksums
484f708b4787a953868508b1fdbfab157d6a75c70b5ed9864512dd3fae4b6c69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

1.0.4 This release

1 release file

1.0.3

1 release file

0.0.5

2 release files

0.0.4

2 release files

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

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