Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SimStadt
3DClient4SimStadtAPI
Commits
baa1f9cd
Commit
baa1f9cd
authored
Jan 13, 2022
by
Kolokolnikova
Browse files
Implemented Normalization functions
for ranges of PV-values
parent
e1e18a32
Changes
1
Hide whitespace changes
Inline
Side-by-side
public/js/pvPotentialNormalization.js
View file @
baa1f9cd
/* TODO: issue #128
write a function which normalizes each value from the pvPotential array
and
*/
\ No newline at end of file
*/
var
minAndMaxPvPotentials
=
[];
function
setMinAndMax
(
pvPotentialValue
)
{
let
pvPotentials
=
[];
pvPotentialSurfaces
.
forEach
(
t
=>
{
for
(
const
[
key
,
value
]
of
Object
.
entries
(
t
.
attributes
.
pvPotential
))
{
if
(
key
===
pvPotentialValue
)
{
pvPotentials
.
push
(
value
);
}
}
});
pvPotentials
=
pvPotentials
.
sort
(
function
(
a
,
b
)
{
return
a
-
b
;
});
minAndMaxPvPotentials
.
push
(
pvPotentials
[
0
]);
minAndMaxPvPotentials
.
push
(
pvPotentials
[
pvPotentials
.
length
-
1
]);
}
function
getNormalizedValue
(
selectedPvPotentialValue
)
{
var
normalizedValue
;
if
(
minAndMaxPvPotentials
[
1
]
-
minAndMaxPvPotentials
[
0
]
!==
0
){
normalizedValue
=
(
selectedPvPotentialValue
-
minAndMaxPvPotentials
[
0
])
/
(
minAndMaxPvPotentials
[
1
]
-
minAndMaxPvPotentials
[
0
]);
}
else
{
normalizedValue
=
1
;
}
return
normalizedValue
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment