Vector length legend for vector arrows

This script requires some effort from the user and if used incorrectly it could lead to wrong or misleading information.

One of the EnSight created part types is a “Vector Arrow” part. The length of these arrows can be in proportional to the magnitude of the vector used to create them (the arrows can also be set to have uniform length). So the length of the arrows has definite meaning, but there is no ‘legend’ like the color palette legend which indicates what the length of a vector arrow means.

This script can create such a legend semi-automatically, but the legend is only accurate in certain situations. Since the arrows and the legend are in a 3D space, the direction the arrows are viewed from will affect how large the arrows appear. So I recommend using this legend only in certain situations such as:

  1. When all the arrows lay in a 2D plane, and they are viewed orthogonally with perspective view turned off (orthographic view mode)
  2. When the viewer can rotate the view, and therefore gauge the 3D scene and have an intuitive feeling about the distortion in size due to the viewer’s perspective

Example: The arrow length shows velocity while color indicates temperature.

The script performs a few simple steps:

  1. Create a single node using a point part
  2. Create a vector variable of unit magnitude on the node using MakeScalNode and MakeVect
  3. Create a vector arrow part on this node using this vector variable

The script will prompt you for the location and direction of the arrow. If desired, the location of the arrow can be changed by editing the point part. After the script runs the user should do two things:

  1. Adjust the arrow length by changing the scale factor of the Vector Arrow Legend part
  2. Create a text annotation indicating the meaning of the length of the reference arrow

One must be careful when scaling the legend arrow so that it represents the correct value. One could follow these steps:

  1. Adjust the scale factor of your vector arrow part(s) (not the legend part) to get the desired vector lengths. Call the scale factor “A”.
  2. Choose a vector value that you want the legend to represent, call this value “B”
  3. A * B = C, C is the scale factor you should use for the Vector Arrow Legend part (since the original vector magnitude is one). Now the legend arrow should be the same length in 3D space as an arrow that has vector value B.
  4. The text annotation should use the value B

Download the script.

If you like the idea of a vector arrow length legend and would like to see it added as a standard feature of EnSight you can vote for it and other features at Link to the arrow legend request

Leave a Reply