Skip to content

vladdu/events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This library manages regions and events, according to the definitions below.

#. We have a discrete 3D space, with cartesian coordinates x, y and z. In it we define 
two distinct kinds of entities, regions and events.

#. A region is a rectangular area ((x0,y0), (x1,y1), z). 

#. No two regions have the same z value.

#. Regions can be created as children of other regions. There are no requirements that the 
children are included geometrically in the parent. A children's z value is always 
larger than its parent's, but between siblings no order is specified.

#. The z values reflect a depth-first traversal of the tree formed by the regions.

#. A region can be destroyed. All its children will be destroyed too, recursively.

#. A region can be reparented. Its z value will be adjusted accordingly and its children 
will be affected correspondingly, keeping their relative z positions.

#. Regions can move and change size in the x and y directions. This doesn't affect any 
other regions.

#. Regions can move backward and forward in the z direction. All children move together 
with it recursively, keeping their relative z positions.

#. An event is a tagged non-empty set of rectangles in the XY plane (the event's area) that 
moves forward or backward in the z direction. The direction of movement can't change. All 
rectangles have the same z value. The event's tag defines its type. A rectangle may have 
zero area, meaning it's just a point.

#. If the intersection of the event's area with the area of a region with the same 
z value is not empty, we say that the event reached the region.

#. A region can be made sensitive or not to a certain event type, meaning that it should 
or should not be notified when an event of that type reaches the region. 

#. A region can be made transparent or opaque to a certain event type: transparent means 
that the event propagates unchanged after reaching the region. In the opaque case, the 
event's area is diminished with the parts that intersect the region's area. If the 
resulting area is null, the event effectively disappears. 

#. Events have default values for sensitivity and transparence that can be modified during
a region's lifetime.

#. There is a root region at (-INF, INF, 0) that is immutable and is insensitive and 
transparent to any event type.

#. Event propagation is fully asynchronous.

--

The implementation separates the geometrical parts of the state of regions and events from the 
application parts. The rules above are managed by a central process.

Regions are processes that get notified when an event reaches them and respond appropriately.

--
Note: the basic idea is taken from a (possibly old) version of a graphical engine 
of a realtime operating system. 

About

an Erlang library for handling regions and events

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages