Pixels Vs. Vectors

  Previous  Next


In a lot of cases, MADRIX Script offers both a pixel-based or a vector-based version of a function.

When working with a matrix and pixels, the dimensions of matrix and effects, such as a vertical line, are absolute and adjusted to that particular matrix.
- For example, you might want to draw a 20x2 horizontal line on a 50x50 matrix.

However, this can be a disadvantage since you might want to write a macro/script that can be applied to a multitude of matrixes with different sizes or someone else might want to use your script. In this case using relative values can help a lot, since effects are scalable then.
- For example, the horizontal line should always be of 50% width and 5% height.
- Valid values for relative values range from 0.0 to 1.0.


Rules Of Calling Functions


Functions of MADRIX Script often tell you what their purpose is and which kind of values they require (absolute or relative).

The name of a draw or render function often starts with a description of what it does, like Draw or Shift. It is followed by Pixel or Vector to describe whether the function requires pixel coordinates or relative coordinates. The final part describes the application of the function, like Line or Shape. Here are two examples:

DrawPixelLine - Draws a line using absolute values

DrawVectorShape - Draws a shape using relative values

ShiftPixelMatrix - Moves an area of the matrix using absolute values


Using Absolute Coordinates

Functions with Pixel in their name operate on absolute pixel values. Imagine a rectangle which is drawn from x=5, y=5 with a size of 10. The object will always be rendered starting from 5, 5 to 15, 15, on every matrix.
- On the one hand, the rectangle appears to be very small on large matrices.
- On the other hand, on small matrices it seems to be a big rectangle because it fills a larger area of the matrix.


Using Relative Coordinates

Functions with Vector in their name operate on relative values. 0.0, 0.0 stands for the top left corner of the effects matrix. 1.0, 1.0 describes its bottom right corner, or its whole width and height.
- A rectangle which is drawn from 0.25 with a size of 0.5 will look the same on every matrix. Its size is simply the half of the matrix size.
- On a matrix with more pixels the rectangle is also drawn with more pixels compared to fewer pixels on a smaller matrix.
- In contrast, the usage of absolute coordinates dictates the utilization of the same amount of pixels.


MADRIX Version: 5.5 | Script Version: 3.14
[Ctrl & +/-] = Zoom In/Out | [Ctrl & 0] = 100%
 Previous   Next


Enable automatic translation | Activer la traduction automatique |