Showing posts with label polygon. Show all posts
Showing posts with label polygon. Show all posts

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.

Sunday, June 5, 2022

TI-84 Plus CE Python: Polygon Path (ppath.py)

TI-84 Plus CE Python:  Polygon Path (ppath.py)


Introduction


The program PPATH:


Between two points:  


1.  Calculates the required leftward, counter-clockwise angle.


2.  Calculates the distance to be traveled. 


The path starts at the origin (0,0).  You can create open paths or closed polygons.  For polygons, add another point and include (0,0) as the last point.  


TI-84 Plus CE Python Program:  PPATH - Python (ppath)


Download the TI-84 Plus CE Python file here:  https://drive.google.com/file/d/1QnPP9ikx45i7gAH22fTkFAmE-pBFQwTD/view?usp=sharing


Copy the code for a text file.  


print("Poly Path \nEdward Shore")

# 2022-04-27

from math import *

from turtle import *

t=Turtle()

# t is required for turtle

from ti_system import *


# hide the grid

t.hidegrid()


# obtain the points

x=[0]

y=[0]

# angles

g=[0]

# degree difference

q=[0]

# distance

d=[0]


print("Point 0: (0,0)")

print("#_0 to #_n-1")

n=eval(input("# points? "))


for i in range(1,n):  

  a=eval(input("x"+str(i)+"? "))

  b=eval(input("y"+str(i)+"? "))

  x.append(a)

  y.append(b)

  r=sqrt((a-x[i-1])**2+(b-y[i-1])**2)

  d.append(r)

  m=degrees(atan2(b-y[i-1],a-x[i-1]))

  v=m-g[i-1]

  if v<0:

    v+=360

  g.append(m)

  q.append(v)

  r6=round(r,6)

  m6=round(v,6)

  print("Distance: "+str(r6))

  print("Left Turn: "+str(m6)+"\u00b0")


print("\nPress [clear] to continue.")

disp_wait()


t.home()

t.pencolor(0,128,0)

# set speed

t.speed(4)

for i in range:

  t.left(q[i])

  t.forward(d[i])

t.done()


Notes:


1.  Turtle is a add-in module for the TI-84 Plus CE Python, which must be downloaded. Download the Turtle module here:  https://education.ti.com/en/product-resources/turtle-module/ti84ce-python


2.  Calling the Turtle module automatically assigns the variable t to a drawing turtle by the line t=Turtle().


3.  The ti_system module is exclusive to the TI-84 Plus CE.  This allows the program to pause with the disp_wait command.  


4.  The underscore character ( _ ) can be typed by the [ 2nd ] [ (-) ] (ans) sequence.  


5.  The hashtag character ( # ) can be typed by the [ 2nd ] [ 3 ] (L3) sequence.  


6.  The line for i in range(1,n) starts a for loop with i taking the values from 1 to n-1. This is good for lists when the initial point (point 0) does not need further processing. 


7.  The default operating angle measurement in Python is Radians.  


8.  The angle difference, which tells us how many degrees to turn left, is normalized to the 0°-360° range.   This is optional.   


9.  The line t.home() sets the turtle to point (0,0) and sets the turtle's orientation to 0° (facing right, forward on the x-axis).


10.  The line t.done() shows the results of the turtle commands. 


Examples


Example 1: Quadrilateral




Example 2:  An Open Path




Enjoy!  


Eddie 



All original content copyright, © 2011-2022.  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. 


Monday, July 12, 2021

Review: Calculated Industries ConcreteCalc Pro (4225)

Review:  Calculated Industries ConcreteCalc Pro (4225)









Quick Facts


Model Number:  4225

Company:  Calculated Industries

Year of Production:  2010 - present

Operating System:  Chain

Batteries: 1 x CR 2016

Memory Register:  1 independent (M), memories M1 - M3

Paperless Tape:  20 steps, arithmetic functions are recorded

Cost:  Retail:  $74.95, but selling prices vary.  I purchased mine used for $30 on eBay.


Product Page:

https://www.calculated.com/mobile/prd104/ConcreteCalc-Pro-4225-Concrete-Calculator.html


Consistent my recent reviews of Calculated Industries calculators, including the Pipe Trades Pro and the ElectricCalc Pro, I am impressed by the keyboard and the feel of the keys, love the Armadillo Gear case cover, and the calculator serves specific purpose and industry.  


Highlighted Features


Here are some, just some, of the features of ConcreteCalc Pro:  


Dimensional Math:  Calculations and conversions with units, both US and Metric, are available on the ConcreteCalc Pro.


Areas and Volumes:   The [ Length ], [ Width ], and [ Height ] keys serve as the entry keys to calculate area and volume.  


VOL = volume of the room

WALL = area of the one of the four walls

ROOM = total surface area of the walls


The results are accessed through repeated presses of the [ Height ] key.  


Geometry:  The ConcreteCalc Pro also works with calculating areas and circumferences of circles, volumes of cylinders and cones, and arc lengths.  Regular polygons are also included.  


Example:  6-sided polygon with radius of 5 in.  

5 [ Inch ] [ Conv ] [ Arc ] (Radius)

6 [ Conv ] [ Length ] (Polygon)

FULL:  120.00°

HALF:  60.00°

SIDE:  6

PER:  30 in (perimeter)

AREA:  64.95191 in^2  (area)


Loads, Blocks, Bags:  Calculate loads and bags of concrete based on volume, and the number of blocks based on area and the size of the blocks.


Stairs:  Use the [ Height ] key to store the total floor-to-floor rise, desired riser height, floor height, and tread width and you can get the run, incline of the stairs, the length of the stringer and more with the [ Stair ] key.  With the Riser Limited option, we can calculate these statistics restricting the desired the riser height as the maximum.  


Rebar calculations 



Eddie


All original content copyright, © 2011-2021.  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. 


Saturday, June 12, 2021

7000G Retro Month - June 12 Edition

7000G Retro Month - June 12 Edition



Introduction


Welcome to the 7000G Retro Month, which features programming for the classic Casio calculators from the mid/late 1980s:  primarily fx-7000G and fx-7500G.  Since the programming language stays similar throughout the years, programs can be translated to the fx-6300G and later graphing calculators with little to no adjustments.  Non graphic programs should be ported to the fx-4000P, fx-4500P (A), fx-3650p (II), fx-50F Plus (II), and fx-5800P with little to no adjustments.  


7000G Retro Month takes place every Saturday during June 2021.


To make text easier to type, I can going to use the following text friendly symbols for the following:


->  for →


/I for ⊿


=> for ⇒


What do you think?   Unicode or simple text equivalents?  


- - - - - - -- - -- - -


Today's subject revolves around Graphics.  Enjoy!


- - - -- - - -- - -- -- -


Get a emulator or graphing calculator to see the results.


Quadratic Fit by Two Roots


Given two roots A and B, the program generates a quadratic equation and it's graph.   The program assumes that the vertex is a minimum.


Y = (X - A) (X - B)


"ROOT1" -> A

"ROOT2" -> B

"Y = X^2 - " /I

A+B /I

"X + " /I

AB /I

Cls

Graph Y=(X-A)(X-B)


Polar Plotting (Self Contained)


I usually use Radians (Mode 5 for fx-7000G, fx-7500G, fx-6300G) angle mode when it comes to graphics and calculus.  To set/change each equation, you will need to edit the program here.  I state the equation to be in the form r(T) where T = θ.  


On the Rec command, x is stored to I and y is stored to J.  (specific to fx-7000G, fx-7500G, fx-6300G)


"POLAR R(T)"

Rad

"RMIN"? -> A

"RMAX"? -> B

"N"? -> N

(B-A)÷N -> H

A-H -> T

Cls

Lbl 1

T+H -> T

[insert r(T) here]

Rec(Ans, T)

Plot I,J

T<B => Goto 1


Cubic Bezier Curve


This program plots a cubic Bezier curve with the following variables:


(x0, y0):  A = A[0], B = A[1]  (exact fit)

(x1, y1):  C = A[2], D = A[3]

(x2, y2):  E = A[4], F = A[5]

(x3, y3):  G = A[6], H = A[7]   (exact fit)


Cls

0 -> I

"CUBIC BEZIER"

Lbl 1

"X"? -> A[ I ]

Isz I

"Y"? -> A[ I ]

Isz I

I < 8 => Goto 1

0 -> T

Lbl 2

A(1-T)^3 + 3C(1-T)^2 T + 3E(1-T) T^2 + GT^3 -> X

B(1-T)^3 + 3D(1-T)^2 T + 3F(1-T) T^2 + HT^3 -> Y

Plot X,Y

T+.02 -> T

T<1 => Goto 2


Press [ G<>T ] to see the graph.  


Polygon Drawing


The programs allow the user to draw many lines in a row by connecting points.   The original point are stored in variables E and F.   To complete the polygon, use (E, F) as the final point.  


The prompt MORE:  enter 0 to stop, anything else to continue connecting points


Cls

"X0"? -> A : A -> E

"Y0"? -> B : B -> F

Plot A,B

Lbl 1

"ORIG (E,F)"

"NEXT X"? -> C

"NEXT Y"? -> D

0 -> T

Lbl 2

(1-T)A+CT -> X

(1-T)B+DT -> Y

Plot X,Y

T+.02->T

T<1 => Goto 2

C -> A : D -> B

"MORE"? -> M

M≠0 => Goto 1


Drawing an Ellipse


This program draws an ellipse.  


"ELLIPSE"

"X RADIUS"? -> A

"Y RADIUS"? -> B

Rad

Cls

Range -A-.5,A+.5,(2A+1)÷20,-B-.5,B+.5,(2B+1)÷20

0 -> T

Lbl 1

Plot A cos T, B sin T

T+2Ï€÷64 -> T

T<2Ï€ => Goto 1


Press [ G<>T ] to see the graph.  


Eddie


All original content copyright, © 2011-2021.  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. 


Python – Earth’s Radius and Gravity in US Units

Python – Earth’s Radius and Gravity in US Units Introduction The following script, gravus2.py, estimates the Earth’s gravity i...