{"id":18076211,"url":"https://github.com/scivision/lineclipping-python-fortran","last_synced_at":"2025-04-05T19:42:54.495Z","repository":{"id":62581394,"uuid":"122401420","full_name":"scivision/lineclipping-python-fortran","owner":"scivision","description":"Line clipping in clean, simple, modern Fortran and Python","archived":false,"fork":false,"pushed_at":"2021-05-10T02:14:55.000Z","size":46,"stargazers_count":10,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-12T23:35:25.322Z","etag":null,"topics":["coarray-fortran","cohen-sutherland","computer-vision","line-clipping"],"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/scivision.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-21T22:23:13.000Z","updated_at":"2024-05-30T12:52:17.000Z","dependencies_parsed_at":"2022-11-03T21:34:16.953Z","dependency_job_id":null,"html_url":"https://github.com/scivision/lineclipping-python-fortran","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scivision%2Flineclipping-python-fortran","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scivision%2Flineclipping-python-fortran/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scivision%2Flineclipping-python-fortran/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scivision%2Flineclipping-python-fortran/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scivision","download_url":"https://codeload.github.com/scivision/lineclipping-python-fortran/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393538,"owners_count":20931809,"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":["coarray-fortran","cohen-sutherland","computer-vision","line-clipping"],"created_at":"2024-10-31T11:09:14.764Z","updated_at":"2025-04-05T19:42:54.474Z","avatar_url":"https://github.com/scivision.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Line clipping\n\n[![Actions Status](https://github.com/scivision/lineclipping-python-fortran/workflows/ci_python/badge.svg)](https://github.com/scivision/lineclipping-python-fortran/actions)\n\n\n[![PyPi versions](https://img.shields.io/pypi/pyversions/pylineclip.svg)](https://pypi.python.org/pypi/pylineclip)\n[![PyPi Download stats](http://pepy.tech/badge/pylineclip)](http://pepy.tech/project/pylineclip)\n\n`lineclipping.f90` Cohen-Sutherland line clipping algorithm for\nmassively parallel coarray modern Fortran. Input scalars or arrays,\noutput intersections or `NaN` if no intersection.\n\n`lineClipping.py` Cohen-Sutherland line clipping algorithm for Python.\nInput scalars, output intersection length, or `None` if no intersection.\n\nJulia line clipping is at https://github.com/scivision/lineclipping-julia\n\n## Install\n\nTo install the latest release:\n\n```sh\npip install pylineclip\n```\n\n### Fortran\n\nIf you want to use the Fortran Cohen-Sutherland line clipping modules\ndirectly (optional):\n\n```sh\nmeson build\n\nmeson test -C build\n```\n\n## Usage\n\nThe main difference with textbook implementations is that I return a\nsentinel value (NaN, None, nothing) if there's no intersection of line\nwith box.\n\n### Python\n\n```python\nimport pylineclip.lineclipping as lc\n\nx3,y3,x4,y4 = lc.cohensutherland((xmin, ymax, xmax, ymin, x1, y1, x2, y2)\n```\n\nIf no intersection, `(None, None, None, None)` is returned.\n\n### Fortran\n\nlineclipping.f90 has two subroutines.\nPick Ccohensutherland if you're calling from C/C++/Python, which cannot tolerate assummed-shape arrays.\nIt's a slim wrapper to cohensutherland which is elemental (can handle scalar or any rank array).\n\nFortran programs will simply use\n\n```fortran\nuse lineclipping\ncall cohensutherland(xmin,ymax,xmax,ymin,x1,y1,x2,y2)\n```\n\nThe arguments are:\n\n```sh\nINPUTS\n------\nxmin,ymax,xmax,ymin:  upper left and lower right corners of box (pixel coordinates)\n\nINOUT\n-----\nx1,y1,x2,y2:\nin - endpoints of line\nout - intersection points with box. If no intersection, all NaN\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscivision%2Flineclipping-python-fortran","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscivision%2Flineclipping-python-fortran","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscivision%2Flineclipping-python-fortran/lists"}