Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
171 lines (170 sloc) 6.9 KB
float x1 =
320 ;
float y1 =
240 ;
float x2 =
320 ;
float y2 =
120 ;
int m ,
s ,
t ,
f =
0 ;
int d =
180 ;
float dd =
180.0 ;
void setup (){
size (
640 ,
480 );
textAlign (
CENTER );}
void draw (){
background (
29 ,
39 ,
45 );
fill (
67 ,
78 ,
89 );
text (
"Enter your phone number" +
"using the two points:" ,
200 ,
50 );
text (
"Angle: " +
nf (
d ,
3 )+
"°" +
nf (
m ,
2 )+
"" +
nf (
s ,
2 )+
"" +
nf (
t ,
2 )+
"′′′" +
nf (
f ,
2 )+
"′′′′\nPhone number: (" +
nf (
d ,
3 )+
") " +
nf (
m ,
2 )+
"" +
nf (
s ,
2 )+
"-" +
nf (
t ,
2 )+
"" +
int (
f /
10 ),
500 ,
300 );
fill (
125 ,
89 ,
76 );
ellipse (
x1 ,
y1 ,
10 ,
10 );
line (
x1 ,
y1 ,
x1 +
50 ,
y1 );
fill (
145 ,
109 ,
96 );
ellipse (
x2 ,
y2 ,
10 ,
10 );
line (
x1 ,
y1 ,
x2 ,
y2 );
if (
dist (
x2 ,
y2 ,
mouseX ,
mouseY )<=
20 &&
mousePressed ){
x2 =
mouseX ;
y2 =
mouseY ;}
try {
dd =
degrees (
atan ((
x2 -
x1 )/(
y2 -
y1 ))+
PI /
2 );}
catch (
ArithmeticException e ){
dd =
180.0 ;}
d =
int (
dd );
m =
int ((
dd -
d )*
60 );
s =
int (((
dd -
d )*
60 -
m )*
60 );
t =
int ((((
dd -
d )*
60 -
m )*
60 -
s )*
60 );
f =
int (((((
dd -
d )*
60 -
m )*
60 -
s )*
60 -
t )*
60 );}
You can’t perform that action at this time.