Skip to content

ArrowHelper direction bug #323

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

Closed
Boomer91 opened this issue May 9, 2020 · 2 comments
Closed

ArrowHelper direction bug #323

Boomer91 opened this issue May 9, 2020 · 2 comments

Comments

@Boomer91
Copy link

Boomer91 commented May 9, 2020

Hi, thanks for developing this awesome tool!

Arrows do render now, but there seems to be a bug with the direction argument. See minimal example below. Unit directions work fine, but e.g. dir = (1,1,1) renders a dir = (1,0,0) vector.

Thanks,
Cyriel

from pythreejs import *

scene = Scene()

camera = PerspectiveCamera(position=[15, 0, -2], up=[0,0,-1])
scene.add(camera)

control = OrbitControls(controlling=camera, maxDistance=100)

renderer = Renderer(camera=camera, scene=scene,
controls=[control],
width=1000, height=800
)

axes = AxesHelper(size=1)
scene.add(axes)

arrow = ArrowHelper(
        dir=[1,0,0],
        origin=[1,0,0],
        length=3,
        color='red',
        headLength=None,
        headWidth=None,
)
scene.add(arrow)

arrow = ArrowHelper(
        dir=[0,1,0],
        origin=[1,0,0],
        length=3,
        color='green',
        headLength=None,
        headWidth=None,
)
scene.add(arrow)

arrow = ArrowHelper(
        dir=[0,0,1],
        origin=[1,0,0],
        length=3,
        color='blue',
        headLength=None,
        headWidth=None,
)
scene.add(arrow)

arrow = ArrowHelper(
        dir=[1,1,1],
        origin=[1,0,0],
        length=3,
        color='black',
        headLength=None,
        headWidth=None,
)
scene.add(arrow)

scene.add(AmbientLight(intensity=0.3))

renderer

Originally posted by @Boomer91 in #258 (comment)

@vidartf
Copy link
Member

vidartf commented May 11, 2020

Please refer to the threejs documentation. It states that dir must be a unit vector. Does it work if you set dir=[1./3., 1./3., 1./3.] ?

dir -- direction from origin. Must be a unit vector.

@Boomer91
Copy link
Author

Ah, I oversaw that. Yes, dir=[1./3., 1./3., 1./3.] works.
Closing

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

No branches or pull requests

2 participants