-
Notifications
You must be signed in to change notification settings - Fork 3
/
boat.h
62 lines (38 loc) · 1.5 KB
/
boat.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef SAILING_BOAT_H
#define SAILING_BOAT_H
typedef struct sailing_boat {
char *name;
/* coordinates of boat */
double x, y;
/* orientation of boat */
double angle;
double sail_angle;
double rudder_angle;
double sheet_length;
/* is the sail free to move? */
int sail_is_free;
/* state variables */
double v, rotational_velocity, ell;
/* parameters */
double drift_coefficient, mass, rudder_distance, mast_distance,
rudder_lift, sail_lift, tangential_friction, angular_friction,
sail_center_of_effort, inertia;
} Boat;
struct sailing_boat *sailing_boat_init();
void sailing_boat_reset(Boat *boat);
void sailing_boat_free(Boat *boat);
char *sailing_boat_get_name(const Boat *boat);
double sailing_boat_get_latitude(const Boat *boat);
void sailing_boat_set_latitude(Boat *boat, double latitude);
double sailing_boat_get_longitude(const Boat *boat);
void sailing_boat_set_longitude(Boat *boat, double longitude);
double sailing_boat_get_sail_angle(const Boat *boat);
void sailing_boat_set_sail_angle(Boat *boat, double sail_angle);
double sailing_boat_get_angle(const Boat *boat);
void sailing_boat_set_angle(Boat *boat, double angle);
double sailing_boat_get_rudder_angle(const Boat *boat);
void sailing_boat_set_rudder_angle(Boat *boat, double rudder_angle);
double sailing_boat_get_velocity(const Boat *boat);
void sailing_boat_set_sheet_length(Boat *boat, double sheet_length);
double sailing_boat_get_sheet_length(const Boat *boat);
#endif