JakovTomasic / RitehMaps

Indoor navigation project for the Faculty of Engineering, Rijeka
Apache License 2.0
3 stars 1 forks source link

Weird node rendering #77

Open NikaRodin opened 9 months ago

NikaRodin commented 9 months ago

Sometimes, some of the nodes in the navigation path render unexpectedly. A good example of this is the path from node 1-64a to node 1-58 (http://localhost:3000/navigation?startNodeId=1-64a&endNodeId=1-58).

In this example, there are two problems:

  1. In the very first navigation step, there are three nodes rendered instead of two. These are their values:
    • first node (1-64a) : { submapId: 2, xCoordinate: 34.61, yCoordinate: 28.75 }
    • second node (the weird one): { submapId: 2, xCoordinate: 34.61, yCoordinate: 28.749999999999993 }
    • third node (the expected one): { submapId: 2, xCoordinate: 34.61, yCoordinate: 30.6 }

You can see that the y-coordinate of the second node is just slightly smaller than the first node. This is a problem for the first step forward navigation type because the map gets rotated in the direction of the first line (the one between the first and second node), but that line is not actually visible to the naked eye.

Feel free to test this yourself by placing console.log("node", node, "index:", index); inside currentStep.nodes.forEach() loop in the client/src/pages/navigation.tsx or client/src/pages/navigation-step-by-step-forward.tsx file.

Interestingly, when you change the y2 coordinate of the hallway "h_main_f1_left_other" in the client/src/data/Hallways.ts file from value 17.04 to 17 or 18, the problem disappears.

  1. In the last navigation step there are also too many nodes being rendered (there is an extra node in the middle). The reason for this is that the first and the last node aren't exactly aligned on the y-axis, so there is a slight turn to the right in between the two middle nodes.

Investigate the causes of these problems and fix the rendering.