Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Galaxy_Simulator
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
benjamin.sitbon
Galaxy_Simulator
Commits
27815908
Commit
27815908
authored
6 years ago
by
Benjamin-Sitbon
Browse files
Options
Downloads
Patches
Plain Diff
Box
Finish without comments
parent
8fbf58e1
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
.idea/workspace.xml
+21
-22
21 additions, 22 deletions
.idea/workspace.xml
Box
+0
-0
0 additions, 0 deletions
Box
Box.c
+76
-0
76 additions, 0 deletions
Box.c
Box.o
+0
-0
0 additions, 0 deletions
Box.o
with
97 additions
and
22 deletions
.idea/workspace.xml
+
21
−
22
View file @
27815908
...
@@ -10,10 +10,9 @@
...
@@ -10,10 +10,9 @@
</component>
</component>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"43aff179-c306-46b9-b69f-eca5306fbf96"
name=
"Default Changelist"
comment=
""
>
<list
default=
"true"
id=
"43aff179-c306-46b9-b69f-eca5306fbf96"
name=
"Default Changelist"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/Vector"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Vector"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Box"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Box"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Vector.c"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Vector.c"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Box.c"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Box.c"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Vector.o"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Vector.o"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Box.o"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Box.o"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/makefile"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/makefile"
afterDir=
"false"
/>
</list>
</list>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
...
@@ -26,7 +25,7 @@
...
@@ -26,7 +25,7 @@
<file
pinned=
"false"
current-in-tab=
"false"
>
<file
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/Vector.c"
>
<entry
file=
"file://$PROJECT_DIR$/Vector.c"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
920
"
>
<state
relative-caret-position=
"
2348
"
>
<caret
line=
"210"
lean-forward=
"true"
selection-start-line=
"210"
selection-end-line=
"210"
/>
<caret
line=
"210"
lean-forward=
"true"
selection-start-line=
"210"
selection-end-line=
"210"
/>
</state>
</state>
</provider>
</provider>
...
@@ -44,8 +43,8 @@
...
@@ -44,8 +43,8 @@
<file
pinned=
"false"
current-in-tab=
"true"
>
<file
pinned=
"false"
current-in-tab=
"true"
>
<entry
file=
"file://$PROJECT_DIR$/Box.c"
>
<entry
file=
"file://$PROJECT_DIR$/Box.c"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
391
"
>
<state
relative-caret-position=
"
226
"
>
<caret
line=
"
56
"
column=
"33"
selection-start-line=
"
56
"
selection-start-column=
"33"
selection-end-line=
"
56
"
selection-end-column=
"33"
/>
<caret
line=
"
131
"
column=
"33"
selection-start-line=
"
131
"
selection-start-column=
"33"
selection-end-line=
"
131
"
selection-end-column=
"33"
/>
</state>
</state>
</provider>
</provider>
</entry>
</entry>
...
@@ -53,8 +52,8 @@
...
@@ -53,8 +52,8 @@
<file
pinned=
"false"
current-in-tab=
"false"
>
<file
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/Box.h"
>
<entry
file=
"file://$PROJECT_DIR$/Box.h"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state>
<state
relative-caret-position=
"153"
>
<caret
column=
"18
"
selection-start-
column=
"18
"
selection-end-column=
"
18
"
/>
<caret
line=
"9
"
selection-start-
line=
"9"
selection-end-line=
"9
"
selection-end-column=
"
27
"
/>
</state>
</state>
</provider>
</provider>
</entry>
</entry>
...
@@ -138,12 +137,12 @@
...
@@ -138,12 +137,12 @@
<option
name=
"number"
value=
"Default"
/>
<option
name=
"number"
value=
"Default"
/>
<option
name=
"presentableId"
value=
"Default"
/>
<option
name=
"presentableId"
value=
"Default"
/>
<updated>
1559227081243
</updated>
<updated>
1559227081243
</updated>
<workItem
from=
"1559227084365"
duration=
"
25870
000"
/>
<workItem
from=
"1559227084365"
duration=
"
35037
000"
/>
</task>
</task>
<servers
/>
<servers
/>
</component>
</component>
<component
name=
"TimeTrackingManager"
>
<component
name=
"TimeTrackingManager"
>
<option
name=
"totallyTimeSpent"
value=
"
25870
000"
/>
<option
name=
"totallyTimeSpent"
value=
"
35037
000"
/>
</component>
</component>
<component
name=
"ToolWindowManager"
>
<component
name=
"ToolWindowManager"
>
<frame
x=
"-7"
y=
"-7"
width=
"1550"
height=
"838"
extended-state=
"6"
/>
<frame
x=
"-7"
y=
"-7"
width=
"1550"
height=
"838"
extended-state=
"6"
/>
...
@@ -209,31 +208,31 @@
...
@@ -209,31 +208,31 @@
</state>
</state>
</provider>
</provider>
</entry>
</entry>
<entry
file=
"file://$PROJECT_DIR$/
Box
.h"
>
<entry
file=
"file://$PROJECT_DIR$/
Vector
.h"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state>
<state
relative-caret-position=
"85"
>
<caret
column=
"18
"
selection-start-
column=
"18
"
selection-end-column=
"
18
"
/>
<caret
line=
"5
"
selection-start-
line=
"5"
selection-end-line=
"5
"
selection-end-column=
"
33
"
/>
</state>
</state>
</provider>
</provider>
</entry>
</entry>
<entry
file=
"file://$PROJECT_DIR$/
Vector.c
"
>
<entry
file=
"file://$PROJECT_DIR$/
Box.h
"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
920
"
>
<state
relative-caret-position=
"
153
"
>
<caret
line=
"
210"
lean-forward=
"true
"
selection-
start
-line=
"
210
"
selection-end-
line
=
"2
10
"
/>
<caret
line=
"
9"
selection-start-line=
"9
"
selection-
end
-line=
"
9
"
selection-end-
column
=
"2
7
"
/>
</state>
</state>
</provider>
</provider>
</entry>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Vector.
h
"
>
<entry
file=
"file://$PROJECT_DIR$/Vector.
c
"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"8
5
"
>
<state
relative-caret-position=
"
234
8"
>
<caret
line=
"
5"
selection-start-line=
"5
"
selection-
end
-line=
"
5
"
selection-end-
column=
"33
"
/>
<caret
line=
"
210"
lean-forward=
"true
"
selection-
start
-line=
"
210
"
selection-end-
line=
"210
"
/>
</state>
</state>
</provider>
</provider>
</entry>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Box.c"
>
<entry
file=
"file://$PROJECT_DIR$/Box.c"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
391
"
>
<state
relative-caret-position=
"
226
"
>
<caret
line=
"
56
"
column=
"33"
selection-start-line=
"
56
"
selection-start-column=
"33"
selection-end-line=
"
56
"
selection-end-column=
"33"
/>
<caret
line=
"
131
"
column=
"33"
selection-start-line=
"
131
"
selection-start-column=
"33"
selection-end-line=
"
131
"
selection-end-column=
"33"
/>
</state>
</state>
</provider>
</provider>
</entry>
</entry>
...
...
This diff is collapsed.
Click to expand it.
Box
+
0
−
0
View file @
27815908
No preview for this file type
This diff is collapsed.
Click to expand it.
Box.c
+
76
−
0
View file @
27815908
...
@@ -33,6 +33,42 @@ bool is_inside(box b, vec *v){
...
@@ -33,6 +33,42 @@ bool is_inside(box b, vec *v){
}
}
}
}
double
compute_length
(
box
b
){
int
x
=
fabs
(
b
.
x0
)
+
fabs
(
b
.
x1
);
int
y
=
fabs
(
b
.
y0
)
+
fabs
(
b
.
y1
);
return
x
;
}
double
mid_point
(
double
a
,
double
b
){
double
mid
=
a
+
(
b
-
a
)
/
2
;
return
mid
;
}
box
*
divide_in_four
(
box
b
){
double
x_mid
=
mid_point
(
b
.
x0
,
b
.
x1
);
double
y_mid
=
mid_point
(
b
.
y0
,
b
.
y1
);
box
b1
=
new_box
(
b
.
x0
,
x_mid
,
y_mid
,
b
.
y1
);
box
b2
=
new_box
(
x_mid
,
b
.
x1
,
y_mid
,
b
.
y1
);
box
b3
=
new_box
(
b
.
x0
,
x_mid
,
b
.
y0
,
y_mid
);
box
b4
=
new_box
(
x_mid
,
b
.
x1
,
b
.
y0
,
y_mid
);
box
*
tab
=
malloc
(
4
*
sizeof
(
tab
));
tab
[
0
]
=
b1
;
tab
[
1
]
=
b2
;
tab
[
2
]
=
b3
;
tab
[
3
]
=
b4
;
return
tab
;
}
//TEST FONCTIONS//
//TEST FONCTIONS//
...
@@ -66,9 +102,49 @@ int Test_is_inside(){
...
@@ -66,9 +102,49 @@ int Test_is_inside(){
free
(
v2
);
free
(
v2
);
}
}
int
Test_compute_length
(){
box
b
=
new_box
(
-
1
.
0
,
1
.
0
,
-
2
.
0
,
2
.
0
);
double
test
=
compute_length
(
b
);
if
(
test
==
2
.
0
){
printf
(
"Test_compute_length IS OK
\n
"
);
}
else
{
printf
(
"Test_compute_length has an ERROR
\n
"
);
}
}
int
Test_mid_point
(){
double
test
=
mid_point
(
3
.
0
,
4
.
0
);
if
(
test
==
3
.
5
){
printf
(
"Test_mid_point IS OK
\n
"
);
}
else
{
printf
(
"Test_mid_point has an ERROR
\n
"
);
}
}
int
Test_divide_in_four
(){
box
b
=
new_box
(
-
1
.
0
,
1
.
0
,
-
1
.
0
,
1
.
0
);
box
*
tab
=
divide_in_four
(
b
);
if
(
compute_length
(
tab
[
0
])
==
compute_length
(
tab
[
1
])
&&
compute_length
(
tab
[
1
])
==
compute_length
(
tab
[
2
])
&&
compute_length
(
tab
[
2
])
==
compute_length
(
tab
[
3
])){
printf
(
"Test_divide_in_four IS OK
\n
"
);
}
else
{
printf
(
"Test_divide_in_four has an ERROR
\n
"
);
}
}
int
box_tests
(){
int
box_tests
(){
Test_new_box
();
Test_new_box
();
Test_is_inside
();
Test_is_inside
();
Test_compute_length
();
Test_mid_point
();
Test_divide_in_four
();
}
}
int
main
(
int
argc
,
char
*
argv
[]){
int
main
(
int
argc
,
char
*
argv
[]){
...
...
This diff is collapsed.
Click to expand it.
Box.o
+
0
−
0
View file @
27815908
No preview for this file type
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