-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv2.java
More file actions
executable file
·48 lines (40 loc) · 742 Bytes
/
Copy pathv2.java
File metadata and controls
executable file
·48 lines (40 loc) · 742 Bytes
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
class v2
{
public double x;
public double y;
public v2()
{
x = 0.0;
y = 0.0;
}
public v2(double x,double y)
{
this.x = x;
this.y = y;
}
public v2(int x,int y)
{
this.x = (double)x;
this.y = (double)y;
}
public v2 Add(v2 b)
{
v2 a = new v2(this.x + b.x,this.y + b.y);
return a;
}
public v2 Scale(double b)
{
v2 a = new v2(this.x * b,this.y * b);
return a;
}
public v2 Scale(int b)
{
v2 a = new v2(this.x * (double)b,this.y * (double)b);
return a;
}
public double Inner(v2 b)
{
double a = this.x * b.x + this.y * b.y;
return(a);
}
}