Difference between revisions of "Object Scale"

From Flowcode Help
Jump to navigationJump to search
Line 13: Line 13:
 
Two additional values can be derived from the scale factor:
 
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.
+
* The ''absolute size'' of an object can be thought of as the absolute product of its scale multiplied by all its child scales.
 +
: This can be thought of as the size of the bounding box of the object. This can be read through the API call [[API Panel.Position.GetBox|GetBox]].
 +
 
 
: 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.
 
: 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 [[API Panel.Position.GetBox|GetBox]].
 
  
* The relative scale can be thought of as the scale factor divided by the objects original scale factor.
+
 
 +
* The ''relative scale'' can be thought of as the scale factor divided by the objects original scale factor.
 +
: Relative scale is the scale of one object in proportion to another. If a house is 10 times bigger than a shed, then the relative scale is 10:1.
 +
 
 
: 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.
 
: 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 ===
 
=== Local and world space ===

Revision as of 22:46, 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 absolute size of an object can be thought of as the absolute product of its scale multiplied by all its child scales.
This can be thought of as the size of the bounding box of the object. This can be read through the API call GetBox.
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.


  • The relative scale can be thought of as the scale factor divided by the objects original scale factor.
Relative scale is the scale of one object in proportion to another. If a house is 10 times bigger than a shed, then the relative scale is 10:1.
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.

To calculate the world size from an objects local scale, this must be multiplied by the scales of all the objects children and parents in the Component tree.