forked from srinathr91/TestJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHeader.java
More file actions
92 lines (77 loc) · 1.5 KB
/
Header.java
File metadata and controls
92 lines (77 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
public class Header {
// number of lines
private static final int obstrucles=2;
public float getobstrucles() {
return obstrucles;
}
private class Line{
private float a,b,c,m,mp;
private float x_start,y_start;
private float x_end,y_end;
public void Line(float x_start,float y_start,float x_end,float y_end){
this.x_start=x_start;
this.y_start=y_start;
this.x_end=x_end;
this.y_end=y_end;
a=x_end-x_start;
b=y_start-y_end;
c=(y_start*x_end)-(x_start*y_end);
m=(y_end-y_start)/(x_end-x_start);
mp=(-1)/(m);
}
public float getA() {
return a;
}
public float getB() {
return b;
}
public float getC() {
return c;
}
public float getM() {
return m;
}
public float getMp() {
return mp;
}
public float getX_start() {
return x_start;
}
public float getY_start() {
return y_start;
}
public float getX_end() {
return x_end;
}
public float getY_end() {
return y_end;
}
}
/**
* Ball class
*/
public class Ball{
//initial coordinates
public float x,y;
//coordinates at time t
public float xt,yt;
//initial velocity
public float ux,uy;
//final velocity
public float vx,vy;
//speed of ball
public double modV;
public double getModV() {
return modV;
}
public void setModV() {
//this.vx=vx;
//this.vy=vy;
double temp=(vx*vx)+(vy*vy);
modV=Math.sqrt(temp);
}
//collusion detection
public int coll_flag;
public boolean coll_dect;
}
}