Skip to content

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.

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

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