Update 29-08-2023 22:20
Thank you for the input! The responses gave me some useful tips and nodes to integrate in the desired workflow. Since not everything was clear, I will give some more context about the project.
I am working on an urban Digital Twin. On this project I am focussing on adding more detail to city by converting 2D points to 3D objects. The government of the Netherlands provides us with open datasets. This open datasets contain for example the position and measurements of street signs and streetlights.
By using QGIS I can retrieve the center axis of a road. The streetlights should light up the road. Therefore, I want to align the lights perpendicular to the center axis of the road. In my test project the road is a simple line. The points are just references to place the object on the correct x and y coordinate. The desired iterations on the project are as following:
- Modelling streetlights with geometry nodes perpendicular to the street.
- Modelling street signs with geometry nodes parallel to the street.
The question in both situations is how can the rotation of instances be based on nearest lines. The 2D points are just reference points from a dataset which tell the position. This position does not contain any information about the orientation of the object.
At the moment I am working on a Geometry Nodes setup to place 3D geometry on some random points. The 3D geometry contains a street light. The light bulb of the street light should be orientated to the line. In other words the street light is perpendicular to the line of the road. I am using the Instances on Points node and hope to achieve my goal by retrieving a normal vector.
This normal vector should illustrate the shortest distances between the line and the vertex. I can retrieve the normal of the line and a normal of the vertex. For my usecase I think I need to capture the normal of the line. I tried a combination of the Capture Attribute node and the Align Euler to Vector node. Are there anymore options left? Perhaps the Raycast node?
Questions and desired solution
In short are my questions as following:
- How can I retrieve the shortest distance between a line and a vertex with a node with Geometry Nodes?
- How can I align an object with the orientation of the shortest distance vector?
I hope to achieve a method in which the light bulb (the source object is orientated to the positive x-axis) get automatically aligned with the shortest distance between a line and a vertex.
I would highly appreciate your input on my research and look forward to hearing from you at your earliest convenience.