CMeasureAngles:Add


The Add method adds an angle marker to the image and reports measurements of the angle in the sense of the second side minus the first side. The Angle Measurement toolbar is opened if not already open. See the toolbar description in the Mira User's Guide.

Syntax

bSuccess = CMeasureAngles:Add( Image_obj, xv, yv, x1, y1, x2, y2 )

bullet.gif    where Image_obj is a CImage object.

bullet.gif    xy and yv are the coordinates of the angle vertex.

bullet.gif    x1 and y1 are the coordinates of the endpoint of the first side.

bullet.gif    x2 and y2 are the coordinates of the endpoint of the second side.

bullet.gif    On success, bSuccess is returned as true.

Example

Suppose a CImage object I exists. The following script creates a new CMeasureAngles object and measures an angle on the image. The passed coordinates are updated to the local centroid position by setting properties in the AngleParams table.

A = new_measureangles()

-- create a new CMeasureAngles object

 

 

Params =

 -- AngleParams properties to change

{

  

  bSetColor = true,

 

  sColor = "0,255,0",

 

  bSetLineThk = true,

 

  nLineThk = 1.5,

 

  bSetCentroid = true,

-- centroid the vertex

  bCentroid = true,

-- centroid the vertex

  bSetCentroidEndpt = true,

-- centroid the endpoints of both sides

  bCentroidEndpt = true,

-- centroid the endpoints of both sides

}

  

A:SetParams(Params)

  

 

 

V = attachlist_imageview()

-- connect to an image window

Assert( V, "No image window")

 -- exit if no image window

-- grab an image from the window, V

 

if V:Count() > 1 then

  

  I = CImage:AttachFromList( V )

-- pick the image from CImageView V

  Assert( I, "No Images available")

 -- exit if no image

else

 

  I = V:GetImage()

-- pick the only image in the window

end

 

xv = 400; yv = 60

-- initial coordinates of the vertex

x1 = 300; y1 = 205

-- initial coordinates of endpoint 1

x2 = 100; y2 = 530

-- initial coordinates of endpoint 2

bSuccess = A:Add( I, xv, yv, x1, y1, x2, y2 )

-- Add the measurement to the image

Related Topics

CMeasureAngles class, AngleParams Table

 


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.