• Re: =?UTF-8?Q?=E2=80=9CWe?= are =?UTF-8?Q?doomed=E2=80=9D?=

    From Kaz Kylheku@21:1/5 to Malcolm McLean on Fri Jan 19 18:35:32 2024
    On 2024-01-19, Malcolm McLean <[email protected]> wrote:
    One problem that could be very easily fixed is that there is no standard representation of a point or a vector. Whilst generally it's just a POD structure with x and y members, the name varies, and sometimes the

    For code working with 2D vectors, designers should consider complex numbers.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @[email protected]
    NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Malcolm McLean on Sun Jan 21 04:06:17 2024
    On 2024-01-20, Malcolm McLean <[email protected]> wrote:
    On 19/01/2024 18:35, Kaz Kylheku wrote:
    On 2024-01-19, Malcolm McLean <[email protected]> wrote:
    One problem that could be very easily fixed is that there is no standard >>> representation of a point or a vector. Whilst generally it's just a POD
    structure with x and y members, the name varies, and sometimes the

    For code working with 2D vectors, designers should consider complex numbers. >>
    That's a nice idea.

    But I've never seen code where the horizontal axis is "real" and the
    vertical "imaginary", except of course in code designed to demonstrate complex numbers as such. Mandelbrot is my favourite test program when
    getting a new system.

    Complex numbers are used for expressing mappings that have geometric interpretations.

    In 2D computer graphics, they are convenient. E.g. to rotate
    a vector that is a complex number z = a + ib, you just multiply by
    a complex number that is on the unit circle representing that
    angle cos(theta) + i sin(theta) .

    The multiplication math is exactly the same as

    [ cos -sin ] [ a ]
    [ sin cos ] [ b ]

    Because when you multiply two complex nubmers (c + id)(a + ib),
    the FOIL rule produces

    ca + icb + ida + iidb

    = (ca - db) + i(cb + da).

    And that's just

    [ c -d ] [ a ] = [ ca - db ]
    [ d c ] [ b ] = [ da + cb ]

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @[email protected]
    NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

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