Hi, I’m working with a point cloud and trying to get walls lines.
These are the steps:
imported the point cloud with Volvox
made a plane section to get walls profile
projected the point into the X-Y plane
made a grid (5x5 cm)
Applied “Closest Point” between projected points and the centroids
Split X and Y coordinates of the points founded in the previous step
Now I’m able to select all the points with the same X coordinate and the same Y coordinate.
I would like a criteria that allow me to create lines where there are the walls and then trim and connect them.
Some advise?
Thank you.
@inno Yes, I used Volvox plug-in to work with the Point Cloud. Ok I’ll do it as you suggest.
Here is the file updated. Extract line walls from PC_v1.gh (103.4 KB)
Get a test (planar for a start) Rnd pt collection.
Define a Grid (with var x/y resolutions) get Rectangles (future Voxels) and test if they contain (*) any rnd Pt (monitor what is sampled already - via some bool [ , ]). So this phase is about “pixelizing” (LOL) the rnd Pts.
Since there’s tons of Matrix classic ops published around … do a Matrix [0-1] (note: the rows go from top to bottom where in a classic 1dim “grid like” 2d Tree the opposite is true).
So we have a Matrix and we must connect all 1’s (in rows/columns) in some rational way. But since there’s tons of Matrix classic ops published around … blah, blah.
(*) this means: the pt X/Y values are included on the Rect Intervals. For voxels you’ll need Z values as well.
Maybe I’m not explain myself in the best way… I already did the steps described.
Now I want to find a criteria that allow me to create lines where there are the walls but I can’t figured out how to do it… I also thought to take all the point in one direction (es: y) and group them according to a threshold distance but I don’t know how to do it
A very simple one: while looping the Matrix rows/columns (or maybe better use a bool [ , ,]/[ , , , ] Array) each time starting from a valid start pos (“cell”) that you encounter a gap(*) (i.e. an user defined integer in row/column “space”) … this means that the start/end pair define a continuity => a Line, hat defines a wall. Then set start = end and continue until you are out of Rows/Columns (and/or espresso).
But in the real world you need a weighting criterion as well (how many Rnd points a given cell - within a given resolution - contains). In other words: a proper Class that monitors things is required here.
(*) a gap value is a “break the loop” condition where:
Rows first: for a given item [R,C] the next ones up to item [R+gap, C] are void/false.
Columns first: for a given item [R,C] the next ones up to item [R, C+gap] are void/false.
Notify if you think that a C# indicative demo could help (this means no native components at all: either Nirvana or Hell)
@PeterFotiadis I think It’s a bit complicated for my knowledge of GH and I’m not so good…
Can you teach me how to do it in the GH file attached please? I would really appreciate it…
Well … I work solely via C# (for me is 100+ times easier to do anything [so to speak] imaginable) plus I don’t use any add-on (other than K2)
Anyway … indeed there’s some simple cases where native componens (and add-ons) can cut the mustard. But not in this case I’m afraid. The reason is that there’s numerous areas in your Pt collection (not to mention general LIDAR cases) … where noise is far more than the “actual” data. For instance see the collections around the windows:
If the crap stuff is comparable with the good stuff … there’s only 3 ways to skin the cat :
the amateur way where he/she attempts to make the computer intelligent by trying to write down “rules” (and pigs do fly). Just think a simple/obvious fact : this is an old house because the walls - in relation to the rooms - are thick. Now … teach a stupid computer to understand this (and what means for the windows/openings).
the pro way where one takes advantage of the only thing that a computer can do: add fast zeros to ones.
the hybrid way … where you ineractively fix things that the computer can’t.
That said this - as things are - is a Reverse Engineering (of the Reverse Engineering) problem: instead of doing something at the Pt Grid creation time (using a vast variety of techniques from fast search [Quad Trees and the likes] to various classic Matrix data manipulation Methods) … we have to roll the bones again: make the paramount bool Array, establish continuity rules … blah, blah … PLUS mastermind a robust back tracing approach (kinda solving a dense Hamiltonian Path in less than a week).
And this back tracing part of the story (as any pattern recognition nerd can testify) is the thing that makes the solution without code impossible (at least in my mind).
And by solution I mean a fire and forget kind of thing: while you are after serious matters (for instance an espresso + cigar) the stupid part (the computer) attempts to fix the chaos (in less than a week).
But on the other hand hope dies last: some good Samarttan may have/know some sort of add-on that can help (i.e. something that does “patern recognition like” things - but as I said I have no idea about add-ons.
@PeterFotiadis Thank you for your time… So your idea is to use code… If so can you show me how to do it? I know it could be complex but i really needed for my thesis…
First do an extensive search: is someone offering a “patterm recognittion kind of thing” out there? (even a primitive one)
If not … what about LIDAR hardware providers? They offer “similar” services - but they are not exactly affortable (for very good reason). Truth is that they are after Meshes but these days a totally new kind of market is on the making.
Then … just for the argument … assume that someone is willing to take a “serious” walk in the big rabbit hole: this means several lines of some sort of freaky stuff that nor you nor your tutor can understand … while these lines are paramount (cross fingers) to support your thesis. So the 1M question is : what could be the thesis without the freaky lines? And by what criteria the thesis would been evaluated?
That said writing code is one thing. Achieving a state where the code runs without critical bugs … well … that’s a totally different animal.
That said there’s 2 cases that rate top in difficulty: The first is to create a real-life random truss … and the second is the general case of this one (Elon … are you interested?).
But … think the following: imagine that someone hires the 2 of us to restore his glamorous victorian villa. This means dollars for us … but also means a lot of work: Drawings, 3d models, master details, 1:1 details, BIM this, BIM that. Articles, Tech Descriptions, BOM, some PhotoRealism etc etc etc. All that cross referenced (i.e. inter-connect CAD and Meta Date to the full)…
Now … we hire someone who does LIDAR scans and we get back some clouds.We are greedy so we think to finish the job by ourselves. But this job has nothing to do with Meshes/BallPivot stuff and the likes: we need CAD Vector data.
You expect big things from some sort of miracle code. I expect nothing because I have written lot’s of lines and I know that all that is just @^%^%.
Why? because the amount of MANUAL work to draw/model the walls (and the basics of the villa) is 1. But the amount of work on windows (and a zillion other details that a classic villa has) is 1000+. Why? because, say, the windows are “like this”:
So the big question is : what exactly serves the smart (cross fingers) software ? And if we opt to do the work by hand instead of trying to make the pig fly … would be that far more productive and profitable ???
This is not to say that LIDAR is useless. But is to say that in several cases is kinda the mosquito and the bazooka thing.
Update: found something that with some “minimum” work MAY yeild “similar” results with your goal.
See this? Is a C# that does random pts with various ways in a BrepFace. The point of interest here is the random spots option (you can control how “big” the spots are): Why? because we can “mimic” some LIDAR scan Topology that way.
Now the 2nd C#: this does the pixels : i.e. Rectangles according some x/y Res where they contain at least one Point and where their centers are inside the BrepFace. I can’t recall why I did such a pointless thing … but anyway. By doing the “pixels” it does the Matrix as well:
So this is more or less close to your Pts situation (i.e. the Rectangle centers ARE your Line(s) candidate pts)…Spot that the Matrix cells (0 means no Rectangle, 1 means the opposite) are 1:1 to the Rectangles positions in x/y space. The only think remaining is to connect the Rectangle centers by looping in rows/columns … where the gap (amount of zeros) is less or equal to some user defined value. That’s more or less elementary via code. Using a bool [ , ] Array is slightly more economical because instead of asking if (Matrix[r,c]==1) you just say if(Array[r,c])
So I’ll add a 3rd C# that does that. Of course doing this with a few Rectangles IS NOT the same when there’s zillions around … but there’s various techniques to “focus” on some area and then to some other (for testing the results, without waiting a week).
I have one question… If I have multiple lines that identify my walls in two lists for walls in X and Y direction how can I set a filter like “If the distance between every point in the line is more than 5 cm cull the line”.
What you could try is draw all the horizontal and vertical lines, like you currently do.
Intersect these lines with each other and shatter them at their intersections.
Out of the shorter line segments, you can then probably construct an undirected line graph, which will “more easily” let you detect connected lines that together form a closed polygon.
Once you have all polygons, you can evaluate and sort them into categories (e.g. walls, rooms, openings, etc.). You can for instance determine walls, because one side length would be within a known range and much smaller than any room.
This sounds more straightforward on paper, than it will eventually be to implement. I doubt that it’s all feasible with no scripting though.
I’ll do an indicative demo as soon as I have some 10 minutes to spend:
Given an user controlled (via a bias to 1 probability variable) List of 1s and 0s do the sequence grouping and then “join” the groups (with 1’s) according a user gap value. Obviously these correspond to some Pts indices. Rather plain/entry level stuff but I’m in the middle of some chaos at the practice right now … PLUS (for an intergrated full demo) this w/e is the USA F1 soad opera (forza Lewis).
All that are elementary via code … but they are kinda a Chinese poem to you (since you are not in the coding thing). For instance this does a classic sequence grouping:
I hear you: what sort of Chinese things are these? You tell me.
BTW: Some ugly - but honest - news: this (for some thesis worth the name … i.e. something that brings new fruits to the party) … is rather well above you: I predict some stormy weather around. What about some Plan B? (or Z).
Update: while crisis is escalating (life sucks) found 3 minutes to sample some existed stuff (I have about 50+K C# things).
So Cluster at {1} should been united to {3} IF and only IF {2} has less or equal (to gap) items … blah, blah. And if max gap = 3 … Cluster {6} means another Line. Elementary my dear Watson.
Cross fingers for some 7 minutes more (or maybe 8).
@PeterFotiadis Yes, I know this is well above me and I don’t have the knowledge to do it beacuase I have a different background and for this reason I asked for a help.
I was thinking to calculate the distance between every point in the line and if the distance is less than the user defined threshold generate a linee between point while if the distance is more than the user defined threshold eliminate all the point in the line.
What do you think of this? Is it insane do it via coding?