Hidden WordScanner
Private scans · No account required

DuckieDai Shoelace Area

Calculate a polygon's area from vertices entered in clockwise or counterclockwise order.

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

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.

JavaScript is required for the optional browser simulation. Source viewing and downloading remain available without it.

Simulation boundary: This preview uses a reviewed browser adapter. It does not execute the downloaded Python and does not prove TI-Python or calculator compatibility.

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

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

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

Download .py

View source below, copy it when JavaScript is available, or download the exact .py bytes.

  1. """DuckieDai Shoelace Area for TI-84 Plus CE Python."""
  2. def duckiedai_intro(program_name, wait=True):
  3. """Show the reusable DuckieDai program opening."""
  4. title = program_name[:16]
  5. empty = 16 - len(title)
  6. left = empty // 2
  7. right = empty - left
  8. print("+----------------------+")
  9. print("| " + " " * left + title + " " * right + " |")
  10. print("| |")
  11. print("| __ |")
  12. print("| ___(o )> quack! |")
  13. print("| \\ <_. ) |")
  14. print("| `---' |")
  15. print("| by DuckieDai |")
  16. print("+----------------------+")
  17. print("Loading...")
  18. if wait:
  19. input("Press enter to start ")
  20. print("\n" * 6)
  21. def number(prompt):
  22. """Allow positive, negative, or zero coordinates."""
  23. while True:
  24. try:
  25. value = float(input(prompt))
  26. if value > -1e100 and value < 1e100:
  27. return value
  28. except ValueError:
  29. pass
  30. print("Enter a valid number.")
  31. def vertex_count():
  32. """Require at least three polygon vertices."""
  33. while True:
  34. try:
  35. count = int(input("Number of vertices: "))
  36. if count >= 3:
  37. return count
  38. except ValueError:
  39. pass
  40. print("Enter 3 or more.")
  41. def shoelace_area(x_values, y_values):
  42. """Calculate polygon area with the shoelace formula."""
  43. total = 0
  44. n = len(x_values)
  45. for i in range(n):
  46. next_i = (i + 1) % n
  47. total += (
  48. x_values[i] * y_values[next_i]
  49. - x_values[next_i] * y_values[i]
  50. )
  51. return abs(total) / 2
  52. def main():
  53. duckiedai_intro("SHOELACE AREA")
  54. print("SHOELACE FORMULA")
  55. print("POLYGON AREA")
  56. print()
  57. print("Enter vertices in")
  58. print("order around polygon.")
  59. print()
  60. print("Clockwise OR")
  61. print("counterclockwise.")
  62. print()
  63. count = vertex_count()
  64. x_values = []
  65. y_values = []
  66. print()
  67. for i in range(count):
  68. print("POINT " + str(i + 1))
  69. x = number("x: ")
  70. y = number("y: ")
  71. x_values.append(x)
  72. y_values.append(y)
  73. print()
  74. area = shoelace_area(
  75. x_values,
  76. y_values
  77. )
  78. print("Using:")
  79. print("Shoelace Formula")
  80. print()
  81. print("Vertices: " + str(count))
  82. print()
  83. print("ANSWER")
  84. print("Area = " + str(area))
  85. print("square units")
  86. print()
  87. print("DuckieDai says: done!")
  88. # TI-Python imports the selected AppVar rather than
  89. # setting __name__ to main.
  90. 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

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.