Post Reply 
(15C) Area and Perimeter of irregular polygon
12-06-2023, 09:47 AM
Post: #8
RE: (15C) Area and Perimeter of irregular polygon
Area (A) (improved wrt the previous version) and perimeter (C)
(though not together; but the program can be easily changed to that extent, using a data register)

55 bytes


                   X       Y       Z       T
001 LBL A
002 GSB 0
003 LBL 1          yi      A       -       xi
004 RCLx (i)       xj*yi   A       -       xi
005 R^
006uRCL (i)
007 Rv             xi      xj*yi   A       xj
008 RCLx (i)       yj*xi
009 -
010 +
011uRCL (i)
012 GTO 1
013 Rv
014 ABS
015 2
016 /
017 RTN

018 LBL C
019 GSB 0
020 LBL 2          yi      P       xi
021 RCL (i)        xj      yi      P       xi
022 R^
023 -
024uRCL (i)
025 Rv             xj-xi   yi      P       xj
026 X<>Y
027 RCL- (i)
028 ->P            d       -       P       xj
029 X<>Y
030 Rv
031 +              P       xj
032uRCL (i)
033 GTO 2
034 Rv
035 RTN

036 LBL 0
037 STO I
038 MATRIX 1
039 RCL DIM I 2 n
040 SQRT
041 RCL g(i)
042 0
043 RCL DIM I
044 RCL g(i)       yn      0       xn      xn
045 RTN


Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (15C) Area and Perimeter of irregular polygon - Werner - 12-06-2023 09:47 AM



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