This repository was archived by the owner on Feb 29, 2024. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfenceplan.java
More file actions
Latest commit
48 lines (46 loc) · 1.28 KB
/
Copy pathfenceplan.java
File metadata and controls
48 lines (46 loc) · 1.28 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
importjava.io.*;
importjava.util.*;
publicclassfenceplan {
// Func Ref
// Output values
// 0 = p, q, r colinear
// 1 = Clockwise
// 2 = Counterclockwise
staticint[][] matrix;
staticPoint[] graph;
publicstaticintorientation(Pointp, Pointq, Pointr)
{
intval = (q.y - p.y) * (r.x - q.x) -
(q.x - p.x) * (r.y - q.y);
if (val == 0) return0; // collinear
return (val > 0)? 1: 2; // clock or counterclock wise
}
publicstaticvoidmain(String[] args) throwsIOException{
BufferedReaderf = newBufferedReader(newFileReader("fenceplan.in"));
StringTokenizerst = newStringTokenizer(f.readLine());
intN = Integer.parseInt(st.nextToken());
intM = Integer.parseInt(st.nextToken());
prev = newint[N];
matrix = newint[N][N];
graph = newPoint[N];
for(inti = 0; i < N;i ++) {
st = newStringTokenizer(f.readLine());
intx,y;
x = Integer.parseInt(st.nextToken());
y = Integer.parseInt(st.nextToken());
graph[i] = newPoint(x,y);
}
Arrays.fill(prev, -1);
}
staticint[] prev;
publicvoidcrawl(intk) {
}
}
classPoint{
intx = 0; inty = 0;
publicPoint() {}
publicPoint(intx, inty) {
this.x = x;
this.y = y;
}
}