{"id":15034748,"url":"https://github.com/mindorksopensource/gogeom","last_synced_at":"2026-03-06T19:35:23.448Z","repository":{"id":57486902,"uuid":"156205736","full_name":"MindorksOpenSource/gogeom","owner":"MindorksOpenSource","description":"This is a Geometrical library for Go Language. Which includes multiple Geometrical calculations like Circle, Lines etc in different forms","archived":false,"fork":false,"pushed_at":"2019-02-06T12:02:55.000Z","size":63,"stargazers_count":56,"open_issues_count":1,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-09T22:51:37.192Z","etag":null,"topics":["geometric-algorithms","geometric-shapes","geometry","geometry-library","geometry-processing","go","golang","golang-application","golang-examples","golang-library","golang-package","golang-sdk","golang-tools","golang-wrapper"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MindorksOpenSource.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-05T11:19:07.000Z","updated_at":"2023-09-10T09:16:09.000Z","dependencies_parsed_at":"2022-09-01T22:51:22.973Z","dependency_job_id":null,"html_url":"https://github.com/MindorksOpenSource/gogeom","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MindorksOpenSource%2Fgogeom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MindorksOpenSource%2Fgogeom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MindorksOpenSource%2Fgogeom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MindorksOpenSource%2Fgogeom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MindorksOpenSource","download_url":"https://codeload.github.com/MindorksOpenSource/gogeom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125643,"owners_count":21051766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geometric-algorithms","geometric-shapes","geometry","geometry-library","geometry-processing","go","golang","golang-application","golang-examples","golang-library","golang-package","golang-sdk","golang-tools","golang-wrapper"],"created_at":"2024-09-24T20:26:12.856Z","updated_at":"2025-10-29T18:15:50.061Z","avatar_url":"https://github.com/MindorksOpenSource.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/MindorksOpenSource/gogeom/blob/master/example/gogeom.svg\"\u003e\u003c/p\u003e\n\n# Gogeom - A Geometrical library for the Go programming language.\n\u003c!-- #### Refer [Wiki](https://github.com/MindorksOpenSource/gogeom/wiki/Circle) for detailed documentation --\u003e\n[![Mindorks](https://img.shields.io/badge/mindorks-opensource-blue.svg)](https://mindorks.com/open-source-projects) [![Mindorks Community](https://img.shields.io/badge/join-community-blue.svg)](https://mindorks.com/join-community) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n```\nThis is a Geometrical library for Go Language.\nWhich includes multiple Geometrical calculations like Circle, Lines etc in different forms.\n```\n## Installation\n\nInstallation is done using `go get`.\n```\ngo get -u github.com/MindorksOpenSource/gogeom\n```\n\n\n\n#### These are following shape calculation which is supported by gogeom.\n- [x]  **Circle**\n- [x]  **Line**\n- [x]  **Ellipse**\n- [x]  **Parabola**\n- [x]  **Triangle**\n- [x]  **Quadrilaterals**\n- [x]  **N-agons(polygons)**\n- [ ] more to come..\n\n# Circle\ngogeom can handle two form of Circle.\n- **Radius Form** \n  ``` \n  (x-a)^2 + (y-b)^2 = r^2 \n  where,\n  (a,b) is the center and \"r\" is the radius of the circle\n  ``` \n- **General Form**\n  ```\n  x2 + y2 + Ax + By+ C = 0\n  where,\n  A,B and C are real numbers\n  ```\n#### Step to follow :\n\n\n- import `shape \"github.com/MindorksOpenSource/gogeom\"`\n- Initalize two circles as (in Radius Form),\n```\nimport geometry \"github.com/MindorksOpenSource/gogeom\"\n\nfunc main() {\n    // (x-a)^2 + (y-b)^2 = r^2 and (x-c)^2 + (y-d)^2 = s^2  are circle equation\n    // r, s are radius of two circles\nr := shape.RadiusFormCircle{\n        // a, b , r , c, d, s\n        2, 3, 4, 5, 6, 7,\n\t}\n}\n```\n-  Initalize two circles as (in General Form),\n```\nimport `shape \"github.com/MindorksOpenSource/gogeom\"\n\nfunc main() {\n// x2 + y2 + Ax + By+ C = 0 and  x2 + y2 + Dx + Ey + F = 0 are circle equation\ng := shape.GeneralFormOfCircle{\n        // a, b , r , c, d, s\n        2, 3, 4, 5, 6, 7,\n\t}\n}\n\n```\n## Calculations for Circles\n| Working                                   | Radius Form                               | General Form        |\n| :-------------                         |:-------------                           | :-----            |\n| **Distance** between two centers of circles| r.DistanceBetweenTwoCenters()    | g.DistanceBetweenTwoCenters()               |\n| **Line  Equation** Connecting Two Centers| \u003csmall\u003er.LineEquationConnectingTwoCenters()\u003c/small\u003e|   \u003csmall\u003eg.LineEquationConnectingTwoCenters()\u003c/small\u003e    |\n| Check if both Circles **Intersect**| r.DoesCircleIntersect()||\n| Check if both  Circles does not **Intersect**| r.AreTwoNonIntersectingCircle()||\n|**Area** of Circle-1 and Circle-2 |r.AreaOfCircles()||\n|**Circumference** of Circle-1 and Circle-2|r.CircumferenceOfCircles()||\n|**∂** is the area of the triangle formed by the two circle centers and one of the intersection point. The sides of this triangle are S, r0 and R0 , the area is calculated by **Heron' s formula**.|r.CalculateDelta()||\n|Calculates  **x1,y1,x2,y2**|r.CalculateXY()||\n|Calculates **x1,y1**|r.CalculateAB()||\n|Calculates  **x2,y2**|r.CalculateCD()||\n|Calculates  **x1,x2**|r.CalculateXs()||\n|Calculates  **y1,y2**|r.CalculateYs()||\n|Calculates the **Line Equation** connecting both intersection points|\u003csmall\u003er.LineEquationConnectingTwoIntersectionPoint()\u003c/small\u003e|\u003csmall\u003eg.LineEquationConnectingTwoIntersectionPoint()\u003c/small\u003e|\n|Check if Both Circles Touch Each other as **tangent**|r.IsTangent()|g.IsTangent()|\n|Check if two circles has **Outer Circle Tangency**|r.IsOuterCircleTangency()||\n|Check if two circle has **Inner Circle Tangency**|r.IsInnerCircleTangency()||\n|Tangential Points|r.TangentPoint()|g.TangentPoint()|\n|Slope of Line of **Intersection Point**|\u003csmall\u003er.SlopeOfConnectingLineOfTwoIntersectionPoint()\u003c/small\u003e|\u003csmall\u003eg.SlopeOfConnectingLineOfTwoIntersectionPoint()\u003c/small\u003e|\n|Radius of Both Circls **R1,R2**||g.RadiusOfTwoCircle()|\n\n# Line\ngogeom can handle two form of Line.\n- **General Form** \n  ``` \n  Ax+By+C =0\n  where A, B and C are any real number and A and B are not both zero.``` \n- **Two Point Form**\n  ```\n  (x1,y1) and (x2,y2) form two lines passing through it\n  ```\n\n  #### Step to follow :\n\n\n- import `shape \"github.com/MindorksOpenSource/gogeom\"`\n- Initalize two lines as (in **General** Form),\n```\n// initialise one line \nl := shape.GeneralLine{\n        // a, b, c\n        2, 3, 4,\n\t}\n}\n\n---- or if you have to initialise multiple line ----\nl := shape.GeneralLines{\n        // a, b, c, d, e, f\n        2, 3, 4, 5, 6, 7,\n\t}\n}\n---- or if you have two point line ----\nl := shape.GeneralLines{\n        // a, b, c, d, e, f\n        2, 3, 4, 5, \n\t}\n}\n\n```\n- Initalize two lines as (in **Two Point Form Line** Form),\n\n## Calculations for Line\n| Working                                   | General Form (Single Line)  | General Form (Multiple Lines)                              | Two Point Form        |\n| :-------------                         |:-------------                         | :-----              | :-----              |\n|Slope of Line| l.SlopeOfLine()||l.SlopeOfLine()|\n|Y-Intercept|l.YIntercept()|||\n|X-Intercept|l.XIntercept()||\n|Mid-Point of the line|||l.MidPoints()|\n|Intersection of two lines **Ax + By + C = 0** and **Dx + Ey + F = 0**||l.IntersectionOfLines()||\n|Point **(x, y)** which divides the line connecting two points **(x1 , y1)** and **(x2 , y2)** in the ratio **p:q**|||l.DividingPoints(p,q)|\n|Point **(x, y)** which divides the line connecting two points **(x1 , y1)** and **(x2 , y2)** **externally** in the ratio **p:q**|||l.ExternalDividingPoints(p,q)|\n|**Angle** Between Two Lines||l.AngleBetweenTwoLines()||\n|**Line Eqn** passing two points|||l.LineThroughTwoPoint()|\n|**EquiDistant Parallel Line**|l.EquiDistantParallelLine()|||\n|Distance Between Two Points|||l.DistanceBetweenTwoPoints()|\n|Distance Between Intercepts|||l.DistanceBetweenInterecepts()|\n \n# Ellipse\nEllipse Equation,\n```\nx^2/a^2 + y^2/b^2 = 1,\n(center at   x = 0   y = 0)\n```       \n #### Step to follow :\n\n\n- import `shape \"github.com/MindorksOpenSource/gogeom\"`\n- Initalize ellipse,\n```\ne := shape.Ellipse {\n        // a, b\n        1,2\n}\n```\n| Working                                   | General Form (Single Line) | Result\n| :-------------                |:-------------    | :-----         \n|Eccentricity of Ellipse|e.GetEccentricity()|float64|\n|Shape Of Locus|e.GetShapeOfLocus()| Circle/Ellipse/Parabola/Hyerbola|\n|Slope Of Tangent Line at **x1,y1**|e.GetSlopeOfTangentLine(x1,y1)| float64|\n|Tangent Line Equation at **x1,y1**|e.GetTangentLineEquation(x1,y1)| string|\n|Ramanujan Approx Circumference of ellipse|e.RamanujanApproxCircumference()| float64|\n\n# Parabola \nGogeom can support two form \n- **Equation of Parabola** \n``` \n  y^2 = 4ax\n  or \n  x^2 = 4ay\n  or \n  (y - k)^2 = 4a(x - h)\n  where, (h,k) are vertex\n  or\n  (x - h)^2 = 4a(y - k)\n  where, (h,k) are vertex\n\n```\n  - import `shape \"github.com/MindorksOpenSource/gogeom\"`\n  - Initalize Parabola,\n```\np := shape.Parabola {\n        1,\n        true // where this boolean value indicates if the parabola is on Y-Axis or not.\n}\n---- or ----\n\np :=shape.Parabola {\n        1,\n        true // where this boolean value indicates if the parabola is on Y-Axis or not.\n}\n```\n#### Step to follow :\n| Working          | Parabola With Origin | Parabola |Result\n| :-------------           |:-------------              | :-----   | :-----   \n|Lenght Of Latus Ration|p.LenghtOfLatusRation()|p.LenghtOfLatusRation()|float64| \n|Focus|p.FocusOfParabola()|p.FocusOfParabola()|float64,float64|\n|Directrix Equation|p.DirectrixEquation()|p.DirectrixEquation()|string|\n|Axis Equation|p.AxisEquation()|p.AxisEquation()|string|\n|Vertex|p.Vertex()||string|\n|Position Of Point - **x,y**||p.PositionOfPoint(x,y)|string|\n|Point Of Interesction - **y = mx + c**||p.PointOfInteresction(m,c)|string|\n|Tangent Equation - **x,y**||p.TangentEquation(x,y)|string|\n|Normal Equation - **x,y**||p.NormalEquation(x,y)|string|\n|Chord Of Contact Equation - **x,y**||p.ChordOfContactEquation(x,y)|string|\n|Polar Of Point - **x,y**||p.PolarOfPoint(x,y)|string|\n|Pole Of line - **lx + my + x = 0** ||p.PoleOfline(l,m)|float64, float64|\n\n# Triangle\nGogeom supports the following types of triangle and their respective calculations\n- Right Angled Triangle\n- Isosceles Triangle\n- Equilateral Triangle\n- Scalene Triangle\n\n#### Step to follow :\n\n\n- import `shape \"github.com/MindorksOpenSource/gogeom\"`\n- Initialize triangles\n```\n//Right Triangle\nrt := shape.RightTriangleSides {\n\t//base, height, hypotenuse\n\t4, 3, 5,\n}\n\n//Isosceles Triangle\nit := shape.IsoscelesTriangleSides {\n\t//base, slants\n\t6,8,\n}\n\n//Equilateral Triangle\net := shape.EquilateralTriangleSides {\n\t//side\n\t6,\n}\n\n//Scalene Triangle\nst := shape.ScaleneTriangleSides {\n\t//side1, side2, side3\n\t3,4,5,\n}\n```\n\n## Calculations for Triangles\n| Triangle | Input values | Working | Calculation | Result|\n| :--- | :--- | :--- | :--- | :--- |\n| Right Triangle | base, height, hypotenuse | Perimeter | rt.PerimeterOfRightTriangle() | float64|\n||| Area | rt.AreaOfRightTriangle() | float64|\n||| Altitude | rt.AltitudeOfRightTriangleBase()  rt.AltitudeOfRightTriangleHeight()  rt.AltitudeOfRightTriangleHypotenuse() | float64 |\n|Isosceles Triangle|base,slants|Perimeter|it.PerimeterOfIsoscelesTriangle()|float64|\n|||Area|it.AreaOfIsoscelesTriangle()|float64|\n|||Altitude|it.AltitudeOfIsoscelesTriangle()|float64|\n|Equilateral Triangle|side|Perimeter|et.PerimeterOfEquilateralTriangle()|float64|\n|||Area|et.AreaOfEquilateralTriangle()|float64 |\n|||Altitude|et.AltitudeOfEquilateralTriangle()|float64|\n|Scalene Triangle|side1, side2, side3|Perimeter  Area|st.PerimeterOfScaleneTriangle()  st.AreaOfScaleneTriangle()|float64|\n\n# Quadrilaterals\nGogeom supports the following types of quadrilaterals and their respective calculations\n- Square\n- Rectangle\n- Parallelogram\n- Trapezium/Trapezoid\n- Rhombus\n- Scalene Quadrilaterals\n\n#### Step to follow :\n- import `shape \"github.com/MindorksOpenSource/gogeom\"`\n- Initialize quadrilaterals\n```\n//when Square sides are known\nsqs := shape.SquareSides {\n\t//side\n\t4,\n}\n\n//when Square diagonals are known\nsqd := shape.SquareDiagonals {\n\t//diagonal\n\t9,\n}\n\n//rectangle\nrct := shape.RectangleSides {\n\t//length, breadth\n\t6,10,\n}\n\n//parallelogram\nplg := shape.ParallelogramSides {\n\t//base, slant, height\n\t10,6,4.5,\n}\n\n//trapezium sides with height\ntph := shape.TrapeziumSidesWithHeight {\n\t//base, top, height\n\t10,5,4.6,\n}\n\n//trapezium sides with slants\ntps := shape.TrapeziumSidesWithSlants {\n\t//base, top, slant1, slant2\n\t10,5,5.2,5.7,\n}\n\n//rhombus with diagonals are known\nrmd := shape.RhombusDiagonals {\n\t//diagonal1, diagonal2\n\t10,8,\n}\n\n//rhombus with sides and height known\nrms := shape.RhombusSides {\n\t//side, height\n\t8,7,\n}\n\n//scalene quadrilateral\nscq := shape.ScaleneQuadrilateralSides {\n\t//side1, side2, side3, side4\n\t4,8,6,5,\n}\n```\n\n## Calculations for Quadrilaterals\n|Quadrilaterals|Input|Working|Calculation|Result|\n|:---|:---|:---|:---|:---|\n|Square|side|Perimeter\u003cbr/\u003eArea\u003cbr/\u003eDiagonal|sqs.PerimeterOfSquare()\u003cbr/\u003esqs.AreaOfSquare()\u003cbr/\u003esqs.DiagonalOfSquare()|float64|\n||diagonal|Perimeter\u003cbr/\u003eArea\u003cbr/\u003eSide|sqd.PerimeterOfSquare()\u003cbr/\u003esqd.AreaOfSquare()\u003cbr/\u003esqd.SideOfSquare()|float64|\n|Rectangle|length,breadth|Perimeter\u003cbr/\u003eArea\u003cbr/\u003eDiagonal|rct.PerimeterOfRectangle()\u003cbr/\u003erct.AreaOfRectangle()\u003cbr/\u003erct.DiagonalOfRectangle()|float64|\n|Parallelogram|base,slant,height|Perimeter\u003cbr/\u003eArea|plg.PerimeterOfParallelogram()\u003cbr/\u003eplg.AreaOfParallelogram()|float64|\n|Trapezium|base,top,height|Area|tph.AreaOfTrapezium()|float64|\n||base,top,slant1,slant2|Perimeter|tps.PerimeterOfTrapezium()|float64|\n|Rhombus|diagonal1,diagonal2|Area\u003cbr/\u003eSide length\u003cbr/\u003ePerimeter|rmd.AreaOfRhombus()\u003cbr/\u003ermd.LengthOfRhombusSides()\u003cbr/\u003ermd.PerimeterOfRhombus()|float64|\n||side,height|Perimeter\u003cbr/\u003eArea|rms.PerimeterOfRhombus()\u003cbr/\u003erms.AreaOfRhombus|float64|\n|Scalene Quadrilaterals|side1,side2,side3,side4|Perimeter|scq.PerimeterOfScaleneQuadrilateral()|float64|\n\n# N-Agon\nGogeom can handle any polygon with given their *number of sides*, *length of sides* and *apothem of the shape*.\n#### Step to follow :\n- import `shape \"github.com/MindorksOpenSource/gogeom\"`\n- Initialize n-agon\n```\n//if polygon\nn := shape.CountAndLengthAndApothemOfAgonSide {\n\t//side_count, side_length, side_apothem\n\t5,6,4.2,\n}\n\n//OR, if hexagon\nn := shape.CountAndLengthAndApothemOfAgonSide {\n\t//side_count, side_length, side_apothem\n\t6,6,4.6,\n}\n```\n\n## Calculations for n-agon (polygons)\n|Input|Working|Calculations|Result|\n|:---|:---|:---|:---|\n|side count,side length,apothem|Perimeter\u003cbr/\u003eArea|n.PerimeterOfAgon()\u003cbr/\u003en.AreaOfAgon()|float64|\n\n### TODO\n* More features related to Geometrical Functions\n\n## If this library helps you in anyway, show your love :heart: by putting a :star: on this project :v:\n\n[Check out Mindorks awesome open source projects here](https://mindorks.com/open-source-projects)\n\n\n#### Contributor\n[Himanshu Singh](https://github.com/hi-manshu)\\\n[Nishchal Raj](https://github.com/nishchalraj)\n\n\n### License\n```\n   Copyright (C) 2018 MINDORKS NEXTGEN PRIVATE LIMITED\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindorksopensource%2Fgogeom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmindorksopensource%2Fgogeom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindorksopensource%2Fgogeom/lists"}