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
c9f6e7e2
Commit
c9f6e7e2
authored
4 years ago
by
Armin Co
Browse files
Options
Downloads
Patches
Plain Diff
H2
parent
db35df0a
Loading
Loading
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
+31
-1
31 additions, 1 deletion
QPong/Utils.cpp
QPong/Utils.hpp
+2
-0
2 additions, 0 deletions
QPong/Utils.hpp
with
34 additions
and
2 deletions
QPong/Particle.cpp
+
1
−
1
View file @
c9f6e7e2
...
@@ -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
Morse
Box
(
m_staticBorders
,
m_xAt
,
m_yAt
,
m_properties
.
elements
());
calculate
H2
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
+
31
−
1
View file @
c9f6e7e2
...
@@ -100,3 +100,33 @@ void calculateMorseBox(float *potential, double *xAt, double *yAt, int arrayElem
...
@@ -100,3 +100,33 @@ void calculateMorseBox(float *potential, double *xAt, double *yAt, int arrayElem
potential
[
i
]
=
1.0
-
V
;
potential
[
i
]
=
1.0
-
V
;
}
}
}
}
void
calculateGaussBox
(
float
*
potential
,
double
*
xAt
,
double
*
yAt
,
int
arrayElements
)
{
constexpr
double
grow
=
0.1
;
constexpr
double
scalePotential
=
1.0
;
for
(
int
i
{
0
};
i
<
arrayElements
;
++
i
)
{
auto
x
=
xAt
[
i
]
*
grow
;
auto
y
=
yAt
[
i
]
*
grow
;
auto
d
=
pow2
(
x
)
+
pow2
(
y
);
auto
V
=
exp
(
-
d
);
V
*=
scalePotential
;
potential
[
i
]
=
1.0
-
V
;
}
}
void
calculateH2Box
(
float
*
potential
,
double
*
xAt
,
double
*
yAt
,
int
arrayElements
)
{
constexpr
double
grow
=
1.0
;
constexpr
double
scalePotential
=
0.005
;
for
(
int
i
{
0
};
i
<
arrayElements
;
++
i
)
{
auto
x
=
xAt
[
i
]
*
grow
;
auto
y
=
yAt
[
i
]
*
grow
;
auto
d
=
sqrt
(
pow2
(
x
)
+
pow2
(
y
));
auto
V
=
d
;
V
*=
scalePotential
;
potential
[
i
]
=
V
;
}
}
This diff is collapsed.
Click to expand it.
QPong/Utils.hpp
+
2
−
0
View file @
c9f6e7e2
...
@@ -18,4 +18,6 @@ void calculateMomentumViewPositions(float *points, int arraySize);
...
@@ -18,4 +18,6 @@ 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
calculateMorseBox
(
float
*
potential
,
double
*
xAt
,
double
*
yAt
,
int
arrayElemnts
);
void
calculateMorseBox
(
float
*
potential
,
double
*
xAt
,
double
*
yAt
,
int
arrayElemnts
);
void
calculateGaussBox
(
float
*
potential
,
double
*
xAt
,
double
*
yAt
,
int
arrayElemnts
);
void
calculateH2Box
(
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