CCentroid:new
The new method constructs a new instance of a CCentroid object. The CCentroid class includes properties that control calculation of centroid positions. Two different constructor overloads are available to create a new CCentroid and initialize the properties. The CCentroid object may also be constructed using the new_centroid function.
C = CCentroid:new() Creates a default CCentroid with properties initialized to default values. C = CCentroid:new( CCentroid_old ) This is a copy constructor. It creates a new CCentroid C initialized to the poperties of the existing CCentroid object CCentroid_old. On failure, nil is returned. |
Two overloads are provided for the CCentroid class. They create a default CCentroid and a copy of a CCentroid. If you pass something other than nil or another CCentroid, the default constructor is used.
The following script illustrates using both constructors. All produce the same result:
|
-- create CCentroid C1 and set values |
|
-- change the default sign |
|
-- copy C1 to a new CCentroid C2 |
|
-- result: C1 sign = 0 |
|
-- result: C2 sign = 0 |
CCentroid, delete, new_centroid
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.