Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Star file loading adjustments #55

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

LorenzLamm
Copy link
Contributor

@LorenzLamm LorenzLamm commented Jun 11, 2024

I encountered some issues when loading points from star files into Surforama (even those generated in Surforama).

This PR should fix these issues and also add the functionality to load star files that do not contain orientation information.
In this case, the normal vector is computed from the nearest triangle and a perpendicular up-vector is assigned.

Previous issues:

  • only points were loaded for me because an error occurred in the definition of normal and up vectors
  • once loaded, orientations could not be altered because only normal_vector_data was assigned, but not normal_vectors

Please find more details in the commented code.
Let me know what you think :)

normal_data, up_data = vectors_data_from_points_data(
point_coordinates=point_coordinates, features_table=features_table
)
if features_table is None:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in case no normal and up-vectors can be read from the star file, we use the normal vector from the mesh and initialize a random up-vector.

@@ -76,3 +153,7 @@ def _load_star_file(self, file_path: Path):

self.surface_picker.normal_vectors_layer.edge_color = "purple"
self.surface_picker.up_vectors_layer.edge_color = "orange"

self.surface_picker.rotations = features_table[ROTATION]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines are necessary to alter the orientations of loaded positions

@@ -65,6 +65,11 @@ def vectors_data_from_points_data(
if len(point_coordinates) == 0:
# if there are no points, there are no vectors
return np.empty((0, 2, 3)), np.empty((0, 2, 3))

# check if the features table is empty
if features_table.empty:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When loading points, this function was called on an empty features table, leading to an error and thus orientation vectors were not loaded properly in Surforama.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant