Changes In Branch 3d-affine-transforms Excluding Merge-Ins
This is equivalent to a diff from 4d97d89c32 to fd7d3894ff
2023-02-12
| ||
22:20 | Add OFMatrix4x4 and OFVector3D check-in: 44eb35b212 user: js tags: trunk | |
2022-11-07
| ||
00:35 | Update buildsys check-in: 7fa46d6a89 user: js tags: trunk | |
00:28 | Merge trunk into branch "invoke-invocation" Leaf check-in: a43377bd13 user: js tags: invoke-invocation | |
00:24 | Merge trunk into branch "3d-affine-transforms" Closed-Leaf check-in: fd7d3894ff user: js tags: 3d-affine-transforms | |
00:23 | Merge trunk into branch "3d-affine-transforms" check-in: 86f8767eca user: js tags: 3d-affine-transforms | |
00:20 | Merge trunk into branch "asn1" check-in: d8ef56254d user: js tags: asn1 | |
00:06 | Merge trunk into branch "ofsock" Leaf check-in: e2284a0f02 user: js tags: ofsock | |
2022-11-06
| ||
23:56 | Merge trunk into branch "sctp" check-in: 9cb5c92f04 user: js tags: sctp | |
21:37 | Fix OFDDPSocket on NetBSD check-in: 4d97d89c32 user: js tags: trunk | |
21:32 | OFBindDDPSocketFailedException: Fix typo check-in: 15e5bfc523 user: js tags: trunk | |
Modified src/Makefile from [47fba670b3] to [2c6ac46242].
1 2 3 4 5 6 7 8 9 10 11 12 | include ../extra.mk SUBDIRS = ${RUNTIME} exceptions encodings forwarding SUBDIRS_AFTER = ${BRIDGE} ${TLS} DISTCLEAN = Info.plist objfw-defs.h SHARED_LIB = ${OBJFW_SHARED_LIB} STATIC_LIB = ${OBJFW_STATIC_LIB} FRAMEWORK = ${OBJFW_FRAMEWORK} LIB_MAJOR = ${OBJFW_LIB_MAJOR} LIB_MINOR = ${OBJFW_LIB_MINOR} | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | include ../extra.mk SUBDIRS = ${RUNTIME} exceptions encodings forwarding SUBDIRS_AFTER = ${BRIDGE} ${TLS} DISTCLEAN = Info.plist objfw-defs.h SHARED_LIB = ${OBJFW_SHARED_LIB} STATIC_LIB = ${OBJFW_STATIC_LIB} FRAMEWORK = ${OBJFW_FRAMEWORK} LIB_MAJOR = ${OBJFW_LIB_MAJOR} LIB_MINOR = ${OBJFW_LIB_MINOR} SRCS = OF4x4Matrix.m \ OFApplication.m \ OFArray.m \ OFBlock.m \ OFCharacterSet.m \ OFColor.m \ OFConstantString.m \ OFCountedSet.m \ OFData.m \ |
︙ | ︙ |
Added src/OF4x4Matrix.h version [fdc5246dcd].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /* * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" OF_ASSUME_NONNULL_BEGIN /** * @brief A 4x4 matrix of floats. */ OF_SUBCLASSING_RESTRICTED @interface OF4x4Matrix: OFObject <OFCopying> { float _values[16]; } #ifdef OF_HAVE_CLASS_PROPERTIES @property (readonly, class) OF4x4Matrix *identity; #endif /** * @brief An array of the 16 floats of the 4x4 matrix in column-major format. * * These may be modified directly. */ @property (readonly, nonatomic) float *values; /** * @brief Returns the 4x4 identity matrix. */ + (OF4x4Matrix *)identity; /** * @brief Creates a new 4x4 matrix with the specified values. * * @param values An array of 16 floats in column-major format * @return A new, autoreleased OF4x4Matrix */ + (instancetype)matrixWithValues: (const float [_Nonnull 16])values; /** * @brief Initializes an already allocated 4x4 matrix with the specified values. * * @param values An array of 16 floats in column-major format * @return An initialized OF4x4Matrix */ - (instancetype)initWithValues: (const float [_Nonnull 16])values; /** * @brief Transposes the matrix. */ - (void)transpose; /** * @brief Mulitplies the receiver with the specified matrix on the left side * and the receiver on the right side. * * @param matrix The matrix to multiply the receiver with */ - (void)multiplyWithMatrix: (OF4x4Matrix *)matrix; @end OF_ASSUME_NONNULL_END |
Added src/OF4x4Matrix.m version [cd962a5d85].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | /* * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OF4x4Matrix.h" #import "OFString.h" static const float identityValues[16] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; static OF4x4Matrix *identity; @implementation OF4x4Matrix + (void)initialize { if (self != [OF4x4Matrix class]) return; identity = [[OF4x4Matrix alloc] initWithValues: identityValues]; } + (OF4x4Matrix *)identity { return identity; } + (instancetype)matrixWithValues: (const float [16])values { return [[[self alloc] initWithValues: values] autorelease]; } - (instancetype)initWithValues: (const float [16])values { self = [super init]; memcpy(_values, values, 16 * sizeof(float)); return self; } - (float *)values { return _values; } - (instancetype)copy { return [[OF4x4Matrix alloc] initWithValues: _values]; } - (bool)isEqual: (OF4x4Matrix *)matrix { if (![matrix isKindOfClass: [OF4x4Matrix class]]) return false; return (memcmp(_values, matrix->_values, 16 * sizeof(float)) == 0); } - (unsigned long)hash { unsigned long hash; OFHashInit(&hash); for (size_t i = 0; i < 16; i++) OFHashAddHash(&hash, OFFloatToRawUInt32(_values[i])); OFHashFinalize(&hash); return hash; } - (void)transpose { float copy[16]; memcpy(copy, _values, 16 * sizeof(float)); _values[1] = copy[4]; _values[2] = copy[8]; _values[3] = copy[12]; _values[4] = copy[1]; _values[6] = copy[9]; _values[7] = copy[13]; _values[8] = copy[2]; _values[9] = copy[6]; _values[11] = copy[14]; _values[12] = copy[3]; _values[13] = copy[7]; _values[14] = copy[11]; } - (void)multiplyWithMatrix: (OF4x4Matrix *)matrix { float copy[16]; memcpy(copy, _values, 16 * sizeof(float)); _values[0] = matrix->_values[0] * copy[0] + matrix->_values[4] * copy[1] + matrix->_values[8] * copy[2] + matrix->_values[12] * copy[3]; _values[1] = matrix->_values[1] * copy[0] + matrix->_values[5] * copy[1] + matrix->_values[9] * copy[2] + matrix->_values[13] * copy[3]; _values[2] = matrix->_values[2] * copy[0] + matrix->_values[6] * copy[1] + matrix->_values[10] * copy[2] + matrix->_values[14] * copy[3]; _values[3] = matrix->_values[3] * copy[0] + matrix->_values[7] * copy[1] + matrix->_values[11] * copy[2] + matrix->_values[15] * copy[3]; _values[4] = matrix->_values[0] * copy[4] + matrix->_values[4] * copy[5] + matrix->_values[8] * copy[6] + matrix->_values[12] * copy[7]; _values[5] = matrix->_values[1] * copy[4] + matrix->_values[5] * copy[5] + matrix->_values[9] * copy[6] + matrix->_values[13] * copy[7]; _values[6] = matrix->_values[2] * copy[4] + matrix->_values[6] * copy[5] + matrix->_values[10] * copy[6] + matrix->_values[14] * copy[7]; _values[7] = matrix->_values[3] * copy[4] + matrix->_values[7] * copy[5] + matrix->_values[11] * copy[6] + matrix->_values[15] * copy[7]; _values[8] = matrix->_values[0] * copy[8] + matrix->_values[4] * copy[9] + matrix->_values[8] * copy[10] + matrix->_values[12] * copy[11]; _values[9] = matrix->_values[1] * copy[8] + matrix->_values[5] * copy[9] + matrix->_values[9] * copy[10] + matrix->_values[13] * copy[11]; _values[10] = matrix->_values[2] * copy[8] + matrix->_values[6] * copy[9] + matrix->_values[10] * copy[10] + matrix->_values[14] * copy[11]; _values[11] = matrix->_values[3] * copy[8] + matrix->_values[7] * copy[9] + matrix->_values[11] * copy[10] + matrix->_values[15] * copy[11]; _values[12] = matrix->_values[0] * copy[12] + matrix->_values[4] * copy[13] + matrix->_values[8] * copy[14] + matrix->_values[12] * copy[15]; _values[13] = matrix->_values[1] * copy[12] + matrix->_values[5] * copy[13] + matrix->_values[9] * copy[14] + matrix->_values[13] * copy[15]; _values[14] = matrix->_values[2] * copy[12] + matrix->_values[6] * copy[13] + matrix->_values[10] * copy[14] + matrix->_values[14] * copy[15]; _values[15] = matrix->_values[3] * copy[12] + matrix->_values[7] * copy[13] + matrix->_values[11] * copy[14] + matrix->_values[15] * copy[15]; } - (OFString *)description { return [OFString stringWithFormat: @"<OF4x4Matrix: {\n" @"\t%g %g %g %g\n" @"\t%g %g %g %g\n" @"\t%g %g %g %g\n" @"\t%g %g %g %g\n" @"}>", _values[0], _values[4], _values[8], _values[12], _values[1], _values[5], _values[9], _values[13], _values[2], _values[6], _values[10], _values[14], _values[3], _values[7], _values[11], _values[15]]; } @end |
Modified src/OFObject.h from [698abcee0b] to [f34dd9cc3a].
︙ | ︙ | |||
277 278 279 280 281 282 283 284 285 286 287 288 289 290 | { if (!OFEqualPoints(rect1.origin, rect2.origin)) return false; if (!OFEqualSizes(rect1.size, rect2.size)) return false; return true; } /** * @brief Adds the specified byte to the hash. * * @param hash A pointer to a hash to add the byte to | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | { if (!OFEqualPoints(rect1.origin, rect2.origin)) return false; if (!OFEqualSizes(rect1.size, rect2.size)) return false; return true; } /** * @struct OF3DVector OFObject.h ObjFW/OFObject.h * * @brief A vector in 3D space. */ typedef struct OF_BOXABLE { /** The x coordinate of the vector */ float x; /** The y coordinate of the vector */ float y; /** The z coordinate of the vector */ float z; } OF3DVector; /** * @brief Creates a new OF3DVector. * * @param x The x coordinate of the vector * @param y The x coordinate of the vector * @param z The z coordinate of the vector * @return An OF3DVector with the specified coordinates */ static OF_INLINE OF3DVector OF_CONST_FUNC OF3DVectorMake(float x, float y, float z) { OF3DVector vec = { x, y, z }; return vec; } /** * @brief Returns whether the two vectors are equal. * * @param vec1 The first vector for the comparison * @param vec2 The second vector for the comparison * @return Whether the two vectors are equal */ static OF_INLINE bool OF3DVectorEqual(OF3DVector vec1, OF3DVector vec2) { if (vec1.x != vec2.x) return false; if (vec1.y != vec2.y) return false; if (vec1.z != vec2.z) return false; return true; } /** * @brief Adds the specified byte to the hash. * * @param hash A pointer to a hash to add the byte to |
︙ | ︙ |
Modified src/ObjFW.h from [940f93b1b8] to [4c0b93e417].
︙ | ︙ | |||
133 134 135 136 137 138 139 140 141 142 143 144 145 146 | #import "OFApplication.h" #import "OFSystemInfo.h" #import "OFLocale.h" #import "OFOptionsParser.h" #import "OFTimer.h" #import "OFRunLoop.h" #ifdef OF_WINDOWS # import "OFWindowsRegistryKey.h" #endif #import "OFAllocFailedException.h" #import "OFException.h" | > > | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | #import "OFApplication.h" #import "OFSystemInfo.h" #import "OFLocale.h" #import "OFOptionsParser.h" #import "OFTimer.h" #import "OFRunLoop.h" #import "OF4x4Matrix.h" #ifdef OF_WINDOWS # import "OFWindowsRegistryKey.h" #endif #import "OFAllocFailedException.h" #import "OFException.h" |
︙ | ︙ |
Modified tests/Makefile from [90bcdcd287] to [0d56240313].
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | testfile_bin.m \ testfile_ini.m DISTCLEAN = Info.plist PROG_NOINST = tests${PROG_SUFFIX} STATIC_LIB_NOINST = ${TESTS_STATIC_LIB} SRCS = ForwardingTests.m \ OFArrayTests.m \ ${OF_BLOCK_TESTS_M} \ OFCharacterSetTests.m \ OFDataTests.m \ OFDateTests.m \ OFDictionaryTests.m \ OFHMACTests.m \ | > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | testfile_bin.m \ testfile_ini.m DISTCLEAN = Info.plist PROG_NOINST = tests${PROG_SUFFIX} STATIC_LIB_NOINST = ${TESTS_STATIC_LIB} SRCS = ForwardingTests.m \ OF4x4MatrixTests.m \ OFArrayTests.m \ ${OF_BLOCK_TESTS_M} \ OFCharacterSetTests.m \ OFDataTests.m \ OFDateTests.m \ OFDictionaryTests.m \ OFHMACTests.m \ |
︙ | ︙ |
Added tests/OF4x4MatrixTests.m version [84ce4ae574].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /* * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "TestsAppDelegate.h" static OFString *const module = @"OF4x4MatrixTests"; @implementation TestsAppDelegate (OF4x4MatrixTests) - (void)_4x4MatrixTests { void *pool = objc_autoreleasePoolPush(); OF4x4Matrix *matrix, *matrix2; TEST(@"+[identity]", memcmp([[OF4x4Matrix identity] values], (float [16]){ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }, 16 * sizeof(float)) == 0) TEST(@"+[matrixWithValues:]", (matrix = [OF4x4Matrix matrixWithValues: (float [16]){ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }])) TEST(@"-[description]", [matrix.description isEqual: @"<OF4x4Matrix: {\n" @"\t1 5 9 13\n" @"\t2 6 10 14\n" @"\t3 7 11 15\n" @"\t4 8 12 16\n" @"}>"]) TEST(@"-[transpose]", R([matrix transpose]) && memcmp(matrix.values, (float [16]){ 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 4, 8, 12, 16 }, 16 * sizeof(float)) == 0) TEST(@"-[isEqual:]", [[OF4x4Matrix identity] isEqual: [OF4x4Matrix matrixWithValues: (float [16]){ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }]]) TEST(@"-[copy]", (matrix2 = [matrix copy]) && [matrix2 isEqual: matrix]) TEST(@"-[multiplyWithMatrix:] #1", R([matrix2 multiplyWithMatrix: [OF4x4Matrix identity]]) && [matrix2 isEqual: matrix]) matrix2 = [OF4x4Matrix matrixWithValues: (float [16]){ 100, 500, 900, 1300, 200, 600, 1000, 1400, 300, 700, 1100, 1500, 400, 800, 1200, 1600 }]; TEST(@"-[multiplyWithMatrix:] #2", R([matrix2 multiplyWithMatrix: matrix]) && [matrix2 isEqual: [OF4x4Matrix matrixWithValues: (float [16]){ 9000, 20200, 31400, 42600, 10000, 22800, 35600, 48400, 11000, 25400, 39800, 54200, 12000, 28000, 44000, 60000 }]]) objc_autoreleasePoolPop(pool); } @end |
Modified tests/TestsAppDelegate.h from [1f4a8a0dc4] to [a51bfb5544].
︙ | ︙ | |||
54 55 56 57 58 59 60 61 62 63 64 65 66 67 | int _fails; } - (void)outputTesting: (OFString *)test inModule: (OFString *)module; - (void)outputSuccess: (OFString *)test inModule: (OFString *)module; - (void)outputFailure: (OFString *)test inModule: (OFString *)module; @end @interface TestsAppDelegate (OFArrayTests) - (void)arrayTests; @end @interface TestsAppDelegate (OFBlockTests) - (void)blockTests; | > > > > | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | int _fails; } - (void)outputTesting: (OFString *)test inModule: (OFString *)module; - (void)outputSuccess: (OFString *)test inModule: (OFString *)module; - (void)outputFailure: (OFString *)test inModule: (OFString *)module; @end @interface TestsAppDelegate (OF4x4MatrixTests) - (void)_4x4MatrixTests; @end @interface TestsAppDelegate (OFArrayTests) - (void)arrayTests; @end @interface TestsAppDelegate (OFBlockTests) - (void)blockTests; |
︙ | ︙ |
Modified tests/TestsAppDelegate.m from [5b13043c48] to [b207daeaa0].
︙ | ︙ | |||
438 439 440 441 442 443 444 445 446 447 448 449 450 451 | #endif [self XMLParserTests]; [self XMLNodeTests]; [self XMLElementBuilderTests]; [self serializationTests]; [self JSONTests]; [self propertyListTests]; #if defined(OF_HAVE_PLUGINS) [self pluginTests]; #endif #ifdef OF_WINDOWS [self windowsRegistryKeyTests]; #endif | > > | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | #endif [self XMLParserTests]; [self XMLNodeTests]; [self XMLElementBuilderTests]; [self serializationTests]; [self JSONTests]; [self propertyListTests]; [self _4x4MatrixTests]; #if defined(OF_HAVE_PLUGINS) [self pluginTests]; #endif #ifdef OF_WINDOWS [self windowsRegistryKeyTests]; #endif |
︙ | ︙ |