Post Reply 
(49g 50g) Shoelace algorithm
08-23-2018, 09:49 PM
Post: #4
RE: ( HP49/50) Shoelace algorithm
(08-23-2018 08:23 PM)John Keith Wrote:  The SWAP is necessary for each group of coordinates because the answer depends on the order of subtraction.
The ABS at end gives a positive answer even if the points are ordered clockwise.

I thought "UNROT * UNROT *" leave only 2 values on stack.
If true, "SWAP -" is the same as "-" with opposite sign.

Opposite sign should not matter:

2*area = abs(sum([x1*y2 - x2*y1, x2*y3 - x3*y2, ...])) = abs(sum([x2*y1 - x1*y2, x3*y2 - x2*y3, ...]))
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(49g 50g) Shoelace algorithm - John Keith - 08-23-2018, 02:20 PM
RE: ( HP49/50) Shoelace algorithm - Albert Chan - 08-23-2018 09:49 PM



User(s) browsing this thread: 1 Guest(s)