[squeak-dev] What it is the expected behavior of Rectangle (class) #intersect: if there is no interesection?

karl ramberg karlramberg at gmail.com
Tue Nov 29 18:05:45 UTC 2022


Here is a quite old spreadsheet like program. (2004)
http://languagegame.org:8080/ggame/11

Maybe you get some inspiration from that :-D

Best,
Karl

On Tue, Nov 29, 2022 at 8:09 AM LawsonEnglish <LEnglish5 at cox.net> wrote:

> I think you’re right. Im trying to see if a selection rectangle for cells
> in a spreadsheet-like thing is selecting anything, so FIRST I do r1
> intersects: rectangleList
>
> and then I guess iterate through again with #intersects: or perhaps I can
> combine.
>
> I’m guessing I need to go look at some python spreadsheet code or
> something.
>
> I’m working on the interface for the MorphleLogic simulator/programming
> app for the first gen SiliconSqueak chip due out first half of next year.
> It will allow one to manually (or programmatically) program an array of ML
> cells as they they were simple logical elements, which allows optimization
> of simple aspects of a software algorithm to be implemented in
> reprogrammable hardware, so this will give folks a feel for what the chip
> can do and hopefully inspire people to buy bunches of them for applications
> as yet unknown. Projected cost of the chip will be in the $0.03 - $0.15
> range in bulk, depending on how cheap they can design it to be. It’s an SOC
> with circuitry designed for control of battery charging builtin, with an
> eye to extending the life of EV battery packs by disabling charging of
> individual batteries so you don’t have to recycle the entire pack to still
> safely  recharge the rest of the pack. Secondary usecase is to keep track
> of solar cell viability in a solar panel, to extend solar panel life.
>
> The SiSq CPU won’t have enough memory to hold the Squeak IDE so you’ll
> need to program it from a laptop-based squeak (or perhaps a
> smartphone-based Squeak), but it should be the first commercial chip
> running the Smalltalk VM as the native ISA (it can also be switched to use
> almost any other stack-based interpreter if you want to use it as a
> SiliconPython chip or SiliconLua chip or whatever). The MorphleLogic part
> simply allows one to optimize special bits of code in hardware, so I’m
> working on the simulator/programmer for that part (the Squeak IDE is
> already done, afterall).
>
>
> L
>
> On Nov 28, 2022, at 22:50, karl ramberg <karlramberg at gmail.com> wrote:
>
> Hi,
> I think you must use this method with a very similar name
>
> intersects: aRectangle
> "Answer whether aRectangle intersects the receiver anywhere."
> "Optimized; old code answered:
> (origin max: aRectangle origin) < (corner min: aRectangle corner)"
>
> Best,
> Karl
>
> On Tue, Nov 29, 2022 at 1:50 AM LawsonEnglish <LEnglish5 at cox.net> wrote:
>
>> I did this and created 2 small rectangles quite far from each other
>> trying to figure out what the method returns when there is no intersection:
>>
>> r1 := Rectangle fromUser.
>> r2 := Rectangle fromUser.
>>
>> r2 3072 at 993 corner: 3203 at 1136
>> r1 2710 at 632 corner: 2835 at 752
>>
>> r2 intersect: r1 3072 at 993 corner: 2835 at 752
>>
>> r1 intersect: r2  3072 at 993 corner: 2835 at 752
>>
>> Could someone explain these results?
>>
>> Not in terms of the math involved (I assume that there’s no math bug as
>> the routine was last edited 22 years ago and it is used everywhere in
>> Morphic), but what the LOGIC is for returning what is returned and what it
>> means in the context of the comments:
>>
>> intersect: aRectangle
>>         "Answer a Rectangle that is the area in which the receiver
>> overlaps with
>>         aRectangle…. “
>>
>> I was trying to figure out how to look to identify when there is no
>> intersection, and that isn’t at all obvious here.
>>
>> Thanks.
>>
>>
>> L
>>
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20221129/3ce096e7/attachment.html>


More information about the Squeak-dev mailing list