I need advice. I’m looking for a way to write a filter in a grasshopper that would pick points on the bottom of my object. How to select the lower point from two points above each other.
From the points with the same coordinate X and Y, simply select the one below.
If you know the elevation of all the bottom points, you can compare the z coordinates. If you want to remove from some unordered point set all the points that are above other points, without a single base level to compare them to, that’ll be harder.
Some of the shapes in your image are wider at the base so the bottom points don’t have the same X/Y coords as the top points. Always best to post a model, even if it has only geometry.
PointsFilter_2018Mar18a.gh (14.2 KB)
I have an idea, non-tested. You project all points down to a plane underneath your shape, ideally not too far below, could be exactly the bottom of the boundingbox. You then merge identical points using Cull Duplicates. Then scale the original shape 1D towards the plane, with a non-zero but very small factor, say 1e-5. You can then use Closest Point to find the first point above each projected point. Because of the vertical scaling you won’t find points at an angle that just happen to be closer in unscaled space. Finally you use the Index output of the CP component to get at your original points.
A simple approach could be: Deconstruct objects, select bottom surfaces(usually #4), use Discontinuity module to get corner points. If necessary find closest point on original boxes.
But since this seems so simple, I might have missed something.
Usually, but what if it’s not? How do you know which is the bottom? This gets difficult when the faces aren’t square to “the world”. First, I added code to generate a 3D array of random shapes rotated at random angles in two axis. The algorithm I posted earlier returns the lowest points below the volumetric center (the Average) but they’re not always on the same face:
PointsFilter_2018Mar18b.gh (23.5 KB)
Version ‘c’ (below) sorts the faces by the height of their area centroids (actually, the average of their discontinuity points…) to return the points on just one face:
PointsFilter_2018Mar18c.gh (22.5 KB)
But it could be argued that the real bottom face is the one with the most surface area below a cutting plane, where each shape is “floating”…