Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tp_8_galaxy
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
Model registry
Operate
Environments
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
arnaud.devevey
tp_8_galaxy
Commits
ded876b2
Commit
ded876b2
authored
6 years ago
by
arnaud.devevey
Browse files
Options
Downloads
Patches
Plain Diff
pause midi
parent
284629ea
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#5918
failed
6 years ago
Stage: test
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
perso/Makefile
+1
-1
1 addition, 1 deletion
perso/Makefile
perso/galaxy.c
+14
-8
14 additions, 8 deletions
perso/galaxy.c
perso/vector.c
+40
-2
40 additions, 2 deletions
perso/vector.c
perso/vector.h
+3
-0
3 additions, 0 deletions
perso/vector.h
with
58 additions
and
11 deletions
perso/Makefile
+
1
−
1
View file @
ded876b2
...
@@ -25,7 +25,7 @@ vector.o : vector.c
...
@@ -25,7 +25,7 @@ vector.o : vector.c
clean
:
clean
:
rm
-f
*
.o
$(
EXE
)
rm
-f
*
.o
galaxy
...
...
This diff is collapsed.
Click to expand it.
perso/galaxy.c
+
14
−
8
View file @
ded876b2
...
@@ -5,17 +5,17 @@
...
@@ -5,17 +5,17 @@
* Date : xx.06.2019 *
* Date : xx.06.2019 *
* * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * */
#include
<stdio.h>
// #include <stdio.h>
#include
<stdlib.h>
// #include <stdlib.h>
#include
<string.h>
// #include <string.h>
#include
<math.h>
// #include <math.h>
#include
<stdint.h>
#include
<assert.h>
#include
<time.h>
// #include <stdint.h>
#include
<libgen.h>
// #include <time.h>
// #include <libgen.h>
#include
"galaxy.h"
#include
"galaxy.h"
#include
"quadtree.h"
#include
"quadtree.h"
...
@@ -44,6 +44,12 @@ int main(int argc, char **argv) {
...
@@ -44,6 +44,12 @@ int main(int argc, char **argv) {
destruction_galaxie();
destruction_galaxie();
*/
*/
tests_vector
();
// tests_star();
// tests_box();
// tests_quadtree();
// tests_galaxy();
// on crée une étoile en (0;0) qui a comme masse 10^6 * masse solaire
// on crée une étoile en (0;0) qui a comme masse 10^6 * masse solaire
...
...
This diff is collapsed.
Click to expand it.
perso/vector.c
+
40
−
2
View file @
ded876b2
#include
<stdio.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<stdlib.h>
#include
<math.h>
#include
<math.h>
#include
<assert.h>
#include
"vector.h"
#include
"vector.h"
/* * * * * * * * * * * * * * * * *
* *
* --- TESTS --- *
* *
* * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * *
/* * * * * * * * * * * * * * * * *
* *
* *
* --- FONCTIONS --- *
* --- FONCTIONS --- *
...
@@ -38,10 +52,11 @@ Vector* sub_vec(const Vector* const v1, const Vector* const v2) {
...
@@ -38,10 +52,11 @@ Vector* sub_vec(const Vector* const v1, const Vector* const v2) {
return
temp_vec
;
return
temp_vec
;
}
}
/*
Vector* mul_vec(const Vector* const v1, const Vector* const v2) {
Vector* mul_vec(const Vector* const v1, const Vector* const v2) {
}
}
*/
Vector
*
scal_mul_vec
(
const
Vector
*
const
v1
,
const
double
lambda
)
{
Vector
*
scal_mul_vec
(
const
Vector
*
const
v1
,
const
double
lambda
)
{
...
@@ -55,7 +70,7 @@ Vector* scal_mul_vec(const Vector* const v1, const double lambda) {
...
@@ -55,7 +70,7 @@ Vector* scal_mul_vec(const Vector* const v1, const double lambda) {
double
norm
(
const
Vector
*
const
v1
)
{
double
norm
(
const
Vector
*
const
v1
)
{
return
sqrt
(
pow
(
v1
->
x
,
2
.
0
)
+
pow
(
v1
->
x
,
2
.
0
));
return
sqrt
(
pow
(
v1
->
x
,
2
.
0
)
+
pow
(
v1
->
y
,
2
.
0
));
}
}
...
@@ -73,3 +88,26 @@ double distance(const Vector* const v1, const Vector* const v2) {
...
@@ -73,3 +88,26 @@ double distance(const Vector* const v1, const Vector* const v2) {
void
print_vec
(
const
Vector
*
const
v
)
{
void
print_vec
(
const
Vector
*
const
v
)
{
printf
(
"
\t
print_vec() : x = %f
\t
y = %f
\n
"
,
v
->
x
,
v
->
y
);
printf
(
"
\t
print_vec() : x = %f
\t
y = %f
\n
"
,
v
->
x
,
v
->
y
);
}
}
void
tests_vector
()
{
Vector
*
v1
=
new_vec
(
1
.
0
,
2
.
0
);
Vector
*
v2
=
new_vec
(
3
.
0
,
5
.
0
);
assert
(
v1
!=
NULL
&&
v2
!=
NULL
);
Vector
*
v_tests
=
new_vec
(
4
.
0
,
7
.
0
);
assert
(
add_vec
(
v1
,
v2
)
==
v_tests
);
v_tests
->
x
=
-
2
.
0
;
v_tests
->
y
=
-
3
.
0
;
assert
(
sub_vec
(
v1
,
v2
)
==
v_tests
);
assert
(
norm
(
v1
)
==
sqrt
(
5
));
v_tests
->
x
=
2
.
0
;
v_tests
->
y
=
3
.
0
;
double
norm_tests
=
norm
(
v_tests
);
assert
(
distance
(
v1
,
v2
)
==
norm_tests
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
perso/vector.h
+
3
−
0
View file @
ded876b2
...
@@ -47,4 +47,7 @@ double distance(const Vector* const v1, const Vector* const v2);
...
@@ -47,4 +47,7 @@ double distance(const Vector* const v1, const Vector* const v2);
void
print_vec
(
const
Vector
*
const
v
);
void
print_vec
(
const
Vector
*
const
v
);
void
tests_vector
();
#endif
#endif
\ No newline at end of file
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