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 transform (non identity) use in creation.camera_marker #377

Merged
merged 1 commit into from Apr 16, 2019

Conversation

wkentaro
Copy link
Contributor

@wkentaro wkentaro commented Apr 16, 2019

Before

Screencast 2019-04-16 18:45:47

After

Screencast 2019-04-16 18:45:18

Code (includes internal)

import numpy as np
import trimesh


cad_file = '/home/wkentaro/Documents/trimesh/models/fuze.obj'

eyes = uniform_points_on_sphere(5, radius=0.5)
targets = np.full(eyes.shape, (0, 0, 0), dtype=float)
T_world2cam = np.array([
    look_at(eye, target)
    for eye, target in zip(eyes, targets)
])

# -----------------------------------------------------------------------------

scene = trimesh.Scene()

geom = trimesh.load(str(cad_file))
geom.visual = geom.visual.to_color()
scene.add_geometry(geom)

scene.camera.resolution = (640, 480)
scene.camera.fov = (60, 45)

for transform in T_world2cam:
    scene.camera.transform = transform
    geom = trimesh.creation.camera_marker(scene.camera, marker_height=0.1)
    scene.add_geometry(geom)

    geom = trimesh.creation.axis(0.01)
    geom.apply_transform(transform)
    scene.add_geometry(geom)

scene.set_camera()

scene.show()

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 84.109% when pulling 4e810b0 on wkentaro:fix_creation_camera_marker into f439e70 on mikedh:master.

@mikedh
Copy link
Owner

mikedh commented Apr 16, 2019

Looks great, thanks! Is there any way we could unit test this? If not no worries, I'll just merge.

@mikedh mikedh merged commit 2181f0c into mikedh:master Apr 16, 2019
mikedh added a commit that referenced this pull request Apr 16, 2019
@wkentaro wkentaro deleted the fix_creation_camera_marker branch April 17, 2019 08:51
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.

None yet

3 participants