-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathTransitionObj.java
More file actions
executable file
·94 lines (73 loc) · 2.11 KB
/
Copy pathTransitionObj.java
File metadata and controls
executable file
·94 lines (73 loc) · 2.11 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
93
94
import java.awt.Color;
import java.awt.Point;
import java.util.Vector;
//Written by: Michael Zimmer - mike@zimmerdesignservices.com
/*
Copyright 2007 Zimmer Design Services
This file is part of Fizzim.
Fizzim is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Fizzim is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
public abstract class TransitionObj extends GeneralObj implements Cloneable {
public abstract void setModifiedTrue();
public abstract void updateObj();
public Object clone ()
throws CloneNotSupportedException
{
return super.clone();
}
public abstract StateObj getStartState();
public StateObj getEndState()
{
return null;
}
public void initTrans(StateObj start, StateObj end){}
public void initTrans(StateObj start){}
public abstract void makeConnections(Vector<Object> objList);
public double getAngle(Point outer, Point inner)
{
int dx = (int) outer.getX() - (int) inner.getX();
int dy = -((int) outer.getY() - (int) inner.getY());
double alpha = 0;
if(dx == 0)
{
if(dy <= 0)
alpha = 3*Math.PI/2;
else
alpha = Math.PI/2;
}
//1st q
else if (dx > 0 && dy > 0)
alpha = Math.atan((double) dy/dx);
//4th q
else if (dx > 0 && dy <= 0)
{
if(dy == 0)
alpha = 0;
else
alpha = 2*(Math.PI) + Math.atan((double) dy/(dx));
}
//2nd, 3rd q
else if (dx < 0)
alpha = (Math.PI)+ Math.atan((double) dy/dx);
return alpha;
}
public Color color = Color.BLACK;
public void setColor(Color c)
{
color = c;
}
public Color getColor()
{
return color;
}
public abstract void updateObjPages(int page);
}