enthought / enthought/mayavi

TVTK visual arrow weird behaviour

Open
#90 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
1.4k
Forks
316
Avg merge
7h 44m
Merged PRs (30d)
5

Description

http://stackoverflow.com/questions/20085398/simple-arrow-mayavi-tvtk-in-mlab-weird-behaviour-looks-like-a-bug

I am trying to do a simple arrow in mlab to point to different areas on the graph.
Consider this example:

```
fig = mlab.figure( bgcolor=(0, 0, 0))
b=visual.Box(x=0, y=10, z=10)
visual.set_viewer(fig)
b=visual.Box(x=0, y=10, z=10)
b2=visual.Box(x=10,y=10,z=10, color=(0,0,1))
a=visual.Arrow(x=10,y=10,z=10, color=(1,0,0))
```

So in my mind the arrow should appear from the blue box, however it lives it's own misterious life and is located absolutely off. That is very strange that boxes are located and bound to the grid (so if I put b to x=10,y=10,z=10 the two boxes will be collocated), however the arrow is not. ![This is what I see](http://i.stack.imgur.com/5p0qU.png) Is this a bug or a feature?

Update:

I was playing around trying to fix the above and found the behaviour of the arrow very weird. This is what I do (in `ipython` for interaction):

```
from mayavi import mlab
from tvtk.tools import visual
fig=mlab.figure( bgcolor=(0, 0, 0))
visual.set_viewer(fig)
```

First put the box somewhere on canvas as a reference:

```
b=visual.Box(x=10,y=4,z=1)
```

Then I want an arrow sticking out of the box:

```
a=visual.Arrow(x=10,y=4,z=1)
```

Didn't work out (same as the first part of the question):

![Arrow_error](http://i.stack.imgur.com/oFYqn.png)

Now, let's change length of the cone without reason

```
a.length_cone
```

returns

```
0.35
```

Let's change it

```
a.length_cone=0.5
```

Now the arrow is sticking out of the box as it should be
![Arrow_error](http://i.stack.imgur.com/LHFiq.png)

Change length of the cone back to 0.35 to see if this changes the arrow back to wrong position

```
a.length_cone=0.35
```

No, the arrow stays in the box where it should be. This looks like a bug.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.