XyzWorld module

This module offer classes designed to support a tri-dimensional environment.

SynergyObject

class synergine_xyz.SynergyObject.SynergyObject(collection, context)[source]

This SynergyObject is designed to support a tri-dimensional environment.

get_position()[source]

Return the actual position.

Returns:position with (z, x, y) signature
Return type:tuple
get_previous_direction()[source]

Return the previous direction of object

Returns:The previous direction
Return type:int
set_position(point)[source]

Update the position. Metas are updated to.

Parameters:point (tuple) – position of the object, with (z, x, y) signature
Returns:
set_previous_direction(previous_direction)[source]

Update the previous position of object. TODO: Directions pythons files must be move in xyz module.

Parameters:previous_direction – The previous direction
Returns:

Mechanisms

class synergine_xyz.mechanism.AroundMechanism.AroundMechanism(events)[source]

Compute near object ids of concerned object.

_get_computed_object_event_parameters(object_id, context)[source]
Parameters:
  • object_id – Concerned object id
  • context – Context object
Returns:

Near objects ids: {‘objects_ids_near’: [0, 1, 2, 3, ...]}

Return type:

dict

class synergine_xyz.mechanism.PositionedAroundMechanism.PositionedAroundMechanism(events)[source]

Compute near object ids with position of concerned object.

_get_computed_object_event_parameters(object_id, context)[source]
Parameters:
  • object_id – Concerned object id
  • context – Context object
Returns:

Near objects ids, organized by positions: {‘objects_ids_near_by_positions’: {(z, x, y): [0, 1, 2, ...], ...}}

Return type:

dict

Context

class synergine_xyz.Context.Context[source]

Context override offering 2D and 3D metas data exploitation methods.

get_around_points_of(point, distance=1, exclude_start_point=True)[source]

Return positions around a point.

Parameters:
  • point – (z, x, y) tuple
  • distance – Distance to compute
Returns:

list of (z, x, y) positions

Return type:

list

get_around_points_of_point(point, exclude_start_point=True)[source]

Return positions around a point with distance of 1.

Parameters:point – (z, x, y) tuple
Returns:list of (z, x, y) positions
Return type:list
get_objects_ids_by_position_near_point(point, distance=1)[source]

Return objects ids positioned around a point, ordered by positions.

Parameters:
  • point – (z, x, y) tuple
  • distance – ! not used at the moment
Returns:

dict with by position key: list of SynergyObject ids

get_objects_ids_near_point(point, distance=1)[source]

Return objects ids positioned around a point.

Parameters:
  • point – (z, x, y) tuple
  • distance – ! not used at the moment
Returns:

list of SynergyObject ids

Return type:

list