Skip to main content

Geometrify is a Python package for easy creation, manipulation,

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Geometrify-1.0.4-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file Geometrify-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: Geometrify-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for Geometrify-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 21a74ece88a5dafcb4c8c85b519ccf52184638c0e4239cdad9f01c10b9c85f39
MD5 1418bdae9c2ae36826e1ff15700ec34d
BLAKE2b-256 484f708b4787a953868508b1fdbfab157d6a75c70b5ed9864512dd3fae4b6c69

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page