{"id":23950720,"url":"https://github.com/flippiecoetser/shapes","last_synced_at":"2025-08-22T13:04:53.502Z","repository":{"id":191371286,"uuid":"684530742","full_name":"FlippieCoetser/Shapes","owner":"FlippieCoetser","description":"Generate Shape Coordinates with ease","archived":false,"fork":false,"pushed_at":"2025-05-02T11:51:02.000Z","size":251,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-22T03:41:48.727Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","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/FlippieCoetser.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,"zenodo":null}},"created_at":"2023-08-29T10:22:32.000Z","updated_at":"2024-07-20T10:36:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"e3deb43f-efb2-4870-836d-22f423c62c6b","html_url":"https://github.com/FlippieCoetser/Shapes","commit_stats":null,"previous_names":["flippiecoetser/shapes"],"tags_count":0,"template":false,"template_full_name":"FlippieCoetser/r.template","purl":"pkg:github/FlippieCoetser/Shapes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlippieCoetser%2FShapes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlippieCoetser%2FShapes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlippieCoetser%2FShapes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlippieCoetser%2FShapes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FlippieCoetser","download_url":"https://codeload.github.com/FlippieCoetser/Shapes/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlippieCoetser%2FShapes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271643468,"owners_count":24795440,"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","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"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":[],"created_at":"2025-01-06T12:53:54.294Z","updated_at":"2025-08-22T13:04:53.440Z","avatar_url":"https://github.com/FlippieCoetser.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shapes R-Package\n\nThis package is used to generates x, y coordinate pairs for basic shapes:\n\n1. `Line.vertical`, `Line.horizontal`\n2. `Rectangle`\n3. `Triangle`\n4. `Circle`\n5. `Trapezoid`\n6. `Segment`\n\n\u003e Note: Structural validation of input specifications is done before generating the coordinates.\n\nThis package also contains a set of utility functions that make working with shapes easier.\nUtilities include:\n\n1. `get.width`: Get the width of a shape.\n2. `get.height`: Get the height of a shape.\n3. `translate`: Translate a shape by using an offset.\n4. `translate.x`: Translate a shape along the x-axis.\n5. `translate.y`: Translate a shape along the y-axis.\n6. `shrink.height`: Shrink a shape height by an amount.\n7. `join`: Join two shapes together.\n\n## Installation\n\nThis package is not available on CRAN. Use `devtools` to either install from GitHub or build from source and install locally.\n\n### Install from GitHub\n\n1. Use the following command to install the package from GitHub:\n\n```r\ndevtools::install_github(\"https://github.com/FlippieCoetser/Shapes\")\n```\n\n### Build from Source\n\n1. Clone the repository to your local machine.\n\n```bash\ngit clone https://github.com/FlippieCoetser/Shapes.git\n```\n\n2. Navigate to the directory where the repository was cloned.\n\n3. Build the package.\n\n```r\ndevtools::build()\n```\n\n4. Install `.tar.gz` file.\n\n```r\ninstall.packages(\"path_to_file/tar_gz_file\", repos = NULL, type = \"source\")\n```\n\n### Load the Package\n\nThere are two ways to load the package: using the `library` function or the package namespace.\n\n1. Using the `library` function.\n\n```r\nlibrary(Shapes)\ngenerate \u003c- Generator()\nvalidate \u003c- Validator()\n```\n\n2. Using the package namespace.\n\n```r\ngenerate \u003c- Shapes::Generator()\nvalidate \u003c- Shapes::Validator()\n```\n\n### Shape Generator Usage\n\nGenerate Shape Coordinates for the following shapes:\n\n1. Line (vertical and horizontal)\n\n```r\nspecifications \u003c- list()\nspecifications[['length']] \u003c- 1\n\nline \u003c- specifications |\u003e generate[['Line.horizontal']]()\n```\n\n1. Rectangle\n\n```r\nspecifications \u003c- list()\nspecifications[['width']]  \u003c- 1\nspecifications[['height']] \u003c- 0.5\n\nrectangle \u003c- specifications |\u003e generate[['Rectangle']]()\n```\n\n2. Triangle\n\n```r\nspecifications \u003c- list()\nspecifications[['base']]   \u003c- 1\nspecifications[['height']] \u003c- 1.5\n\ntriangle \u003c- specifications |\u003e generate[['Triangle']]()\n```\n\n3. Circle\n\n```r\nspecifications \u003c- list()\nspecifications[['radius']] \u003c- 1\n\ncircle \u003c- specifications |\u003e generate[['Circle']]()\n```\n\n4. Trapezoid\n\n```r\nspecifications \u003c- list()\nspecifications[['bottom']] \u003c- 1\nspecifications[['top']]    \u003c- 0.5\nspecifications[['height']] \u003c- 1\n\ntrapezoid \u003c- specifications |\u003e generate[['Trapezoid']]()\n```\n\n5. Segment\n\n```r\nspecifications \u003c- list()\nspecifications[['radius']] \u003c- 1\n\nsegment \u003c- specifications |\u003e generate[['Segment']]()\n```\n\n\u003e Note: An optional align parameter can be passed to the generator function.\n\u003e\n\u003e The align parameter can be one of the following:\n\u003e\n\u003e 1.  `corner`: The Left Bottom Corner of shapes will be at the origin (0,0) and also the default value\n\u003e 2.  `center`: The center of shapes will be at the origin (0,0)\n\u003e 3.  `horizontal`: The shapes will be centred horizontally with the bottom at y = 0\n\u003e 4.  `vertical`: The shapes will be centred vertically with the left side at x = 0\n\nGenerate Shape Coordinates for the following shapes:\n\n1. Centered Aligned Rectangle\n\n```r\nspecifications \u003c- list()\nspecifications[['width']]  \u003c- 1\nspecifications[['height']] \u003c- 0.5\n\nrectangle \u003c- specifications |\u003e generate[['Rectangle']](align = 'center')\n```\n\n### Shape Validator Usage\n\nValidate specifications of shapes and throw exception with meaningful message, for example:\n\n1. Define a specification with missing parameters.\n\n```r\nspecifications \u003c- list()\nspecifications[['width']] \u003c- 1\n```\n\n2. Validate the specifications.\n\n```r\nspecifications |\u003e validate[['Rectangle']]()\n```\n\n3. The following exception will be thrown:\n\n```r\n\"Error: Attribute.NULL: 'height' does not exist.\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflippiecoetser%2Fshapes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflippiecoetser%2Fshapes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflippiecoetser%2Fshapes/lists"}