Eliptic looking graph - vis.js

What options should I use for making my graph looking like an Elipse ? I was messing with the hierarchical option under the layout module, but I've not gotten nowhere near my desired shape.
My graph is left to right, left node group connects to middle one, and middle one connects to the right one. It can be perceived as this image below.
Can someone point me in the right direction ? Thanks for your expertise

As for the elliptic shape around the nodes and edges, you can either set a background image to your graph area or create a node of large size (but this way you may have troubles with node repulsion, though). Unfortunately, there's no way to make sure that all the nodes will always be inside the ellipse (unless you access the vis' canvas and deal with it on low level or do some other hackery).
Also AFAIK it is impossible to create those wavy edges, but for those rounded ones you may want to use repulsion physics instead of barnesHut. See also physicsConfiguration example.

Related

How can I scale a glyph down vertically while keeping the vertical stroke widths the same (and not altering any of the horizontal dimensions)?

I'm using FontForge. I'm modifying the lower case q to make a straight-stalked 9. The q has 2 logical parts, the stalk, and the 'c'. The 'c' is too big vertically. How can I scale it down vertically while keeping the vertical stroke widths the same (and not altering any of the horizontal dimensions)?
I'm a novice with FontForge, so please spell out your explanation and provide step-by-step instructions. Thanks for your help.
It sounds like you want to decrease the x-height of the 'q' without changing stroke widths.
Font-forge provides a built-in tool to achieve this: Element > Styles > Change X-Height. You might like to experiment with this, but in practice it gives you very little control over the results and I would rarely use it.
Instead I would achieve this by directly modifying the nodes of the paths.
First, I would ensure that InterpolateCPsOnMotion is enabled. Double-click the pointer tool in your toolbox to access this setting.
This will help ensure that curves scale correctly (rather than distort) as you move control points. Now, I would select the nodes at the top and sides of the bowl of the q:
and use the down arrow key to move them down about half the distance you wish to decrease the height by. Then I would deselect the nodes at the side of the bowl:
and lower the remaining nodes the rest of the distance:
You will need to check the resulting appearance and possibly make tweaks to get it perfect. Note that this or any scaling technique can subtly distort the axis of modulated strokes, which you may wish to correct.
This technique presupposes that nodes are sensibly placed at the vertical and horizontal extrema of the bowl, and that you don't have extra nodes between these extrema. If you are not in this happy situation, you can add extrema by ctrl-shift-x and you can remove surplus nodes by selecting them and ctrl-m. If you can't remove extra nodes without significantly changing the shape of the bowl, you'll just have to modify these nodes by eye.
Another point: you say you're working from a "c". I'm not sure whether you just mean the C-shape of the bowl of the q, or whether you mean you are copying the actual glyph 'c'. Note that it is rare that the bowl of a 'q' will have exactly the same shape and weight as a 'c'. Typically the stroke will be somewhat lighter to achieve the right visual grey, and especial care will be taken where it intersects the stem. Often the two shapes will differ substantially.

How tell if a point is within a polygon for texture

This seems to be a rather asked question - (hear me out first! :)
I've created a polygon with perlin noise, and it looks like this:
I need to generate a texture from this array of points. (I'm using Monogame/XNA, but I assume this question is somewhat agnostic).
Anyway, researching this problem tells me that many people use raycasting to determine how many times a line crosses over the polygon shape (If once, it's inside. twice or zero times, it's outside). This makes sense, but I wonder if there is a better way, given that I have all of the points.
Doing a small raycast for every pixel I want to fill in seems excessive - is this the only/best way?
If I have a small 500px square image I need to fill in, I'll need to do a raycast for 250,000 individual pixels, which seems like an awful lot.
If you want to do this for every pixel, you can use a sweeping line:
Start from the topmost coordinate and examine a horizontal ray from left to right. Calculate all intersections with the polygon and sort them by their x-coordinate. Then iterate all pixels on the line and remember if you are in or out. Whenever you encounter an intersection, switch to the other side. If some pixel is in, set the texture. If not, ignore it. Do this from top to bottom for every possible horizontal line.
The intersection calculation could be enhanced in several ways. E.g. by using an acceleration data structure like a grid, quadtree, etc. or by examining the intersecting or touching edges of the polygon before. Then, when you sweep the line, you will already know, which edges will cause an intersection.

Connected graph with quadtrees (pathfinding)

I read some about quadtrees, and I am trying to take advantage of them for pathfinding. To this end, I am trying to use a quadtree to create a connected graph, where each "minimum rectangle" (a childless node) is directly connected to its adjacent minimum rectangles. To illustrate... if you take a look at the bottom-right rectangle in http://en.wikipedia.org/wiki/File:Point_quadtree.svg, that rectangle is a childless node in the tree, and it should be directly connected to the three rectangles surrounding it, which are also childless nodes.
Creating the quadtree is pretty easy, but I'm not sure how to detect connections with it. Can anyone offer me some insight?
Thanks in advance!
The bottom right rectangle is just a child of the adjacent 3 rectangle. Look from above at it like a pyramid when you are standing at the top and look how the quadtree divide the space recursivley into 4 directions. here is a better explanation http://blog.notdot.net/2009/11/Damn-Cool-Algorithms-Spatial-indexing-with-Quadtrees-and-Hilbert-Curves

C# GDI: Union/Outline of Overlapping Ellipses

Banging my head on the wall with this one...
Google searches so far null...
I have a ton of over lapping circles in a mapping program...they represent radar ranges for installations such as fixed operating bases, strategic facilities, anti-aircraft assets...
Most if not all overlap one or many of their bretheren...some may stand alone...Imagine an outlying installation with limited range...
I am trying to draw the UNION of the aggregated collection of circle objects...technically ellipses bound by rectangles...
I am trying to draw the outside boundary of the air defense system...I want to eliminate all drawing of the portion of the child ellipses that fall within that outer boundry...
If an outlying station is standing alone so to speak it should be drawn as a simple circle...
Should I link a picture?
What the heck here it is...image is a bit big so I linked it
image 1024x1024
What I want to draw is union outline of the British and then of the Germans...
So far I can't figure out how to this in C# GDI...
I Do not want to fill the path using the Winding Mode Flag...I want to Draw the OUTLINE..
Any help greatly appreciated...
Oneway
Create a new image, render the circles in solid colour to that area, then overlay that image on your map at, say, 50% opacity.
Alternatively, run an edge detect on that solid-colour image to find the overall outline.

Where can I find information on line growing algorithms?

I'm doing some image processing, and I need to find some information on line growing algorithms - not sure if I'm using the right terminology here, so please call me out on this is needs be.
Imagine my input image is simply a circle on a black background. I'd basically like extract the coordinates, so that I may draw this circle elsewhere based on the coordinates.
Note: I am already using edge detection image filters, but I thought it best to explain with a simple example.
Basically what I'm looking to do is detect lines in an image, and store the result in a data type where by I have say a class called Line, and various different Point objects (containing X/Y coordinates).
class Line
{
Point points[];
}
class Point
{
int X, Y;
}
And this is how I'd like to use it...
Line line;
for each pixel in image
{
if pixel should be added to line
{
add pixel coordinates to line;
}
}
I have no idea how to approach this as you can probably establish, so pointers to any subject matter would be greatly appreciated.
I'm not sure if I'm interpreting you right, but the standard way is to use a Hough transform. It's a two step process:
From the given image, determine whether each pixel is an edge pixel (this process creates a new "binary" image). A standard way to do this is Canny edge-detection.
Using the binary image of edge pixels, apply the Hough transform. The basic idea is: for each edge pixel, compute all lines through it, and then take the lines that went through the most edge pixels.
Edit: apparently you're looking for the boundary. Here's how you do that.
Recall that the Canny edge detector actually gives you a gradient also (not just the magnitude). So if you pick an edge pixel and follow along (or against) that vector, you'll find the next edge pixel. Keep going until you don't hit an edge pixel anymore, and there's your boundary.
What you are talking about is not an easy problem! I have found that this website is very helpful in image processing: http://homepages.inf.ed.ac.uk/rbf/HIPR2/wksheets.htm
One thing to try is the Hough Transform, which detects shapes in an image. Mind you, it's not easy to figure out.
For edge detection, the best is Canny edge detection, also a non-trivial task to implement.
Assuming the following is true:
Your image contains a single shape on a background
You can determine which pixels are background and which pixels are the shape
You only want to grab the boundary of the outside of the shape (this excludes donut-like shapes where you want to trace the inside circle)
You can use a contour tracing algorithm such as the Moore-neighbour algorithm.
Steps:
Find an initial boundary pixel. To do this, start from the bottom-left corner of the image, travel all the way up and if you reach the top, start over at the bottom moving right one pixel and repeat, until you find a shape pixel. Make sure you keep track of the location of the pixel that you were at before you found the shape pixel.
Find the next boundary pixel. Travel clockwise around the last visited boundary pixel, starting from the background pixel you last visited before finding the current boundary pixel.
Repeat step 2 until you revisit first boundary pixel. Once you visit the first boundary pixel a second time, you've traced the entire boundary of the shape and can stop.
You could take a look at http://processing.org/ the project was created to teach the fundamentals of computer programming within a visual context. There is the language, based on java, and an IDE to make 'sketches' in. It is a very good package to quickly work with visual objects and has good examples of things like edge detection that would be useful to you.
Just to echo the answers above you want to do edge detection and Hough transform.
Note that a Hough transform for a circle is slightly tricky (you are solving for 3 parameters, x,y,radius) you might want to just use a library like openCV

Resources