{"id":19264272,"url":"https://github.com/cphyc/fortran-geometry","last_synced_at":"2026-01-29T16:31:59.027Z","repository":{"id":74150436,"uuid":"106323692","full_name":"cphyc/fortran-geometry","owner":"cphyc","description":null,"archived":false,"fork":false,"pushed_at":"2017-10-18T17:29:28.000Z","size":76,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-31T08:20:24.577Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Fortran","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/cphyc.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":"2017-10-09T19:01:19.000Z","updated_at":"2019-03-14T03:07:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"3760bf6c-d226-4117-96c9-79ef455e8c0c","html_url":"https://github.com/cphyc/fortran-geometry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cphyc/fortran-geometry","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cphyc%2Ffortran-geometry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cphyc%2Ffortran-geometry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cphyc%2Ffortran-geometry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cphyc%2Ffortran-geometry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cphyc","download_url":"https://codeload.github.com/cphyc/fortran-geometry/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cphyc%2Ffortran-geometry/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28880980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T10:31:27.438Z","status":"ssl_error","status_checked_at":"2026-01-29T10:31:01.017Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2024-11-09T19:40:34.344Z","updated_at":"2026-01-29T16:31:59.000Z","avatar_url":"https://github.com/cphyc.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fortran-geometry\n\nThis is a very specific and very limited module in Fortran to easily volumetric properties of geometrical objects.\nFor now it supports:\n* [x] cube\n* [x] cylinder\n* [ ] box (easy to implement, just not done)\n* [ ] sphere (should be easy too)\n\n## How to use it?\n\nThe soft is presented as a module that you can `use` (`use CylinderGeometry`). You can then create geometrical objects. Properties of these objects are accessed using the Fortran 2008 Object-Oriented syntax, e.g.:\n```fortran\nprogram test\n  use CylinderGeometry\n\n  type(Cylinder_t) :: cyl\n  type(Cube_t) :: cube\n\n  real(8) :: volume\n  logical :: intersect\n\n  ! Define a cylinder\n  cyl%center = (/1., 1., 1./)\n  cyl%r = 1.0  ! This is the radius\n  cyl%h = 1.0  ! This is the height\n  cyl%normal1 = (/1., 1., 1./)\n\n  ! Define a cube\n  cube%center = (/10., 8., 0./)\n  cube%a = 1.5 ! This is the width of the cube\n\n  ! Let's get the volume\n  print*, 'Volume of the cube:', cube%volume()\n\n  ! Let's get the volume that intersect between the cube and the cylinder\n  call cyl%intersectionVolume(cube, volume, intersect)\n\n  print*, 'Cube and volume intersect?', intersect\n  print*, 'Volume of intersection   :', volume\nend program test\n```\n\n## A note on the \"algorithm\"\n\nThere are two algorithms implemented to compute the intersection volume. The first one is using a Monte-Carlo based approach, where random points are drawn from within the smallest volume. The ratio of points also falling in the other one to the total number of points gives the relative volume of the intersection. The convergence is in `1/sqrt(N)`, where `N` is the number of draws. To use it, use the method `intersectionMethodMC`.\n\nThe other algorithm is a recursive one. At each step, it divides the box in two equal-sized boxes along one axis and calls itself recursively for the two subboxes. At each depth, the axis is changed (first split along the x axis, then along the y axis, then along the z axis). The algorithm stops at the maximal depth or when all the points of the box are within the cylinder. Once the maximal depth is reached, we approximate the volume of the box in the cylinder by the number of corners in the cylinders / the number of corners (8).\n\n## Need some more examples?\n\nYou can read the test or send me an email to get more information.\n\n## Licensing\nThe code follows the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcphyc%2Ffortran-geometry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcphyc%2Ffortran-geometry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcphyc%2Ffortran-geometry/lists"}