{'fraction_non_alphanumeric': 0.023905135352199177, 'fraction_numerical': 0.007511692729248358, 'mean_word_length': 4.917808219178082, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
PARAMETRIC MODELLING APPROACH TO RECONSTRUCTING ARCHITECTURAL INDOOR SPACES FROM POINT CLOUDS

In this paper, some outcomes of a research project which aims to introduce automation to speed up modelling of architectural spaces based on point clouds are presented. The main objective of the research is to replace some manual parametric modelling steps with automatic processes to obtain editable models in BIM-ready software and not to generate non-parametric IFC (Industry Foundation Classes) models. An approach of automation using visual programming for interior wall modelling based on point clouds is presented. The pipeline and the different concepts represented in this paper are applicable using different programming languages but here the use of Rhinoceros as a modelling software and its open-source visual programming extension "Grasshopper" is intentional as it is in common use for parametric modelling and generative design in architectural practice. In this research, it is assumed that there is a predominance of three mutually orthogonal directions of the walls in the interior spaces to be analysed, which is the case of most indoor spaces.


INTRODUCTION
The creation of the digital models from 3D scanning point clouds is an important but time-consuming practice in terms of manual modelling work. Being able to automatically generate 2D planes, 3D environments, and Building Information Models (BIM) of existing construction based on the point cloud has very high potential. With the spread of indoor mobile mapping systems, the generation of point clouds has become faster and more accessible. However, many use cases, such as architectural projects, facility management, some indoor building navigation and robotics, are based on BIM models but not on point clouds.
Point clouds contain a huge amount of data, still, in practice, the models used for the spatial design of architecture must be simplified, representing the space and its main features. Details can be added at an advanced stage for project execution. From an architectural point of view, being able to detect geometrical constraints from point clouds is more important than high accuracy. For example, recognising parallelism between walls and identifying right angles is more important than recognising small deformations in a wall. Constraints allow the architecture to be characterised and understood conceptually. Therefore, modelling for the mentioned purposes is an implicit representation of architectural elements and their constraining relationships. Then, the transformation of a non-continuous explicit representation data, such as point clouds, into a continuous implicit representation, such as solid models and BIM is a challenge based on interpretations. To automate the process, these interpretations should also be automated, and they cannot be correct in every case. Additionally, every automated result should be queried. Then, we talk about a semiautomatic process. In the built environment, most indoor spaces have a Palladian design (Stiny and Mitchell, 1978), characterized by a regular arrangement of rectangular spaces (Tran et al., 2019), or follow the Manhattan-world assumption which states there is a predominance of three mutually orthogonal directions in the scene (Vanegas et al., 2010). The constraints and the clear structure of such an arrangement is much easier to read and therefore to program. And, in the case of the automation of such virtual spaces based on laser scanning surveys, the modelling tasks could be accelerated in most cases of existing buildings. Considering this fact, this research, as well as others in this field, focuses on solving the problem of modelling spaces characterised by these regular arrangements with vertical walls and horizontal ceilings. This work differs from most of the state of art research in its parametric modelling approach of using the visual programming language, Grasshopper, commonly used in practice by architects. Grasshopper makes it possible to combine modelling with programming seamlessly and is suitable for programming by professionals without having to rely on scripting languages ( Figure 1). In this case, it was chosen because the aim of this applied research is to propose solutions within the reach of architecture, engineering, and construction (AEC) professionals.

BACKGROUND & RELATED WORK
Many scholars strive to find an automation approach that succeeds in classifying and interpreting the points and then creating the corresponding model that represents the real architectural object (object-oriented models). The knowledge and definition of objects comprises three aspects: geometric properties (e.g. the size), topological properties (e.g. the connectivity with other objects), as well as semantic aspects (e.g. categorising and type definition of object) (Becker et al., 2013). There are different directions and approaches to investigate these three aspects that can lead to the automation.
Most of the research, including this one, deals with geometric feature recognition. In the search for geometry, there are common approaches and techniques. Many investigations are based on the use of RANSAC algorithm (Random sample consensus) (Fischler and Bolles, 1981) to estimate planes in dense point clouds. The estimation of planes is a very convenient step for recognising main building elements such as floors, ceilings (Leoni et al., 2019), wall surfaces (Hossein Pouraghdam et al., 2019) or for the detection of cuboids which represent interior spaces (Jenke et al., 2009). Another common method of recognising planes and orientations is to use histogram analysis according to a specific direction (Okorn et al., 2010). For example, peaks in a vertical histogram might indicate the presence of a scanned horizontal plane such as floor and ceiling (Turner and Zakhor, 2015). Other research supports the recognition of the structure with reconstruction grammars (Prusinkiewicz and Lindenmayer, 1990). These grammars define common rules in buildings of a certain type. These rules simplify the automatic modelling based on point clouds (Becker et al., 2015;Tran et al., 2019). Topology reconstruction is an important aspect to achieve a correct interpretation of the wall connections. Researching this aspect is challenging due to the incompleteness and complexity of point cloud data of building scenes. Bassier and Vegauwen (2020) propose a connection evaluation framework that takes as the input a set of pre-processed point clouds of building's walls and computes the best fit topology between them. This problem is also known in other industries where reverse engineering plays an important role (Ramamurthy et al., 2015). In order to create BIM models, the semantic classification of the elements is central. In this field, there are several studies that are based on the extraction of different planes and the assignment of a specific label according to their orientation or dimensionality. This allows the modelling of objects on the basis of a part of the point cloud that corresponds to a specific category in order to obtain semantically differentiated objects (Xiong et al., 2013). In addition, several studies employ artificial intelligence, which has been shown to be efficient, to perform a semantic segmentation of point clouds as the basis for BIM reconstruction (Ma et al., 2020). Concerning parametric modelling, in recent years, several visual programming interfaces as support for the modelling process have been developed. Several providers of CAD and BIM modelling software have integrated such interfaces into their products. This has enabled AEC professionals to program modelling processes by creating algorithms. In addition, many developers have developed functions and libraries for specific modelling and model analysis functions. Regarding the combination of point clouds and parametric modelling, mention must be made of the DURAARK project (Zwierzycki et al., 2016) and their VOLVOX product, which is a Grasshopper plug-in offering functions to work with point clouds in parametric modelling environment, and which was used in this research. Moreover, parametric modelling combined with point clouds can be essential to virtually reproduce existing structures not only by recognising geometries but also by parameterising variations according to the analysed rules of the shapes in the point cloud (Paris and Wahbeh, 2016).

Overview
The input data is a registered unified point cloud limited to one storey, without segmentation and without colours (simple XYZ text file). The clouds used as input are very light compared to the average that is produced for the survey (5 -10 cm spacing between points). The subsampling of the point clouds was done according to the minimum spacing between the points. This guaranteed a homogeneous distribution of the points in the scanned space since it deletes more points where the density is high.
The input point cloud is transformed in a preparation step to align the main two walls' directions parallelly to the main X and Y axes of a local coordinate system. This preparation step is performed to simplify the process and to avoid searching for the main walls' direction. The subsampling and the transformation are executed using the point cloud processing software, "Cloud Compare".

Figure 2. Overall process of the proposed method
The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XLIII-B4-2021 XXIV ISPRS Congress (2021 edition) As a result, when the proposed process is executed, the axes of the recognised walls constructed at floor level are obtained, and these are converted into solids by extruding them for the retrieved ceiling height and giving them, at this stage of the research, a predefined generic thickness. Hence, the important result of this research is to automatically reconstruct the axes of the walls and derive their height. For parametric modelling, adopted by BIM modelling software, these are the two geometric data required to build a wall, given the type of wall. The strategy in this research is to keep these conventional modelling steps, i.e., to find as a first step the axis and length of the different walls and not their surfaces, unlike the methods using RANSAC for plane recognition. In this way, it is possible to proceed with a parametric modelling considering that, for an editable BIM model in the AEC fields, the thickness of walls should be generated as the sum of the thickness parameters of internal layers resulting from the analysis and definition of the type and not simply from the distance between the surfaces of the two sides. Therefore, to work on axis recognition, a two-dimensional point cloud analysis is performed with a very low resolution where the two sides of the wall join. The pipeline of the developed algorithm is divided into multiple stages. A graph representation of the overall process is given in Figure 2, and a visual overview of the method is given in Figure. 3. The main steps of the proposed approach are the following: 1. Identify the important horizontal reference planes (floorceiling for each floor). This step was performed using the principle of "peaks in the histogram" (Martens and Blankenbach, 2020). 2. Filter the point cloud using a significant segment of it to eliminate noise due to interfering objects. 3. Project the filtered part onto a 2D plane to simplify the problem by eliminating the third dimension. 4. Create a two-dimensional analysis of the voxelization method by creating a grid of cells and filtering the cells according to their coincidence with points. 5. Classify the cells according to X and Y axes alignment. 6. Create cell clusters by analysing their distribution along X and Y directions to estimate walls and overcome the presence of significant clutter and occlusions. 7. Generate new points corresponding to valid cells. 8. Connect the newly generated points to create wall construction lines. 9. Filter and unify double lines of a wall. 10. Use the generated wall construction lines to create wall geometries from the height retrieved from the main floor levels extracted in step 1. The next sub-chapters give more detail on the algorithm developed by dividing it into three modules.

Defining the space segment to analyse
After importing the point cloud by reading the text file and using the coordinates contained therein to construct a point cloud ("Construct Cloud" function of Volvox), we proceed to filter the cloud. We proceed with the principle of histogram analysis to identify the predominant horizontal planes (floors and ceilings). This step is performed by density-based clustering of points analysing the Z-coordinates then choosing the two groups with the highest density which should represent the floor and ceiling in one floor. Technically, this was possible in four steps: • Reduce the number of points in the cloud randomly (1% of the points is sufficient) to speed up the process • Double project the point cloud on the XZ plane, and then on YZ to place the points on the same vertical axis • Analyse the points to generate detached groups based on a distance threshold parameter ("Point Group" function).

•
Filter the two largest groups and find the average Z coordinate for each group.

•
Create the two horizontal planes according to these found coordinates. Then differentiate the planes (the plane with the smaller Z coordinate is the floor and vice versa). The second step is to obtain a segment of the point cloud that contains most of the points belonging to the walls. It is evident, also according to other studies (Hong et al., 2015), that the top of each room should have fewer interfering objects and interruptions. Therefore, in the algorithm, a parametric search zone was defined to be adapted to different cases as seen in Figure 5. Defining a large search area (at least 1m height) allows more points to be collected that belong to walls than to furniture and allows continuity to be obtained when openings are not at full height. At the end of this module, the point cloud was projected onto the horizontal floor plane for subsequent analysis.

From points to cells
This step is crucial for this approach. In this approach, we want to avoid working directly with the points of the point cloud for several reasons. The most important ones are: To avoid the irregularity of the points alignment (noise); and to be able to group them. This is a method normally used in similar research in both 2D form (pixels) and 3D form (voxels) (Xiong et al., 2013). Accordingly, in this step, we create a grid of square cells of a parametric size of 20-40 cm. Then we compare it with the point cloud and filter out the cells containing points inside, which we can call (valid cells). The choice of a large cell size is intended for the following reasons: • To join, if possible, the points on the two sides of the wall • To minimise interruptions due to occlusion zones in the point cloud • To simplify the calculation  Accordingly, we obtain two groups of cells: those belonging to walls of direction X and those belonging to walls of direction Y. For each group of cells, to differentiate them into different walls, they are grouped according to a threshold of detachment ("point group" function).
The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XLIII-B4-2021 XXIV ISPRS Congress (2021 edition)

From cells to lines
The creation of lines is done by connecting the centres of the cells belonging to a specific wall. A continuity criterion has been defined to fill possible gaps. In this case, it is also based on a detachment threshold parameter. Figure 8 shows the lines that continue if the detachment threshold of 4 cells gaps is not exceeded. Since two neighbouring lines cannot be from two different walls because they are too close to each other to form an architectural space (20-40 cm), then they should belong to the same wall. Therefore, we try to generate a new line in the middle parallel to these two lines and of a length that could reach the outermost endpoints of these two lines ( Figure 9). This last line will replace the two neighbouring lines (Figure 10). Figure 9. Some examples of removing double lines by the algorithm. A line is generated (green) in the middle parallel to the neighbouring two lines (red) and of a length that reaches the outermost endpoints of these two lines.
The last modelling step for this research phase is to be able to create a correct connection between the lines in order to obtain a topology as suitable as possible for modelling. Despite the filtering rules built into the algorithm up to this point, some lines are longer than they should be, as can be seen in Figure 10. To solve this issue, we proceed with a division of the lines from one group with the others from the other group (lines in the X direction cut the lines in the Y direction and vice versa). In this way, the leftover pieces, which are the smallest, can be eliminated by filtering them according to a length threshold. Figure 11. The lines obtained from the process on an example of a point cloud.

RESULTS
The developed algorithm has been tested on several cases of indoor point clouds, and it appears that the automatic modelling is efficient to speed up the overall modelling process. Processing takes from one to several minutes to generate the geometries of the walls. This time depends on the chosen resolution and accuracy parameters: • point cloud resolution • the extent of the search area • the size of the cells in the analysed grid The most important accuracy parameter is the size of the cells used for the analysis. In this case, the maximum error could be half of this parameter. This could happen when the points belonging to a wall fall on the most extreme zone of the cell, and according to the algorithm, the wall is modelled in the centre of the cell. For instance, the maximum error could be 15cm when the grid is drawn with a cell size of 30cm. The proposed reconstruction is an approach which allows the automation of wall recognition and geometric modelling (position, length, and height). The rest of the information (structure, wall layers and materials) is related to the type of wall observed by experts in a scan-to-BIM process. Such information cannot be provided by laser scanning. The parametric nature of geometric objects in BIM allows automatic adaptation when they are assigned a predefined type. Figure 12. Some examples of automatic modelling using the algorithm. On the left, the original point clouds, and on the right, the automatically obtained wall models.

CONCLUSIONS AND FUTURE WORK
The presented approach is a first step in this research. It is suitable for interior modelling cases where the regularity and structure of the model is very important, and where this aspect is preferable to detail and evidence of irregularities. Grasshopper was very slow for processing point clouds and is not to be compared with similar processing in programming languages such as C. But the advantages of using Grasshopper as an extension of 3D modelling software that allows parametric modelling are multiple: the possibility for the user to directly visualise and verify the completeness and measure deviations is very important. In addition, manual adjustments of the model are possible as soon as it is transformed from a Grasshopper algorithm into Rhino objects (using "Bake" function). Finally, the possibility to export the parametrized model into different model formats including IFC and the availability of direct connections to different BIM software by using additional modules. Several improvements to this approach are possible. The next goals of this research toward a better automation process are as follows.
First, quality: The quality should be optimised by working on analyses that can be performed on different cloud resolutions and different grid cell sizes (multi-level analysis) to refine axis position and to acquire information about the wall thickness as an indicator of wall type classification. The combination of this information with the results presented in this paper could be used to increase the accuracy and allow the differentiation of the types of walls identified according to their thickness.
Second, topology: Improve the connections between the lines which from the axes of the walls. this includes the development of connection criteria when there is a lack of data from the point cloud.
And third, filtering: Investigate faster and more effective filtering approaches of points and lines for more rapid results. As a horizontal extension of the research, there are potentials for integrating artificial intelligence concepts that go beyond statistics. filtering and recognition of points belonging to specific category objects allows great steps forward in the quality of reconstruction and extension of the concept to recognise openings within walls and a search for different orientations of walls outside the Manhattan-world assumption.