removal of junk and changes made by luca

This commit is contained in:
2024-05-29 17:34:24 +02:00
parent f350e58fda
commit fbe392d511
2 changed files with 7 additions and 7 deletions

View File

@@ -64,7 +64,9 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
Exercise exercise = new Exercise(EMuscleGroup.ARMS, "Bicep Curls", "Oefening voor de biceps.", gesturePathBuilder.build(), gesturePathBuilder.build());
personalMotionPreviewElement.initialize(exercise);
personalMotionPreviewElement.provideQiContext(null);
});
}
@Override

View File

@@ -42,13 +42,12 @@ public class PersonalMotionPreviewElement extends View {
private final Paint targetPaint = new Paint();
private final Paint backgroundColor = new Paint();
private Matrix4f modelMatrix = new Matrix4f(); // The model view matrix for the 3D to 2D transformation.
private Matrix4f viewMatrix = new Matrix4f(); // The view matrix for the 3D to 2D transformation.
private Matrix4f projectionMatrix = new Matrix4f(); // The projection matrix for the 3D to 2D transformation.
private final Vector4f objectPosition = new Vector4f(0, 0, 0, 1); // The location of the object in 3D space.
private ConcurrentLinkedQueue<Vector2f> vectors = new ConcurrentLinkedQueue<>();
private Vector2f[] axisVectors;
private Vector2f[] axisVectors = new Vector2f[0];
@@ -173,7 +172,7 @@ public class PersonalMotionPreviewElement extends View {
private Vector2f projectVertex(Vector3f point, int virtualWidth, int virtualHeight) {
viewMatrix
.identity()
.lookAt(new Vector3f(0, 0, -5), new Vector3f(0, 0, 0), new Vector3f(0, 1, 0));
.lookAt(new Vector3f(0, 0, -2), new Vector3f(0, 0, 0), new Vector3f(0, 1, 0));
// Transform the projection matrix to a perspective projection matrix
// Perspective transformation conserves the depth of the object
@@ -184,8 +183,7 @@ public class PersonalMotionPreviewElement extends View {
// Convert world coordinates to screen-space using MVP matrix
Vector4f screenCoordinates = new Vector4f(point, 1.0f)
.mul(this.projectionMatrix)
.mul(this.viewMatrix)
.mul(this.modelMatrix);
.mul(this.viewMatrix);
// Normalize screen coordinates from (-1, 1) to (0, virtualWidth) and (0, virtualHeight)
float normalizedX = (screenCoordinates.x / screenCoordinates.w + 1.0f) * 0.5f * virtualWidth;
@@ -199,8 +197,8 @@ public class PersonalMotionPreviewElement extends View {
public void onDraw(Canvas canvas) {
canvas.drawRect(0, 0, getWidth(), getHeight(), backgroundColor);
this.setBackgroundColor(0xFF000000); // Black
if (this.exercise == null)
return;
/*if (this.exercise == null)
return;*/
for (int i = 0, startX, endX, startY, endY; i < axisVectors.length/2; i++)
{