www.gusucode.com > mbcsimulink 工具箱 matlab 源码程序 > mbcsimulink/Centre2LTRB.m

    function LTRB = Centre2LTRB(centre,width,height)
%CENTRE2LTRB Convert from {center, width, height} to Simulink position rect
%
%  POS = CENTRE2LTRB(CEN, W, H) converts the 2-element location CEN and the
%  width and height (W and H) to a standard Simulink position - [Left, Top,
%  Right, Bottom].

%  Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc.


LTRB(1) = ceil(centre(1) - width/2);
LTRB(2) = ceil(centre(2) - height/2);
LTRB(3) = LTRB(1) + width;
LTRB(4) = LTRB(2) + height;