---------------
# 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.
.. code-block:: command
pip install Geometrify
Example
-------
.. code-block:: python
from Geometrify.geometry import Coordinate
# Create two coordinate points
point1 = Coordinate(1, 2)
point2 = Coordinate(4, 5)
Basic Operations
----------------
.. code-block:: python
# 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
--------------------
.. code-block:: python
distance = point1.distance(point2) # 4.243
Midpoint calculation
---------------------
.. code-block:: python
midpoint = point1.midpoint(point2) # Coordinate(2.5, 3.5)
Slope calculation
-----------------
.. code-block:: python
slope = point1.slope(point2) # 1.0
Angle calculation with respect to positive X-axis
-------------------------------------------------
.. code-block:: python
point2.angle_with_positive_x(point3) # 18.435
Angle calculation with respect to positive Y-axis
-------------------------------------------------
.. code-block:: python
point2.angle_with_positive_y(point3) # 71.565
Angle between two lines given their slopes
------------------------------------------
.. code-block:: python
angle = Coordinate.angle_between_slopes(1.75,0.27) # 45.146
Calculates the area of a triangle formed by three coordinates
-------------------------------------------------------------
.. code-block:: python
point3 = Coordinate(7, 6)
triangle_area = point1.triangle_area(point2, point3) # 3.0
Reflect a point about a line
-----------------------------
.. code-block:: python
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
------------------
.. code-block:: python
translated_point = point1.translate(2, 3) # Coordinate(3, 5)
Scale a point
-------------
.. code-block:: python
scaled_point = point1.scale(2) # Coordinate(2, 4)
Intersection point of two lines
-------------------------------
.. code-block:: python
point4 = Coordinate(23,12)
intersection = Coordinate.line_intersection(point1,point2,point3,point4) # Coordinate(3.8,4.8)
Distance between a point and a line
-----------------------------------
.. code-block:: python
# 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
-----------------------------------------------
.. code-block:: python
equation = line_start.line_equation(line_end) # y = 1.333x + (-0.333)
Raw data
{
"_id": null,
"home_page": "https://github.com/1abhi6/Geometrify",
"name": "Geometrify",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "2D geometry,Coordinate geometry,Coordinate datatype",
"author": "Abhishek Santosh Gupta",
"author_email": "abhi@getifyme.com",
"download_url": "",
"platform": null,
"description": "---------------\r\n# Geometrify\r\n---------------\r\n\r\nGeometrify 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.\r\n\r\nUsage\r\n-----\r\n\r\n- Make sure you have installed Python in your system.\r\n- Run the following command in Command Prompt.\r\n\r\n.. code-block:: command\r\n\r\n pip install Geometrify\r\n\r\n\r\nExample\r\n-------\r\n\r\n.. code-block:: python\r\n\r\n from Geometrify.geometry import Coordinate\r\n\r\n # Create two coordinate points\r\n point1 = Coordinate(1, 2)\r\n point2 = Coordinate(4, 5)\r\n\r\n\r\nBasic Operations\r\n----------------\r\n\r\n.. code-block:: python\r\n\r\n # Basic operations such as addition, subtraction, multiplication and division of the coordinates\r\n added_point = point1 + point2 # Coordinate(5, 7)\r\n substracted_point = point1 - point2 # Coordinate(-3, -3)\r\n multiplied_point = point1 * point2 # Coordinate(4, 10)\r\n divided_point = point1 / point2 # Coordinate(0.25, 0.4)\r\n\r\n\r\nDistance calculation\r\n--------------------\r\n\r\n.. code-block:: python\r\n\r\n distance = point1.distance(point2) # 4.243\r\n\r\n\r\nMidpoint calculation\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n midpoint = point1.midpoint(point2) # Coordinate(2.5, 3.5)\r\n\r\n\r\nSlope calculation\r\n-----------------\r\n\r\n.. code-block:: python\r\n\r\n slope = point1.slope(point2) # 1.0\r\n\r\n\r\nAngle calculation with respect to positive X-axis\r\n-------------------------------------------------\r\n\r\n.. code-block:: python\r\n\r\n point2.angle_with_positive_x(point3) # 18.435\r\n\r\n\r\nAngle calculation with respect to positive Y-axis\r\n-------------------------------------------------\r\n\r\n.. code-block:: python\r\n\r\n point2.angle_with_positive_y(point3) # 71.565\r\n\r\n\r\nAngle between two lines given their slopes\r\n------------------------------------------\r\n\r\n.. code-block:: python\r\n\r\n angle = Coordinate.angle_between_slopes(1.75,0.27) # 45.146\r\n\r\n\r\nCalculates the area of a triangle formed by three coordinates\r\n-------------------------------------------------------------\r\n\r\n.. code-block:: python\r\n\r\n point3 = Coordinate(7, 6)\r\n triangle_area = point1.triangle_area(point2, point3) # 3.0\r\n\r\n\r\nReflect a point about a line\r\n-----------------------------\r\n\r\n.. code-block:: python\r\n\r\n line_start = Coordinate(0, 0)\r\n line_end = Coordinate(1, 1)\r\n reflected_point = point1.reflect(line_start, line_end) # Coordinate(2.0, 1.0)\r\n\r\n\r\nTranslate a point\r\n------------------\r\n\r\n.. code-block:: python\r\n\r\n translated_point = point1.translate(2, 3) # Coordinate(3, 5)\r\n\r\n\r\nScale a point\r\n-------------\r\n\r\n.. code-block:: python\r\n\r\n scaled_point = point1.scale(2) # Coordinate(2, 4)\r\n\r\n\r\nIntersection point of two lines\r\n-------------------------------\r\n\r\n.. code-block:: python\r\n\r\n point4 = Coordinate(23,12)\r\n intersection = Coordinate.line_intersection(point1,point2,point3,point4) # Coordinate(3.8,4.8)\r\n\r\n\r\nDistance between a point and a line\r\n-----------------------------------\r\n\r\n.. code-block:: python\r\n\r\n # Create two Coordinate objects to represent the start and end points of a line\r\n line_start = Coordinate(1, 1)\r\n line_end = Coordinate(4, 5)\r\n\r\n # Create a third Coordinate object to represent a point\r\n point = Coordinate(2, 3)\r\n\r\n # Use the distance_to_line method to calculate the distance between the point and the line\r\n distance = point.distance_to_line(line_start, line_end) # 0.4\r\n\r\n\r\nEquation of the line passing through two points\r\n-----------------------------------------------\r\n\r\n.. code-block:: python\r\n\r\n equation = line_start.line_equation(line_end) # y = 1.333x + (-0.333)\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Geometrify is a Python package for easy creation, manipulation,",
"version": "1.0.3",
"split_keywords": [
"2d geometry",
"coordinate geometry",
"coordinate datatype"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a4630fae8e6a83d9ddcb391615920fe112b072a8c84ae13c5ed39b4b19870c70",
"md5": "62d2704e0064f6cd3f2f10346c1882a3",
"sha256": "35a19762401269632516de30b4cd1fad871967a762b7313e6203a77986f02efb"
},
"downloads": -1,
"filename": "Geometrify-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "62d2704e0064f6cd3f2f10346c1882a3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 5975,
"upload_time": "2023-03-30T14:19:36",
"upload_time_iso_8601": "2023-03-30T14:19:36.303252Z",
"url": "https://files.pythonhosted.org/packages/a4/63/0fae8e6a83d9ddcb391615920fe112b072a8c84ae13c5ed39b4b19870c70/Geometrify-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-30 14:19:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "1abhi6",
"github_project": "Geometrify",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "geometrify"
}