MvtUtil: Create a RefVec: Align Hexagonal L2RT2B


ASTER::ACTION::MotionControl::MvtUtil: Create a reference vector with computed results in Align Hexagonal L2RT2B format

Function to create target coordinates referenced when moving object instances with MoveTowards.

MoveTowards: RefVec, which is one of the motion templates, uses the Reference Vector created in the “Align Hexagonal L2RT2B Format”.

The coordinates for instance placement are calculated based on user-defined parameters. The computed coordinate data is called “Reference Vector” and is used as the target coordinates when moving instances selected as mvt.Pursuer.


Differences from the Beta Version of Align: Hexagonal

Align: Hexagonal, implemented in the beta version, has been removed from the Align feature.

Align: Hexagonal has been reimplemented as an alignment template for MoveTowards.

OblectControl :: Align is a function for aligning object instances. Instances can complete alignment instantly by selecting a placement pattern.

Reference Vector is not a function for aligning instances but a function for calculating the coordinates that instances will ultimately reach using the given parameters.

In ASTER’s MoveTowards, mvt.Target is defined as coordinate data rather than object instances, so the Reference Vector can be registered as the target coordinates for moving mvt.Pursuers.


Relevant URL

Differences from MoveTowards: TgtArr

MoveTowards: RefVec uses std::deque (double-ended queue), a C++ sequential container, to achieve faster and lighter processing.

Motion Template mvt.Target Data Structure
MoveTowards: TgtArr JSON Array JSON 2D array
MoveTowards: RefVec Reference Vector c++ std::deque (Container)

Reference Vector is expected to be faster and more efficient than MoveTowards: TgtArr, which uses JSON Array as the target. JSON Array suffers from generally slow processing due to the specifications of the nlohmann/json library used by ASTER.

Details

In the future, new operational methods utilizing the characteristics of std::deque will be explored for MoveTowards: RefVec. MoveTowards: TgtArr can be easily integrated with JSON, while MoveTowards: RefVec is preferable when handling a larger number of instances requiring increased processing speed and reduced computational load.


Parameter

"14, 400, 50, 2, 4, +80, +80, 1"
Name Type Description
Repetition unsigned int Number of times the coordinate calculation process repeats
Starting X Coordinate int X coordinate of the starting alignment point
Starting Y Coordinate int Y coordinate of the starting alignment point
Initial Grid Row Instance Count unsigned int Number of instances in the first grid row
Reversal Row Instance Count unsigned int Number of instances at the reversal row
Grid Cell Width unsigned int Width of each grid cell (in pixels)
Grid Cell Height unsigned int Height of each grid cell (in pixels)
Align Option unsigned int Alignment option: 0 (Left), 1 (Centre), or 2 (Right)

Repetition

Number of coordinate calculation cycles: unsigned int

First, the placement shape is determined, and the Repetition value, which defines the number of coordinate calculation cycles, is set. Since the Repetition value determines the number of calculations, an accurate value is required to avoid unnecessary computational costs.

In the actual operation of MoveTowards: RefVec, if the repetition value is set lower than the number of instances, the excess instances will be redundantly placed at the last processed coordinates. ASTER rev.1.0.4


Starting X|Y Coordinates

Set the reference point for starting the placement process using XY coordinates: int


Initial Grid Row Instance Count

Set the maximum number of instances arranged in the initial row of the grid: unsigned int

This value defines the number of instances that can be placed in the starting grid row. Adjust flexibly according to the placement pattern.

Grid placement process:

  • Grid placement proceeds from left to right and top to bottom. For example, in a Hexagonal arrangement, the top and bottom grid rows have “the same number of placed instances and are the narrowest rows across all rows”. For inverted triangle placement patterns, set a value smaller than Reversal Grid Row Instance Count.

  • During the grid placement process, the number of instances per row increases or decreases based on the placement shape, and when reaching the “Reversal Point”, the direction of instance count change reverses.


Reversal Grid Row Instance Count

Set the number of instances placed in the reversal row: unsigned int

As the grid placement progresses and reaches the reversal row, the direction of instance count change reverses.

Processing flow:

  1. Start from the initial row and place instances while incrementing or decrementing (+1 or -1) the instance count for each row.
  2. At the Reversal Point, the sign of increase or decrease reverses.
  3. After reversal, continue placement downward while updating the instance count with the new sign.

For example, in a Hexagonal arrangement, the central row reaches the maximum instance count, and after the reversal point, the instance count begins to decrease.


Grid Cell Width|Height

Set the width and height of grid cells in pixels: unsigned int


Align Option

Option settings for alignment patterns: unsigned int

The table below describes the settings for alignment patterns.

Argument Pattern
0 Left align
1 Center align
2 Right align

Sample Parameters for Placement Shapes

Reference Vector: Hexagonal is a versatile placement template that supports many alignment patterns with relatively simple parameters.

Hexagonal shapes can be varied into different placement shapes by adjusting the parameters.

Below are sample parameters for creating alignment patterns such as Diamond (Rhombus), Triangle, and Trapezoid from Reference Vector: Hexagonal.

Description of the image
"19, 450, 100,   3, 5,  +84, +71,   1"

Description of the image
"16, 450, 100,   1, 4,  +142, +71,   1"

Description of the image
"15, 450, 100,   1, 5,   +71, +71,   1"

Description of the image
"14, 450, 100,   5, 2,   +71, +71,   1"