This basically finds the midpoint and distance on a number line, a plane, and 3D space.
e.g. (0,0,0) and (1,0,0) :They are exactly one distance unit and have a midpoint of (0.5,0,0)
-- Distance and Midpoint --
:Disp "Dist, MidPoint","(1-3)"
:Input "Num Dimensions: ",X
:If X=1
:Then
:Prompt A,B
:abs(A-B)→C
:If A<B
:(C/2)+A→D
:If B<A
:(C/2)+B→D
:Disp "MP:",D,"DIST:",C
:Else
:If X=2
:Then
:Prompt X,Y
:Input "X2:",A
:Input "Y2:",B
:√((X-A)2+(Y-B)2)→D
:((A+X)/2)→Q
:((B+Y)/2)→R
:X→dim(L1)
:Q→L1(1)
:R→L1(2)
:Disp "MIDPOINT: XY",L1,"DIST:",D
:Else
:If X=3
:Then
:Prompt X,Y,Z
:Input "X2=?",A
:Input "Y2=?",B
:Input "Z2=?",C
:√((A-X)2+(B-Y)2+(C-Z)2)→D
:((A+X)/2)→Q
:((B+Y)/2)→R
:((C+Z)/2)→S
:X→dim(L1)
:Q→L1(1)
:R→L1(2)
:S→L1(3)
:Disp "MIDPOINT: XYZ",L1,"Dist:",D
:End
No comments:
Post a Comment