Skip to content

Commit

Permalink
add coordinate systems
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Templeton committed Jun 27, 2024
1 parent a9a46b8 commit 905776f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
});

_ = b.addModule("astroz.coordinates", .{
.root_source_file = b.path("src/coordinates.zig"),
.target = target,
.optimize = optimize,
});

const lib_unit_tests = b.addTest(.{
.root_source_file = b.path("src/ccsds.zig"),
.target = target,
Expand Down
36 changes: 36 additions & 0 deletions src/coordinates.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const std = @import("std");

pub const Equatorial_Coordinate_System = struct {
declination: Declination,
right_ascension: Right_Ascension,

const Self = @This();

pub fn new(declination: Declination, right_ascension: Right_Ascension) Self {
return .{ .declination = declination, .right_ascension = right_ascension };
}
};

pub const Declination = struct {
degrees: u8,
arcminutes: u8,
arcseconds: f32,

const Self = @This();

pub fn new(degree: ?u8, arcminutes: ?u8, arcseconds: ?f32) Self {
return .{ .degree = degree orelse 0, .arcminutes = arcminutes orelse 0.0, .arcseconds = arcseconds orelse 0.0 };
}
};

pub const Right_Ascension = struct {
hours: u8,
minutes: u8,
seconds: f32,

const Self = @This();

pub fn new(hours: ?u8, minutes: ?u8, seconds: ?f32) Self {
return .{ .hours = hours orelse 0, .minutes = minutes orelse 0, .seconds = seconds orelse 0.0 };
}
};

0 comments on commit 905776f

Please sign in to comment.