Skip to content

I think Heat drift has a bug #1

@devoh747

Description

@devoh747
    // Next drift heat up and diffuse it a little bit
    for (int i = 0; i < Size; i++)
        heat[i] = (heat[i] * BlendSelf +
                   heat[(i + 1) % Size] * BlendNeighbor1 +
                   heat[(i + 2) % Size] * BlendNeighbor2 +
                   heat[(i + 3) % Size] * BlendNeighbor3)
                  / BlendTotal;

Say the Size is 10 and coming thru the loop we are at i=9
(i+1) % Size will evaluate to 0
(i+2) % Size will evaluate to 1
(i+3) % Size will evaluate to 2

So at pixel 9 you will be adding in the heat[0]*Blend+heat[1]*Blend+heat[2]*Blend when it should be the heat from heat[8]*Blend+heat[7]*Blend+heat[6]*Blend. I figure you need something so that you do not go outside the array.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions