Post Reply 
Image/ sketch in program
05-25-2023, 11:18 AM (This post was last modified: 05-25-2023 11:34 AM by Amer7.)
Post: #11
RE: Image/ sketch in program
Thank you, It works.
This is program for Pothenot snellius - Problem used in Geodesy to calculate the coordinates of point T.

On the beginning you are asked to input coordinates of points A,M,B, and measured angle Alpha, Beta. Point A is determined going from unknown point T in clockwise direction A,M,B


[Image: attachment.php?aid=12152]

This is the result

[Image: attachment.php?aid=12153]

You can Use this data to test the program:
[Image: attachment.php?aid=12155]
Note: this is 47 deg- 43 min-13.8sec
Calculator set in Degrees mode

The code:
Code:

EXPORT Nazad2()
BEGIN
LOCAL Aa,Ab,ya,xa,yb,xb,Xt,Yt;
LOCAL xm,ym,da,db,Mi1,Kk2,Pp2;
LOCAL Tx,Ty;

INPUT({Aa,Ab,ya,xa,ym,xm,yb,xb},"U smjeru kazaljke na satu od nepoznate tacke", {"Alfa","Beta","ya","xa","ym","xm","yb","xb"});

// Duzine a=da i b=db
da:=SQRT((ya-ym)^2+(xa-xm)^2);
db:=SQRT((ym-yb)^2+(xm-xb)^2);

///Mikro tj Mi
Mi1:=atan((da*sin(Ab))/(db*sin(Aa)));

// Direkcioni sa A na M 
LOCAL y1,x1,n1;
y1:=ym-ya;
x1:=xm-xa;

CASE
  IF y1>0 AND x1>0 THEN n1:=ATAN(y1/x1) END;
  IF y1>0 AND x1<0 THEN n1:=ATAN(y1/x1)+180 END;
  IF y1<0 AND x1<0 THEN n1:=ATAN(y1/x1)+180 END;
  IF y1<0 AND x1>0 THEN n1:=ATAN(y1/x1)+360 END;

END;

// Direkcioni sa B na M 
LOCAL y2,x2,n2;
y2:=ym-yb;
x2:=xm-xb;

CASE
  IF y2>0 AND x2>0 THEN n2:=ATAN(y2/x2) END;
  IF y2>0 AND x2<0 THEN n2:=ATAN(y2/x2)+180 END;
  IF y2<0 AND x2<0 THEN n2:=ATAN(y2/x2)+180 END;
  IF y2<0 AND x2>0 THEN n2:=ATAN(y2/x2)+360 END;
END;

// Ugao delta 
LOCAL n3,n4,n5,n6,Dd1;

CASE
IF n1>180 THEN n3:=n1-180 END;
IF n1<180 THEN n3:=n1+180 END;
END;

CASE
IF n2>180 THEN n4:=n2-180 END;
IF n2<180 THEN n4:=n2+180 END;
END;

// Ugao delta Dd1
Dd1:=n3-n4;

// fi+ ksi=Ff1    fi - ksi=kk1
LOCAL Ff1,Kk1;
Ff1:= 180- ((Aa+Ab+Dd1)/2);
Kk1:=atan(tan(Ff1)*1/tan(Mi1+45));


// FI I KSI 
LOCAL Fi1,Ks1;

CASE 
IF Mi1>45 THEN Fi1:=Ff1-Kk1 END;
IF Mi1<45 THEN Fi1:=Ff1+Kk1 END;
END;

CASE
IF Mi1>45 THEN Ks1:=Ff1+Kk1 END;
IF Mi1<45 THEN Ks1:=Ff1-Kk1 END;
END;

LOCAL Fa,Fb;
Fa:=n1+Fi1;
Fb:=n2-Ks1;


Xt:=(xa*tan(Fa)-xb*tan(Fb)-ya+yb)/(tan(Fa)-tan(Fb));
Yt:=ya+(Xt-xa)*tan(Fa);

Tx:=ROUND(Xt,3);
Ty:=ROUND(Yt,3);

PRINT();
PRINT("X= "+Xt);
PRINT("Y= "+Yt);

PRINT("------UPUTSTVO--------");
PRINT("--------DIGITRON U STEPENE------");
PRINT("u smjeru kazaljke na satu od nepoznate Oznacit A(FI) M u sredini, desno B- ksi");

PRINT("da= "+da);
PRINT("db= "+db);
PRINT("Mikro= "+→HMS(Mi1));
PRINT("A na M= "+→HMS(n1));
PRINT("B na M= "+→HMS(n2));
PRINT("n3 = "+→HMS(n3));
PRINT("n4 = "+→HMS(n4));
PRINT("delta = "+→HMS(Dd1));
PRINT("fi + ksi  = "+→HMS(Fi1));
PRINT("fi - ksi  = "+→HMS(Kk1));
PRINT("fi   = "+→HMS(Fi1));
PRINT("ksi   = "+→HMS(Ks1));
PRINT("alfaA   = "+→HMS(Fa));
PRINT("alfaB   = "+→HMS(Fb));
PRINT("***-----REZULTAT----------****");
PRINT("X= "+Xt);
PRINT("Y= "+Yt);

///Resizing

WHILE xa>230 DO
xa:=xa/1/2;
END;

WHILE ya>300 DO
ya:=ya/1/2;
END;

WHILE xb>230 DO
xb:=xb/1/2;
END;

WHILE yb>300 DO
yb:=yb/1/2;
END;

WHILE xm>230 DO
xm:=xm/1/2;
END;
WHILE ym>300 DO
ym:=ym/1/2;
END;

WHILE Xt>230 DO
Xt:=Xt/1/2;
END;
WHILE Yt>300 DO
Yt:=Yt/1/2;
END;

WAIT(-1);
RECT();

//Tacka A
TEXTOUT_P("A",ya-10,240-xa-10,1,RGB(0,0,225));
RECT_P(ya,240-xa,ya+5,240-xa+5,RGB(0,0,225));
PIXON_P(ya,240-xa,RGB(0,0,225));

//TackaB
TEXTOUT_P("B",yb-10,240-xb-10,1,RGB(235,52,204));
RECT_P(yb,240-xb,yb+5,240-xb+5,RGB(235,52,204));
PIXON_P(yb,240-xb,RGB(235,52,204));
//TACKA M
TEXTOUT_P("M",ym-10,240-xm-10,1,RGB(0,225,0));
RECT_P(ym,240-xm,ym+5,240-xm+5,RGB(0,225,0));
PIXON_P(ym,240-xm,RGB(0,225,0));
//Tacka T
TEXTOUT_P("T",Yt-10,240-Xt-10,1,RGB(225,0,0));
RECT_P(Yt,240-Xt,Yt+5,240-Xt+5,RGB(225,0,0));
PIXON_P(Yt,240-Xt,RGB(225,0,0));
//koordinates
TEXTOUT_P("Yt="+Ty+"m Xt="+Tx+"m",2,240-10,1,RGB(225,0,0));


//Linije 
LINE_P(ya,240-xa,ym,240-xm,RGB(5,5,5));
LINE_P(ya,240-xa,Yt,240-Xt,RGB(5,5,5));
LINE_P(Yt,240-Xt,ym,240-xm,RGB(5,5,5));
LINE_P(Yt,240-Xt,yb,240-xb,RGB(5,5,5));
LINE_P(ym,240-xm,yb,240-xb,RGB(5,5,5));
WAIT(−1);


END;

@matalog I really appreciate the time you took to write the tips and commands. They were a lot of help!
Also thank to other users like road that helped me in the past with the variable inputs.


Attached File(s) Thumbnail(s)
           

.hpprgm  PresjekNazad1.hpprgm (Size: 7.85 KB / Downloads: 1)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Image/ sketch in program - Amer7 - 05-10-2023, 10:25 AM
RE: Image/ sketch in program - matalog - 05-10-2023, 03:36 PM
RE: Image/ sketch in program - Amer7 - 05-15-2023, 10:34 AM
RE: Image/ sketch in program - Amer7 - 05-17-2023, 11:30 AM
RE: Image/ sketch in program - matalog - 05-17-2023, 07:28 PM
RE: Image/ sketch in program - matalog - 05-17-2023, 07:27 PM
RE: Image/ sketch in program - Amer7 - 05-18-2023, 05:21 PM
RE: Image/ sketch in program - matalog - 05-18-2023, 10:10 PM
RE: Image/ sketch in program - Amer7 - 05-24-2023, 08:03 PM
RE: Image/ sketch in program - matalog - 05-24-2023, 10:24 PM
RE: Image/ sketch in program - Amer7 - 05-25-2023 11:18 AM
RE: Image/ sketch in program - matalog - 05-25-2023, 12:37 PM



User(s) browsing this thread: 1 Guest(s)