FAST AND SMART 3D MODELLING: AN ALGORITHMIC TOOL BASED ON CHURCH TYPOLOGY

: Increasingly advanced technological development and the broad possibilities introduced by computer graphics and parametric-semantic modelling force us to reflect on the concept of smart models, especially in relation to the purposes for which the models themselves are created, directing research towards in-depth studies linked to the type of information that the model is intended to convey. This research shows the results obtained in the development and experimentation of a generative modelling algorithm dedicated to the rapid and semi-automatic modelling of churches. The work stems from the need to elaborate a useful tool to prepare, in a short time, an intelligent database - graphic and informative - rapidly visualisable, dedicated to the management of churches in post-earthquake emergency conditions. The main


INTRODUCTION
The widespread presence of masonry buildings, with many churches included in this category, constitutes a significant reality for the Italian territory.In earthquake situations, these structures often suffer significant damage, accentuated in part by the intrinsic nature of the construction material used and, on the other hand, by their morphological and compositional characteristics.Churches generally consist of large rooms circumscribed by slim walls, are rich in pushing elements and have few horizontal connections.The typical vulnerability of these architectures, together with the recognition of their strong identity in the context of Italy's historical heritage, guided the research towards the development of a digital tool to support the documentation of the state of damage of churches following seismic events.The research carefully examined the documentation procedures currently in use in order to identify the essential inputs needed to achieve the set objectives.Effective data management represents a significant challenge for the conservation of architectural heritage and to reduce the time required to inform intervention strategies.

Theoretical framework
In Italy the current method of evaluating the damage suffered by churches as a result of earthquakes is mainly based on the in-situ compilation of the 'A-DC Model' survey and evaluation forms, in accordance with the Prime Ministerial Decree D.P.C.M. of 23 February 2006(Gazzetta Ufficiale 7.3.2006, no. 55).This is a sheet (on paper or in PDF format) that makes it possible to indicate, through the compilation of textual fields, many descriptive and dimensional characteristics of the specific church to be evaluated, looking at first-or second-level analyses.In the first and second level sheets referring to masonry churches, damage assessment is performed according to precise Guidelines that consider valid the idea that such artefacts are the outcome of the aggregation of various architectonic portions that are significant from a structural point of view, defined with the name of macro-elements (Lagomarsino, 2006).Each macro-element therefore corresponds to a portion (main nave, lateral naves, chapels, transept, presbytery, apse, façade and bell tower, ...) that is considered autonomous in its structural response and can therefore be considered as a single independent block, although strongly related to the rest of the building.The connection areas between the macro-elements are, consequently, the point at which disaggregations may be generated due to specific movements of one macro-element with respect to the other.The way in which this occurs following an earthquake; or, the way in which a single macro-element is damaged in the event of an earthquake, define a specific collapse mechanism (Di Tommaso and Bufo, 2020;Fillia, et al., 2021).According to this approach, churches are decomposable into different macro-elements to which correspond, in turn, twentyeight collapse mechanisms, each dependent on specific stresses experienced by the structure.Following the 'AD-C Model', during post-earthquake on-site inspections, numerous volunteer technicians are asked to fill out predefined forms, entering or ticking off the data necessary to calculate the damage index and vulnerability index.For each macro-element, the form asks for metric and material data to be documented, as well as producing a quick representative sketch of the mapping of the crack framework, which is indispensable for understanding the possible collapse mechanisms to which the church is subjected.
In this procedure, although the damage index is obtained through a mathematical calculation, the validation of the result is complex because it is strongly influenced by the subjectivity of the compiler in reading and interpreting the data collected.From this point of view, a critical element is the absence of a standard interface that can support all stages of the process, from mapping to systematisation and data transmission, and that also holds together supporting documentation, including texts, drawings and photographs (Dell'Amico, 2019).The lack of a unified system in fact contributes to ambiguous interpretations of the collected data, making a cohesive and homogeneous evaluation difficult.

Main aims
This research proposes the development of a digital product/smart model aimed at documenting the information contained in the 'A-DC Model'.This digital tool is designed to facilitate the collection of data from the first and second level sheets, using a three-dimensional graphic model as a basis.The aim is for the 3D model to function as an anchoring structure for the data, while providing an integrated tool for their analysis.The information and purposes of the models are dictated by the boards, and consequently the data are divided into two main categories: dimensional data and typological data.While the former emphasise the relevance of the physical dimensions of the analysed church, the latter focus on its overall composition, referring to the specific characteristics of its individual constituent macro-elements.In complement to this, additional data useful to obtain a complete understanding of the artefact is taken into account.This additional data, for the board, consists of requesting sketches of the crack pattern recorded on site for each macro-element, highlighting the importance of locating any evidence of ongoing structural problems.For research, this phase is replaced by the realisation of the 3D model.In short, the central idea is to create a rapid and unified working environment that simplifies the mapping, systematisation and transmission of data to be collected in situ.This environment should guarantee the verification of interpretations, offering an integrated, three-dimensional view of the information.The experimentation focuses on how to facilitate on-site operators, enabling the rapid construction of the model directly during the survey phase and without requiring detailed knowledge of the actual procedures used in three-dimensional modelling operations.In fact, users must be able to enter the data necessary to transform the generic 3D model into a 3D model consistent with the case study.The experimental phase therefore focused on the development and testing of an adaptive parametric modelling algorithm based on the concept of shape grammar and specifically designed for the rapid and semi-automatic creation of church models.The algorithm was named with the acronym ChurMa -Churces Maker.The construction of the ChurMa algorithm (Fig. 1) was initially based on theoretical foundations of church composition.Subsequently, experimentation was subjected to a series of tests referring to various case studies of actually built churches, in order to assess its limits and adaptability in customising the values attributed to individual parameters.The in itinere improvement of the tool depends precisely on the results of the testing activity, useful to simplify the relationship between the parameters and to add new typological variations to better adapt the generated 3D model to the real architecture.The work was therefore created with the aim of developing a fastmodelling tool, useful for documenting damage to masonry churches in post-earthquake emergency conditions, to support decision-making processes, reduce intervention times, decrease costs and optimise resources (Chevrier, et al., 2009).

METHODOLOGICAL APPROACH
The increasingly advanced technological evolution and the broad possibilities offered by computer graphics and parametricsemantic modelling require in-depth reflection on the concept of 'smart models', especially in relation to the objectives for which models are created, defining specific tools and processes according to the type of information the model aims to convey.This approach reflects an awareness of the need to find optimal solutions for developing models, especially considering that smart models are not simply visual representations but vehicles for often complex and contextually significant data.Parametric-semantic modelling makes it possible to represent reality by interpreting it according to specific contexts and precisely from data (Capone, 2016).In the context of the present research, in order to facilitate the understanding of the space under investigation (one or more churches), the digitisation process was organised according to an approach based on parametric modelling (i) and the shape grammar (Stiny and Gips, 1972) (ii).This is to replicate, in a digital environment, those rules of behaviour that exist between the parts that make up the architectural reality of churches, in order to arrive at parametric representations of them from predefined primitives -first 2D and then 3D.The approach is therefore based on a design-oriented generative system where: i) The design of the basic forms was carried out by flanking the concept of the macro-element with the concept of the microelement, also deduced from the observation and compositional analysis of an extensive collection of documents relating to real churches.This was done in order to understand their overall morphology and arrive at a geometric and typological conceptualisation to be included in the grammar of form.ii) To complement the geometric considerations, understanding the rules of aggregation and behaviour between individual parts was crucial.To this end, technical manuals and historical architectural treatises were consulted.These texts, while primarily aimed at providing specific nomenclature for all parts and sub-parts of architecture, have the added value of generalising architectural concepts to cover a wide range of real cases.In fact, these sources provide a description of architectural parts, but also offer a series of details on the significant characteristics of the different portions of the manufact, including churches, emphasising their functional relevance and suggesting their compositional rules.Operationally, the tool through which the work was constructed was the Grasshopper application.Here, the visual approach Figure 2. Adaptation test of the parametric model to the five case studies.Superimposition on the plan and elevation drawings to check correspondences.
facilitates an intuitive and interactive representation of operations, facilitating the construction of the logical flow without necessarily resorting to the traditional programming language based on text and specific syntactic rules.'Where a phrase structure grammar is defined over an alphabet of symbols and generates languages of strings of symbols, shape grammars are defined over an alphabet of shapes and generate languages of shapes' (Stiny, 1975) The parameterisation of the geometric shapes under experimentation took place, in a first phase, starting from the typological analysis and semantic decomposition of the historical churches, setting the macro-elements (Lanzara, et al., 2021) and defining the minimum parameters necessary to make the tool easy to use even for inexperienced modellers.This translates into the manipulation of the coordinate values of a finite number of points dependent on geometric rules necessary to obtain the most goal-oriented result.As is well known, a single point -understood as a basic entitycan be described in VPL through the parameterisation of Cartesian (X, Y, Z) coordinate values.The connection between several points can generate lines, which, in turn, can generate surfaces.The construction of several connected surfaces can finally give depth to the model, which becomes a threedimensional entity made up of variables and parameters.Thus, the coordinates of the points and, consequently, their reciprocal positions, have been used as key data to establish and bind the relationships between several geometric entities, guiding the process of form generation.More specifically, through the set of ordered instructions constituting the algorithm, the rules of adjacency, proximity, alignment, intersection, centrality and orientation were translated into mathematical operations.In this way, control points have become parameters with architectural significance, facilitating the creation of intricate architectural structures with specific shapes.An example of this is the setting of constraints between parameters to respect a fixed distance or a fixed proportion: think, in the case of churches, of the position and size of a church's side chapels, which are generally the same and repeated.Thus, the process involved the translation of apparently common -or theoretically obvious -concepts into complex combinations of 'VPL components'.In the context of churches, it was necessary to express relationships such as the side-by-side arrangement of the secondary naves in relation to the main nave, or the existence of an enclosure that simultaneously separates and unites them (on the one hand, it acts as a physical division between nave and side aisle, on the other hand, it is a closing element of the individual macro-element, for both).Similarly, it was necessary to address the location of the transept, with a development adjacent to but transverse to the naves, and to establish the condition that the main façade must be equal to or greater -not less -than the first rooms located beyond it and inside the church.The model in Grasshopper was therefore made by continuous aggregations of rules that formed forms, which in turn were aggregated by rules to make them first elements, then microelements and finally macro-elements, always relating everything.Each parameter was chosen so that it could correspond to the data acquired on site by the operators and thus be consistent with the damage cards.This overlapping of typological and aggregative solutions therefore led to a breakdown of the algorithm into four levels of detail 1) Church: composition of multiple related macro-elements.E.g.: nave + apse + side chapels + main façade.2) Macroelement: composition of multiple related microelements.Modifiable in overall geometric parameters and/or detail.E.g.: the Lateral Chapels alone or the Transept alone.
3) Micro-element: typological solution of the architectural portion and/or set of elements.Modifiable in the overall geometric parameters and/or details.E.g.: the Pavilion Vault used as the roof of the Side Chapels.4) Element: detail portion of the micro-element or macroelement.E.g.: window perforations used on the Main Façade or on the walls of the Central Nave.From a parametric point of view, the parameters are differentiated into: 1) Operating parameters: these are the numerous parameters necessary for the model to function but cannot be modified by the users who will use the model.These are the basic rules constituting the algorithm.2) Adaptation parameters: these are the few parameters that the user can modify so that the final graphic result is consistent with the real church to be replicated.To synthesise, while the construction of the algorithm entailed the summation of a large number of solutions (think for example of the numerous types of vaults that may cover the chapels of a church and the relative dimensional and formal adaptation parameters, as well as the relationships that must be established with the other parts), the construction of the model useful for replicating a specific church derives from the selection of the few characteristics useful for replicating what is necessary in situ.It is necessary to include here a consideration also with respect to the level of detail of the model.If by level of detail we mean the model's adherence to the real thing, it must be borne in mind that in the generation of digital twins, adherence cannot be understood as a mere indistinct copy of all the features of the artefact.Rather, mimesis can be assessed at different levels of detail depending on the importance of the feature to be replicated in relation to the effectiveness of the response to the objective for which the model is being realised.In this case, the model aims to replicate with immediacy, under emergency conditions, the typological characteristics and main dimensions of masonry churches, as required by the damage assessment sheets.This is to immediately obtain a 3D of the case study on which on-site operators can locate and map the lesions present within the annotated church.In this regard, the final rendering of the model was set to be devoid of details superfluous to the objective: elements such as mouldings, cornices, ornamental details, fixtures, were not included.

Description
As part of the experimentation, tests were conducted on different churches identified within the heritage of historical religious buildings in Naples (di Luggo, et al., 2016) in order to test the algorithm's ability to adapt its forms to those actually constituting real cases.This also served to project the future development of the algorithm.
The tests were carried out on five cases selected on the basis of different parameters.These were, in fact, cases that differed in terms of the presence or absence of macro-elements, their different modes of aggregation rather than the various configurational types of the macro-elements themselves.A further criterion guiding the selection was to examine churches that could represent a significant sample of religious buildings with recurring constituent characteristics in the Neapolitan panorama.In addition, the sample also took into account the size parameter.This led to the identification of five churches differing in complexity and size, starting from minute complexes up to basilica-like typological and dimensional examples.The compositionally simpler example is represented by the Church of Santi Giuseppe e Cristoforo, which consists of a single hall covered by barrel vaults with lunettes, followed by a space that serves as the presbytery, representing the extension of the nave, and covered by a barrel vault.Connected to the latter is the cylindrical apse with a semi-cathedron apse.Similar in size is the church of San Nicola dei Caserti.It is a singular example of a church with a nave and side chapels, all covered by barrel vaults.The central core is characterised by the transept and the dome set on a drum.This is followed by a long presbytery that ends in an apse covered by a semi-castern.The smallest of the selected examples is the Santi Cosma e Damiano church.It is a single-nave church with side chapels, two on each side, with barrel vaults.The nave is covered by two cross vaults that emphasise the double span.Extending the nave is the cross-vaulted presbytery.On either side of the latter, two deep chapels outline the transept.In this case, the church has no apse.The church of San Giorgio dei Genovesi, the fourth church selected, introduces the typological theme of the single-nave Latin cross church with side chapels.It is therefore an example of a building of worship characterised by a wide and long barrelvaulted nave and an imposing dome on a high drum.The transept is delineated by the two wide and high side chapels also covered by barrel vaults.The composition is completed by an area dedicated to the presbytery and apse with a polygonal layout and a pavilion vault.The last example identified is the church of Santa Maria degli Angeli in Pizzofalcone.This is the most complex and dimensionally largest case.The church, in the shape of a Latin cross, is articulated in this case over three naves with side chapels.The majestic, wide nave is covered by a lunetted barrel vault.The two side aisles, on the other hand, have vaults on spherical pendentives, and a central lantern.The vaulted systems follow the usual hierarchical order in which the vaults of the rooms on the sides of the nave are progressively lower.The four side chapels are covered by barrel vaults.The large transept, outlining the Latin cross, has two arms that, in terms of layout, are aligned with the depth of the side chapels.Like the nave, the transept also has a lunetted barrel vault.This church is also characterised by a majestic dome, with a lantern, set on a high drum.The two naves continue, beyond the transept, with the same architectural elements for a further bay.Aligned to the latter is the presbytery.

ChurMa test
After an understanding of the typological configuration and metric dimensions of the churches used as test cases was gained, ChurMa was started.During this process, only the adaptation parameters were calibrated, simulating precisely the task of an inexperienced modeller who must obtain the church model in order to document its state of damage.Therefore, the respective macro-elements were selected for each church, and the acquired data on dimensions and types were entered for each of them.Finally, the result was generated.For the verification phase, the model obtained in Grasshopper with ChurMa was 'frozen', i.e. made into a finished 3D model, no longer subject to modification by parameters.This model was verified according to two procedures: 1) The first procedure involved comparing the model with the plan, section and elevation data of the relevant church.The twodimensional products are the result of graphic elaborations resulting from survey campaigns carried out in the past by the research team (Fig. 2).
2) The second procedure operated a semi-automatic comparison by superimposing this lightweight 3D model on the point cloud obtained from the survey.In this case, the fit of the model was assessed with respect to its adherence to the main surfaces of the mesh-transformed point cloud (De Matteis and Zizi., 2019).The following results emerged from the comparison: Some features found in churches were replicated by the algorithm with excessive simplification.This is the case with domes and apses whose basic geometry does not correspond to polygonal, cylindrical or quadrangular profiles.The church of San Nicola dei Caserti, in fact, does not correspond in the shape of the apse, generating a difference in the overall dimensions of the space.Another aspect concerns the presence of lunettes at the vaults covering the central aisles.In this case, the vaults chosen to be set in the algorithm are exclusively of the cylindrical type, while spheroidal lunettes are often found.These characteristics, however, do not seem to invalidate the documentation for the purposes of the damage assessment sheet.ChurMa was however able to fulfil the need to obtain the model very quickly, with a sufficient level of adaptability and responsiveness to the requirements for mapping the required information.The process in use proved simple and intuitive, allowing configuration by pressing a few keys and writing a few attributes, with no need for modelling on the part of the user.
Although it is necessary to implement and optimise certain steps in the construction of the operating parameters, speed is a strong point in the simplified management of the documentation of churches in response to seismic events.Finally, on the finished model of each church, it is possible to proceed as for any other type of 3D model to the phase of drawing the lesions, supported by 3D polylines and cutting boxes for sectional visualisation.

Tolerance setting in the verification of Mesh vs. NURBS results
The representation of architecture can be understood as the sum of groups of objects oriented in space and in constant relation to one another.An object, or several objects, can automatically generate discretised geometric-analytic relationships within three-dimensional digital environments that can be modified, in turn, by means of a computer language based on applied mathematical concepts.Computational geometry has become an interesting subject of study and the combination of algorithmic programming with geometry has produced algorithmic geometries known as Generative Algorithms (Khabazi, 2010;Stavric, et al., 2013).The combination of the descriptive process with the computational one is the essential key with which to analyse the differences between two digital surfaces: a Mesh surface, obtained from the triangulation of a point cloud, and a NURBS surface, obtained by means of generative algorithms; both are used to try to describe the physical and architectural reality that surrounds us.A polygonal mesh, in computer graphics, is a grid that defines an object in space, composed of vertices, edges and faces (Siddi, 2014).These types of surfaces are widely used in the field of architectural surveying: from the point cloud it is possible to extract continuous Triangulated irregular network (TIN) surfaces -commonly known as meshes -obtained through the use of specific software (Einaudi, et al., 2019).NURBS (Non-Uniform Rational B-Splines) geometries, on the other hand, are mathematical representations of 3D geometry that precisely define any shape: from a simple line, to a circle, arc or curve, to the most complex 3D free-form or organic solid or surface.The research stands right in the middle of these two concepts.The aim is to analytically analyse the 'divergence' between the NURBS dispatch model and the surface interpolated from the surveyed cloud points (Fig. 4).From a conceptual point of view, it can be understood that a NURBS surface obtained from a speditive model will lack a precise amount of approximations compared to a discretization made by points.The ChurMa tool makes it possible to obtain a simplified NURBS model of the analysed case study object by simply entering its actual geometric properties of length, height, depth and type into the algorithm.When comparing, and superimposing, this simplification with a more complex model, such as that obtained from the point cloud, many data will clearly not match: just think of any mouldings identified in the point cloud, which, conversely, are of no interest to the ChurMa model.Nevertheless, with the aid of special algorithms in Grasshopper, it was possible to proceed with a semi-automatic comparison between the rough surfaces of the cloud and the NURBS model.For simplicity's sake, the procedure can also be applied to individual surfaces, taking advantage of the decomposition of the model generated for ChurMa into elements.Once the corresponding surfaces had been identified, they were decomposed into a finite number of points, identified through the intersection of their constituent isocurves.By connecting the corresponding nth points between the two surfaces by means of lines, the respective lengths of which become part of the parameters used to control divergence, a list of lengths is obtained, each relative to the distance between the two surfaces (Fig. 4).The limit values establish the maximum and minimum accuracy in the correspondence and define the desired tolerance.Finally, by means of Boolean logic and an inclusion/exclusion logic, it was decided to have the algorithm calculate a pattern transformed into colourimtric input in order to make the correspondences or divergences between surfaces immediately visualisable.

CONCLUSION
Tests carried out on several churches in Naples revealed the adaptability of ChurMa (Fig. 5), which led to the development of two possible advancement scenarios: addition or subtraction.One can add useful parameters to better detail the models towards the mimesis of reality or one can simplify them to obtain simple typological models that can be used in some different field, such as analysing the structural behaviour of artefacts or linking information of a different nature to specific parts of the model (photos, geospatial data, detailed information, ...) thus enabling relative geolocalisation.It is evident that the purposes of using models are crucial in defining the algorithm tool.Visual programming in this context emerges as a powerful means to explore and generate architectural forms, simplifying the process through the graphical representation of relationships and underlying geometric rules.Among the ongoing developments, research is advancing towards the creation of a digital visual platform, a mobile application, based on the possibility of rapidly rendering data for documentation purposes and, above all, in emergency situations, providing a simplified approach to specifically assess the safety of churches according to the parameters imposed by the postseismic evaluation sheets.This, through an interface that can be more user friendly, without the user necessarily having to use the algorithm through the Grasshopper interface.

Figure 1 .
Figure1.ChurMa starts by choosing the macro-elements in the church in order to make them typologically and dimensionally adherent to the case study.

Figure 3 .
Figure 3.Comparison of point cloud and ChurMa model for the church of San Nicola dei Caserti.

Figure 4 .
Figure 4. Purple NURBS surface and gradient applied to the Mesh.On the left the reduction factor is low, resulting in greater divergence tolerance.On the right it has been increased (Blue -Low divergence, Yellow -Medium divergence, Red -High divergence).PhD Gianluca Barile.

Figure 5 .
Figure 5. Preview of the ChurMa algorithm detailing the only parameters the user needs to modify for the left nave.