

% Get X/Y/Z data for the stream linesįcn = c(round(linspace(1, length(c), 5))) % index into 5 equally spaced points You can add velocity cones on top of the streamlines to indicate the velocity along the lines. Hhh = streamline(x, y, z, u, v, w, sx, sy, sz) The following shows a single streamline starting at point (-1, 1, -1.5) clf Streamline gives you information about a particular particle in space and describes how it moves through the vector field. In fact, coneplot has an option to display arrows instead of cones: delete(h)Ĭoneplot(x, y, z, u, v, w, cx, cy, cz, 'quiver') Set(h, 'FaceColor', 'r', 'EdgeColor', 'none') H = coneplot(x, y, z, u, v, w, cx, cy, cz, 5) This way, you can work with a high-resolution data without sacrificing graphics. coneplot allows you to specify locations of the vectors (in the form of cones). In such situations, there's a different function called coneplot that you can use. Print -dpng -r200 largeQuiver % save as PNG fileĪs you can see, there are too many arrows to make this a meaningful plot. W = -z % z-component of vector field % Using an invisible figure because this will choke most video cards For this reason, the visualization may not be very useful if you want a higher resolution: = meshgrid(-1.5:0.1:1.5) Quiver3 (and quiver) places a vector at each grid point. V = sin(4*x) - sin(2*y) % y-component of vector field U = x + cos(4*x) + 3 % x-component of vector field Local a, b = CFrame.new(5, 8, 6), CFrame.new(6, 2, 3) * CFrame.Angles(math.pi, 0, math.pi/3)ĭraws a ray starting from origin towards origin+direction with params as RaycastParams.In order to visualize vector fields, you can use the quiver3 function. local visualizer = require(game:GetService("ServerScriptService").VectorVisualizer) All these are named accordingly and put inside a model called “CFrame”. It’s fun to see how the last three vectors are affected by a rotated CFrame.

Draws its cframe.Position, its cframe.lookVector as the green vector, its cframe.upVector as the blue vector, its cframe.rightVector as the red vector. The created part is named “Vector”, parented to workaspace, and has its Locked property set to true. The function also returns the created part. Optional color, thickness and transparency arguments exist. The default value for origin is Vector3.new(0, 0, 0). Visualize(vector, origin, color, thickness, transparency)ĭraws vector starting from origin. You can acquire the module here, the source code is here. Vectors are visualized as lines, CFrames have their position visualized as a line, but also displays the three rotational vectors (lookVector (-Z) is the green one, upVector (+Y) is the blue one, rightVector (+X) is the red one). This can be very helpful for debugging, and even trying to understand some stuff concerning these two. With the help of this module, you can draw Vector3 and CFrame values, by literally visualizing them as parts. (Perhaps this module suits you better, mine is poorly tested and lacks a lot of features, it was made in a matter of minutes and just thought would be cool to share, didn’t know a not so bad number of people were going to use it.
