Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
phys_tp_elec
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
boris.stefanov
phys_tp_elec
Commits
af2b1331
Commit
af2b1331
authored
2 years ago
by
JM
Browse files
Options
Downloads
Patches
Plain Diff
Warnings retirés
parent
39826c63
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/draw.c
+3
-3
3 additions, 3 deletions
src/draw.c
src/field.c
+3
-2
3 additions, 2 deletions
src/field.c
src/field.h
+0
-11
0 additions, 11 deletions
src/field.h
with
6 additions
and
16 deletions
src/draw.c
+
3
−
3
View file @
af2b1331
...
...
@@ -4,9 +4,9 @@
#include
"field.h"
void
gfx_draw_line
(
struct
gfx_context_t
*
ctxt
,
coordinates_t
p0
,
coordinates_t
p1
,
uint32_t
color
)
{
int
dx
=
abs
(
p1
.
column
-
p0
.
column
);
int
dx
=
abs
(
(
int
)
p1
.
column
-
(
int
)
p0
.
column
);
int
sx
=
p0
.
column
<
p1
.
column
?
1
:
-
1
;
int
dy
=
-
abs
(
p1
.
row
-
p0
.
row
);
int
dy
=
-
abs
(
(
int
)
p1
.
row
-
(
int
)
p0
.
row
);
int
sy
=
p0
.
row
<
p1
.
row
?
1
:
-
1
;
int
error
=
dx
+
dy
;
...
...
@@ -50,7 +50,7 @@ void gfx_draw_circle(struct gfx_context_t *ctxt, coordinates c, uint32_t r, uint
if
(
d
>=
2
*
x
){
d
=
d
-
2
*
x
-
1
;
x
++
;
}
else
if
(
d
<
2
*
(
r
-
y
)){
}
else
if
(
d
<
2
*
(
(
int
)
r
-
y
)){
d
=
d
+
2
*
y
-
1
;
y
--
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/field.c
+
3
−
2
View file @
af2b1331
#include
<stdbool.h>
#include
<stdlib.h>
#include
<time.h>
#include
"draw.h"
#include
"field.h"
...
...
@@ -41,10 +42,10 @@ double compute_delta_x(){
}
bool
is_in_screen
(
coordinates_t
pos
){
if
(
pos
.
column
>
WID
||
pos
.
column
<
0
)
if
(
pos
.
column
>
WID
)
return
false
;
if
(
pos
.
row
>
HEI
||
pos
.
row
<
0
)
if
(
pos
.
row
>
HEI
)
return
false
;
return
true
;
...
...
This diff is collapsed.
Click to expand it.
src/field.h
+
0
−
11
View file @
af2b1331
...
...
@@ -18,17 +18,6 @@ bool compute_e(charge_t c, vec2 p, double eps, vec2 *e);
// Return false if for some qiP, norm(qiP) < eps
bool
compute_total_normalized_e
(
charge_t
*
charges
,
int
num_charges
,
vec2
p
,
double
eps
,
vec2
*
e
);
// Compute and then draw all the points belonging to a field line,
// starting from pos0.
// Returns false if pos0 is not a valid position
// (for example if pos0 is too close to a charge).
static
bool
draw_field_line
(
struct
gfx_context_t
*
ctxt
,
charge_t
*
charges
,
int
num_charges
,
double
dx
,
vec2
pos0
,
double
x0
,
double
x1
,
double
y0
,
double
y1
);
// Draw all the charges
// A circle with minus sign for negative charges
// A circle with a plus sign for positive charges
static
void
draw_charges
(
struct
gfx_context_t
*
context
,
charge_t
*
charges
,
int
num_charges
,
double
x0
,
double
x1
,
double
y0
,
double
y1
);
void
draw_everything
(
struct
gfx_context_t
*
ctxt
,
charge_t
*
charges
,
...
...
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