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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Armin Co
qpong
Commits
db35df0a
Commit
db35df0a
authored
4 years ago
by
Armin Co
Browse files
Options
Downloads
Patches
Plain Diff
MorseBox
parent
2279f396
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
QPong/Particle.cpp
+1
-1
1 addition, 1 deletion
QPong/Particle.cpp
QPong/Utils.cpp
+2
-2
2 additions, 2 deletions
QPong/Utils.cpp
QPong/Utils.hpp
+1
-1
1 addition, 1 deletion
QPong/Utils.hpp
with
4 additions
and
4 deletions
QPong/Particle.cpp
+
1
−
1
View file @
db35df0a
...
@@ -84,7 +84,7 @@ Particle::Particle(Properties properties, GameOptions &options, Player &playerOn
...
@@ -84,7 +84,7 @@ Particle::Particle(Properties properties, GameOptions &options, Player &playerOn
else
else
{
{
// "Simulation"
// "Simulation"
calculate
Gauss
Box
(
m_staticBorders
,
m_xAt
,
m_yAt
,
m_properties
.
elements
());
calculate
Morse
Box
(
m_staticBorders
,
m_xAt
,
m_yAt
,
m_properties
.
elements
());
m_leftBat
.
moveAway
();
m_leftBat
.
moveAway
();
m_rightBat
.
moveAway
();
m_rightBat
.
moveAway
();
}
}
...
...
This diff is collapsed.
Click to expand it.
QPong/Utils.cpp
+
2
−
2
View file @
db35df0a
...
@@ -85,7 +85,7 @@ void calculateBorderPotential(float *potential, [[maybe_unused]] double *xAt, do
...
@@ -85,7 +85,7 @@ void calculateBorderPotential(float *potential, [[maybe_unused]] double *xAt, do
}
}
}
}
void
calculate
Gauss
Box
(
float
*
potential
,
double
*
xAt
,
double
*
yAt
,
int
arrayElements
)
void
calculate
Morse
Box
(
float
*
potential
,
double
*
xAt
,
double
*
yAt
,
int
arrayElements
)
{
{
constexpr
double
grow
=
0.1
;
constexpr
double
grow
=
0.1
;
constexpr
double
scalePotential
=
1.0
;
constexpr
double
scalePotential
=
1.0
;
...
@@ -94,7 +94,7 @@ void calculateGaussBox(float *potential, double *xAt, double *yAt, int arrayElem
...
@@ -94,7 +94,7 @@ void calculateGaussBox(float *potential, double *xAt, double *yAt, int arrayElem
auto
x
=
xAt
[
i
]
*
grow
;
auto
x
=
xAt
[
i
]
*
grow
;
auto
y
=
yAt
[
i
]
*
grow
;
auto
y
=
yAt
[
i
]
*
grow
;
auto
d
=
sqrt
(
pow2
(
x
)
+
pow2
(
y
));
auto
d
=
sqrt
(
pow2
(
x
)
+
pow2
(
y
));
// V(x) = 1 / cosh^2(x)
~
= 1 / (1/2 * (cosh(2x)+1))
// V(x) = 1 / cosh^2(x) = 1 / (1/2 * (cosh(2x)+1))
auto
V
=
1.0
/
(
0.5
*
(
cosh
(
2.0
*
d
)
+
1.0
));
auto
V
=
1.0
/
(
0.5
*
(
cosh
(
2.0
*
d
)
+
1.0
));
V
*=
scalePotential
;
V
*=
scalePotential
;
potential
[
i
]
=
1.0
-
V
;
potential
[
i
]
=
1.0
-
V
;
...
...
This diff is collapsed.
Click to expand it.
QPong/Utils.hpp
+
1
−
1
View file @
db35df0a
...
@@ -17,5 +17,5 @@ void calculatePointPositions(float *points, int arraySize);
...
@@ -17,5 +17,5 @@ void calculatePointPositions(float *points, int arraySize);
void
calculateMomentumViewPositions
(
float
*
points
,
int
arraySize
);
void
calculateMomentumViewPositions
(
float
*
points
,
int
arraySize
);
void
calculateTriangleIndices
(
uint32_t
*
indices
,
int
arraySize
);
void
calculateTriangleIndices
(
uint32_t
*
indices
,
int
arraySize
);
void
calculateBorderPotential
(
float
*
potential
,
double
*
xAt
,
double
*
yAt
,
int
arrayElements
);
void
calculateBorderPotential
(
float
*
potential
,
double
*
xAt
,
double
*
yAt
,
int
arrayElements
);
void
calculate
Gauss
Box
(
float
*
potential
,
double
*
xAt
,
double
*
yAt
,
int
arrayElemnts
);
void
calculate
Morse
Box
(
float
*
potential
,
double
*
xAt
,
double
*
yAt
,
int
arrayElemnts
);
#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