{"id":15394359,"url":"https://github.com/xyproto/shapes","last_synced_at":"2026-06-18T21:32:10.616Z","repository":{"id":136551431,"uuid":"163825967","full_name":"xyproto/shapes","owner":"xyproto","description":"Go module for dealing with shapes and points. Includes an animated example.","archived":false,"fork":false,"pushed_at":"2019-01-03T19:22:37.000Z","size":1112,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T11:32:43.585Z","etag":null,"topics":["ascii-graphics","fractions","points","shapes","software-rendering"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xyproto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-02T10:18:58.000Z","updated_at":"2019-03-21T02:41:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"0f0d2636-fc10-4610-9bb9-a72e58f303e7","html_url":"https://github.com/xyproto/shapes","commit_stats":{"total_commits":22,"total_committers":2,"mean_commits":11.0,"dds":"0.045454545454545414","last_synced_commit":"8ef3d97389271e9d1c4cd55a0585c71f8cc44ff7"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/xyproto/shapes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xyproto%2Fshapes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xyproto%2Fshapes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xyproto%2Fshapes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xyproto%2Fshapes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xyproto","download_url":"https://codeload.github.com/xyproto/shapes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xyproto%2Fshapes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34508863,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ascii-graphics","fractions","points","shapes","software-rendering"],"created_at":"2024-10-01T15:23:23.374Z","updated_at":"2026-06-18T21:32:10.596Z","avatar_url":"https://github.com/xyproto.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# shapes\n\nDeal with points and triangles.\n\nIt is possible to add a triangle and get the coordinates as human-readable fractions.\n\nHere is a sample program, that animates three ASCII triangles and outputs coordinates as both floats and fractions:\n\n![screenshot](img/screenshot.png)\n\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/xyproto/shapes\"\n\t\"math\"\n\t\"time\"\n)\n\nconst (\n\ttwoPi = 2.0 * math.Pi\n\n\t// ASCII viewport\n\tfromX = -5\n\ttoX   = 10\n\tfromY = -4\n\ttoY   = 5\n\n\t// Terminal codes for the forground characters\n\ty = \"\\033[1;93mo\\033[0m\"\n\tb = \"\\033[1;94m@\\033[0m\"\n\tr = \"\\033[1;31m#\\033[0m\"\n\n\t// The background character\n\tbg = \" \"\n\n\t// Terminal code for clearing the rest of the line\n\tclearToEnd = \"\\033[K\"\n)\n\nfunc init() {\n\tfmt.Print(\"\\033[H\\033[2J\")\n}\n\nfunc reset() {\n\t// Reset the cursor\n\tfmt.Print(\"\\033[H\")\n}\n\nfunc main() {\n\tvar (\n\t\t// The original triangle\n\t\tot = shapes.NewTrianglef(0, 0, 4, 0, 4, 2)\n\n\t\t// The center position of the original triangle\n\t\tcenter = ot.Center()\n\n\t\t// Three triangles\n\t\tt1, t2, t3 *shapes.Tri\n\n\t\t// Angle, in radians\n\t\tangle = 0.0\n\t)\n\tfor {\n\t\t// Create three new triangles, by rotating ot with different angles\n\t\tt1 = ot.RotateAround(angle, center)\n\t\tt2 = ot.RotateAround(angle-(math.Pi/3.0), center)\n\t\tt3 = ot.RotateAround(angle-(math.Pi/3.0)*2.0, center)\n\n\t\t// Increase the angle just a bit, with wraparound\n\t\tangle += 0.07\n\t\tif angle \u003e= twoPi {\n\t\t\tangle -= twoPi\n\t\t}\n\n\t\t// Reset the cursor\n\t\treset()\n\n\t\t// Draw three triangles, using ASCII graphics.\n\t\tfmt.Println(t1.Draw(fromX, toX, fromY, toY, y, bg), clearToEnd)\n\t\tfmt.Println(t2.Draw(fromX, toX, fromY, toY, b, bg), clearToEnd)\n\t\tfmt.Println(t3.Draw(fromX, toX, fromY, toY, r, bg), clearToEnd)\n\n\t\t// Output the coordinates of the third triangle, as floats\n\t\tshapes.FloatOutput = true\n\t\tfmt.Println(t3.Points(), clearToEnd)\n\n\t\t// Output the coordinates of the third triangle, as fractions\n\t\tshapes.FloatOutput = false\n\t\tfmt.Println(t3.Points(), clearToEnd)\n\n\t\t// Wait a bit\n\t\ttime.Sleep(10 * time.Millisecond)\n\t}\n}\n```\n\n## General Info\n\n* License: MIT\n* Version: 0.0.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxyproto%2Fshapes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxyproto%2Fshapes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxyproto%2Fshapes/lists"}