Difference between revisions of "Nodal geometry"

From Organic Design wiki
m
m
 
(45 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Glossary]][[Category:Nodal Concepts]]
+
{{legacy}}
The nodal geometry (aka layer model) underlies the two fundamental hierarchical layout methodlogies which are the ''polar'' and the ''rectangular''. The general idea of containment applied within the geometrical context is implimented in the form of relativity of child co-ordinates to their parents.
+
__NOTOC__
 +
== Layers ==
 +
At this stage the conceptual structure of the project's interface is a 2D layer model, where layers are stacked in z-order and can exhibit transparency. Layers are arranged as nested data structures allowing each to be composed from a list of ''n'' child layers. The position and clipping area of a child layer are governed by its parent. The [[peerd.c]] interface uses SDL's [[Wikipedia:OpenGL|OpenGL]] context with an orthographic projection matrix.
  
The geometry notion is the base-class of polar and rectangular and as such encapsulates all that they share in common. The polar and rectangular notions are then defined as extending this base-geometry notion in their respective specialised directions. The graphical user interface of a peer is [[Desktop]] which defines the collection of ''widgets'' and can also be seen as the ''generic application'' to be extended by more sepcific application based on requirements fed back from the field of use.
+
[[Image:Peer-interface-3.jpg|thumb]]
  
# The base geometry
 
At the most general level the geometry is defining the three dimensions of space. In the nodal model, as in the Taoist and the Advaita Vedanta systems, Time is not treated as simply one of the four dimensions composing the space-time continuum, but all four of them do work using the same method of discrete recursive sub-division.
 
  
The geometry is a sub-class of the [[Nodal Space]] which is in turn based on [[List Space]]. The geometry defines the three dimensions which each apply the nodal-recursion allowing the division of the dimension into a potential continuum.
+
This project was completed some time back and "retro-fitted" for motivational reasons! It has extended the basic [[IO]] functionality up to allow the ordered stacking of rectangular layers which can each exhibit a fill colour and image.
  
At the level of interface, the base-geometry is sructured as a stack of z-ordered layers, which each contain a graphical object. All the layers at this level share the same origin, and the z-coordinate system is an integer sequence.
+
The next milestone is [[recursive rectangles]] which integrates the layers (rectangles) with the [[nodal model]] giving them containment as a (tree of layers), and integrates the mouse input with tree allowing a particular rectangle in the tree to be clicked on. The render method of rectangles and the collision-detection test method for the mouse click are both nodal [[workflow]]s passed around the tree until completed.
  
#The polar geometry (3DSpace)
+
== Textures ==
The polar implimentation of the geometry is being ported from [[space.as]] which already handles hierarchy, recursion and relativity of coordinates. Currently its coordinate system is actually rectangular (x,y,z), but this is actually not too important at this time.
+
Later we'll allow any layer to be cached as a texture, rather than only the layers at the root level. This way processing load would be reduced by utilising the large unused resource of texture memory on the video card - usually around 256MB. These cached layer-composites are 32bit having alpha and are called ''[[w:Sprites|sprites]]''.
  
In this system there is only one set of layers that all objects in the entire space reside in. The objects in the space form their own containment relationship independently of the layer-stack, and indeed have no direct knowledge themselves of the layers. The layer that any object resides on is handled by the polar geometry based on the object's 3D coordinates, not by the individual objects.
+
== Nodal reduction ==
*see [[Wikipedia:Octree]] - recursive subdivision used for collision detection in OpenGL.
+
The root-level layers are hooked into the reduction loop permanently, and they in turn hook in various children (based on redraw or collision queries) or metrics updates which must be resolved: these queries are guaranteed to be resolved by the end of the frame. The queries exhibit workflow and so are passed around amongst the nodes to be processed, and passed on again until resolved.
##Polar parent methods & properties
 
:''(these are still in the process of being migrated to the nodal conceptual structure)''
 
*'''create'''
 
*'''reduce'''
 
*'''active'''
 
*'''rotation'''
 
*'''zbuff'''
 
*'''zbLength'''
 
*'''children'''
 
*'''template'''
 
*'''zSCREEN'''
 
*'''zcmp'''
 
  
##Polar child properties
+
<table class='expandable' title='Technical details'>
*'''space'''
+
<tr><td>
*'''time'''
+
Each layer receives a quantum and does the following single operations set (considered reasonably atomic):
*'''create'''
+
*If absolute metrics are invalid, set from state of relative metrics
*'''reduce'''
+
*If sprite invalid, render background colour and or bg image
*'''motion'''
+
*If collision query, calculate and pass on if unresolved
*'''die'''
 
*'''x,y,z,scale'''
 
*'''colour,alpha'''
 
  
#The rectangular geometry (BoxModel)
+
== Sprites ==
This model extends the base-geometry in a slightly different way, in this case the layers follow the same hierarchy as the object's own containment and an object can create and remove layers from their context (by creating or removing child objects), and can directly manipulate which objects are assigned to which layers.
+
:''Sprites are runtime caches, device specific and represented non-nodally (as a '''spriteInfo struct''' in [[interface.c]], or a '''symbol''' in peer.as)''
 +
*in [[interface.h]]
 +
typedef struct {
 +
int x,y,w,h,t;
 +
double scale,rotation;
 +
Uint32 fill;
 +
GLuint texture;
 +
} spriteInfo;
 +
*x,y,w,h ''(pixels)''
 +
*scale ''(float)''
 +
*rotation ''(float)''
 +
*dynamic ''(if dynamic, sprite is root of new texture structure at runtime)''
 +
*tile, next ''(maybe move these into container)''
  
In this model, the parents rectangular bounds can be enforced onto the children (ie a window), and then various specific layout mechanisms applied within this context. There are two fundamental rectangular layouts used for the interface, ''table'' and ''paragraph'', which are both designed to be conceptually compatible with the ''[http://www.w3.org/TR/REC-CSS2/box.html W3C Box Model]''.
+
== Container ==
 +
:''Containers are device-independent nodal structures with no language-specific representation''
 +
*x,y
 +
*w,h ''(min,cur,max)''
 +
*units ''(%|px|mm...)''
 +
*layout ''(U|D|L|R|none)''
 +
*align ''(L|R|C|J) - relative to layout direction''
 +
*wrap ''(bool)''
 +
*clip ''(bool)''
 +
*fill ''(colour, alpha)''
 +
*sprite
 +
</table>
  
The nodal BoxModel implimentation uses standard properties to determine border and spacing metrics and styles and allows the organisation of the child objects into ''rows'' within the bounding rectangle. This level also handles the layout issues involved with the children occupying a larger rectangle than the parent (eg. scrollbars etc).
+
== Collision and Blitting ==
 +
[[w:bit blit|Bit blitting]] is the low-level method of building [[w:Sprite (computer graphics)|sprite]] functionality. The details of blitting aren't currently necessary since our two first target interface environments are [[w:OpenGL|OpenGL]] and [[w:SWF|SWF]] which both include sprite-like functionality.
  
##Rectangular parent properties
+
[[w:collision detection|Collision detection]] is a means of determining which items rectangular bounds intersect with a given rectangle. Collision detection is used for determining which object should receive mouse-click events, or which objects are encompassed by a selection rectangle.
*'''dimension''' &nbsp; ''(horizontal or vertical, order is the z dimension)''
 
*'''direction''' &nbsp; ''(iterate list with prev or next)''
 
*'''border'''
 
*'''margin'''
 
*'''padding'''
 
*'''background'''
 
*'''children''' &nbsp; ''(the items in the list to be laid out)''
 
  
##Rectangular subclasses
+
Both blitting and collision detection are similar processes and are both [[nodal [[workflow]]s which propagate amongst children and siblings in the [[loop]]s of a [[node space]] until resolved. There's no actual movement involved in this "passing around" process though, because its all achieved by adjusting [[node references|references]] to the workflow node, not manipulating the workflow itself. The workflow is guarunteed to be resolved by the end of the frame.
:Rectangular :: Table
 
:Rectangular :: Paragraph
 
  
 +
== Mouse click event ==
 +
When a mouse click is detected by [[communications]], the ''click'' process is hooked into the first child of the "desktop" [[association]]. When a click first occurs, the ''recipient'' which should act on it is unknown, so the ''collision workflow'' described above is first resolved which results in a known recipient. If this recipient node has no ''click'' [[association]], then check parent and so on up to [[desktop]].
  
#Collision detection and redraw tree
+
== Interface event model ==
Collision detection and the tree of redraw work use the recursion already inherent in the [[Nodal Reduction]] environment, but are essentially doing exactly the same process as the currently accepted ways, see [[Wikipedia:Collision detection|Collision detection]] and [[Wikipedia:Octree|Octrees]].
+
The interface aspects of the event model are handled by ''Geometry'' because its oriented around which container exhibits the keyboard [[input focus]], and which containers bounds the mouse pointer is within. So this is essentially a [[w:collision detection|collision detection]] issue which although modelled nodally (so that execution recursion can be shared amongst recursive processes), it is essentially just the usual [[Wikipedia:Octree|Octree]] method.
  
 
+
== See also ==
 
 
'''See also:'''
 
 
*[http://www.w3.org/TR/REC-CSS2/box.html Box Model] ''(W3C)''
 
*[http://www.w3.org/TR/REC-CSS2/box.html Box Model] ''(W3C)''
*[[Wikipedia:List_of_layout_engines|Layout Engines]] ''(Wikipedia)''
+
*[[Wikipedia:List of layout engines|Layout Engines]] ''(Wikipedia)''
 +
[[Category:Interface]][[Category:Nodal Concepts|Geometry]]

Latest revision as of 08:55, 22 July 2011

Legacy.svg Legacy: This article describes a concept that has been superseded in the course of ongoing development on the Organic Design wiki. Please do not develop this any further or base work on this concept, now this page is for historic record only.


Layers

At this stage the conceptual structure of the project's interface is a 2D layer model, where layers are stacked in z-order and can exhibit transparency. Layers are arranged as nested data structures allowing each to be composed from a list of n child layers. The position and clipping area of a child layer are governed by its parent. The peerd.c interface uses SDL's OpenGL context with an orthographic projection matrix.

Peer-interface-3.jpg


This project was completed some time back and "retro-fitted" for motivational reasons! It has extended the basic IO functionality up to allow the ordered stacking of rectangular layers which can each exhibit a fill colour and image.

The next milestone is recursive rectangles which integrates the layers (rectangles) with the nodal model giving them containment as a (tree of layers), and integrates the mouse input with tree allowing a particular rectangle in the tree to be clicked on. The render method of rectangles and the collision-detection test method for the mouse click are both nodal workflows passed around the tree until completed.

Textures

Later we'll allow any layer to be cached as a texture, rather than only the layers at the root level. This way processing load would be reduced by utilising the large unused resource of texture memory on the video card - usually around 256MB. These cached layer-composites are 32bit having alpha and are called sprites.

Nodal reduction

The root-level layers are hooked into the reduction loop permanently, and they in turn hook in various children (based on redraw or collision queries) or metrics updates which must be resolved: these queries are guaranteed to be resolved by the end of the frame. The queries exhibit workflow and so are passed around amongst the nodes to be processed, and passed on again until resolved.

Collision and Blitting

Bit blitting is the low-level method of building sprite functionality. The details of blitting aren't currently necessary since our two first target interface environments are OpenGL and SWF which both include sprite-like functionality.

Collision detection is a means of determining which items rectangular bounds intersect with a given rectangle. Collision detection is used for determining which object should receive mouse-click events, or which objects are encompassed by a selection rectangle.

Both blitting and collision detection are similar processes and are both [[nodal workflows which propagate amongst children and siblings in the loops of a node space until resolved. There's no actual movement involved in this "passing around" process though, because its all achieved by adjusting references to the workflow node, not manipulating the workflow itself. The workflow is guarunteed to be resolved by the end of the frame.

Mouse click event

When a mouse click is detected by communications, the click process is hooked into the first child of the "desktop" association. When a click first occurs, the recipient which should act on it is unknown, so the collision workflow described above is first resolved which results in a known recipient. If this recipient node has no click association, then check parent and so on up to desktop.

Interface event model

The interface aspects of the event model are handled by Geometry because its oriented around which container exhibits the keyboard input focus, and which containers bounds the mouse pointer is within. So this is essentially a collision detection issue which although modelled nodally (so that execution recursion can be shared amongst recursive processes), it is essentially just the usual Octree method.

See also