CPoint:Offset
The Offset method adds a numeric offset to the x and y members of the CPoint. For example, consider applying an offset of (4,6). Then x=1.3 becomes x=5.3, and x=-16.2 becomes x=-10.2.
P = CPoint:Offset( dx ) P = CPoint:Offset( dx, dy ) P = CPoint:Offset( CPoint_old ) P = CPoint:Offset( CRect_old ) P = CPoint:Offset( tblOffset ) dx is the offset to apply to both the x and y members of the CPoint. dx and dy are offset values to apply respectively to the x and y members of the CPoint. CPoint_old is another CPoint object. Its x and y members are used as offsets to the x and y members of the current CPoint. CRect_old is a CRect object. Its Width and Height are used respectively as offsets for the x and y members of the CPoint. tblOffset is a 1-dimensional array. Element 1 is used to offset the x member and element 2 is used to offset the y member of the CPoint. P returned is the original CPoint object. This allows the Offset method to be used as part of an operator expression, if desired. On failure, nil is returned. |
The following script creates a CPoint object and applies an Offset to its values.
|
-- create a CPoint object |
|
-- result: x=4.4, y=-12.7 |
|
-- offset the values |
|
-- result: x=0.4, y=-6.7 |
|
-- create a rectable offset in the method call |
|
-- result: x=1.4, y=-3.7 (apply width and height) |
CPoint class, CRect class, CPoint Math Operators
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.