[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 2d lattice
From: |
Nelson Minar |
Subject: |
Re: 2d lattice |
Date: |
Sun, 4 Feb 96 12:06:29 MST |
>Can any of the space objects have boundaries? i.e. is there any way to
>control the wrap-around feature of Discrete2d?
Right now Discrete2d doesn't have any wraparound code at all. If the
world size is [0,100) [0,100) and you specify a coordinate outside
that range, it will probably segfault.
We've also decided to add in new methods to the Discrete2d object like
"getObjectAtNormX: Y:" that normalize coordinates. Two normalization
methods will be provided - one for wraparound, one that raises errors
for out of bounds coordinates.
BTW, does anyone have a fast algorithm for normalizing numbers to a
range like [0, 100)? If the number is positive, then you can just do
normX = x % 100;
but if the number is negative, that doesn't work (C doesn't specify the
modulus operator on negative numbers, sigh.) There's got to be some
trick I'm just missing.
- 2d lattice, John Carnahan, 1996/02/02
- Re: 2d lattice,
Nelson Minar <=