mirror of
https://gitlab.com/MisterBiggs/astro-helper.git
synced 2025-08-02 19:31:23 +00:00
added structures
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
module AstroHelper
|
||||
using LinearAlgebra
|
||||
|
||||
using DataFrames
|
||||
|
||||
include("quaternions.jl")
|
||||
include("aeStructures.jl")
|
||||
|
||||
end # module
|
||||
|
30
src/aeStructures.jl
Normal file
30
src/aeStructures.jl
Normal file
@@ -0,0 +1,30 @@
|
||||
struct Section
|
||||
data::DataFrame
|
||||
xc::Float64
|
||||
yc::Float64
|
||||
Ixx::Float64
|
||||
Iyy::Float64
|
||||
Ixy::Float64
|
||||
|
||||
function Section(A, x, y)
|
||||
d = DataFrame(A=A, x=x, y=y)
|
||||
|
||||
d.Ax = d.A .* d.x
|
||||
d.Ay = d.A .* d.y
|
||||
|
||||
xc = sum(d.Ax) / sum(d.A)
|
||||
yc = sum(d.Ay) / sum(d.A)
|
||||
|
||||
Ixx = sum(d.A .* ((d.y .- yc).^2))
|
||||
Iyy = sum(d.A .* ((d.x .- xc).^2))
|
||||
Ixy = sum(d.A .* ((d.x .- xc) .* (d.y .- yc)))
|
||||
|
||||
|
||||
new(d, xc, yc, Ixx, Iyy, Ixy)
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user