-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPI.java
More file actions
102 lines (81 loc) · 1.59 KB
/
API.java
File metadata and controls
102 lines (81 loc) · 1.59 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
95
96
97
98
99
100
101
102
/* API.java
Ian Westrope
CS 324
HW #4
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class API extends JComponent
{
// frame dementions
int FRAME_WIDTH = 700;
int FRAME_HEIGTH = 700;
// viewport min and max points
double VP_xmin;
double VP_ymin;
double VP_xmax;
double VP_ymax;
// 3d window min and max points
double W_xmin;
double W_ymin;
double W_zmin;
double W_xmax;
double W_ymax;
double W_zmax;
public static void DefineFrame()
{
JFrame f = new JFrame("HW 4");
f.addWindowListener( new WindowAdapter()
{
public void widnowClosing( WindowEvent e )
{
System.exit(0);
}
}
);
f.setSize( FRAME_WIDTH, FRAME_HEIGTH );
f.getContentPane().add( new API() );
f.setVisible( true );
}
public static void DefineViewport( double xmin, double ymin, double xmax, double ymax )
{
VP_xmin = xmin;
VP_ymin = ymin;
VP_xmax = xmax;
VP_ymax = ymax;
}
public static void DefineWindow( double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
{
W_xmin = xmin;
W_ymin = ymin;
W_zmin = zmin;
W_xmax = xmax;
W_ymax = ymax;
W_zmax = zmax;
}
public static void Move3D()
{
}
public static void Draw3D()
{
}
public static Matrix PreMultiply( Matrix A, Matrix B)
{
Matrix C = new Matrix();
// for 4x4 matrices
int n = 4;
int m = 4;
for( int i = 0; i < 1; i++ )
{
for( int j = 0; j < n; j++ )
{
for( int k = 0; k < m; k++ )
{
C[i][k] += A[i][k] * B[k][j];
}
}
}
return C;
}
}