Blender Geometry Nodes - remove double instance and end pieces - geometry

I'm very new to blender and started testing out geometry nodes following a tutorial.
(Donuts and Gummies)
I am now attempting a small project to polish my skills.
I want to have only one instance of the traverse on the long shaft every n times. Currently, I have two instances in the middle and 4 at the ends. (see image below)
My objectives are:
Get one instance every n times on the shaft
Remove the end pieces completely.

I managed to solve my first issue by merging the edges like so
Still need assistance on the 2nd issue, please.

The solution to my second issue was fixed using the Trim Curve node.
I had to do some calculations to plugin the values, but that was the easy part.
Hope someone finds this useful.

Related

How to prevent overlapping of arrows?

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.

How do i work with .osm files in terms of creation of nodes and edges so i can put it on a Djikstra Algorithm?

I have a MetroManila.osm file and i parse it so it can read roads only using this command: --keep = --keep-nodes=highway --keep-ways=. Is this the right command for filtering only the roads? What i want after parsing is to create a node where there's intersections or curves, or is it possible with just using the whole nodes in MetroManila.osm? Can i create an edge using it and how do i do it? Currently, i'm really lost on what to do since i'm fairly new on android studio and in osmdroid.
This hasn't really anything to do with Android or osmdroid.
For learning how to create a routing graph from an OSM file see the related answer at help.openstreetmap.org. Quoting from it:
parse all ways; throw away those that are not roads, and for the others, remember the node IDs they consist of, by incrementing a "link counter" for each node referenced.
parse all ways a second time; a way will normally become one edge, but if any nodes apart from the first and the last have a link counter greater than one, then split the way into two edges at that point. Nodes with a link counter of one and which are neither first nor last can be thrown away unless you need to compute the length of the edge.
(if you need geometry for your graph nodes) parse the nodes section of the XML now, recording coordinates for all nodes that you have retained.
Also take a look at routing in the OSM wiki to get some general hints and existing tools and libraries.
Regarding osmdroid: If you don't rely on offline routing then take a look at osmbonuspack, it supports online routing.
If you don't want to reinvent the wheel then just use one of the existing offline routing tools mentioned in the OSM wiki.

"Split Wall" using Revit API

I have a wall and have to split it using Revit API. I have placement points as an input and need to split the wall based on those points. Do we have any command to achieve this using Revit API?
Any help would be greatly appreciated.
No there is no direct method for that. You'll have to make a copy of your wall with ElementTransformUtils.CopyElement method, then move one point of the original and one point of the copy to the location of your split point. To move the points, you have to create and assign a new curve to the wall location:
((LocationCurve)wall.Location).Curve = newCurve;
What do you mean by split wall? You can split certain family instances, such as beams, columns, etc. using the FamilyInstance.Split method. That does not apply to walls, however. You can split faces on a wall to apply different materials. For that, please refer to the FaceSplitter class.

Fixing Vertices in Layout (KKLayout) JUNG/JUNG2

I am new here.. MY Question :
i have used KKLayout for visualization a graph. The Graph is created in while-Loop (after each iteraion) after a new Calculation and every time the vertices is placed on random Locations/Postions. I want to fix them, so that they placed on same Position after each Loop-Iteration. How can i fix them ???? thanx
By default, the force-directed layouts start with their vertices in random positions; this is why you're seeing this behavior.
There are a couple of different approaches that you can take to resolving this issue.
(1) Use the Layout.setInitializer() method to specify a consistent starting position for each vertex. This will ensure that KKLayout always does the same thing.
(2) If there is a specific layout result (set of positions) that you like, you can use StaticLayout initialized with those positions. PersistentLayoutImpl can be useful for serializing/restoring those positions if desired.

Visit all nodes in a graph with least repeat visits

I have a tile based map where several tiles are walls and others are walkable. the walkable tiles make up a graph I would like to use in path planning. My question is are their any good algorithms for finding a path which visits every node in the graph, minimising repeat visits?
For example:
map example http://img220.imageshack.us/img220/3488/mapq.png
If the bottom yellow tile is the starting point, the best path to visit all tiles with least repeats is:
path example http://img222.imageshack.us/img222/7773/mapd.png
There are two repeat visits in this path. A worse path would be to take a left at the first junction, then backtrack over three already visited tiles.
I don't care about the end node but the start node is important.
Thanks.
Edit:
I added pictures to my question but cannot see them when viewing it. here they are:
http://img220.imageshack.us/img220/3488/mapq.png
http://img222.imageshack.us/img222/7773/mapd.png
Additionally, in the graphs I need this for there will never be a situation where min repeats = 0. That is, to step on every tile in the map the player must cross his own path at least once.
Your wording is bad -- it allows a reduction to an NP-complete problem. If you could minimize repeat visits, then could you push them to 0 and then you would have a Hamiltonian Cycle. Which is solvable, but hard.
This sounds like it could be mapped onto the traveling salesman problem ... and so likely ends up being NP complete and no efficient deterministic algorithm is known.
Finding a path is fairly straight forward -- find a (or the minimum) spanning subtree and then do a depth/breadth-first traversal. Finding the optimal route is the really difficult bit.
You could use one of the dynamic optimization techniques to try and converge on a fairly good solution.
Unless there is some attribute of the minimum spanning subtree that could be used to generate the best path ... but I don't remember enough graph theory for that.

Resources