Difference between revisions of "Object Scale"

From Flowcode Help
Jump to navigationJump to search
(Created page with "==Flowcodes representation of scale== Flowcode represents an objects position in terms of coordinates, '''scale''' and [[Object rot...")
 
Line 1: Line 1:
 +
This article refers to the representation of an object drawn on either the [[System panel]] or the [[Dashboard panel]].
 +
 
==Flowcodes representation of scale==
 
==Flowcodes representation of scale==
  

Revision as of 22:08, 7 May 2013

This article refers to the representation of an object drawn on either the System panel or the Dashboard panel.

Flowcodes representation of scale

Flowcode represents an objects position in terms of coordinates, scale and rotation.

Internally an objects scale is kept as a scale factor in the X, Y and Z axis. When accessing the SIM API this is the value that is altered, and relates to the diagonal of a transform matrix: File:Scale matrix.png

This is a multiplier applied to the object which alters the size of all its child objects. All API functions deal with this scale - this is mainly because the calculations involved in converting to other representations and back every time scale needs to be set would slow the programs down, but also because conversion to other representations can result in rounding errors and inaccuracies when combined with rotation.

Other representations

Two additional values can be derived from the scale factor:

  • The size of an object can be thought of as the absolute product of its scale multiplied by all its child scales.
For leaf objects - those with no child objects of their own - this means the scale factor and the size equate to the same value, e.g. the scale factor and size of a sphere are the same thing.
This can be thought of as the size of the bounding box of the object. This can be read through the API call GetBox.
  • The relative scale can be thought of as the scale factor divided by the objects original scale factor.
For objects that have no original scale - objects are dragged on to the panel with an arbitrary scale factor - relative scale does not make sense, as this would always be relative to some 'magic' number chosen out of the authors control.

Local and world space

Main article: Local and world space

When working with objects in the flowchart, local coordinates are always preferred over world coordinates. This is so that scaling an objects parent does not affect the 'coordinate space' of the program - moving to coordinates (1, 2, 3) will always move to the same point in the component, despite the users scaling of the component, which is out of the component authors control.

It is very difficult to program an object to behave as expected in all circumstances using the world position.