Saturday, April 5, 2025

Casio fx-CG 50: Draw a Polygon of Vertices

Casio fx-CG 50: Draw a Polygon of Vertices 



Introduction


The program POLYPTS draws a polygon of vertices and calculates the area.



Casio fx-CG 50 Program: POLYPTS


ClrGraph

S-WindAuto

“# POINTS”? → N

(1 + N) → Dim List 1

(1 + N) → Dim List 2

For 1 → I to N

ClrText

Green Locate 1, 7, “POINT”

Red Locate 7, 7, I

“X”? → List 1[ I ]

“Y”? → List 2[ I ]

Next

List 1[ 1 ] → List 1[N + 1]

List 2[ 1 ] → List 2[N + 1]

0 → A

For 2 → I To N+1

A + (List 1[ I ] × List 2[I – 1] – List 1[I – 1] × List 2[ I ]) → A

Next

Abs A ÷ 2 → A

“AREA = “

A ◢

S-Gph 1 DrawOn, xyLine, List 1, List 2, 1, Square, ColorLinkOff, ColorAuto

DrawStat



Examples



Example 1: 4 Points


(0, 14)

(5, 5)

(18, 0)

(0, -4)


Area = 116




Example 2: 4 Points


(4, 10)

(15, 10)

(11, 2)

(2, 2)


Area = 80





Example 3: 5 Points


(1, 1)

(4, 2)

(3, 6)

(0, 4)

(0, 2)


Area = 13





Next time, an anniversary for the blog...  14 years!   Gratitude as always,



Eddie


All original content copyright, © 2011-2025. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Casio fx-CG 50: Draw a Polygon of Vertices

Casio fx-CG 50: Draw a Polygon of Vertices  Introduction The program POLYPTS draws a polygon of vertices and calculates the area...