Differences From Artifact [53376eca89]:
- File
tests/OFMatrix4x4Tests.m
— part of check-in
[db7991d07b]
at
2023-02-16 19:59:20
on branch trunk
— OFVector3D -> OFPoint3D
For now, we're only interested in transformed points. (user: js, size: 2557) [annotate] [blame] [check-ins using]
To Artifact [2df72718ee]:
- File tests/OFMatrix4x4Tests.m — part of check-in [3e4ed4e59f] at 2023-02-16 21:37:01 on branch trunk — OFMatrix4x4: Add translation and scaling (user: js, size: 3066) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
20 21 22 23 24 25 26 |
static OFString *const module = @"OFMatrix4x4Tests";
@implementation TestsAppDelegate (OFMatrix4x4Tests)
- (void)matrix4x4Tests
{
void *pool = objc_autoreleasePoolPush();
OFMatrix4x4 *matrix, *matrix2;
| | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
static OFString *const module = @"OFMatrix4x4Tests";
@implementation TestsAppDelegate (OFMatrix4x4Tests)
- (void)matrix4x4Tests
{
void *pool = objc_autoreleasePoolPush();
OFMatrix4x4 *matrix, *matrix2;
OFVector3D point;
TEST(@"+[identityMatrix]",
memcmp([[OFMatrix4x4 identityMatrix] values], (float [16]){
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
|
| ︙ | ︙ | |||
83 84 85 86 87 88 89 90 |
[matrix2 isEqual: [OFMatrix4x4 matrixWithValues: (float [16]){
9000, 20200, 31400, 42600,
10000, 22800, 35600, 48400,
11000, 25400, 39800, 54200,
12000, 28000, 44000, 60000
}]])
TEST(@"-[transformedPoint3D:]",
| > > > > > > > > > > > | | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
[matrix2 isEqual: [OFMatrix4x4 matrixWithValues: (float [16]){
9000, 20200, 31400, 42600,
10000, 22800, 35600, 48400,
11000, 25400, 39800, 54200,
12000, 28000, 44000, 60000
}]])
TEST(@"[-translateWithVector3D:]",
R(matrix2 = [OFMatrix4x4 identityMatrix]) &&
R([matrix2 translateWithVector3D: OFMakeVector3D(1, 2, 3)]) &&
R(point = [matrix2 transformedPoint3D: OFMakeVector3D(2, 3, 4)]) &&
point.x == 3 && point.y == 5 && point.z == 7)
TEST(@"-[scaleWithVector3D:]",
R([matrix2 scaleWithVector3D: OFMakeVector3D(-1, 0.5, 2)]) &&
R(point = [matrix2 transformedPoint3D: OFMakeVector3D(2, 3, 4)]) &&
point.x == -3 && point.y == 2.5 && point.z == 14)
TEST(@"-[transformedPoint3D:]",
R((point = [matrix transformedPoint3D: OFMakeVector3D(1, 2, 3)])) &&
point.x == 18 && point.y == 46 && point.z == 74)
objc_autoreleasePoolPop(pool);
}
@end
|