Hi CE folks,
I think this question is / might be for the developers as I can't
seem to make CE do what I need.
I have two separate shape layers - one represents building podiums (green) the other building towers (pink).
Each of these has a different rulefile applied.
I'm using the minimum distance function to dynamically adjust the height (labeled tag on the roof of the podium) that the towers get placed upon as labels and distances to them seems to be the only way I can achieve this.
The general idea being that we can bring in GIS podium layers with a "number of levels" field and then bring in a separate towels layer and dynamically generate towers that sit upon podiums.
This all works well when the podiums are the same, or very similar size, with a reasonable separation distance.
When they get closer together however, in a denser neighborhood with smaller podium separation, the whole thing falls apart. It's all to do with geometry and distances as per the last two frames of the GIF.
I'm wondering if it's possible to request an additional query (or set of to make it more flexible) to the minimum distance function. So in this case I would only want to pull in the Y distance with my psudo code ...
Is that remotely possible as a request I wonder ?
Other options would also be handy ...
As in querying minimum distance on a plane.
Hope all that makes sense.
Adding the axis world.y as an optional parameter to minimumDistance() wouldn't be sufficient to solve your problem if the result were to use the y component of the vector between two objects. For example, if the neighboring building has a short podium, and the current shape has a tall podium, then the neighboring building's podium roof could be closer (smaller y component) to the initial shape than it's own podium's roof. What would be desirable is to find the distance to an object which is in a certain direction, namely in world.y, from the initial shape. This is probably what you meant, and we don't have a operation for that yet, but we'll keep it in mind for the future. Thanks for the suggestion.
Maybe there is a workaround that would work for you. If you could label your roof shapes with some sort of identifier, then your tower shape could query the minimum distance to the exactly the right shape. You could add initialShape.origin to the label name when creating the label on the podium roof. If you could create your shapes so that the have unique names, and so that those unique names match for corresponding shapes in your two layers, then you could use initialShape.name. Even better would be if you had an attribute that you could access that is unique for each building. Just append this value to your label. If using initialShape.origin, it might be good to round to the nearest integer. This is not an ideal solution. Out of the three, the best would be if you had a unique building identifier in an attribute on your shapes.
label("roof_" + rint(initialShape.origin.x) + "_" + rint(initialShape.origin.z)) label("roof_" + initialShape.name) label("roof_" + myBuildingID)
Thanks a lot for your reply, and the great suggestion. Very much appreciated.
I'll definitely give that a go as I didn't realise one could add other valuable things to the label.
It would be interesting to see if one can parse and further use some of the label functionality down the line?
Yes you are correct that what I was suggesting was a distance that's locked to a certain direction. Essentially it's raycasting from a polygon/shape by specifying a vector. I use this quite a bit in packages such as Houdini, Lightwave etc (anyplace that has this type of access), as it's a handy technique for various things, not only sticking things on top of other things.
So in this pseudo case you'd be effectively casting only upwards from the tower shape to determine the distance of the labeled podium shape above and place the resulting tower model on top. The neighboring building podium shape would never be included in the query (no matter how close in the y direction) as it's impossible for it to be "hit" by the directed cast.
It's a very hacky way of "passing" information to other shapes.
I'll post some graphics later to make that clearer.