• word on this example

    From fir@21:1/5 to All on Thu Aug 29 13:25:50 2024
    sorry i start thread on it (as its my inner work not general c maybe,
    though some could comment) but this example has some new ideas and
    sometimes i tend to forget some things that i deeply not worked
    and this would be pity to forget that

    and here by chance some things appeared clean

    point {ints x y}
    line {points p q}
    draw line(color c)
    {
    point a = p
    int m = max abs(q-p) ' a+=(q-p)/m, Setpixel a, c
    }

    those structure definitions are neat (first tiem i see this)
    it looks almost finallly good and it resolves some problems
    (what problems like
    int a b c, i didnt slightly liked now ints a b c removes that
    and also makes this structure array nice mixup, gods, thats good, clean
    as fuk)

    draw line(color c)

    also neat idea , in fact this draw is a method of line
    but how you could write with older ideas

    line
    {
    points p q

    draw(color c)
    {
    point a = p
    int m = max abs(q-p) ' a+=(q-p)/m, Setpixel a, c
    }
    }

    line a = {10,10,200,100};
    a draw(0xcccccc) //used to look ok but now sucks

    it also resolves this great problem method may have
    couple of parents not only one

    becouse draw here may be seen as a child of both line and color

    instead of
    draw line(color c)
    {
    point a = p
    int m = max abs(q-p) ' a+=(q-p)/m, Setpixel a, c
    }


    draw color line //here both color and line are typenames
    {
    point a = p //fields of both color and lien are accsible here
    int m = max abs(q-p) ' a+=(q-p)/m, Setpixel a, rgb //say rgb is
    field of color
    }

    calling would be

    draw 0xffffff {{10,10}, {100,200}}

    or

    line l {{10,10}, {100,200}}
    color c 0xffffff

    draw c l

    if soem mises names could be added cast or something
    draw (line) l (color) c

    i dont know, at least seems intresting imo

    some could say that display should be also added becouse
    Setpixel must come from something so it would be




    color (chars r g b a)
    point {ints x y}
    line {points p q}
    display(ins w h) { w h 4 chars map } // "100 ints t" is int t[100]

    display set point with color {
    map[y][x][0] = color.r
    map[y][x][1] = color.g
    map[y][x][2] = color.b
    //assumming array acces is like that (which is not optimal imo) and i
    want to explicitely write which byte takes r g b

    // may go automatic map[y][x] = color //may omit map probably wrting
    [y][x] = color
    }

    line l {10,10,100,200}
    color c {30 40 50 0}
    display d(640 480)

    draw color line on display
    {
    point a = p //could also write line.q instead q optionally etc
    int m = max abs(q-p) ' a+=(q-p)/m, set a with color
    }


    maybe not fuly right but probably something this way

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From fir@21:1/5 to fir on Thu Aug 29 13:53:03 2024
    fir wrote:

    point {ints x y}
    line {points p q}

    note soem could say making tables by adding s is kinda limiting
    like not all write in english and not all words makes plurat by adding s

    like

    vertex {floats x y z}
    triangle {vertexs a b c}

    in not englis say polish is yet more weird like sat kwiat is flower
    then flowers is kwiaty not kwiats

    yet it limits normal names then you cant name maybe some
    normal names with s (?)


    but this can be somewhat resolved simply some need to use keyword
    plural or something (same as typedef)


    plural int ints
    plural kwiat kwiaty

    and predefined type would be predefined (ints floats bits chars etc)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From fir@21:1/5 to All on Sat Aug 31 02:40:11 2024
    display(ins w h) { w h 4 chars map }

    in fact i dont know how to define array
    this above i think is wrong

    maybe if

    some { ints a b c }

    then something like that

    some {ints a b c d[20 20] e[100 20] }

    i dont think sadly it look best

    the fact it shouldnt be d[][] but rather d[j i] or d[j,i]

    some from fact that if language supports vectors like

    point {ints x y}

    then indexing by p shopuld be avaliable and vector form
    is "1 2" or "1,2" not 1][2



    point p = 2 3

    d[p] same as d[2 3]


    but this form
    some {ints a b c d[20 20] e[100 20] }

    isnt much good

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From fir@21:1/5 to fir on Sat Aug 31 02:55:19 2024
    fir wrote:

    point p = 2 3

    d[p] same as d[2 3]

    if so the order of indexing also i guess must be different

    as point p = 200 10 is 200 in x and 10 in y it seem it must be

    d[200 10] not d[10][200] (the last one not conform to vector indexing)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From fir@21:1/5 to fir on Sat Aug 31 17:56:25 2024
    fir wrote:
    fir wrote:

    point p = 2 3

    d[p] same as d[2 3]

    if so the order of indexing also i guess must be different

    as point p = 200 10 is 200 in x and 10 in y it seem it must be

    d[200 10] not d[10][200] (the last one not conform to vector indexing)


    the problem with

    ints d[100 100] is that "d[100 100]" is/would be element 100 100
    and the the same look in definition with different meaning is not much
    good imo

    even
    ints a b c d(100 100) //defining int a int b int c and int d[100][100]

    would be probably better but
    im not sure if good

    ints tab(100) as an array definition? - im not sure

    it could be eventually something like
    ints a b c d`100`100 //or other symbol instead of `
    eventually but also im not sure

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)