Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ISC_123 - Travail Pratique 001 - Simulation Système Planétaire
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
florian.burgener
ISC_123 - Travail Pratique 001 - Simulation Système Planétaire
Commits
58922599
Commit
58922599
authored
3 years ago
by
Florian Burgener
Browse files
Options
Downloads
Patches
Plain Diff
Add fake planets
parent
48648d15
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
PlanetarySystem.c
+30
-17
30 additions, 17 deletions
PlanetarySystem.c
with
30 additions
and
17 deletions
PlanetarySystem.c
+
30
−
17
View file @
58922599
...
...
@@ -70,16 +70,29 @@ const double JUPITER_SEMI_MAJOR_AXIS = 778.570 * 1E9;
const
double
JUPITER_ECCENTRICITY
=
0
.
04
89
;
const
int32_t
JUPITER_DRAWING_RADIUS
=
30
;
const
int32_t
JUPITER_COLOR
=
0xD8CA9D
;
// // Naboo
// const char JUPITER_NAME[] = "Jupiter";
// const double JUPITER_MASS = 1898.13 * 1E24;
// const double JUPITER_SEMI_MAJOR_AXIS = 778.570 * 1E9;
// const double JUPITER_ECCENTRICITY = 0.0489;
// const int32_t JUPITER_DRAWING_RADIUS = 30;
// const int32_t JUPITER_COLOR = 0xD8CA9D;
// // Endor
const
int32_t
OBJECTS_LENGTH
=
10
;
// Naboo
const
char
NABOO_NAME
[]
=
"Naboo"
;
const
double
NABOO_MASS
=
10
*
1E24
;
const
double
NABOO_SEMI_MAJOR_AXIS
=
100
*
1E9
;
const
double
NABOO_ECCENTRICITY
=
0
.
6
;
const
int32_t
NABOO_DRAWING_RADIUS
=
13
;
const
int32_t
NABOO_COLOR
=
0x00008B
;
// Endor
const
char
ENDOR_NAME
[]
=
"Endor"
;
const
double
ENDOR_MASS
=
1E23
;
const
double
ENDOR_SEMI_MAJOR_AXIS
=
100
*
1E9
;
const
double
ENDOR_ECCENTRICITY
=
0
.
34
;
const
int32_t
ENDOR_DRAWING_RADIUS
=
8
;
const
int32_t
ENDOR_COLOR
=
0x228B22
;
// Coruscant
const
char
CORUSCANT_NAME
[]
=
"Coruscant"
;
const
double
CORUSCANT_MASS
=
1E27
;
const
double
CORUSCANT_SEMI_MAJOR_AXIS
=
600
*
1E9
;
const
double
CORUSCANT_ECCENTRICITY
=
0
.
4675
;
const
int32_t
CORUSCANT_DRAWING_RADIUS
=
35
;
const
int32_t
CORUSCANT_COLOR
=
0x5C4033
;
const
int32_t
OBJECTS_LENGTH
=
11
;
PlanetarySystem
*
planetary_system_create
()
{
PlanetarySystem
*
planetary_system
=
(
PlanetarySystem
*
)
malloc
(
sizeof
(
PlanetarySystem
));
...
...
@@ -91,12 +104,12 @@ PlanetarySystem *planetary_system_create() {
planetary_system
->
previous_interval
=
1
;
planetary_system
->
show_names
=
true
;
char
*
names
[]
=
{(
char
*
)
SUN_NAME
,
(
char
*
)
MERCURY_NAME
,
(
char
*
)
VENUS_NAME
,
(
char
*
)
EARTH_NAME
,
(
char
*
)
MOON_NAME
,
(
char
*
)
APOLLO_11_NAME
,
(
char
*
)
MARS_NAME
,
(
char
*
)
JUPITER_NAME
,
"Naboo"
,
"Endor"
};
double
masses
[]
=
{
SUN_MASS
,
MERCURY_MASS
,
VENUS_MASS
,
EARTH_MASS
,
MOON_MASS
,
APOLLO_11_MASS
,
MARS_MASS
,
JUPITER_MASS
,
1000000
,
1E23
};
double
semi_major_axes
[]
=
{
SUN_SEMI_MAJOR_AXIS
,
MERCURY_SEMI_MAJOR_AXIS
,
VENUS_SEMI_MAJOR_AXIS
,
EARTH_SEMI_MAJOR_AXIS
,
MOON_SEMI_MAJOR_AXIS
,
APOLLO_11_SEMI_MAJOR_AXIS
,
MARS_SEMI_MAJOR_AXIS
,
JUPITER_SEMI_MAJOR_AXIS
,
800
.
598262
*
1E9
,
100
*
1E9
};
double
eccentricities
[]
=
{
SUN_ECCENTRICITY
,
MERCURY_ECCENTRICITY
,
VENUS_ECCENTRICITY
,
EARTH_ECCENTRICITY
,
MOON_ECCENTRICITY
,
APOLLO_11_ECCENTRICITY
,
MARS_ECCENTRICITY
,
JUPITER_ECCENTRICITY
,
0
.
8
,
0
.
34
};
int32_t
drawing_disc_radiuses
[]
=
{
SUN_DRAWING_RADIUS
,
MERCURY_DRAWING_RADIUS
,
VENUS_DRAWING_RADIUS
,
EARTH_DRAWING_RADIUS
,
MOON_DRAWING_RADIUS
,
APOLLO_11_DRAWING_RADIUS
,
MARS_DRAWING_RADIUS
,
JUPITER_DRAWING_RADIUS
,
12
,
12
};
int32_t
drawing_colors
[]
=
{
SUN_COLOR
,
MERCURY_COLOR
,
VENUS_COLOR
,
EARTH_COLOR
,
MOON_COLOR
,
APOLLO_11_COLOR
,
MARS_COLOR
,
JUPITER_COLOR
,
0x007700
,
0x007700
};
char
*
names
[]
=
{(
char
*
)
SUN_NAME
,
(
char
*
)
MERCURY_NAME
,
(
char
*
)
VENUS_NAME
,
(
char
*
)
EARTH_NAME
,
(
char
*
)
MOON_NAME
,
(
char
*
)
APOLLO_11_NAME
,
(
char
*
)
MARS_NAME
,
(
char
*
)
JUPITER_NAME
,
(
char
*
)
NABOO_NAME
,
(
char
*
)
ENDOR_NAME
,
(
char
*
)
CORUSCANT_NAME
};
double
masses
[]
=
{
SUN_MASS
,
MERCURY_MASS
,
VENUS_MASS
,
EARTH_MASS
,
MOON_MASS
,
APOLLO_11_MASS
,
MARS_MASS
,
JUPITER_MASS
,
NABOO_MASS
,
ENDOR_MASS
,
CORUSCANT_MASS
};
double
semi_major_axes
[]
=
{
SUN_SEMI_MAJOR_AXIS
,
MERCURY_SEMI_MAJOR_AXIS
,
VENUS_SEMI_MAJOR_AXIS
,
EARTH_SEMI_MAJOR_AXIS
,
MOON_SEMI_MAJOR_AXIS
,
APOLLO_11_SEMI_MAJOR_AXIS
,
MARS_SEMI_MAJOR_AXIS
,
JUPITER_SEMI_MAJOR_AXIS
,
NABOO_SEMI_MAJOR_AXIS
,
ENDOR_SEMI_MAJOR_AXIS
,
CORUSCANT_SEMI_MAJOR_AXIS
};
double
eccentricities
[]
=
{
SUN_ECCENTRICITY
,
MERCURY_ECCENTRICITY
,
VENUS_ECCENTRICITY
,
EARTH_ECCENTRICITY
,
MOON_ECCENTRICITY
,
APOLLO_11_ECCENTRICITY
,
MARS_ECCENTRICITY
,
JUPITER_ECCENTRICITY
,
NABOO_ECCENTRICITY
,
ENDOR_ECCENTRICITY
,
CORUSCANT_ECCENTRICITY
};
int32_t
drawing_disc_radiuses
[]
=
{
SUN_DRAWING_RADIUS
,
MERCURY_DRAWING_RADIUS
,
VENUS_DRAWING_RADIUS
,
EARTH_DRAWING_RADIUS
,
MOON_DRAWING_RADIUS
,
APOLLO_11_DRAWING_RADIUS
,
MARS_DRAWING_RADIUS
,
JUPITER_DRAWING_RADIUS
,
NABOO_DRAWING_RADIUS
,
ENDOR_DRAWING_RADIUS
,
CORUSCANT_DRAWING_RADIUS
};
int32_t
drawing_colors
[]
=
{
SUN_COLOR
,
MERCURY_COLOR
,
VENUS_COLOR
,
EARTH_COLOR
,
MOON_COLOR
,
APOLLO_11_COLOR
,
MARS_COLOR
,
JUPITER_COLOR
,
NABOO_COLOR
,
ENDOR_COLOR
,
CORUSCANT_COLOR
};
for
(
int32_t
i
=
0
;
i
<
planetary_system
->
objects_length
;
i
+=
1
)
{
CelestialObject
*
object
=
celestial_object_create
(
names
[
i
],
masses
[
i
],
semi_major_axes
[
i
],
eccentricities
[
i
],
drawing_disc_radiuses
[
i
],
drawing_colors
[
i
]);
...
...
@@ -148,7 +161,7 @@ void planetary_system_draw(PlanetarySystem *planetary_system) {
// Drawing the names of the objects afterwards so that they are not under the rest of the drawings.
planetary_system_draw_object_names
(
planetary_system
);
char
text
[
1
00
];
char
text
[
2
00
];
sprintf
(
text
,
"Focused Object : %s"
,
planetary_system
->
objects
[
planetary_system
->
reference_frame_index
]
->
name
);
draw_text
(
text
,
vector2_create
(
5
,
15
));
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment