CMatrix:Copy


The Copy method copies an existing CMatrix into the current one. The current CMatrix does not need to be empty before copying. For a new matrix, an easier alternative to using Copy is to use the new constructor, passing it the CMatrix to be copied.

Syntax

CMatrix:Copy( CMatrix2 )

where

    CMatrix2 is an existing CMatrix object.

Example

The following script duplicates the CMatrix M into a new CMatrix M2:

Mold = CMatrix:new()

-- create a CMatrix

Mold:Set( 2, 44, 1805 )

-- set member 2, 44

Mold:Set( 50, 20, 102 )

-- set member 50, 20

Mold:Set( 120, 2, 600.5 )

-- set member 120, 2

Mnew = CMatrix:new()

-- create an empty CMatrix Mnew

Mnew:Copy( Mold )

-- copy Mold into the current object

Printf("N= %d,%d", Mold:Count(), Mnew:Count() )

-- result: N= 3,3

Related Topics

new

Dup

CMatrix Class