Synopsis
- comp (compSelector) { selector operator operations | ... }
Parameters
- compSelector—keywordThe component into which to split
- f — faces.
- e — edges.
- fe — face edges.
- v — vertices.
- g — groups.
- m — materials.
- h — holes.
- selector—keyword
- { front | back | left | right | top | bottom }—The y-normals of the components are analyzed by classifying their directions into the corresponding quadrants (in relation to the local coordinate system of the current shape).
- { object.front | object.back | object.left | object.right | object.top | object.bottom | object.side}—The y-normals of the components are analyzed by classifying their directions into the corresponding quadrants (in relation to the object coordinate system of the current initial shape).
- { world.south | world.north | world.west | world.east | world.up | world.down | world.side }—The y-normals of the components are analyzed by classifying their directions into the corresponding quadrants (in relation to the world coordinate system).
- { vertical | horizontal | aslant | nutant }—The y-normals are analyzed in relation to the xz-plane of the current shape's local coordinate system. The angle between normals and xz-plane is used to classify the components with the ranges in degrees:
- horizontal: ]78.75, 90]
- aslant: ]11.25, 78.75]
- vertical: ]-11.25, 11.25]
- nutant: ]-78.55, -11.25]
- horizontal: ]-90, -78.75]
- side—selects all but the horizontal components.
- { border | inside }—components at the border of or fully inside the geometry respectively. Border edges are connected to only one face; border faces contain one or more border edges; border vertices are start or end point of one or more border edges. This selector does not work on holes.
- { eave | hip | valley | ridge }—these selectors work on edges only and are designed to be used in conjunction with roofs. See roof edges for more details.
- { street.front | street.back | street.left | street.right | street.side }—if the streetWidth attribute is available on the initial shape, these selectors can be used to identify street-facing components. See street selectors for more details.
- all—selects all components.
- index(float)—selects the index-th component (0-based).
- operatorThe operator defines how the selected components are used to generate successor shapes. Valid operators are:
- : Each selected component is put into a new shape.
- = All selected components are combined into one new shape.
- operationsA sequence of CGA operations to execute.
Description
The comp operation (component split) allows to divide a shape into its topological components, which are either faces, edges, vertices, groups, materials, or holes . The components can be selected using either their index or a set of semantic selection keywords. Group and material components satisfy a specific selection keyword if at least one geometric component (usually a face) satifies it. The selected components are transformed to a new shape and processed by a sequence of shape operations. Depending on the operator, either one shape is created for each individual selected component (":") ore one shape for the whole set of selected components ("=").
The selection parameters of a component split work in a excluding manner: if a parameter has selected a specific component, this component cannot be part of another selection (from left to right).
The local coordinate systems (pivot and scope) of the newly generated shapes are aligned according to the geometry's topology; the component split is one of the few shape operations which manipulate the pivot of a shape.
- f
In the case of a face component split, the x-axis will be parallel to the first edge of the face and the z-axis wil point along the face's normal. The pivot will be positioned at the first vertex of the first edge of the face; the scope will be the bounding box of the face, i.e.the z-dimension of the emerging shape's scope is set to zero. See example.
- e
In the case of an edge component split, the x-axes of the pivot an the scope are along the edge and the z-axes point along the average of the normals of the neighboring faces. The y- and z-dimension of the scope are set to zero and the x-dimension is the length of the edge. The pivot will be positioned at one of the endpoints of the edge. The indexing of edges is as follows: index 0 is the first edge of the first face, index 2 the second edge of the first face etc. Shared edges are skipped on second encounter. See example.
- fe.
In contrast to edges, face edges are considered separate for each face. Similarly, indexing is done firstly per face and secondly per edge, but shared edges are not skipped. Furthermore, contrary to edges, face edges have a unique direction determined by the orientation of the face they belong to. The x-axes of the pivot and the scope are directed in face orientation and the z-axes point out of the face orthogonally to the edge and the face normal. The pivot is positioned at the first vertex of the face edge. See an example.
- v
In case of a vertex component split, the pivot is positioned at the vertex, the z-axes will point along the average of the normals of the neighboring faces and all scope dimensions are set to zero.
Shape attributes
Each generated shape will have a number of attributes set:
- comp.sel—A string containing the selector which chose the components for this shape.
- comp.index— The zero-based index of the selected component.
- comp.total—The total number of components selected by the selector.
Index and total are per selector; for instance:...
primitiveCube()
comp(f) { front : Front
| side : Side }
will create one Front shape with comp.sel="front", comp.index=0, comp.total=1 and three Side shapes with comp.sel="side", comp.index=0,1,2 and comp.total=3.
For more information, see comp attribute.
Trim planes
Additionally, for faces, the component split generates trim planes. Trim planes are placed along the shared edges of the new faces in a bisecting angle. The purpose of trim planes is twofold. On one side, trimming handles geometry intersections on the boundary of two neighboring faces, and on the other side, trimming is used to handle non-rectangular faces. The trim planes are applied using the insert operation, primitive operations, or the trim operation.
According to the direction of the shared edge, trim planes are classified into horizontal and vertical planes. They can be switched on or off by setting the trim attribute to true or false. By default, trimming is activated for vertical trim planes and deactivated for horizontal trim planes. Check the trim planes examples below.
Note:
- Trim planes are only generated if the : operator is used.
- Trim planes can be configured in the procedural runtime preferences.
Occluder shape
An unlabled occluder shape is automatically generated before the component split is applied. The occluder shape is made available for unlabeled occlusion queries.
Roof edges
There is a number of selectors which are designed to classify typical roof edges:
- eave—Horizontal border edges on the bottom of the roof. The edges are always oriented anti-clockwise around the original face.
- hip—Inside edges connected to at least one eave edge. Hip edges are always oriented upwards, i.e. the ending point has larger y-coordinate than the starting point.
- valley—Inside edges where the two connected faces form a concavity. Valley edges are always oriented upwards, i.e. the ending point has larger y-coordinate than the starting point.
- ridge—Inside edges which are not hip or valley. Ridge edges are always oriented upwards, i.e. the ending point has larger y-coordinate than the starting point.
The figure below shows a few examples.
![Roof edges Roof edges](GUID-B3C1C4A8-ADB9-4067-9C98-E643144E722A-web.png)
Street selectors
Components adjacent to a street can be selected with the street.front selector, rear components can be selected with the street.back selector, and components in between front and back can be selected with the street.left and street.right selectors. street.side combines left and right components. Below are examples of the street.xxx selectors.
![Street selector 1 Street selector 1](GUID-7A532280-4A93-42DC-B208-848F90FAF781-web.png)
![Street selector 2 Street selector 2](GUID-5272470F-0CBF-405F-B7E0-35BA9FB88282-web.png)
These selectors depend on the availability of the streetWidth attribute map; see Auto-generated street width attributes. If the attribute is not available, component selection falls back to theobject.xxx selectors.
Related
Examples
Facade selection / face split details
Let us split the mass model of a building into the main facade and a number of side facades. Note the orientation of the pivot (the annotated axes). | ![]() |
| ![]() |
Each face is now the geometry of a new shape; the new shapes' scopes and pivots depend on the faces' orientation. The x-axis points along the first edge and the z-axis points along the face normal. The scope's z-dimension is zero. | ![]() |
Selectors
Selectors 1: Quadrant-based Selectors are demonstrated by using them to color the faces of a spherical geometry. The selection is relative to the local coordinate system (the shown scope).
| ![]() |
Selectors 2: Angle to y-axis based Note the horizontal areas (blue) on the sphere's poles.
| ![]() |
Index-based selection
A mesh can also be disassembled into its components by addressing them directly by their index. The indexing scheme is inherently encoded in the model itself. | ![]() |
Only faces 0, 2 and 4 of the cylinder are selected.
| ![]() |
Trim planes
At shared edges, trim planes (green) are inserted.
| ![]() |
Inserted geometry is cut with the trim planes.
| ![]() |
By default, horizontal trim planes are off. Enabling them before inserting the geometry gives a different result.
| ![]() |
The operator
Using the ":" operator results in a new shape for each component selected by the selector. In the example below, a shape is created for each side of the extruded geometry. Therefore, the Lot Shape has five successors (one for each side). Each successor shape has its pivot and scope set up differently.
| ![]() |
In contrast, using the "=" operator results in exactly one new shape for all component selected by the selector. In the example below, one shape is created for all five sides of the extruded geometry. Thje new shape's geometry contains all five faces, and the pivot and scope are set up relative to the first selected face.
| ![]() |
Border and inside selectors
The picture shows the initial shape. It is a subdivided plane, consisting of a number of faces. | ![]() |
The example selects the border and inside faces and colors them.
| ![]() |
Here, there border and inside edges are selected and colored cubes are inserted.
| ![]() |
Finally, the border and inside vertices are used to insert colored cubes.
| ![]() |
Edge split details
A building mass model is split into its edges, and the built-in cube model is inserted into each edge shape. The pivot of the new shape is set to the edge's start vertex, and the alignment is as follows: the x-axis points along the edge, the z-axis is the average of the neighbouring face normals and the y-axis is normal to the two former ones. The scope has zero translation and rotation, and the sizes are (edge-length, 0, 0).
| ![]() |
A split into face edges creates more components, for each face the edges are considered separately. Edges are oriented wrt. face orientations. The pivot is now set to the edge's start vertex and the x-axis points in face orientation, the z-axis is pointing out of the face orthogonally to the edge and the face normal.
| ![]() |
Vertex split details
A building mass model is split into its vertices. The pivot of the new shape (the VShapes in the rule above) is set to the vertex position, and the alignment is as follows: the z-axis is the average of the neighbouring face normals and the x- and y-axes are chosen such that they are all normal to each other. The scope has zero translation, rotation and size.
| ![]() |
Group split details
A tree model is split into its groups.
| ![]() |
Material split details
A tree model is split into its materials. In this case groups and materials are the same.
| ![]() |