{"id":20032532,"url":"https://github.com/akicho8/stylet_support","last_synced_at":"2025-07-31T10:14:32.763Z","repository":{"id":59156751,"uuid":"14064372","full_name":"akicho8/stylet_support","owner":"akicho8","description":"GUIに依存しない数学関連ライブラリ","archived":false,"fork":false,"pushed_at":"2022-04-20T11:03:30.000Z","size":2187,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-28T18:12:03.730Z","etag":null,"topics":["library","mathematics","vector"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akicho8.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-02T10:19:16.000Z","updated_at":"2023-11-01T12:10:51.000Z","dependencies_parsed_at":"2022-09-13T20:11:22.096Z","dependency_job_id":null,"html_url":"https://github.com/akicho8/stylet_support","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/akicho8/stylet_support","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akicho8%2Fstylet_support","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akicho8%2Fstylet_support/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akicho8%2Fstylet_support/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akicho8%2Fstylet_support/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akicho8","download_url":"https://codeload.github.com/akicho8/stylet_support/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akicho8%2Fstylet_support/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267554721,"owners_count":24106538,"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-07-28T02:00:09.689Z","response_time":68,"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":["library","mathematics","vector"],"created_at":"2024-11-13T09:38:11.033Z","updated_at":"2025-07-31T10:14:32.742Z","avatar_url":"https://github.com/akicho8.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"* GUIに依存しない数学関連ライブラリ\n\n#+BEGIN_SRC ruby\nPoint.new                                      # =\u003e [0.0, 0.0]\nPoint[1, 2]                                    # =\u003e [1, 2]\nPoint[1, 2].members                            # =\u003e [:x, :y]\nPoint[1, 2].values                             # =\u003e [1, 2]\nPoint[1, 2]                                    # =\u003e [1, 2]\n\nVector.superclass                              # =\u003e Stylet::Point2\n\nPoint.new(Point[1,2])                          # =\u003e [1, 2]\nPoint[Point[1,2]]                              # =\u003e [1, 2]\n\nVector.new                                     # =\u003e [0.0, 0.0]\nVector.new                                     # =\u003e [0.0, 0.0]\nVector.new(1, 2)                               # =\u003e [1, 2]\n\nVector.zero                                    # =\u003e [0.0, 0.0]\nVector.one                                     # =\u003e [1.0, 1.0]\n\na = Vector[1, 2]\nb = Vector[3, 4]\n\na + b                                          # =\u003e [4.0, 6.0]\na - b                                          # =\u003e [-2.0, -2.0]\na * 2                                          # =\u003e [2.0, 4.0]\na / 2                                          # =\u003e [0.5, 1.0]\n\na.add(b)                                       # =\u003e [4.0, 6.0]\na.sub(b)                                       # =\u003e [-2.0, -2.0]\na.scale(2)                                     # =\u003e [2.0, 4.0]\na.mul(2)                                       # =\u003e [2.0, 4.0]\na.div(2)                                       # =\u003e [0.5, 1.0]\n\na + [3, 4]                                     # =\u003e [4.0, 6.0]\na - [3, 4]                                     # =\u003e [-2.0, -2.0]\n\nVector.one.reverse                             # =\u003e [-1.0, -1.0]\n-Vector.one                                    # =\u003e [-1.0, -1.0]\n\nVector[3, 4].normalize                         # =\u003e [0.6, 0.8]\n\nVector.one.normalize                           # =\u003e [0.7071067811865475, 0.7071067811865475]\nVector.one.magnitude                           # =\u003e 1.4142135623730951\nVector.one.magnitude_sq                        # =\u003e 2.0\n\nv = Vector.rand\nv.round(2)                                     # =\u003e [-1.0, -0.88]\nv.round                                        # =\u003e [-1, -1]\nv.floor                                        # =\u003e [-1, -1]\nv.ceil                                         # =\u003e [0, 0]\nv.truncate                                     # =\u003e [0, 0]\n\nVector.rand                                    # =\u003e [-0.5758140223421724, -0.23276547457672714]\nVector.rand(3)                                 # =\u003e [1, 1]\nVector.rand(3..4)                              # =\u003e [4, 4]\nVector.rand(3.0..4)                            # =\u003e [3.9402342251571714, 3.550203689124972]\nVector.rand(-2.0..2.0)                         # =\u003e [-1.181268220930995, 1.4942116900421252]\n\nVector[1, 0].dot_product(Vector[1, 0])       # =\u003e 1\nVector[1, 0].dot_product(Vector[-1, 0])      # =\u003e -1\n\nVector.cross_product(Vector.rand, Vector.rand) # =\u003e -0.7348374986070235\n\nVector.rand.distance_to(Vector.rand)           # =\u003e 1.7226903872525836\n\nv = Vector.new\nv.object_id                                    # =\u003e 70298637530620\nv.replace(Vector.rand)                         # =\u003e [-0.2619785178209082, -0.4396795163426983]\nv.object_id                                    # =\u003e 70298637530620\n\nVector.zero.distance_to(Vector.one)            # =\u003e 1.4142135623730951\n\nVector.zero.zero?                              # =\u003e true\nVector.one.nonzero?                            # =\u003e true\n\nVector.zero.inspect                            # =\u003e \"[0.0, 0.0]\"\nVector.zero.to_s                               # =\u003e \"[0.0, 0.0]\"\n\nVector[1,2].prep                               # =\u003e [-2, 1]\n#+END_SRC\n\n** TIPS\n\n*** 当たり判定を高速化するには？\n\n当たり判定を次のようにしているとき\n\n#+BEGIN_SRC ruby\nif v.magnitude \u003c r\nend\n#+END_SRC\n\n次のようにすると sqrt を省略できる\n\n#+BEGIN_SRC ruby\nif v.magnitude_sq \u003c r ** 2\nend\n#+END_SRC\n\n*** a地点からb地点へのベクトルを求めるには？\n\n#+BEGIN_SRC ruby\nb - a\n#+END_SRC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakicho8%2Fstylet_support","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakicho8%2Fstylet_support","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakicho8%2Fstylet_support/lists"}