Something really simple, like a big circle 'A' and a smaller circle 'B' inside it. Surprisingly no examples have nested circles.
Graphviz doesn't draw circles; it draws graph nodes of different shapes. You can get a node consisting of two concentric circles by setting the node's shape=doublecircle. Alternatively, you can draw two nodes with shape=circle at the same position. For a basic catalogue of node shapes, see https://www.graphviz.org/doc/info/shapes.html
Related
I want to generate a hexagon grid on the ocean for finding a shortest path.
Networkx provides lattice.hexagonal_lattice_graph which generates a graph whose nodes and edges are the hexagonal tiling of the plane.
However, I do not want to search along the edges of the hexagons, but I would like to consider the hexagons as nodes and the 6 adjacent hexagons as the neighboring nodes. In this way, there are 6 search directions from a node, as shown in this figure.
To apply this on a ship routing problem, I would generate such a graph for the earth and exclude all hexagon tiles inside land polygons, and divide the hexagons intersecting with the land polygon borders into smaller hexagons, creating a higher graph density in coastal areas.
How do I create such a hexagonal tiling graph, such that each node has edges in the six directions with Networkx?
Similar question is found here.
I recursively subdivided triangles of an icosahedron into smaller triangles as done in this blog.
Then used Networkx to construct a graph of the vertices and edges.
I'm trying to work out which tiles a rectangle overlaps.
Right now I'm just taking the mix/max bounds of the rect, and iterating through the grid tiles that are within those bounds. And for each tile I check whether the tile rectangle intersects with the other rectangle. This isn't very performant as I still have to iterate a lot of tiles and do a lot of intersection checks.
I'm wondering if theres a more performant or mathematical way to achieve this.
Sort rectangle vertices by Y-coordinate and treat horizontal bands between vertice Y-positions separately (it is possible to get 1, 2 or 3 bands).
For every Y-interval you have left and right sides, walk through them using Bresenham algorithm (for pixels) or Amanatides-Woo algorithm (for cells/voxels).
For every horizontal you have the leftmost and the rightmost cell, fill also all cells between them.
Also look for triangle rasterization algorithms for more ideas.
When I compute the difference between two shapes which touches one another (for example a rectangle A in a bigger rectangle B with a hole at rectangle A) and a clip shape (rectangle C) the two touching shapes are merged because their share the same edges and then the clipping is executed.
Is it possible to avoid merging touching shapes when clipping?
Here is an example of the difference between two shapes (A in green and B in red) and a clip (so the operation is: A & B - Clip), it returns the blue shape:
Instead of the blue rectangle, I would like to have those two shapes:
And the intersection would give:
This would give me the four shapes I want:
I know I could perform the operations on each shape separately, but I am afraid it will be more costly.
Note
Here is the result of a XOR:
In the hand I compute the operation myself:
compute the intersections between edges (of the clip shape and other shapes).
for each vertex: sort its edges by angle (mandatory)
walk through each edge clockwise and counterclockwise to compute the new polygons with their holes
This is efficient enough, but I need a space-partitioning data structure to sort edges and quickly their intersections.
Given two points (vertices), say i and j represented by small circles. How can I draw an arc (arrow) connecting those two vertices in Javafx 8? Surprisingly, very little information exists on drawing arcs in javafx8.
Given two points,(vertices), say i and j and a number of arcs between the two vertices. For each arc a direction is given. So for example, I can have 2 arcs from i to j, and 1 arc from j to i. How can I draw these arcs in javafx 8 such that they don't overlap each other. I was thinking on drawing each arc as half of an oval.
Normally I would provide sample code, but here I really have no clue how to draw an arc in between two points in Javafx?
Here is an example of something I would like to draw:
In my application I know the exact coordinates for the vertices a,b,c,d. I just need to know how to draw the arcs (I would favor a faster, simple solution over a pretty solution).
There are two kinds of surface mesh models, closed mesh like a sphere or a cube and the second one is the open mesh model which means the surface of the model is not in a closed loop. It is open from somewhere like a hollow pipe.
Sp what I want is I want to detect the border vertices of the open mesh model. there is no border in closed loop mesh but in open mesh we have to detect border vertices for some smoothing, subdivision, etc. operations.
Kindly, suggest me how can I select/detect border vertices ? what is the optimal way to do this ?
by comparing edges of the triangles ? Give me some idea ?
Thanks.
Assuming that you have a manifold mesh, then the border of the mesh are those edges which belong to only one polygon. Edges that are not on the border will belong to two polygons. The border vertices are the vertices that belong to the border edges.
A naive way to find the border vertices is to iterate through all your edges, count how many polygons they belong to, and if they only belong to one polygon, then collect the edge's vertices as border vertices. You will have to remove duplicates vertices from your collection, though.
A second approach is to have your mesh data structure examine each edge as they are added to the mesh, or as polygons are attached to particular edges. In this way, the mesh data structure can keep a list of up-to-date border edges for you, so that when you needed the edges you would not have to find them each time. This will greatly reduce the overhead of determining border edges, although inserting edges and polygons will be slightly more expensive. Your mesh data structure will also take up a bit more memory.
Assuming that your mesh is a 2D (or 2.5D) regular, well-constructed triangulation. You can use some of the properties listed here: http://graphics.stanford.edu/courses/cs468-10-fall/LectureSlides/02_Basics.pdf
Page 9 defines the degree (or valence) of a vertex as the number of incident edges. As shown, all boundary vertices 4 incident edges. "Internal" vertices have 5 incident edges.
Page 17 defines a boundary edge as one that is adjacent to exactly one face.
You might find the discussion on page 22 helpful (closed 2-manifold triangle meshes)