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

fix: #475 adding labels #474

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

fix: #475 adding labels #474

wants to merge 3 commits into from

Conversation

MYlab10
Copy link

@MYlab10 MYlab10 commented Jul 15, 2024

This will help people learn and understand better about 3d models

Related Issue

Closes #475

Description

import pyvista as pv
from pyvista import examples

Download a sample mesh (bunny model)

mesh = examples.download_bunny_coarse()

Create a Plotter object

pl = pv.Plotter()

Add the bunny mesh to the plotter

pl.add_mesh(mesh, show_edges=True, color='white')

Add points on the mesh (for visualization, not necessary for labeling)

#pl.add_points(mesh.points, color='red', point_size=20)

Define the coordinates and labels for different parts of the bunny model

labels = {
"Ear Left": [-0.08508963,0.15244128,-0.07269581],
"Ear Right": [-0.01597024,0.13926028,-0.02299697],
"Nose": [-0.11643464,0.05128627,0.07609549],
"Bottom": [0.14346997,-0.08839463,0.04595339],
}

Add labels to the plotter

for label, coord in labels.items():
pl.add_point_labels([coord], [label], point_color='blue', point_size=10, font_size=20, text_color='black')

Set the camera position for a better view

pl.camera_position = [(0.02, 0.30, 0.73),
(0.02, 0.03, -0.022),
(-0.03, 0.94, -0.34)]

Show the plot

pl.show()

Screenshots

Original Updated
image image
image

Checklist

  • [ x] My code adheres to the established style guidelines of the project.
  • [ x] I have included comments in areas that may be difficult to understand.
  • [x ] My changes have not introduced any new warnings.
  • [ x] I have conducted a self-review of my code.

This will help people learn and understand better about 3d models
Copy link

vercel bot commented Jul 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
virtuo-learn ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2024 4:50am

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Great job, @MYlab10! 🎉 Thank you for submitting your pull request for Virtuo-Learn. Our dedicated team will review it diligently.Your contribution is valuable and we appreciate your efforts to improve our project.

@MYlab10 MYlab10 changed the title creating additional 3d model and adding labeling to the 3d models visualisation. feature/adding labeling to the 3d models Jul 15, 2024
@MYlab10 MYlab10 changed the title feature/adding labeling to the 3d models fix: #475 adding labeling to the 3d models solved Jul 15, 2024
help users understand better about 3d models
@MYlab10 MYlab10 changed the title fix: #475 adding labeling to the 3d models solved fix: #475 adding labels Jul 15, 2024
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.

[Feature] <adding labeling to the 3d models>
1 participant