From bf80194c07446639bb1ec364bf7268aad0b702e2 Mon Sep 17 00:00:00 2001 From: JCNoguera Date: Thu, 22 Feb 2024 10:02:36 +0100 Subject: [PATCH] refactor: rename HALF_PERIOD constants to PERIOD --- client/src/features/visualizer-threejs/constants.ts | 4 ++-- client/src/features/visualizer-threejs/utils.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/features/visualizer-threejs/constants.ts b/client/src/features/visualizer-threejs/constants.ts index 66f6cd27f..94f527f66 100644 --- a/client/src/features/visualizer-threejs/constants.ts +++ b/client/src/features/visualizer-threejs/constants.ts @@ -92,5 +92,5 @@ export const HALF_WAVE_PERIOD_SECONDS = 5; /* Values for randomizing the tangle */ export const NUMBER_OF_RANDOM_PERIODS = 100; -export const MIN_SINUSOID_HALF_PERIOD = 1; -export const MAX_SINUSOID_HALF_PERIOD = 4; +export const MIN_SINUSOID_PERIOD = 5; +export const MAX_SINUSOID_PERIOD = 8; diff --git a/client/src/features/visualizer-threejs/utils.ts b/client/src/features/visualizer-threejs/utils.ts index 53d3417c0..f38a82354 100644 --- a/client/src/features/visualizer-threejs/utils.ts +++ b/client/src/features/visualizer-threejs/utils.ts @@ -18,8 +18,8 @@ import { SINUSOIDAL_AMPLITUDE_ACCUMULATOR, INITIAL_SINUSOIDAL_AMPLITUDE, NUMBER_OF_RANDOM_PERIODS, - MIN_SINUSOID_HALF_PERIOD, - MAX_SINUSOID_HALF_PERIOD, + MIN_SINUSOID_PERIOD, + MAX_SINUSOID_PERIOD, } from "./constants"; import type { ICameraAngles, ISinusoidalPositionParams, IThreeDimensionalPosition } from "./interfaces"; @@ -283,7 +283,7 @@ export function positionToVector(position: IThreeDimensionalPosition) { export function generateRandomPeriods(): { periods: number[]; sum: number } { let sum = 0; const periods = Array.from({ length: NUMBER_OF_RANDOM_PERIODS }, () => { - const period = Number(randomNumberFromInterval(MIN_SINUSOID_HALF_PERIOD, MAX_SINUSOID_HALF_PERIOD).toFixed(4)); + const period = Number(randomNumberFromInterval(MIN_SINUSOID_PERIOD, MAX_SINUSOID_PERIOD).toFixed(4)); sum += period; return period; });