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
513663b3
Commit
513663b3
authored
2 years ago
by
JM
Browse files
Options
Downloads
Patches
Plain Diff
Correction struct
parent
14760f3d
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/field.c
+11
-2
11 additions, 2 deletions
src/field.c
src/field.h
+2
-6
2 additions, 6 deletions
src/field.h
src/main.c
+1
-0
1 addition, 0 deletions
src/main.c
with
14 additions
and
8 deletions
src/field.c
+
11
−
2
View file @
513663b3
...
...
@@ -3,6 +3,7 @@
#include
<stdlib.h>
#include
"field.h"
#include
"draw.h"
#include
"../utils/utils.h"
#define SIGN_SIZE 10
...
...
@@ -38,14 +39,22 @@ bool compute_total_normalized_e(charge_t *charges, int num_charges, vec2 p, doub
// 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
)
{
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
)
{
vec2
pos
=
vec2_create
(
pos0
.
x
,
pos0
.
y
);
vec2
pos_sum
;
for
(
int
i
=
0
;
i
<
num_charges
;
i
++
)
{
// compute_e(charges[i], ..., &pos_sum);
}
//vec2 pos_next =
return
EXIT_SUCCESS
;
}
// 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_charges
(
struct
gfx_context_t
*
context
,
charge_t
*
charges
,
int
num_charges
,
double
x0
,
double
x1
,
double
y0
,
double
y1
)
{
for
(
int
i
=
0
;
i
<
num_charges
;
i
++
)
{
coordinates_t
charge_center
=
position_to_coordinates
(
CHARGE_R
,
CHARGE_R
,
x0
,
x1
,
y0
,
y1
,
charges
[
i
].
pos
);
...
...
This diff is collapsed.
Click to expand it.
src/field.h
+
2
−
6
View file @
513663b3
...
...
@@ -18,15 +18,11 @@ bool compute_total_normalized_e(charge_t *charges, int num_charges, vec2 p, doub
// 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
);
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_charges
(
struct
gfx_context_t
*
context
,
charge_t
*
charges
,
int
num_charges
,
double
x0
,
double
x1
,
double
y0
,
double
y1
);
#endif
This diff is collapsed.
Click to expand it.
src/main.c
+
1
−
0
View file @
513663b3
...
...
@@ -2,6 +2,7 @@
#include
<time.h>
#include
"draw.h"
#include
"../utils/utils.h"
#include
"field.h"
#define SIDE_LEN 1000
#define WID SIDE_LEN
...
...
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