ObjFW
Loading...
Searching...
No Matches
OFMatrix4x4.h
1/*
2 * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
3 *
4 * All rights reserved.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License version 3.0 only,
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 * version 3.0 for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * version 3.0 along with this program. If not, see
17 * <https://www.gnu.org/licenses/>.
18 */
19
20#import "OFObject.h"
21
22OF_ASSUME_NONNULL_BEGIN
23
27OF_SUBCLASSING_RESTRICTED
29{
30 OF_ALIGN(16) float _values[4][4];
31}
32
33#ifdef OF_HAVE_CLASS_PROPERTIES
34@property (readonly, class) OFMatrix4x4 *identityMatrix;
35#endif
36
42@property (readonly, nonatomic) float (*values)[4];
47+ (OFMatrix4x4 *)identityMatrix;
48
55+ (instancetype)matrixWithValues: (const float [_Nonnull 4][4])values;
56
57- (instancetype)init OF_UNAVAILABLE;
58
65- (instancetype)initWithValues: (const float [_Nonnull 4][4])values
66 OF_DESIGNATED_INITIALIZER;
67
74- (void)multiplyWithMatrix: (OFMatrix4x4 *)matrix;
75
81- (void)translateWithVector: (OFVector3D)vector;
82
88- (void)scaleWithVector: (OFVector3D)vector;
89
96- (OFVector4D)transformedVector: (OFVector4D)vector;
97
109- (void)transformVectors: (OFVector4D *)vectors count: (size_t)count;
110@end
111
112OF_ASSUME_NONNULL_END
A 4x4 matrix of floats.
Definition OFMatrix4x4.h:30
The root class for all other classes inside ObjFW.
Definition OFObject.h:692
A protocol for the creation of copies.
Definition OFObject.h:1350
A vector in 3D space.
Definition OFObject.h:304
A vector in 4D space.
Definition OFObject.h:356