Skip to content

Commit 1eb0cd9

Browse files
add fixed direction
1 parent 71b3160 commit 1eb0cd9

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/Definitions/directions.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,26 @@ function add_direction_orthogonal!(
8787

8888
fun = t -> unitvec(cross3(direction3(frames, dir1, axid, t), direction3(frames, dir2, axid, t)))
8989
return add_direction!(frames, name, axid, fun)
90+
end
91+
92+
"""
93+
add_direction_fixed!(frames, name, axes, offset::AbstractVector)
94+
95+
Add a fixed direction to `frames`.
96+
"""
97+
function add_direction_fixed!(
98+
frames::FrameSystem{O,N}, name::Symbol, axes, offset::AbstractVector{T}
99+
) where {O,N,T}
100+
101+
if length(offset) != 3
102+
throw(
103+
DimensionMismatch(
104+
"The offset vector should have length 3, but has $(length(offset))."
105+
),
106+
)
107+
end
108+
109+
voffset = SVector{3,N}(offset)
110+
fun = t -> voffset
111+
return add_direction!(frames, name, axes, fun)
90112
end

src/FrameTransformations.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ export add_axes_bci2000!, add_axes_bcrtod!
105105

106106
include("Definitions/planetary.jl")
107107

108-
export add_direction_position!, add_direction_velocity!, add_direction_orthogonal!
108+
export add_direction_position!, add_direction_velocity!, add_direction_orthogonal!,
109+
add_direction_fixed!
109110

110111
include("Definitions/directions.jl")
111112

0 commit comments

Comments
 (0)