www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@constar/optmgr_interior.m

    function [om,ok] = optmgr_interior( c, varargin )
%OPTMGR_INTERIOR   Creates an xregoptmgr for CONSTAR objects
%   OPTMGR_INTERIOR(C) is a nested optim manger (xegoptmgr object) for the 
%   constar object C. This nested optim manger controls the case when not all 
%   of the supplied data points are on the boundary of the region and those 
%   that are on the boundary need to be found.
%
%   See also OPTMGR, OPTMGR_BOUNDARYONLY, OPTMGR_AUTODILATION, 
%   OPTMGR_MANUALDILATION, OPTMGR_RAYSFROMDATA, OPTMGR_RAYSFROMNUMBER.


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

om = contextimplementation( xregoptmgr, c, @i_interior, [], ...
    'Interior', @optmgr_interior );
om = setAltMgrs( om, { @optmgr_interior, @optmgr_boundaryonly } );

om = AddOption( om, 'DilationRadius', ...
    optmgr_autodilation(c), 'xregoptmgr', 'Dilation Radius' );
om = AddOption( om, 'RayCasting', ...
    optmgr_raysfromdata(c), 'xregoptmgr', 'Ray Casting' );

om = AddOption( om, 'ActualDilationRadius', ...
    -1, {'numeric', [-Inf,Inf]}, '', 0 );

ok = 1;

%--------------------------------------------------------------------------
function [con, I, R] = i_interior( con, om, X, varargin )
% Inputs:
%    con     constar object
%    om      option manger
%    X       data points
% Outputs:
%    con     constar object
%    I       boundary point indices
%    R       dilation radius

% Need to code the data so that the dialation works in a sensible way
Xc = pCodeData( con, X );

% Get the dilation radiius 
dilationradius = get( om, 'DilationRadius' );
[con, radius] = run( dilationradius, con, [] );

% Get the number of rays to use for the ray casting
raycasting = get( om, 'RayCasting' );
[con, nrays] = run( raycasting, con, [] );

% Perform the ray casting
[I, R] = ray_casting( Xc, radius, nrays, zeros( 1, nActiveFactors( con ) ) );
 
I = I.';