<< Click to Display Table of Contents > 

Client Control Interface Manual > Programming Examples > Rotate Output Matrix

Rotate Output Matrix
Previous pageReturn to chapter overviewNext page

The following examples shows how to mark an entity with the name RotateEntity.

 

Rotate Output Matrix

 

// Rotate the output matrix for 20 degrees around the middle of the entity center and marks again. This step will be repeated 19 times.

 

if( cci.ScIsRunning() == 0 )

{

    MessageBox.Show( "SAMLight not found""Warning" );

    return;

}

 

double min_x, min_y, max_x, max_y;

double center_x, center_y;

long i;

double ang_inc;

double act_angle;

string entity_name = // set entity name here, for example "RotateEntity";

 

// calculate the center of the entity

min_x = cci.ScGetEntityOutline( entity_name, 0 );

min_y = cci.ScGetEntityOutline( entity_name, 1 );

max_x = cci.ScGetEntityOutline( entity_name, 3 );

max_y = cci.ScGetEntityOutline( entity_name, 4 );

center_x = ( min_x + max_x ) / 2;

center_y = ( min_y + max_y ) / 2;

 

// Repeat the rotation and marking

ang_inc = 20 * 2 * Math.PI / 360;

act_angle = 0;

for( i = 0; i < 19; i++ )

{

    cci.ScOpticMatrixReset();

    cci.ScOpticMatrixRotate( center_x, center_y, act_angle );

    cci.ScMarkEntityByName( entity_name, 1 );

    act_angle = act_angle + ang_inc;

}

Table 418: Rotate Output Matrix