cdwispointinsidecircle.il

来自「skill语言在Cadence平台二次开发中大量使用」· IL 代码 · 共 32 行

IL
32
字号
; SKILL function to determine whether a target point is within a circle
;    inputs
;        pt_target		- an (x y) list
;        pt_center_circle	- an (x y) list
;        d_radius		- a number
;    outputs
;        t if point is within the circle
;      nil if point is not within the circle
defun( cdwIsPointInsideCircle ( pt_target pt_center_circle d_radius)
let((compr result return_val)

pt_target_x = xCoord( pt_target)
pt_target_y = yCoord( pt_target)

pt_center_circle_x = xCoord( pt_center_circle)
pt_center_circle_y = yCoord( pt_center_circle)

compr = ((( pt_target_x - pt_center_circle_x)*( pt_target_x - pt_center_circle_x)
        + ( pt_target_y - pt_center_circle_y)*( pt_target_y - pt_center_circle_y)) / (d_radius*d_radius))

if( compr < 1.0 then
    result = t
else
    result = nil
);end-if

return_val = result

);end-let

);end-defun

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?