import
java.io.*;
class
GFG{
static
double
line_slope(
double
a,
double
b)
{
if
(a !=
0
)
return
-b / a;
else
return
(-
2
);
}
static
void
line_equation(
double
a,
double
b,
double
c,
double
x1,
double
y1,
double
alfa)
{
double
given_slope = line_slope(a, b);
double
x = alfa *
3.14159
/
180
;
if
(given_slope == -
2
)
{
double
slope_1 = Math.tan(x);
double
slope_2 = Math.tan(
3.14159
- x);
int
g = (
int
)x1, f = (
int
)x1;
g *= (-slope_1);
g += y1;
if
(g >
0
)
System.out.println(
"y = "
+
(Math.round(slope_1 *
100.0
) /
100.0
) +
"x +"
+ (Math.round(g *
100.0
) /
100.0
));
if
(g <=
0
)
System.out.println(
"y = "
+
(Math.round(slope_1 *
100.0
) /
100.0
) +
"x "
+ (Math.round(g *
100.0
) /
100.0
));
f *= (-slope_2);
f += y1;
if
(f >
0
)
{
System.out.println(
"y = "
+
(Math.round(slope_2 *
100.0
) /
100.0
) +
"x +"
+ (Math.round(f *
100.0
) /
100.0
));
}
if
(f <=
0
)
System.out.println(
"y = "
+
(Math.round(slope_1 *
100.0
) /
100.0
) +
"x "
+ (Math.round(g *
100.0
) /
100.0
));
return
;
}
if
(
1
- Math.tan(x) * given_slope ==
0
)
{
System.out.println(
"x = "
+
(Math.round(x1 *
100.0
) /
100.0
));
}
if
(
1
+ Math.tan(x) * given_slope ==
0
)
{
System.out.println(
"x = "
+
(Math.round(x1 *
100.0
) /
100.0
));
}
double
slope_1 = (given_slope + Math.tan(x)) /
(
1
- Math.tan(x) * given_slope);
double
slope_2 = (given_slope - Math.tan(x)) /
(
1
+ Math.tan(x) * given_slope);
int
g = (
int
)x1, f = (
int
)x1;
g *= (-slope_1);
g += y1;
if
(g >
0
&&
1
- Math.tan(x) * given_slope !=
0
)
System.out.println(
"y = "
+
(Math.round(slope_1 *
100.0
) /
100.0
) +
"x +"
+ (Math.round(g *
100.0
) /
100.0
));
if
(g <=
0
&&
1
- Math.tan(x) * given_slope !=
0
)
System.out.println(
"y = "
+
(Math.round(slope_1 *
100.0
) /
100.0
) +
"x "
+ (Math.round(g *
100.0
) /
100.0
));
f *= (-slope_2);
f += y1;
if
(f >
0
&&
1
+ Math.tan(x) * given_slope !=
0
)
{
System.out.println(
"y = "
+
(Math.round(slope_2 *
100.0
) /
100.0
) +
"x +"
+ (Math.round(f *
100.0
) /
100.0
));
}
if
(f <=
0
&&
1
+ Math.tan(x) * given_slope !=
0
)
System.out.println(
"y = "
+
(Math.round(slope_2 *
100.0
) /
100.0
) +
"x +"
+ (Math.round(f *
100.0
) /
100.0
));
}
public
static
void
main (String[] args)
{
double
a =
2
, b =
3
, c = -
7
;
double
x1 =
4
, y1 =
9
;
double
alfa =
30
;
line_equation(a, b, c, x1, y1, alfa);
}
}