geometry · MIT License
Overview
Calculate a polygon's area from vertices entered in clockwise or counterclockwise order.
- Tested on a TI calculator
- Downloaded 60 times
- Version 1.0.0
- 2735 bytes
- No imports
Tried it? Did this program work on your calculator?
Before you run it
- TI-84 Plus CE Python · tested on OS 5.8.3, Python App 5.8.3.0048
- TI Connect CE .py conversion to a Python AppVar in RAM; owner physically verified the supplied program.
- Vertices are entered in order around a non-self-crossing polygon.
- The TI program requires at least three vertices.
- Self-crossing or unordered vertices can produce an unintended area.
Try the DuckieDai calculator screen
This browser preview is deliberately limited to a triangle. The TI program accepts any number of ordered vertices from three onward.
TI-84 Plus CE Python · screen preview
Learn the math
How the shoelace formula works
The idea
The shoelace formula finds the area of any polygon from the coordinates of its corners. You multiply coordinates in a criss-cross pattern, like lacing a shoe, and halve the result.
The formula
A = 0.5*|sum of (x_i*y_next - x_next*y_i)|
x_i, y_i- coordinates of each corner, taken in order around the polygon
A- area in square units
Using the program
- Enter how many corners the polygon has (3 or more).
- Then type each corner's x and y, going around the shape in one direction.
- Clockwise and counterclockwise both work.
Worked example
A rectangle has corners (0,0), (4,0), (4,3), and (0,3). Enter 4 for the number of vertices, then the four points in that order.
The program shows Area = 12.0 square units, which matches 4 x 3.
Tips and common mistakes
- The corners must be in order around the edge. Jumping across the shape gives a wrong answer.
- Do not repeat the first point at the end; the program closes the shape for you.
- The polygon must not cross itself.
Where this comes up
It is used in coordinate geometry, in surveying and mapping problems, and in computer science courses as a standard polygon-area algorithm.
Exact reviewed bytes
Source code
"""DuckieDai Shoelace Area for TI-84 Plus CE Python."""def duckiedai_intro(program_name, wait=True):"""Show the reusable DuckieDai program opening."""title = program_name[:16]empty = 16 - len(title)left = empty // 2right = empty - leftprint("+----------------------+")print("| " + " " * left + title + " " * right + " |")print("| |")print("| __ |")print("| ___(o )> quack! |")print("| \\ <_. ) |")print("| `---' |")print("| by DuckieDai |")print("+----------------------+")print("Loading...")if wait:input("Press enter to start ")print("\n" * 6)def number(prompt):"""Allow positive, negative, or zero coordinates."""while True:try:value = float(input(prompt))if value > -1e100 and value < 1e100:return valueexcept ValueError:passprint("Enter a valid number.")def vertex_count():"""Require at least three polygon vertices."""while True:try:count = int(input("Number of vertices: "))if count >= 3:return countexcept ValueError:passprint("Enter 3 or more.")def shoelace_area(x_values, y_values):"""Calculate polygon area with the shoelace formula."""total = 0n = len(x_values)for i in range(n):next_i = (i + 1) % ntotal += (x_values[i] * y_values[next_i]- x_values[next_i] * y_values[i])return abs(total) / 2def main():duckiedai_intro("SHOELACE AREA")print("SHOELACE FORMULA")print("POLYGON AREA")print()print("Enter vertices in")print("order around polygon.")print()print("Clockwise OR")print("counterclockwise.")print()count = vertex_count()x_values = []y_values = []print()for i in range(count):print("POINT " + str(i + 1))x = number("x: ")y = number("y: ")x_values.append(x)y_values.append(y)print()area = shoelace_area(x_values,y_values)print("Using:")print("Shoelace Formula")print()print("Vertices: " + str(count))print()print("ANSWER")print("Area = " + str(area))print("square units")print()print("DuckieDai says: done!")# TI-Python imports the selected AppVar rather than# setting __name__ to main.main()
- Filename
SHOELACE.py- Size
- 2735 bytes
- SHA-256
f0f5f745c9ade2dd05b7afdd06d19edcffb0c5f25397661cf000052cc2f63ef7
Usage
Inputs
- At least three ordered polygon vertices
- Finite coordinate values between -1e100 and 1e100
Outputs
- Polygon area from the shoelace formula
Units: Coordinates use one coordinate system; area uses square coordinate units.
Assumptions and limitations
Assumptions
- Vertices are entered in order around a non-self-crossing polygon.
Constraints
- The TI program requires at least three vertices.
Known failures
- Self-crossing or unordered vertices can produce an unintended area.
Compatibility and review
- Review status
- Tested on a TI calculator
- Tested on
- TI-84 Plus CE Python; OS 5.8.3; Python App 5.8.3.0048; exact source owner-tested through TI Connect CE
- What happened
- Owner confirmed the supplied shoelace area program runs on the physical calculator.
- Dependencies
- No imports
- Suggested calculator name
SHOELACE— you can give it another valid, unique name when you transfer it- Desktop test cases
- Not available for this interactive-only source
This exact source auto-launches an interactive calculator session, so compatibility evidence comes from the recorded physical-device review rather than an importable desktop fixture.
Transfer and launch
Download the .py file, send it to your calculator with TI Connect CE as SHOELACE or another name, then open the Python App and try the worked example on this page first.
Full installation and troubleshooting guide. Check your teacher's or exam's rules before using any program.
Version history
- 1.0.0 — current version, published . Download this reviewed version
Related learning
Did a DuckieDai program help with your homework? Every program here is free. If you would like to say thanks, you can leave a tip on Cash App ($duckiedai214) or read what tips pay for.
Independent compatibility resource: Hidden Word Scanner is independent and is not affiliated with or endorsed by Texas Instruments. TI product names describe compatibility only.
Action-count privacy: Successful downloads, preview starts, and preview completions increment same-origin aggregate counters, and so does a Yes or No answer about whether the program worked. Your browser notes that you answered; that note is never sent to the site. No entered values, source text, IP address, account, cookie, device identifier, or fingerprint is stored with these counts.