Difference between revisions of "Object Scale"

From Flowcode Help
Jump to navigationJump to search
m (ReeceL moved page Object scale to Object Scale without leaving a redirect)
(No difference)

Revision as of 09:30, 7 June 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 of the object. When accessing the SIM API this is the value that is altered, and relates to the diagonal of a transform matrix:

Eg Object Scale.png

This is a transformation applied to the object which alters the size of it, and when rendered on the panel 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.


Scale vs Size

The scale factors of an object describes its dimensions without considering any child objects, and as such will not be affected if any other object on the panel changes its location, size or orientation.

The absolute size of an object can be thought of as the 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.

Unlike scale, the size of an object depends on the children of that object. Though it may be more intuitive to think of size instead of scale, and therefore size is used in the properties pane, internally and in the exposed API Flowcode uses scale, as this is much quicker to calculate and easier to control.

When considering world size, not only the objects children are considered, but also its parents scale. This is the bounding box of the object multiplied by all its parents scales.

Scale and rotation

Flowcode applies rotation before scale to an object. This means that rotating an object 90 degrees in X will make it appear that the height and depth of the object have switched. This is not the case, however, as this rotation will essentially cause the object to be lying on its side, with its Z axis parallel with the ground. Changing the Z scale will therefore affect what the viewer perceives as the Y.

File:Eg Object scale rotate 01.svg
Object before rotation

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.