-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvecmath3.dart
32 lines (24 loc) · 1.01 KB
/
vecmath3.dart
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
import 'term.dart';
import 'constants.dart';
import 'vecmath.dart';
/// A 3-value homogeneous coordinate representing X, Y, and a homogeneous factor W.
class Vector3 extends VectorN {
Term get xVal => coordinates[0];
Term get yVal => coordinates[1];
Term get wVal => coordinates[2];
Vector3([Term xVal = zero, Term yVal = zero, Term wVal = one])
: super(3, [xVal, yVal, wVal]);
Vector3.fromList(List<Term> coordinates)
: super(3, coordinates);
Vector3 makeVector(List<Term> coordinates) => Vector3.fromList(coordinates);
Vector3 normalize() => super.normalize();
}
/// A 3x3 coordinate matrix
class Matrix3x3 extends MatrixNxN {
Matrix3x3(List<List<Term>> elements) : super(3, elements);
Matrix3x3 makeMatrix(List<List<Term>> elements) => Matrix3x3(elements);
@override Vector3 transform(Vector3 vec) => super.transform(vec);
@override Matrix3x3 minors() => super.minors();
@override Matrix3x3 cofactors() => super.cofactors();
@override Matrix3x3 transpose() => super.transpose();
}