www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@des_constraints/isInside.m
function [c, in] = isInside(c, X, st, keep_pts) %ISINSIDE Check that points are inside the ALL the constraints % % [C, IN] = ISINSIDE(C, X) % [C, IN] = ISINSIDE(C, X, STARTINDEX) % [C, IN] = ISINSIDE(C, X, STARTINDEX, KEEPPOINTS) % % The points, X, should be natural units. % % STARTINDEX is the index of the point before the first point in X. This % allows a subset of points to be passed in and remembered correctly. % % KEEPPOINTS is a boolean flag. If set to true the state (inside vs % outside) of the points is remembered. % % Using the ISINSIDENOMEMORY method also ensures that no state % information is stored. % % See also DES_CONSTRAINTS, CONBASE/ISINSIDE, DES_CONSTRAINTS/ISINSIDENOMEMORY. % Copyright 2005-2011 The MathWorks, Inc. if nargin<4 keep_pts=1; end if nargin<3 st=0; end if ~isempty(X) in = true(size(X,1),1); for n=1:length(c.Constraints) in = isInside( c.Constraints{n}, X, in ); end if keep_pts % keep track of interior points c.InteriorPoints= [c.InteriorPoints st+find(in)]; end else in=[]; end %------------------------------------------------------------------------------| % EOF %------------------------------------------------------------------------------|