26.05.04 Cell Placement
Cell-placement constrains the placement of artifacts onto a grid for easy placement for general users. Cell-placement is not compatible with block-placement.
The cell-placement makes use of the volume of the artifact, as defined in 26.05.02-Artifact-Volume.
26.05.04.01 Requirements of the Cell-placement
The artifact itself, i.e., the Artifact object, that participates in the cell-placement MUST have volume, as defined in 26.05.02-Artifact-Volume.
26.05.04.02 Alter the Artifact Level Cell-placement
The Layout Mode module introduces a new member in ArtifactProperties to adjust the behavior of the cell-placement. The new member in ArtifactProperties is defined as
interface ArtifactProperties {
snapping: boolean // OPTIONAL
// ...
}
where snapping is OPTIONAL and its value MUST be of type boolean. When not specified, the implementation MUST use the default value true if no other module alters the default value. When working with the Category module, the default value MUST follow the default value defined for each category.
An artifact with snapping set to false will not participate in the cell-placement.
26.05.04.03 The Input and Result of the Cell-placement Snapping
The cell-placement snapping takes an input layout from Form and produces a resulting layout in which each element in the layout list, if it participates in the snapping, follows the cell-placement.
For artifact , its original placement can be written as before performing the cell-placement snapping, where indexes artifacts in the input layout that participate in the cell-placement snapping. The resulting placement can be written as after performing the cell-placement snapping.
For artifact , its original rotation can be written as the Euler angle before performing the cell-placement snapping, where indexes artifacts in the input layout that participate in the cell-placement snapping. The resulting rotation can be written as after performing the cell-placement snapping.
The cell-placement snapping alters the ground plane coordinate of the artifact and the rotation. The height is left unchanged.
26.05.04.04 Snap the Rotation
The cell placement allows only -axis rotation. The input and -axis rotations will be mapped to 0 during the snapping. To focus only on the relevant data in the cell-placement, in the following sections, rotation refers to the -axis rotation, as rotation around any other axis is mapped to zero. The snapped -axis rotation together with zero rotation on the other axes is the resulting rotation for each Embedding.
Cell-placement allows artifacts to have only -axis rotations of 0, 90, 180, or 270 degrees. This means the value of the resulting rotation around -axis MUST be in the set .
26.05.04.05 Snap the Position
The cell placement constrains the position horizontally, i.e., the ground plane coordinate , and the height is left unchanged. In the following section, it should be understood that the snapping is performed on the ground plane coordinate.
The ground plane is divided into cells of size by . The cells are placed so that the origin of the ground plane coincides with the corner points of nearby cells. Therefore,
- the center of a cell belongs to the set , known as the cell lattice,
- the corners (vertices) of the cells belong to the set , where denotes all integers and half-integers, known as the vertex lattice.
A valid placement of an Embedding MUST have the corners of its rounded volume’s footprint, as defined in 26.05.04-Cell-Placement#26.05.04.06 Rounding Rule, coincide exactly with points in the vertex lattice.
Moreover, the above rules mean:
- If the rounded
volume.lengthis an integer, then the coordinate in the length direction must lie in . - If the rounded
volume.lengthis a half-integer, then the coordinate in the length direction must lie in . - The same rule applies to the rounded
volume.width. Note that a 90 or 270 degrees rotation swaps length and width in the scene coordinates.
26.05.04.06 Rounding Rule
When performing cell-placement snapping, an Embedding MUST be rounded to respect the cell-placement as follows in the following order
- The
rotationof theEmbeddingMUST be rounded to the nearest value defined in 26.05.04-Cell-Placement#26.05.04.04 Snap the Rotation. If it is exactly between two legal values, it MUST round to the larger value. - Each element of the
Artifact’svolume, for the purposes of cell-placement and stacking logic, MUST be rounded up (ceiling) to the next integer or half-integer, i.e., an element in . The volume after being rounded up is called the rounded volume. The footprint calculated using the rounded volume is therefore its rounded volume’s footprint. - Each element of the
Embedding’spositionMUST be rounded to the nearest value defined in 26.05.04-Cell-Placement#26.05.04.05 Snap the Position. If it is exactly between two legal values, it MUST round to the larger value.