{"id":16300304,"url":"https://github.com/librasteve/raku-physics-navigation","last_synced_at":"2025-07-31T21:02:35.947Z","repository":{"id":122841453,"uuid":"295801610","full_name":"librasteve/raku-Physics-Navigation","owner":"librasteve","description":"A Physics::Measure abstraction layer providing Latitude, Longitude, Bearing , Position, Course and Buoy classes.","archived":false,"fork":false,"pushed_at":"2024-06-21T18:27:56.000Z","size":133,"stargazers_count":4,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-28T23:20:46.784Z","etag":null,"topics":["navigation","physics","raku","raku-module","rakulang"],"latest_commit_sha":null,"homepage":"","language":"Raku","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"artistic-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/librasteve.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":"2020-09-15T17:28:56.000Z","updated_at":"2024-06-21T18:27:25.000Z","dependencies_parsed_at":"2024-06-22T10:38:27.755Z","dependency_job_id":null,"html_url":"https://github.com/librasteve/raku-Physics-Navigation","commit_stats":null,"previous_names":["librasteve/raku-physics-navigation"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/librasteve%2Fraku-Physics-Navigation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/librasteve%2Fraku-Physics-Navigation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/librasteve%2Fraku-Physics-Navigation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/librasteve%2Fraku-Physics-Navigation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/librasteve","download_url":"https://codeload.github.com/librasteve/raku-Physics-Navigation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244056404,"owners_count":20390719,"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":["navigation","physics","raku","raku-module","rakulang"],"created_at":"2024-10-10T20:50:52.408Z","updated_at":"2025-03-20T05:31:05.568Z","avatar_url":"https://github.com/librasteve.png","language":"Raku","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License: Artistic-2.0](https://img.shields.io/badge/License-Artistic%202.0-0298c3.svg)](https://opensource.org/licenses/Artistic-2.0)\n[![raku-physics-navigation -\u003e DH](https://github.com/librasteve/raku-Physics-Navigation/actions/workflows/navigation-weekly.yaml/badge.svg)](https://github.com/librasteve/raku-Physics-Navigation/actions/workflows/navigation-weekly.yaml)\n\n# raku Physics::Navigation\n\nThis module is an abstraction on [Physics::Measure](https://github.com/librasteve/raku-Physics-Measure) that provides Latitude, Longitude, Bearing, Position, Course and Buoy classes.\n\nProvides Measure objects that have value, units and error and can be used in many common physics calculations. Uses [Physics::Unit](https://github.com/librasteve/raku-Physics-Unit) and [Physics::Error](https://github.com/librasteve/raku-Physics-Error).\n\n# Instructions\n```zef --verbose install Physics::Navigation```\n\nand, conversely, ```zef uninstall Physics::Navigation```\n\n**For a gentler introduction to and explanation of these features, please refer to [raku Yacht Navigation](https://github.com/librasteve/raku-Yacht-Navigation) for a descriptive Jupyter notebook**\n\n# Synopsis\n\n```perl6\nuse lib '../lib';\nuse Physics::Navigation;\nuse Physics::Measure;\n\n# objects can be set up longhand as in Physics::Measure, now joined by Latitude, Longitude, etc.\n$Physics::Measure::round-val = 0.1;\n\nmy Distance $d1   .=new( value =\u003e 42,  units =\u003e 'nmile' );\t  say ~$d1;\nmy Time     $t1   .=new( value =\u003e 1.5, units =\u003e 'hr' );\t\t  say ~$t1;\nmy Latitude $lat1 .=new( value =\u003e 45, compass =\u003e \u003cN\u003e );\t\t  say ~$lat1;\n\n# the emoji ♓️ \u003cpisces\u003e operator shorthand does all that the Physics::Measure emoji ♎️ \u003clibra\u003e operator does\nmy $d2 = ♓️'42 nmile';\t\t\t\t\t\t  say ~$d2;\nmy $t2 = ♓️'1.5 hr';\t\t\t\t\t\t  say ~$t2;\nmy $s2 = $d2 / $t2;\t\t\t\t\t\t  say ~$s2.in('knots');\n\n# and then some - parses final NEWS letter to determine lat or long\nmy $lat2 = ♓️\u003c43°30′30″S\u003e;\t\t\t\t          say ~$lat2;\nmy $long1 = ♓️\u003c45°W\u003e;\t\t\t\t\t\t  say ~$long1;\nmy $long2 = ♓️\u003c22°E\u003e;\t\t\t\t\t\t  say ~$long2;\n\n# the .in conversion method works and the identity 1° lat === 1 nautical mile is preserved\nmy $lat3 = in-lat( $d1 );\t\t\t\t\t  say ~$lat3;\nmy $d3 = $lat2.in('nmiles');\t\t\t                  say ~$d3;\n\n# you can do \"Measure math\" using the standard operators \u003c[+-*/**]\u003e\nmy $d4 = $d3 * 2;\t\t\t\t\t\t  say ~$d4;\nmy $lat4 = $lat2 - $lat1;                                         say ~$lat4;\n\n# Bearings can be True(T) or Magnetic(M), with Variation and Deviation [Vw|Ve|Dw|De]\n$Physics::Navigation::variation =  ♓️\u003c7°Vw\u003e;\n\nmy $bear1 = ♓️\u003c80°T\u003e;                                             say ~$bear1;\nmy $bear2 = ♓️\u003c43°30′30″M\u003e;                                       say ~$bear2;\nmy $bear3 = $bear2 + $bear1.M;                                    say ~$bear3;\n\n# here's how to steer your boat to Port (Pt) or Starboard (Sb)\nmy $steer = ♓️\u003c50°Pt\u003e;                                            say ~$steer;\nmy $bear4 = $bear2 + $steer;                                      say ~$bear4;\nmy $bear5 = $bear4.back;                                          say ~$bear5; #and take a back bearing\n\ntry {\n\tmy $bear-nope = $bear2 + $bear1;\n}\nif $! { say \"Can't mix True \u0026 Magnetic ... $!\" }\n\nmy Position $start  .=new( $lat1, $long1 );\t                  say ~$start;\nmy Position $finish .=new( $lat2, $long2 );\t                  say ~$finish;\n\n# get great circle distance and initial azimuth bearing\nsay ~$start.haversine-dist($finish).in('km');\nsay ~$start.forward-azimuth($finish);\n\n# make a Vector (angle + distance) and move by that amount\nmy $vector  = $start.diff($finish);\t\t\t         say ~$vector;\nmy $finish2 = $start.move($vector);\t\t\t         say ~$finish2;\n\n# use Measure math to make Velocity objects\nmy $dur     = ♓️'3 weeks';\t\t\t                 say ~$dur;\nmy $vel     = $vector.divide: $dur;\t\t\t         say ~$vel;\nmy $vector2 = $vel.multiply: $dur;\t\t                 say ~$vector2;\n\nmy $pos-A = Position.new( ♓️\u003c51.5072°N\u003e, ♓️\u003c0.1276°W\u003e );\nmy $pos-B = Position.new( ♓️\u003c51.5072°N\u003e, ♓️\u003c0.1110°W\u003e );\nmy $pos-C = Position.new( ♓️\u003c51.5072°N\u003e, ♓️\u003c0.1100°W\u003e );\n\n# there are Fixes, Estimated positions and Transits\nmy $fix-A = Fix.new( direction =\u003e ♓️\u003c112°T\u003e, location  =\u003e $pos-A );\nmy $fix-B = Fix.new( direction =\u003e ♓️\u003c25°T\u003e,  location  =\u003e $pos-B );\n\nmy $ep = Estimate.new( :$fix-A, :$fix-B );                      say ~$ep;\n\nmy $tr = Transit.new( :$pos-A, :$pos-B );                       say $tr.aligned( $pos-C );\n\n# Course objects handle Course To Steer, Tidal Flow, Course Over Ground (and leeway)\n%course-info\u003cleeway\u003e =  ♓️\u003c112°Pt\u003e;\nmy $tidal-flow = Velocity.new( θ =\u003e ♓️\u003c112°T\u003e, s =\u003e ♓️'2.2 knots' );\nmy Course $course .= new( over-ground =\u003e ♓️\u003c22°T\u003e, :$tidal-flow );  say ~$course;\nsay $course.speed-over-ground.in('knots');\n\n# Buoy objects know their shape, colour, light pattern, etc.\nmy $scm = SouthCardinal.new( position =\u003e $pos-A );               say ~$scm;\nmy $ncm = NorthCardinal.new( position =\u003e $pos-A );               say ~$ncm;\n\n# Lateral Buoys know about IALA standards\n$IALA = A;\nmy $plm = PortLateral.new( position =\u003e $pos-B );                 say ~$plm;\n\n# use .light-defn to get an English description\nsay $plm.light-defn;\n\n# .duration and .patterm methods also support SVG animation\nsay \"SVG-animation: duration is {$plm.light-svg.duration}s, pattern is: [{$plm.light-svg.pattern}];\";\n```\n\n# Summary\n\nThe family of Physics::Navigation, Physics::Measure, Physics::Unit, Physics::Error and Physics::Constants raku modules is a consistent and extensible toolkit intended for science and education. It provides a comprehensive library of both metric (SI) and non-metric units, it is built on a Type Object foundation, it has a unit expression Grammar and implements math, conversion and comparison methods.\n\n# Contribution\n\nYou are welcome to contribute in any way - please open a pull request.\n\nAny feedback is welcome to librasteve / via the github Issues above.\n\nCopyright (c) Henley Cloud Consulting Ltd. 2021-2023\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibrasteve%2Fraku-physics-navigation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibrasteve%2Fraku-physics-navigation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibrasteve%2Fraku-physics-navigation/lists"}