{"id":13423607,"url":"https://github.com/thomasp85/euclid","last_synced_at":"2025-03-17T06:31:55.395Z","repository":{"id":66336286,"uuid":"296249087","full_name":"thomasp85/euclid","owner":"thomasp85","description":"Exact Computation Geometry Framework Based on 'CGAL'","archived":false,"fork":false,"pushed_at":"2023-01-27T08:54:42.000Z","size":13867,"stargazers_count":85,"open_issues_count":12,"forks_count":13,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-27T19:21:16.267Z","etag":null,"topics":["cgal","computational-geometry","geometry","rstats"],"latest_commit_sha":null,"homepage":"https://r-euclid.com","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thomasp85.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-09-17T07:16:38.000Z","updated_at":"2024-11-05T05:34:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"a421bae2-7fd3-4ccb-8950-c5196ed626ef","html_url":"https://github.com/thomasp85/euclid","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/thomasp85%2Feuclid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasp85%2Feuclid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasp85%2Feuclid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasp85%2Feuclid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomasp85","download_url":"https://codeload.github.com/thomasp85/euclid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243847061,"owners_count":20357317,"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":["cgal","computational-geometry","geometry","rstats"],"created_at":"2024-07-31T00:00:38.665Z","updated_at":"2025-03-17T06:31:54.183Z","avatar_url":"https://github.com/thomasp85.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\nset.seed(2)\n```\n\n# euclid \u003ca href='https://r-euclid.com'\u003e\u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"138.5\"/\u003e\u003c/a\u003e\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/thomasp85/euclid/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/thomasp85/euclid/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/thomasp85/euclid/branch/master/graph/badge.svg)](https://codecov.io/gh/thomasp85/euclid?branch=master)\n\u003c!-- badges: end --\u003e\n\nThe purpose of euclid is to provide a new unified foundation for computational geometry in R. It provides new data types for common low level geometric concepts such as lines, planes, points, triangles, etc. as well as a core of functionality relates to these primitives. Specialised geometric algorithms are intended to extend this package so that e.g. Tessellation will live in it's own package but use the foundation laid out in euclid.\n\nAt its core euclid is an interface to the CGAL library for computational geometry. More specifically, it provides access to the functionality in the [2D and 3D Linear Geometry Kernel](https://doc.cgal.org/4.14.3/Kernel_23/index.html). The CGAL foundation means that computations with euclid are exact and free of the imprecision attached to working with floating point numbers. This is very important for geometry since floating point errors can compound and lead to failures in geometric predicates at the core of many geometric algorithms. To achieve this, data in euclid is never converted to R data structures but remain as pointers to CGAL structures unless specifically converted to numerics (in which case the floating point world kicks in)\n\n## Installation\n\nFor now, euclid can be installed from github using remotes:\n\n```{r, eval=FALSE}\n# install.packages(\"remotes\")\nremotes::install_github(\"thomasp85/euclid\")\n```\n\n## Data types\n\nThe core of euclid is a set of new primitive vector types that model 2 and 3 dimensional geometric objects. The following types are present:\n\n### 2 and 3 dimensions\n\n-   Circles\n\n-   Directions\n\n-   Lines\n\n-   Points\n\n-   Weighted Points\n\n-   Rays\n\n-   Segments\n\n-   Triangles\n\n-   Vectors\n\n### 2 dimensions\n\n-   Iso rectangles\n\n### 3 dimensions\n\n-   Iso cubes\n\n-   Planes\n\n-   Spheres\n\n-   Tetrahedrons\n\n### Special vector types\n\nIn addition to the geometric data types, euclid also provides these primitive vector types:\n\n-   Exact numerics\n\n-   Bounding boxes\n\n-   Affine transformation matrices\n\n## Example\n\nThe following example shows how to work with the different data types:\n\n```{r, message=FALSE}\nlibrary(euclid)\n\n# Construct some exact numbers\nrandom_num \u003c- exact_numeric(rnorm(20))\n\n# Exact numbers behave much like R numerics (though not everything is possible)\nrandom_num[1:5]\nmax(random_num)\nrandom_num[2] * 10\nrandom_num[5] + random_num[16]\nsum(random_num)\n\n# With exact numbers we can construct our geometries\np \u003c- point(random_num[1:10], random_num[11:20])\np\n\n# Create a line based on a vector, going through the origin\nl \u003c- line(point(0, 0), vec(3, 7))\n\n# Which points lies on the positive side of the line?\np %is_on_positive_side% l\n\n# Project points to line\np1 \u003c- project(p, l)\n\n# Do the projected points lie on the line?\np1 %is_on% l\n\n# Construct a triangle from a random point to the extremes of the projected points\nt \u003c- triangle(point(rnorm(1), rnorm(1)), min(p1), max(p1))\nt\n\n# Which points lies inside the triangle?\np %is_inside% t\n\n# Visualise result\nplot(p, pch = 16)\neuclid_plot(t)\neuclid_plot(p[p %is_inside% t], cex = 3)\n\n# Area of t (cannot be given exact for all geometries so is returned as numerics)\napprox_area(t)\n```\n\n## Code of Conduct\n\nPlease note that the euclid project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasp85%2Feuclid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomasp85%2Feuclid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasp85%2Feuclid/lists"}