~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to macros/scicos/get_blocks_in_rect.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
function [in,out]=get_blocks_in_rect(scs_m,ox,oy,w,h)
2
2
// Copyright INRIA
3
 
in=[];out=[]
4
 
for k=2:size(scs_m)
5
 
  o=scs_m(k)
6
 
  if o(1)=='Block'|o(1)=='Text' then
7
 
    // check is block is outside rectangle
8
 
    orig=o(2)(1)
9
 
    sz=o(2)(2)
10
 
    x=[0 1 1 0]*sz(1)+orig(1)
11
 
    y=[0 0 1 1]*sz(2)+orig(2)
12
 
    ok=%f
13
 
    for kk=1:4
14
 
      data=[(ox-x(kk))'*(ox+w-x(kk)),(oy-h-y(kk))'*(oy-y(kk))];
15
 
      if data(1)<0&data(2)<0 then ok=%t;in=[in k];break;end
 
3
  in=[];out=[]
 
4
  for k=1:lstsize(scs_m.objs)
 
5
    o=scs_m.objs(k)
 
6
    if typeof(o)=='Block'|typeof(o)=='Text' then
 
7
      x=[0 1 1 0]*o.graphics.sz(1)+o.graphics.orig(1)
 
8
      y=[0 0 1 1]*o.graphics.sz(2)+o.graphics.orig(2)
 
9
      ok=%f
 
10
      for kk=1:4
 
11
        data=[(ox-x(kk))'*(ox+w-x(kk)),(oy-h-y(kk))'*(oy-y(kk))];
 
12
        if data(1)<0&data(2)<0 then ok=%t;in=[in k];break;end
 
13
      end
 
14
      if ~ok then out=[out k],end
16
15
    end
17
 
    if ~ok then out=[out k],end
18
16
  end
19
 
end
 
17
endfunction