How to prevent overlapping of arrows? - python-3.x

I'm trying to plot multiple arrows to and from different points. I'm using pyplot.quiver and here's my result.
As can be seen, in many places the arrows between two points are overlapping each other. However, I want something similar to this image below where the arrows instead of overlapping are juxtaposed against each other.
I realise that any two points can be connected by only one straight line so my method of simply passing in the list of x and y lists is probably wrong. I am looking for the best possible method to ensure that the arrows are next to each other instead of on top of each other
Any help would be appreciated.
EDIT (16/06/19): I stumbled upon a Python library called Networkx which allows to analyse, visualise, and do other stuff related to network data and that's what I used to create this. It has nice functions for drawing two juxtaposed arrows between a pair of points and trying other things - curved arrows, changing the arrowhead etc.

Related

What's the differences with the line, path, and shape classes in KonvaJS?

I'm a big fan of PaperJS, however, the library doesn't see much activity so we're looking at other tools, like KonvaJS, Fabric, and Pixi. We'd like to replicate the example here:
http://paperjs.org/examples/path-simplification/
in KonvaJS but we're not sure which class is the most appropriate? Should we use the line, which is described as a collection of points with tension, the path tool which is what we use in Paper, or the shape class? Does KonvaJS offer the same type of access to the bezier curve tools and shape border, blue line, found in the above-mentioned paper example?
Konva.Line requires a list of x & y passed into its points property as a simple array, then draws straight lines connecting those points. The tension property can be used to make the straight line joins more curvy.
Konva.Path expects you to provide a data property that is more like a list of SVG drawing instructions, so move, lineto, arc, etc. (See supported instructions list in Konva docs for Konva.Path.data here)
There is no built-in equivalent path-editing features to those in the demo you linked to - so no automatic anchors on the path control points and no Bezier handles. You would have to DIY those. Having said that, it would all be achievable - what I mean is the drawing of the control anchors and lines, the listening for mouse and drag events, and the final passing back of the SVG drawing data to the Konva.Path shape when the path's edit mode ends are all well supported in Konva.
As at May 2022, the Konva lib is well supported, with appropriately frequent (as Goldilocks would want - not too many and not too few), no ill-thought-out breaking changes, issues are responded to, SO posts replied to, and there is a busy Discord channel.

3D bounding box - is there a simple method for making one?

Is there a simple/quick way to find out the dimensions of a 3D axis aligned bounding box for an item with rotations in the <x,y,z> axes? I know that in math there are different methods/equations to come up with the same answer for a problem and I've previously in the past explained with bare bones information about a method that worked for me, that I probably didn't explain well.
I also know that there are (downloadable)functions available for some languages like java and python to help solve/tackle parts of the math. Though that might not help those that want to understand those different methods better or might not have access to those particular functions for the language they are using.
So if a person has the following information:
The item center point coordinate in the x,y,z
The item x,y,z size
Along with the x,y,z rotation(s)
What would be the easiest approach with a person knowing that information, while either using or not using the item center point, matrix/matrices or cos and sin. Though an approach that would also be compact enough to take up the least amount of memory usage.

Why is it usually easier to perform selection tests in object space?

I'm taking an introductory graphics course, and while I intuitively understand that converting a click or touch into object coordinates will make the math much cleaner, reduce the chances for human error, and potentially make debugging easier, none of these are actually a very good explanation, conceptually, of why object coordinate spaces are used in selection tests, as opposed to simply using world coordinates for the test - rather, they're just observations of what tends to happen when object coordinates are used. So I ask: why?
A selection test involves comparing the click coordinates, which you get in window coordinates, against lots and lots of object features, which are represented in object coordinates.
You need to transform them into the same coordinate system in order to do the checks, so you can EITHER transform the one simple click point OR you can transform all the various object features.
Transforming one point or line is just a lot easier that transforming a whole bunch of object features of various types.
There are cases where the location of a specific object or point may not be known within a world coordinate system, but is known relative to some other coordinate system.
To summarize an example from my course text, consider the idea of two different towns, one using a grid system for its layout, and the other using what I can only describe as the New England we-made-cow-trails-into-roads method. A government employee is tasked with creating a layout of the area which includes them, and in doing so has to convert the two coordinate systems into a third, which encompasses the other two.
Sometimes, using a world atlas just isn't practical to get across the street, and so something much more local (and relevant) is used instead, as it provides much more detail over a much smaller area.
The text also explains that it may be more than simply impractical to use a given coordinate system - it may yield results that are improbable or just plain wrong. This is evidenced in the evolution of the geocentric and heliocentric models of the universe - the distance of the stars from us was calculated with very different results using the two models.
Thinking of my own example, the best that comes to mind would be something like your own internal organs - from the outside, you don't know for sure exactly the shape, size, and structure of each of them, but your own body does. In order to be able to access that information, you need to look inside the body (ideally in a way that doesn't kill you). It's not something that is plainly observable from outside.

Different strokes in SVG-subpaths

Is it possible to draw different strokes (I want different line widths) in a subpath of SVG?
I know this can be accomplished using different paths, but it is not possible to use use line-joins on different paths. I want to use a line-join round with different line width.
If it is not possible, what is the best techique to draw two connected lines with different strokes (in the picture below the lines are not connected)?
A path element only has one stroke-width property, so it's not possible at the moment to have different stroke-width per subpath since it's all in one element.
Feel free to explain further on how you need the connected lines join, an illustration might help.
Have a look at the tubefy examples for how to do variable-width stroking and other neat effects with svg and some scripting.

Identify the plot in this image

I'm not math savvy, but this Mathematica plot caught my eye and I was hoping you could help me identify it.
I've searched the various functions and keywords found in the pictured code, but none of the results suggested anything specific to me about whatever algorithm is at work in this plot.
Sorry about the quality, it's a screen capture of a video
Looks like a Voronoi Diagram to me.
As others have noted, you're looking at a Voronoi diagram generated by Mathematica. You can see the Mathematica expression being used, and the key function is ListDensityPlot.
If you follow the latter link and open the "Neat Examples" section you'll see another Voronoi diagram. The key parameter there is InterpolationOrder→0.
Except for the two dots in the light-purple area (third from top left), one of which might be a video artifact, every coloured area has a single dot, and points in the field appear (both by looking at the diagram and guessing what the code means) to be coloured according to which of the dots they are closest to.
Which would make it, as #Moron has said, a Voronoi diagram.
True. Voronoi Diagrams can build that sort of "image".
Look for Voronoi Diagrams or Thiessen Polygons.

Resources