AngleBetweenVectors
An accurate and stable calculation of the angle separating two vectors.
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 5 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.4%) to scientific vocabulary
Keywords
Repository
An accurate and stable calculation of the angle separating two vectors.
Basic Info
Statistics
- Stars: 30
- Watchers: 2
- Forks: 4
- Open Issues: 1
- Releases: 5
Topics
Metadata Files
README.md
AngleBetweenVectors.jl
When computing the arc separating two cartesian vectors, this is robustly stable; others are not.
Copyright © 2018-2022 by Jeffrey Sarnoff. This work is released under The MIT License.
preferred citiation
Sarnoff, Jeffrey (2022). AngleBetweenVectors (Version 0.3.1) [Source Code].
Open access at https://github.com/JeffreySarnoff/AngleBetweenVectors.jl
https://doi.org/10.5281/zenodo.6745689
AngleBetweenVectors exports angle.
angle(point1, point2) determines the angle of their separation. The smaller of the two solutions is used. π obtains If the points are opposed, [(1,0), (-1,0)]; so 0 <= angle(p1, p2) <= pi.
This function expects two points from a 2D, 3D .. ManyD space, in Cartesian coordinates. Tuples and Vectors are handled immediately (prefer Tuples for speed). To use another point representations, just define a Tuple constructor for it. NamedTuples and SVectors have this already.
Most software uses acos(dot(p1, p2) / sqrt(norm(p1) norm(p2)) instead. While they coincide often; it is exceedingly easy to find cases where angle is more accurate and then, usually they differ by a few ulps. Not always.
provides
angle( point₁, point₂ )- points are given as Cartesian coordinates
- points may be of any finite dimension >= 2
- points may be any type with a Tuple constructor defined
point representations that just work
- points as Tuples
- points as NamedTuples
- points as Vectors
- points as SVectors (StaticArrays)
working with other point representations
Just define a Tuple constructor for the representation. That's all.
```julia
working with this?
struct Point3D{T} x::T y::T z::T end
define this:
Base.Tuple(a::Point3D{T}) where {T} = (a.x, a.y, a.z)
this just works:
angle(point1::Point3D{T}, point2::Point3D{T}) where {T} ```
why use it
This implementation is more robustly accurate than the usual method.
You can work with points in 2D, 3D, .. 1000D .. ?.
notes
The shorter of two angles is given as an unoriented magnitude (0 <= radians < π).
Vectors are given by their Cartesian coordinates in 2D, 3D or .. N-dimensions.
This follows a note by Professor Kahan Computing Cross-Products and Rotations (pg 15):
"More uniformly accurate .. valid for Euclidean spaces of any dimension, it never errs by more than a modest multiple of ε."
Owner
- Name: Jeffrey Sarnoff
- Login: JeffreySarnoff
- Kind: user
- Location: New York
- Website: https://github.com/JeffreySarnoff
- Repositories: 32
- Profile: https://github.com/JeffreySarnoff
Citation (CITATION.cff)
cff-version: 1.2.0
message: If you use this software, please cite it using these metadata.
title: AngleBetweenVectors
abstract: Compute the arc separating two cartesian vectors in a stable and robust manner.
authors:
- given-names: Jeffrey
family-names: Sarnoff
email: "jeffrey.sarnoff@gmail.com"
affiliation: "Julia Innovator"
type: software
doi: "10.5281/zenodo.6745689"
url: "https://github.com/JeffreySarnoff/AngleBetweenVectors.jl"
repository-code: "https://github.com/JeffreySarnoff/AngleBetweenVectors.jl"
version: 0.3.1
date-released: 2022-06-25
license: MIT
GitHub Events
Total
- Watch event: 2
Last Year
- Watch event: 2
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Jeffrey Sarnoff | J****f | 132 |
| Julia TagBot | 5****t | 1 |
Issues and Pull Requests
Last synced: 5 months ago
All Time
- Total issues: 2
- Total pull requests: 3
- Average time to close issues: 10 months
- Average time to close pull requests: 5 days
- Total issue authors: 2
- Total pull request authors: 3
- Average comments per issue: 2.5
- Average comments per pull request: 1.67
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- stelmo (1)
- bgodard (1)
Pull Request Authors
- JeffFessler (1)
- JeffreySarnoff (1)
- JuliaTagBot (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- julia 33 total
- Total dependent packages: 3
- Total dependent repositories: 0
- Total versions: 4
juliahub.com: AngleBetweenVectors
An accurate and stable calculation of the angle separating two vectors.
- Documentation: https://docs.juliahub.com/General/AngleBetweenVectors/stable/
- License: MIT
-
Latest release: 0.3.0
published about 7 years ago
Rankings
Dependencies
- julia 0.7