Characteristics
- A Space is a coordinate system in which objects like Snappers can exist. Each Space belongs to a World.
- Contains spatial objects like Snappers, Animations and Vessels.
- Uses a Bsp (binary space partition) for fast search of objects in Space.
- Space-specific data can be stored in
auxillaryData
(streamed) andcachedData
(not streamed), such as user settings specific to an Alternative. - Operations like parts calculation and Snapper invalidations are performed per Space.
- Space event callbacks can be invoked via hooks, such as
setMainSpaceHooks()
andspaceObjectClickedHooks()
.
Space Coordinates
A Snapper exists at a certain position and rotation in Space and occupies a bound.
Take this spherical Snapper as an example.
The Snapper's localBound()
is defined by a box between points p0 and p1. When a user's click falls within this bound()
in Space, the Snapper is selected.
A Snapper's origin point is the origin point of its localBound()
. As the graphics and connectors belong to the Snapper, the position of the graphics and connectors refer to the Snapper's origin point. This is commonly referred to as the snapperPos.
Whereas a Snapper's space position is the coordinates of the Snapper's origin point relative to Space's origin point. Commonly referred to as the spacePos.
Space Implementations Examples
The Space class can be extended to serve different purposes. Here are some examples of specialized Spaces in our core codebase.
AlternativeSpace
A Space that corresponds to an Alternative. Selecting different Alternatives in the Alternatives Dialog basically switches between AlternativeSpaces.
BlockSpace
A Space that holds Snappers belonging to the same Block. This Space is owned by a BlockSnapper in the Block.
PaperSpace
A Space that corresponds to a page in Paper View. Selecting different papers in Paper View basically switches between PaperSpaces.
Comments
0 comments
Please sign in to leave a comment.