SHIP:Data Types:Dimension

From Serious Documentation
Jump to: navigation, search

See Also

Node

Data Type Description
Dimension A numeric type specifically within the pixel dimension range.

Dimensional properties such as ol are of type Dimension. Dimensions are similar to Short numbers, however the range is more limited.

SHIPv4

  • 0x8101, or -32,511 is the smallest number; many example projects have the explicit resource constant of M_MIN_DIM set to this value.
  • 0x7FFF, or +32,767 is the largest number; many example projects have the explicit resource constant of M_MAX_DIM set to this value.
  • 0x8000, or -32,768 is the "not a number" code, meaning this dimension is "unset"; ; many example projects have the explicit resource constant of M_NAN_DIM set to this value.

Attempts to set a property with type Dimension outside these values will have predictable but generally undesirable results. For example, incrementing a property of type Dimension already at M_MAX_DIM will cause that property to roll around (the 16-bit field) and have resultant value -1.

SHIPv5

The range for Dimension is under review for SHIPv5 Beta 2, and may be constrained to a 12-bit value from -2^11 to +2&11-1.

In SHIPv5, attempts to set a property with type Dimension outside the permitted range will be clipped to the extremes, for example

box.ol = 32,767; 

will result in box.ol having the value of M_MAX_DIM.