Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TP_Solar_System
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hugo.marty
TP_Solar_System
Commits
8f7a068c
Commit
8f7a068c
authored
1 year ago
by
hugo.marty
Browse files
Options
Downloads
Patches
Plain Diff
fix(planet.c): Correction de bug
parent
f27efa5d
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
program/main
+0
-0
0 additions, 0 deletions
program/main
program/main.o
+0
-0
0 additions, 0 deletions
program/main.o
program/planet/planet.c
+4
-3
4 additions, 3 deletions
program/planet/planet.c
program/planet/planet.h
+7
-0
7 additions, 0 deletions
program/planet/planet.h
with
11 additions
and
3 deletions
program/main
+
0
−
0
View file @
8f7a068c
No preview for this file type
This diff is collapsed.
Click to expand it.
program/main.o
+
0
−
0
View file @
8f7a068c
No preview for this file type
This diff is collapsed.
Click to expand it.
program/planet/planet.c
+
4
−
3
View file @
8f7a068c
...
@@ -56,8 +56,8 @@ system_t create_system(double delta_t, bool active_fictive_planet)
...
@@ -56,8 +56,8 @@ system_t create_system(double delta_t, bool active_fictive_planet)
planets
[
4
]
=
jupyter
;
planets
[
4
]
=
jupyter
;
// Saturne
// Saturne
planet_t
saturn
e
=
create_planet
(
1426700000
,
5.6846e26
,
0
.
053
9
,
vec2_create_zero
(),
EARTH_RADIUS
*
9
.
4492
,
MAKE_COLOR
(
203
,
175
,
112
),
vec2_create_zero
(),
true
);
planet_t
saturn
=
create_planet
(
1426700000
,
5.6846e26
,
0
.
053
9
,
vec2_create_zero
(),
EARTH_RADIUS
*
9
.
4492
,
MAKE_COLOR
(
203
,
175
,
112
),
vec2_create_zero
(),
true
);
planets
[
5
]
=
saturn
e
;
planets
[
5
]
=
saturn
;
// Uranus
// Uranus
planet_t
uranus
=
create_planet
(
2870700000
,
0.04726e25
,
0
.
04726
,
vec2_create_zero
(),
EARTH_RADIUS
*
4
.
00723
,
MAKE_COLOR
(
191
,
210
,
215
),
vec2_create_zero
(),
true
);
planet_t
uranus
=
create_planet
(
2870700000
,
0.04726e25
,
0
.
04726
,
vec2_create_zero
(),
EARTH_RADIUS
*
4
.
00723
,
MAKE_COLOR
(
191
,
210
,
215
),
vec2_create_zero
(),
true
);
...
@@ -137,6 +137,7 @@ void show_system(struct gfx_context_t *ctxt, system_t *system, double scale)
...
@@ -137,6 +137,7 @@ void show_system(struct gfx_context_t *ctxt, system_t *system, double scale)
// Afficher chaque planète
// Afficher chaque planète
for
(
uint32_t
i
=
0
;
i
<
system
->
nb_planets
;
i
++
)
for
(
uint32_t
i
=
0
;
i
<
system
->
nb_planets
;
i
++
)
{
{
// Afficher la planète
vec2
pos
=
vec2_create
(
system
->
planets
[
i
].
pos
.
x
/
MAX_RANGE
,
system
->
planets
[
i
].
pos
.
y
/
MAX_RANGE
);
vec2
pos
=
vec2_create
(
system
->
planets
[
i
].
pos
.
x
/
MAX_RANGE
,
system
->
planets
[
i
].
pos
.
y
/
MAX_RANGE
);
pos
=
vec2_mul
(
1
/
scale
,
pos
);
pos
=
vec2_mul
(
1
/
scale
,
pos
);
coordinates
coord
=
vec2_to_coordinates
(
pos
,
ctxt
->
width
,
ctxt
->
height
);
coordinates
coord
=
vec2_to_coordinates
(
pos
,
ctxt
->
width
,
ctxt
->
height
);
...
@@ -190,7 +191,7 @@ vec2 compute_all_forces(planet_t *planet, system_t *system)
...
@@ -190,7 +191,7 @@ vec2 compute_all_forces(planet_t *planet, system_t *system)
return
result
;
return
result
;
}
}
/// @brief Met à jour l'etiereté du système
/// @brief Met à jour l'e
n
tiereté du système
/// @param system
/// @param system
/// @param delta_t
/// @param delta_t
void
update_system
(
system_t
*
system
,
double
delta_t
)
void
update_system
(
system_t
*
system
,
double
delta_t
)
...
...
This diff is collapsed.
Click to expand it.
program/planet/planet.h
+
7
−
0
View file @
8f7a068c
...
@@ -4,6 +4,12 @@
...
@@ -4,6 +4,12 @@
#include
"../vec2/vec2.h"
#include
"../vec2/vec2.h"
#include
"../gfx/gfx.h"
#include
"../gfx/gfx.h"
typedef
struct
_ring
{
double
radius
;
uint32_t
color
;
}
ring_t
;
typedef
struct
_planet
typedef
struct
_planet
{
{
double
semi_major_axis
;
double
semi_major_axis
;
...
@@ -16,6 +22,7 @@ typedef struct _planet
...
@@ -16,6 +22,7 @@ typedef struct _planet
bool
clockwise
;
bool
clockwise
;
}
planet_t
;
}
planet_t
;
typedef
struct
_system
typedef
struct
_system
{
{
planet_t
star
;
// ex. The sun
planet_t
star
;
// ex. The sun
...
...
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