Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
qpong
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
Container registry
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Armin Co
qpong
Commits
3d2098a4
Commit
3d2098a4
authored
Jan 31, 2021
by
Armin Co
Browse files
Options
Downloads
Patches
Plain Diff
Updated Gausbox
parent
f187f9fb
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
App/GameLayer.cpp
+5
-5
5 additions, 5 deletions
App/GameLayer.cpp
QPong/Particle.cpp
+2
-2
2 additions, 2 deletions
QPong/Particle.cpp
QPong/Utils.cpp
+9
-2
9 additions, 2 deletions
QPong/Utils.cpp
with
16 additions
and
9 deletions
App/GameLayer.cpp
+
5
−
5
View file @
3d2098a4
...
@@ -177,9 +177,9 @@ void QPong::GameLayer::reset()
...
@@ -177,9 +177,9 @@ void QPong::GameLayer::reset()
const
int
xRand
=
rand
()
%
64
;
const
int
xRand
=
rand
()
%
64
;
const
int
yRand
=
rand
()
%
32
;
const
int
yRand
=
rand
()
%
32
;
int
positive
=
rand
()
%
2
;
int
positive
=
rand
()
%
2
;
m_properties
.
momentum
.
x
=
(
1.0f
-
(
2.0f
*
positive
))
*
(
1.0
+
static_cast
<
float
>
(
xRand
)
/
120.0f
);
m_properties
.
momentum
.
x
=
(
1.0f
-
(
2.0f
*
positive
))
*
(
1.0
+
static_cast
<
float
>
(
xRand
)
/
120.0f
)
/
20.0
;
positive
=
rand
()
%
2
;
positive
=
rand
()
%
2
;
m_properties
.
momentum
.
y
=
(
1.0f
-
(
2.0f
*
positive
))
*
(
1.0
+
static_cast
<
float
>
(
yRand
)
/
120.0f
);
m_properties
.
momentum
.
y
=
(
1.0f
-
(
2.0f
*
positive
))
*
(
1.0
+
static_cast
<
float
>
(
yRand
)
/
120.0f
)
/
20.0
;
}
}
m_options
.
game
=
m_gaming
;
m_options
.
game
=
m_gaming
;
m_options
.
absorbtionEnabled
=
m_gaming
;
m_options
.
absorbtionEnabled
=
m_gaming
;
...
@@ -278,14 +278,14 @@ void QPong::GameLayer::onGuiRender()
...
@@ -278,14 +278,14 @@ void QPong::GameLayer::onGuiRender()
{
{
// GUI settings for the particle
// GUI settings for the particle
ImGui
::
Begin
(
"Particle Settings"
);
ImGui
::
Begin
(
"Particle Settings"
);
ImGui
::
DragFloat2
(
"Start Position"
,
glm
::
value_ptr
(
m_properties
.
position
),
0.0
1
f
,
-
1.0f
,
1.0
f
);
ImGui
::
DragFloat2
(
"Start Position"
,
glm
::
value_ptr
(
m_properties
.
position
),
0.0
25
f
,
-
0.8f
,
0.8
f
);
// Select initial momentum for particle at restart
// Select initial momentum for particle at restart
ImGui
::
DragFloat2
(
"Momentum [x,y]"
,
glm
::
value_ptr
(
m_properties
.
momentum
),
0.01f
,
-
3.0f
,
3.0
f
);
ImGui
::
DragFloat2
(
"Momentum [x,y]"
,
glm
::
value_ptr
(
m_properties
.
momentum
),
0.
0
01f
,
-
0.1f
,
0.1
f
);
ImGui
::
Checkbox
(
"Random Momentum"
,
&
m_randomMomentum
);
ImGui
::
Checkbox
(
"Random Momentum"
,
&
m_randomMomentum
);
float
sharpness
=
m_properties
.
sharpness
;
float
sharpness
=
m_properties
.
sharpness
;
if
(
ImGui
::
DragFloat
(
"Sharpness"
,
&
sharpness
,
1
.0f
,
5.0f
,
1000.0f
))
if
(
ImGui
::
DragFloat
(
"Sharpness"
,
&
sharpness
,
5
.0f
,
5.0f
,
1000.0f
))
{
{
m_properties
.
sharpness
=
sharpness
;
m_properties
.
sharpness
=
sharpness
;
}
}
...
...
This diff is collapsed.
Click to expand it.
QPong/Particle.cpp
+
2
−
2
View file @
3d2098a4
...
@@ -158,8 +158,8 @@ void Particle::initialiseParticleMomentum()
...
@@ -158,8 +158,8 @@ void Particle::initialiseParticleMomentum()
constexpr
std
::
complex
<
double
>
ci
{
0.0
,
1.0
};
// complex number
constexpr
std
::
complex
<
double
>
ci
{
0.0
,
1.0
};
// complex number
const
double
hbar
=
m_properties
.
hbar
;
const
double
hbar
=
m_properties
.
hbar
;
const
double
A0
=
m_properties
.
startValue
;
const
double
A0
=
m_properties
.
startValue
;
const
double
px0
=
m_properties
.
momentum
.
x
/
20.0
;
const
double
px0
=
m_properties
.
momentum
.
x
;
const
double
py0
=
m_properties
.
momentum
.
y
/
20.0
;
const
double
py0
=
m_properties
.
momentum
.
y
;
const
double
x0
=
m_properties
.
position
.
x
;
const
double
x0
=
m_properties
.
position
.
x
;
const
double
y0
=
m_properties
.
position
.
y
;
const
double
y0
=
m_properties
.
position
.
y
;
const
double
lambda
=
m_properties
.
sharpness
;
const
double
lambda
=
m_properties
.
sharpness
;
...
...
This diff is collapsed.
Click to expand it.
QPong/Utils.cpp
+
9
−
2
View file @
3d2098a4
...
@@ -95,9 +95,16 @@ void calculateSchroedingerPotential(float *potential, double *xAt, double *yAt,
...
@@ -95,9 +95,16 @@ void calculateSchroedingerPotential(float *potential, double *xAt, double *yAt,
void
calculateGaussBox
(
float
*
potential
,
double
*
xAt
,
double
*
yAt
,
int
arrayElements
)
void
calculateGaussBox
(
float
*
potential
,
double
*
xAt
,
double
*
yAt
,
int
arrayElements
)
{
{
constexpr
double
grow
=
2.0
;
constexpr
double
grow
=
0.1
;
constexpr
double
scalePotential
=
1.0
;
for
(
int
i
{
0
};
i
<
arrayElements
;
++
i
)
for
(
int
i
{
0
};
i
<
arrayElements
;
++
i
)
{
{
potential
[
i
]
=
1.0
/
((
exp
(
-
pow2
(
xAt
[
i
]
*
grow
)
+
-
pow2
(
yAt
[
i
]
*
grow
)))
*
5500.0
);
auto
x
=
xAt
[
i
]
*
grow
;
auto
y
=
yAt
[
i
]
*
grow
;
auto
d
=
sqrt
(
pow2
(
x
)
+
pow2
(
y
));
// V(x) = 1 / cosh^2(x) ~= 1 / (1/2 * (cosh(2x)+1))
auto
V
=
1.0
/
(
0.5
*
(
cosh
(
2.0
*
d
)
+
1.0
));
V
*=
scalePotential
;
potential
[
i
]
=
1.0
-
V
;
}
}
}
}
\ 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