26.05.06 Slot Placement
Slot-placement places artifacts in a set of predefined slots.
26.05.06.01 Requirements of the Slot-placement
The Slot-placement introduces a new member in FormProperties to represent the slots allowing for placing artifacts. It is defined as
interface FormProperties {
slotProfile: SlotProfile // OPTIONAL
// ...
}
where slotProfile is OPTIONAL and MUST be of type SlotProfile. If slotProfile is not present, then slot-placement MUST NOT be performed regardless of layout mode. If layout mode is not slot layout mode, slotProfile SHOULD be ignored unless specified and used by other modules.
The input Form for slot-placement MUST have a slotProfile in its properties member.
The slot-placement introduces two new members in EmbeddingProperties to represent which slot the artifact is placed in. They are defined as
interface EmbeddingProperties {
slotIndex: number // OPTIONAL
slotOrientationIndex: number // OPTIONAL
// ...
}
where
slotIndexis OPTIONAL and MUST be of typenumberand MUST be an integer.slotOrientationIndexis OPTIONAL, and MUST be of typenumberand MUST be an integer.
The Embedding participating in slot-placement MUST have an EmbeddingProperties with member slotIndex. Embeddings not carrying it MUST NOT participate in slot-placement.
26.05.06.02 Define Slot and SlotProfile and Slot Type Object
A SlotProfile type object defines the slots available in the scene. It is defined as
interface SlotProfile {
slots: Slot[] // REQUIRED
}
where
slotsis REQUIRED and MUST be an array ofSlot. EachSlotin the array MUST have a distinctslotIndex.
A Slot defines a slot in the scene. It MUST be representable as a JSON object, contain only JSON-serializable values, and contain the following data.
interface Slot {
slotIndex: number // REQUIRED
position: Coordinate // REQUIRED
slotRotation: SlotRotation // OPTIONAL
}
where
slotIndexis REQUIRED, and its value MUST be of typenumberand MUST be an integer.positionis REQUIRED and it MUST be of typeCoordinate.slotRotationis OPTIONAL, and its value MUST be of typeSlotRotation. WhenslotRotationis not provided, it indicates zero rotation on all axes.
A SlotRotation defines the possible rotations for the artifact.
interface SlotRotation {
rotationStep: number // OPTIONAL
rotationStepAxis: Coordinate // OPTIONAL
eulerStep: Euler[] // OPTIONAL
}
rotationStepis OPTIONAL and its value MUST be of typenumberand MUST be an integer.rotationStepindicates the allowed rotations aroundrotationStepAxisby , where is the integer specified byrotationStepand is an integer that can be specified viaslotOrientationIndexinEmbeddingProperties. ArotationStepof zero indicates that smooth rotation is allowed and, in theEmbedding, the rotation MUST be specified inrotation.rotationStepAxisis OPTIONAL and its value MUST be of typeCoordinate. It specifies the axis around whichrotationSteprotations are applied. The magnitude ofrotationStepAxisMUST be ignored; only its direction is used. If not provided, the default axis is the -axis, i.e.,[0, 0, 1].eulerStepis OPTIONAL and its value MUST be an array of typeEuler.eulerStepindicates the allowed Euler rotations. In theEmbedding, the choice can be specified inslotOrientationIndexby the index of an element ineulerStep, where the index starts from zero. An emptyeulerSteparray indicates that smooth Euler rotation is allowed and, in theEmbedding, the rotation MUST be specified inrotation.
The default value for SlotRotation is {eulerStep: [[0, 0, 0]]}.
26.05.06.03 The Input and Result of the Slot-placement
The slot-placement takes an input layout from Form and produces a resulting layout in which each element, if it participates in the slot-placement, is placed in a slot.
For artifact , its original placement can be written as before performing the slot-placement, where indexes artifacts in the input layout that participate in the slot-placement. The resulting placement can be written as after performing the slot-placement.
For artifact , its original rotation can be written as the Euler angle before performing the slot-placement, where indexes artifacts in the input layout that participate in the slot-placement. The resulting rotation can be written as after performing the slot-placement.
The input will not be used for slot-placement. is completely determined by the SlotProfile.
26.05.06.04 Performing the Slot-placement
In this section, we illustrate how to place an artifact at a slot. To place an artifact , where indexes artifacts in the layout, is to derive its placement and its rotation in the scene.
The process of placing at slots can be operated by the following steps. The placement of the artifact in the scene MUST be reproducible by these steps, regardless of the implementation.
- Order to place.
Process embeddings in the order they appear in the
layout. Keep a set of “used slots.” - Select the slot.
Using the
slotIndexin theEmbedding, find the matchingSlotinslotProfile.- If no matching
Slotexists, do not place ; continue with the next artifact from step 2. - If this
slotIndexis already in the “used slots” set, do not place ; continue with the next artifact from step 2. - Otherwise, add this
slotIndexto the “used slots” set.
- If no matching
- Derive the position.
Determine from the selected
Slot.- If
positionis provided, set toposition. - Otherwise, do not place ; continue with the next artifact from step 2.
- If
After iterating through the layout, each placed artifact has a determined placement . It is RECOMMENDED not to define slotProfile entries whose slots lie outside the scene.
The process of deriving the rotation of the placed artifact can be operated by the following steps. The rotation of the artifact in the scene MUST be reproducible by these steps, regardless of the implementation.
- Select the slot.
Using theslotIndexin theEmbedding, find the matchingSlotinslotProfile.- If no matching
Slotexists, do not place ; continue with the next artifact from step 1. - Otherwise, proceed to step 2.
- If no matching
- No
slotRotationspecified.
If theSlothas noslotRotation, the rotation of the artifact is zero on all axes. rotationStepis a non-zero integer .
Allowed rotations are around the axis ofrotationStepAxisonly, from the set ;- If
slotOrientationIndexis present and is an integer , set the rotation aroundrotationStepAxisto . - Else if
rotationis present, round it to the nearest value in rotation aroundrotationStepAxisto , where “nearest” is the shortest Euclidean distance after wrapping angles on the lattice with basis . If exactly between two options, select the one with larger . - Else set the rotation to 0.
- If
rotationStepis zero. A smooth rotation aroundrotationStepAxisis allowed.- If
rotationis present, use it. - Otherwise set the rotation around
rotationStepAxisto 0.
- If
eulerStepis a non-empty array.
Allowed rotations are the Euler triples listed ineulerStep.- If
slotOrientationIndexis present and is an integer, select the Euler triple at that index; if the index exceeds the array length, select the first element (index 0). - Else if
rotationis present, select the nearest Euler triple fromeulerStep, where “nearest” is the shortest Euclidean distance after wrapping angles on the lattice with basis . If exactly between two options, select the one with the smaller array index. - Else select the first element (index 0) of
eulerStep.
- If
eulerStepis an empty array.
A smooth Euler rotation is allowed.- If
rotationis present, use it. - Otherwise the rotation is zero on each axis.
- If