Voxel Configuration

See also

The Voxel configuration is mainly developed in Rust and as such has its own documentation.

Voxel configuration tries to minimize the information needed to represent a world with RoFI modules.

For this reason there are some limitations in expresivity of Voxel configuration, which allows for a more space efficient representation and for more efficient algorithms when using this representation:

  • All modules have to be a Universal module.

  • All joint values have to be a multiple of 90 degrees.

  • Modules are not distinguishable.

  • Shoes of modules and rotations are not distinguishable if they can be mapped to each other.

  • The configuration is not fixed in space.

These limitations imply that symmetries are baked into the representation.

Note

The name Voxel comes from the original idea representing the world as a 3D grid of values that are either empty or contain a shoe of a RoFI module.

Since then the representation of the voxel world has shifted and it is no longer stored as a 3D vector of values, but the meaning and name Voxel stayed the same.

Explicit Connections

Voxel world allows specifying explicit connections, but this is not yet reflected in cpp code.

Voxel Configuration in Cpp

The class representing Voxel configuration in cpp is rofi::voxel::VoxelWorld. rofi::voxel::VoxelWorld can be easily converted to and from rofi::configuration::RofiWorld by rofi::voxel::VoxelWorld::toRofiWorld() and rofi::voxel::VoxelWorld::fromRofiWorld() respectively.

Note

When converting from rofi::voxel::VoxelWorld to rofi::configuration::RofiWorld, rofi::voxel::VoxelWorld::toRofiWorld() expects that the rofi::voxel::VoxelWorld is connected.

If you want to convert rofi::voxel::VoxelWorld that isn’t connected, you can set parameter fixateModulesByOne.

Types, Constants and Support Classes

using rofi::voxel::Position = std::array<int, 3>
enum class rofi::voxel::Axis : int

Values:

enumerator X
enumerator Y
enumerator Z
enum class rofi::voxel::JointPosition

Values:

enumerator Zero
enumerator Plus90
enumerator Minus90
struct Direction

Public Functions

inline auto movePosition(Position position) const -> Position
inline auto opposite() const -> Direction
auto operator<=>(const Direction&) const = default

Public Members

Axis axis = {}
bool is_positive = {}

Public Static Functions

static inline auto fromVector(const std::array<int, 3> &direction) -> std::optional<Direction>
static inline auto fromVector(const rofi::configuration::matrices::Vector &direction) -> std::optional<Direction>

Classes

struct Voxel

This documentation is copy from Rust voxel::Voxel

Canonized representation:

  • when body_dir.is_dir_to_plus is true, the Voxel is assumed a BodyA otherwise it’s assumed BodyB

  • when shoe_rotated is false, X-connectors are in the next axis

    • body_dir.axis is Axis::X => X-connectors are in Y axis

    • body_dir.axis is Axis::Y => X-connectors are in Z axis

    • body_dir.axis is Axis::Z => X-connectors are in X axis otherwise X-connectors are in the previous axis

    • body_dir.axis is Axis::X => X-connectors are in Z axis

    • body_dir.axis is Axis::Y => X-connectors are in X axis

    • body_dir.axis is Axis::Z => X-connectors are in Y axis

  • when joint_pos is Zero, the shoe joint is in the zero position when joint_pos is Plus90 the Z-connector is towards the plus axis otherwise the Z-connector is towards the minus axis

Public Functions

inline auto getOtherBodyPos() const -> Position

Voxel -> Rofi Module.

inline auto zConnDirection() const -> Direction
inline auto xPlusConnDirection() const -> Direction
inline auto getXPlusConnMatrixRotation() const -> rofi::configuration::matrices::Matrix
bool operator==(const Voxel&) const = default

Public Members

Position pos = {}
Direction body_dir = {}
bool shoe_rotated = {}
JointPosition joint_pos = {}

Public Static Functions

static inline auto fromRofiModule(const rofi::configuration::UniversalModule &rofiModule) -> atoms::Result<std::array<Voxel, 2>>
static inline auto getConnectors(Voxel shoeA, Voxel shoeB) -> std::array<Connector, 6>
static inline auto getConnOrientation(Direction connDirection, Direction connOrientationVector, Direction otherOrientationVector) -> rofi::configuration::roficom::Orientation
static inline auto toRofiModule(Voxel shoeA, Voxel shoeB, rofi::configuration::ModuleId moduleId) -> rofi::configuration::UniversalModule
struct Connector

Public Members

std::string_view name
Position pos
Direction dir
Direction oriVec
struct VoxelWorld

Public Functions

inline auto toRofiWorld(bool fixateModulesByOne = false) const -> atoms::Result<rofi::configuration::RofiWorld>

Converts VoxelWorld to rofi::configuration::RofiWorld.

VoxelWorld should be connected and the resulting RofiWorld will be fixed on one component to the world at the according position.

If you want to convert VoxelWorld that isn’t connected, you can set fixateModulesByOne.

Parameters

fixateModulesByOne – specifies whether to connect each module to the world separately by a rofi::configuration::RigidJoint instead of connecting modules together by rofi::configuration::RoficomJoints

bool operator==(const VoxelWorld&) const = default

Public Members

std::vector<Voxel> bodies = {}

Public Static Functions

static inline auto fromRofiWorld(const rofi::configuration::RofiWorld &rofiWorld) -> atoms::Result<VoxelWorld>

Converts rofi::configuration::RofiWorld to VoxelWorld.

Requires that:

Note

Does not check if the resulting VoxelWorld is connected.