[Oberon] tree programming

Jörg joerg.straube at iaeth.ch
Wed Sep 5 18:13:22 CEST 2018


Hi Dieter
I wouldn't call this problem a "tree problem".
It rather looks like a coloring problem: how to fill all connected pixels with the same color?
I would try to do it with a recursive procedure although other approaches do exist..
br
Jörg

Am 05.09.18, 15:57 schrieb "Oberon im Auftrag von Dieter" <oberon-bounces at lists.inf.ethz.ch im Auftrag von d.gloetzel at web.de>:

    Imagin a matrix consisting of "0"  and "1". Now I want to separate the 
    islands of "1" and get a handle on
    the indices of each island.
    i.e. : I want to transform this:
      0 0 0 0 0 1 0 1 1 0 1 0 0
      0 0 0 0 0 1 0 1 0 0 1 0 1
      0 0 0 0 0 1 0 1 0 1 0 0 1
      0 0 0 0 1 1 0 0 0 1 0 1 0
      0 0 0 1 1 0 0 0 0 0 0 1 0
      0 0 0 1 1 1 1 0 0 0 0 0 0
    into something like this:
      0 0 0 0 0 1 0 2 2 0 3 0 0
      0 0 0 0 0 1 0 2 0 0 3 0 6
      0 0 0 0 0 1 0 2 0 4 0 0 6
      0 0 0 0 1 1 0 0 0 4 0 5 0
      0 0 0 1 1 0 0 0 0 0 0 5 0
      0 0 0 1 1 1 1 0 0 0 0 0 0
    
    
    I only half-understand, what Wirth writes on trees in his green Oberonbook.
    But it looks to me like a tree problem.
    
    Thanks and regards,
    Dieter
    
    
    
    
    -- 
    ____________________________________
    Dr. Dieter Glötzel
    Im Rosengarten 27
    64367 Mühltal
    
    --
    Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
    https://lists.inf.ethz.ch/mailman/listinfo/oberon
    




More information about the Oberon mailing list