From 2426e7b2e22947318b4ac4db01feb0765e925870 Mon Sep 17 00:00:00 2001 From: Luca Warmenhoven Date: Wed, 29 May 2024 16:11:43 +0200 Subject: [PATCH] Updated PersonalMotionPreviewElement --- .../components/PersonalMotionPreviewElement.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/code/src/Fitbot/app/src/main/java/com/example/fitbot/ui/components/PersonalMotionPreviewElement.java b/code/src/Fitbot/app/src/main/java/com/example/fitbot/ui/components/PersonalMotionPreviewElement.java index 4154037..141b0bc 100644 --- a/code/src/Fitbot/app/src/main/java/com/example/fitbot/ui/components/PersonalMotionPreviewElement.java +++ b/code/src/Fitbot/app/src/main/java/com/example/fitbot/ui/components/PersonalMotionPreviewElement.java @@ -102,12 +102,12 @@ public class PersonalMotionPreviewElement extends View { this.axisVectors = new Vector2f[] { - projectVertex(new Vector3f(-1.0f, 0, 0), getWidth(), getHeight()), - projectVertex(new Vector3f(1.0f, 0, 0), getWidth(), getHeight()), - projectVertex(new Vector3f(0, -1.0f, 0), getWidth(), getHeight()), - projectVertex(new Vector3f(0, 1.0f, 0), getWidth(), getHeight()), - projectVertex(new Vector3f(0, 0, -1.0f), getWidth(), getHeight()), - projectVertex(new Vector3f(0, 0, 1.0f), getWidth(), getHeight()) + projectVertex(new Vector3f(-100.0f, 0, 0), getWidth(), getHeight()), + projectVertex(new Vector3f(100.0f, 0, 0), getWidth(), getHeight()), + projectVertex(new Vector3f(0, -100.0f, 0), getWidth(), getHeight()), + projectVertex(new Vector3f(0, 100.0f, 0), getWidth(), getHeight()), + projectVertex(new Vector3f(0, 0, -100.0f), getWidth(), getHeight()), + projectVertex(new Vector3f(0, 0, 100.0f), getWidth(), getHeight()) }; } @@ -142,6 +142,9 @@ public class PersonalMotionPreviewElement extends View { Log.i("MotionProcessor", "Processed data: " + progress + " (" + preprocessed + ")"); Vector2f parsed = projectVertex(processed, this.getWidth(), this.getHeight()); this.vectors.add(parsed); + // Remove the first element if the array is too big + if (this.vectors.size() > 100) + this.vectors.poll(); }); saySomethingNice(); }