DELETED src/OFDoubleMatrix.h Index: src/OFDoubleMatrix.h ================================================================== --- src/OFDoubleMatrix.h +++ src/OFDoubleMatrix.h @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012 - * Jonathan Schleifer - * - * 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 - -#import "OFObject.h" - -@class OFDoubleVector; - -/** - * \brief A class for storing and manipulating matrices of doubles. - */ -@interface OFDoubleMatrix: OFObject -{ -@public - size_t rows, columns; - double *data; -} - -/** - * \brief Creates a new matrix with the specified dimension. - * - * If the number of rows and columns is equal, the matrix is initialized to be - * the identity. - * - * \param rows The number of rows for the matrix - * \param columns The number of colums for the matrix - * \return A new autoreleased OFDoubleMatrix - */ -+ matrixWithRows: (size_t)rows - columns: (size_t)columns; - -/** - * \brief Creates a new matrix with the specified dimension and data. - * - * \param rows The number of rows for the matrix - * \param columns The number of colums for the matrix - * \param data The first double of the data for the matrix. The data is in the - * format rows-columns. - * \return A new autoreleased OFDoubleMatrix - */ -+ matrixWithRows: (size_t)rows - columns: (size_t)columns - data: (double)data, ...; - -/** - * \brief Initializes the matrix with the specified dimension. - * - * If the number of rows and columns is equal, the matrix is initialized to be - * the identity. - * - * \param rows The number of rows for the matrix - * \param columns The number of colums for the matrix - * \return An initialized OFDoubleMatrix - */ -- initWithRows: (size_t)rows - columns: (size_t)columns; - -/** - * \brief Initializes the matrix with the specified dimension and data. - * - * \param rows The number of rows for the matrix - * \param columns The number of colums for the matrix - * \param data The first double of the data for the matrix. The data is in the - * format rows-columns. - * \return An initialized OFDoubleMatrix - */ -- initWithRows: (size_t)rows - columns: (size_t)columns - data: (double)data, ...; - -/** - * \brief Initializes the matrix with the specified dimension and arguments. - * - * \param rows The number of rows for the matrix - * \param columns The number of colums for the matrix - * \param data The first double of the data for the matrix. The data is in the - * format rows-columns. - * \param arguments A va_list with data for the matrix - * \return An initialized OFDoubleMatrix - */ -- initWithRows: (size_t)rows - columns: (size_t)columns - data: (double)data - arguments: (va_list)arguments; - -/** - * \brief Sets the value for the specified row and colmn. - * - * \param value The value - * \param row The row for the value - * \param column The column for the value - */ -- (void)setValue: (double)value - forRow: (size_t)row - column: (size_t)column; - -/** - * \brief Returns the value for the specified row and column. - * - * \param row The row for which the value should be returned - * \param column The column for which the value should be returned - * \return The value for the specified row and column - */ -- (double)valueForRow: (size_t)row - column: (size_t)column; - -/** - * \brief Returns the number of rows of the matrix. - * - * \return The number of rows of the matrix - */ -- (size_t)rows; - -/** - * \brief Returns the number of columns of the matrix. - * - * \return The number of columns of the matrix - */ -- (size_t)columns; - -/** - * \brief Returns an array of doubles with the contents of the matrix. - * - * The returned array is in the format columns-rows. - * Modifying the returned array directly is allowed and will change the matrix. - * - * \brief An array of doubles with the contents of the vector - */ -- (double*)cArray; - -/** - * \brief Adds the specified matrix to the receiver. - * - * \param matrix The matrix to add - */ -- (void)addMatrix: (OFDoubleMatrix*)matrix; - -/** - * \brief Subtracts the specified matrix from the receiver. - * - * \param matrix The matrix to subtract - */ -- (void)subtractMatrix: (OFDoubleMatrix*)matrix; - -/** - * \brief Multiplies the receiver with the specified scalar. - * - * \param scalar The scalar to multiply with - */ -- (void)multiplyWithScalar: (double)scalar; - -/** - * \brief Divides the receiver by the specified scalar. - * - * \param scalar The scalar to divide by - */ -- (void)divideByScalar: (double)scalar; - -/** - * \brief Multiplies the receiver with the specified matrix on the left side and - * the receiver on the right. - * - * \param matrix The matrix to multiply the receiver with - */ -- (void)multiplyWithMatrix: (OFDoubleMatrix*)matrix; - -/** - * \brief Transposes the receiver. - */ -- (void)transpose; - -/** - * \brief Translates the nxn matrix of the receiver with an n-1 vector. - * - * \param vector The vector to translate with - */ -- (void)translateWithVector: (OFDoubleVector*)vector; - -/** - * \brief Rotates the 4x4 matrix of the receiver with a 3D vector and an angle. - * - * \param vector The vector to rotate with - * \param angle The angle to rotate with - */ -- (void)rotateWithVector: (OFDoubleVector*)vector - angle: (double)angle; - -/** - * \brief Scales the nxn matrix of the receiver with an n-1 vector. - * - * \param scale The vector to scale with - */ -- (void)scaleWithVector: (OFDoubleVector*)vector; -@end DELETED src/OFDoubleVector.h Index: src/OFDoubleVector.h ================================================================== --- src/OFDoubleVector.h +++ src/OFDoubleVector.h @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012 - * Jonathan Schleifer - * - * 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 - -#import "OFObject.h" - -@class OFDoubleMatrix; - -/** - * \brief A class for storing and manipulating vectors of doubles. - */ -@interface OFDoubleVector: OFObject -{ -@public - size_t dimension; - double *data; -} - -/** - * \brief Creates a new vector with the specified dimension. - * - * \param dimension The dimension for the vector - * \return A new autoreleased OFDoubleVector - */ -+ vectorWithDimension: (size_t)dimension; - -/** - * \brief Creates a new vector with the specified dimension and data. - * - * \param dimension The dimension for the vector - * \param data The first double of the data for the vector - * \return A new autoreleased OFDoubleVector - */ -+ vectorWithDimension: (size_t)dimension - data: (double)data, ...; - -/** - * \brief Initializes the vector with the specified dimension. - * - * \param dimension The dimension for the vector - * \return An initialized OFDoubleVector - */ -- initWithDimension: (size_t)dimension; - -/** - * \brief Initializes the vector with the specified dimension and data. - * - * \param dimension The dimension for the vector - * \param data The first double of the data for the vector - * \return An initialized OFDoubleVector - */ -- initWithDimension: (size_t)dimension - data: (double)data, ...; - -/** - * \brief Initializes the vector with the specified dimension and data. - * - * \param dimension The dimension for the vector - * \param The first double of the data for the vector - * \param arguments A va_list with data for the vector - * \return An initialized OFDoubleVector - */ -- initWithDimension: (size_t)dimension - data: (double)data - arguments: (va_list)arguments; - -/** - * \brief Sets the value for the specified index. - * - * \param value The value - * \param index The index for the value - */ -- (void)setValue: (double)value - atIndex: (size_t)index; - -/** - * \brief Returns the value for the specified index. - * - * \param index The index for which the value should be returned - * \return The value for the specified index - */ -- (double)valueAtIndex: (size_t)index; - -/** - * \brief Returns the dimension of the vector. - * - * \return The dimension of the vector - */ -- (size_t)dimension; - -/** - * \brief Changes the dimension of the vector. - * - * If the new dimension is smaller, elements will be cut off. - * If the new dimension is bigger, new elements will be filled with zeros. - * - * \param dimension The new dimension for the vector - */ -- (void)setDimension: (size_t)dimension; - -/** - * \brief Returns an array of doubles with the contents of the vector. - * - * Modifying the returned array directly is allowed and will change the vector. - * - * \return An array of doubles with the contents of the vector - */ -- (double*)cArray; - -/** - * \brief Returns the magnitude or length of the vector. - * - * \return The magnitude or length of the vector - */ -- (double)magnitude; - -/** - * \brief Normalizes the vector. - */ -- (void)normalize; - -/** - * \brief Adds the specified vector to the receiver. - * - * \param vector The vector to add - */ -- (void)addVector: (OFDoubleVector*)vector; - -/** - * \brief Subtracts the specified vector from the receiver. - * - * \param vector The vector to subtract - */ -- (void)subtractVector: (OFDoubleVector*)vector; - -/** - * \brief Multiplies the receiver with the specified scalar. - * - * \param scalar The scalar to multiply with - */ -- (void)multiplyWithScalar: (double)scalar; - -/** - * \brief Divides the receiver by the specified scalar. - * - * \param scalar The scalar to divide by - */ -- (void)divideByScalar: (double)scalar; - -/** - * \brief Multiplies the components of the receiver with the components of the - * specified vector. - * - * \param vector The vector to multiply the receiver with - */ -- (void)multiplyWithComponentsOfVector: (OFDoubleVector*)vector; - -/** - * \brief Divides the components of the receiver by the components of the - * specified vector. - * - * \param vector The vector to divide the receiver by - */ -- (void)divideByComponentsOfVector: (OFDoubleVector*)vector; - -/** - * \brief Returns the dot product of the receiver and the specified vector. - * - * \return The dot product of the receiver and the specified vector - */ -- (double)dotProductWithVector: (OFDoubleVector*)vector; - -/** - * \brief Returns the cross product of the receiver and the specified vector. - * - * This currently only works for 3D vectors. - * - * \return The cross product of the receiver and the specified vector - */ -- (OFDoubleVector*)crossProductWithVector: (OFDoubleVector*)vector; - -/** - * \brief Multiplies 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: (OFDoubleMatrix*)matrix; -@end DELETED src/OFFloatMatrix.h Index: src/OFFloatMatrix.h ================================================================== --- src/OFFloatMatrix.h +++ src/OFFloatMatrix.h @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012 - * Jonathan Schleifer - * - * 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 - -#import "OFObject.h" - -@class OFFloatVector; - -/** - * \brief A class for storing and manipulating matrices of floats. - */ -@interface OFFloatMatrix: OFObject -{ -@public - size_t rows, columns; - float *data; -} - -/** - * \brief Creates a new matrix with the specified dimension. - * - * If the number of rows and columns is equal, the matrix is initialized to be - * the identity. - * - * \param rows The number of rows for the matrix - * \param columns The number of colums for the matrix - * \return A new autoreleased OFFloatMatrix - */ -+ matrixWithRows: (size_t)rows - columns: (size_t)columns; - -/** - * \brief Creates a new matrix with the specified dimension and data. - * - * \param rows The number of rows for the matrix - * \param columns The number of colums for the matrix - * \param data The first float of the data for the matrix. The data is in the - * format rows-columns. - * \return A new autoreleased OFFloatMatrix - */ -+ matrixWithRows: (size_t)rows - columns: (size_t)columns - data: (float)data, ...; - -/** - * \brief Initializes the matrix with the specified dimension. - * - * If the number of rows and columns is equal, the matrix is initialized to be - * the identity. - * - * \param rows The number of rows for the matrix - * \param columns The number of colums for the matrix - * \return An initialized OFFloatMatrix - */ -- initWithRows: (size_t)rows - columns: (size_t)columns; - -/** - * \brief Initializes the matrix with the specified dimension and data. - * - * \param rows The number of rows for the matrix - * \param columns The number of colums for the matrix - * \param data The first float of the data for the matrix. The data is in the - * format rows-columns. - * \return An initialized OFFloatMatrix - */ -- initWithRows: (size_t)rows - columns: (size_t)columns - data: (float)data, ...; - -/** - * \brief Initializes the matrix with the specified dimension and arguments. - * - * \param rows The number of rows for the matrix - * \param columns The number of colums for the matrix - * \param data The first float of the data for the matrix. The data is in the - * format rows-columns. - * \param arguments A va_list with data for the matrix - * \return An initialized OFFloatMatrix - */ -- initWithRows: (size_t)rows - columns: (size_t)columns - data: (float)data - arguments: (va_list)arguments; - -/** - * \brief Sets the value for the specified row and colmn. - * - * \param value The value - * \param row The row for the value - * \param column The column for the value - */ -- (void)setValue: (float)value - forRow: (size_t)row - column: (size_t)column; - -/** - * \brief Returns the value for the specified row and column. - * - * \param row The row for which the value should be returned - * \param column The column for which the value should be returned - * \return The value for the specified row and column - */ -- (float)valueForRow: (size_t)row - column: (size_t)column; - -/** - * \brief Returns the number of rows of the matrix. - * - * \return The number of rows of the matrix - */ -- (size_t)rows; - -/** - * \brief Returns the number of columns of the matrix. - * - * \return The number of columns of the matrix - */ -- (size_t)columns; - -/** - * \brief Returns an array of floats with the contents of the matrix. - * - * The returned array is in the format columns-rows. - * Modifying the returned array directly is allowed and will change the matrix. - * - * \brief An array of floats with the contents of the vector - */ -- (float*)cArray; - -/** - * \brief Adds the specified matrix to the receiver. - * - * \param matrix The matrix to add - */ -- (void)addMatrix: (OFFloatMatrix*)matrix; - -/** - * \brief Subtracts the specified matrix from the receiver. - * - * \param matrix The matrix to subtract - */ -- (void)subtractMatrix: (OFFloatMatrix*)matrix; - -/** - * \brief Multiplies the receiver with the specified scalar. - * - * \param scalar The scalar to multiply with - */ -- (void)multiplyWithScalar: (float)scalar; - -/** - * \brief Divides the receiver by the specified scalar. - * - * \param scalar The scalar to divide by - */ -- (void)divideByScalar: (float)scalar; - -/** - * \brief Multiplies the receiver with the specified matrix on the left side and - * the receiver on the right. - * - * \param matrix The matrix to multiply the receiver with - */ -- (void)multiplyWithMatrix: (OFFloatMatrix*)matrix; - -/** - * \brief Transposes the receiver. - */ -- (void)transpose; - -/** - * \brief Translates the nxn matrix of the receiver with an n-1 vector. - * - * \param vector The vector to translate with - */ -- (void)translateWithVector: (OFFloatVector*)vector; - -/** - * \brief Rotates the 4x4 matrix of the receiver with a 3D vector and an angle. - * - * \param vector The vector to rotate with - * \param angle The angle to rotate with - */ -- (void)rotateWithVector: (OFFloatVector*)vector - angle: (float)angle; - -/** - * \brief Scales the nxn matrix of the receiver with an n-1 vector. - * - * \param scale The vector to scale with - */ -- (void)scaleWithVector: (OFFloatVector*)vector; -@end DELETED src/OFFloatVector.h Index: src/OFFloatVector.h ================================================================== --- src/OFFloatVector.h +++ src/OFFloatVector.h @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012 - * Jonathan Schleifer - * - * 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 - -#import "OFObject.h" - -@class OFFloatMatrix; - -/** - * \brief A class for storing and manipulating vectors of floats. - */ -@interface OFFloatVector: OFObject -{ -@public - size_t dimension; - float *data; -} - -/** - * \brief Creates a new vector with the specified dimension. - * - * \param dimension The dimension for the vector - * \return A new autoreleased OFFloatVector - */ -+ vectorWithDimension: (size_t)dimension; - -/** - * \brief Creates a new vector with the specified dimension and data. - * - * \param dimension The dimension for the vector - * \param data The first float of the data for the vector - * \return A new autoreleased OFFloatVector - */ -+ vectorWithDimension: (size_t)dimension - data: (float)data, ...; - -/** - * \brief Initializes the vector with the specified dimension. - * - * \param dimension The dimension for the vector - * \return An initialized OFFloatVector - */ -- initWithDimension: (size_t)dimension; - -/** - * \brief Initializes the vector with the specified dimension and data. - * - * \param dimension The dimension for the vector - * \param data The first float of the data for the vector - * \return An initialized OFFloatVector - */ -- initWithDimension: (size_t)dimension - data: (float)data, ...; - -/** - * \brief Initializes the vector with the specified dimension and data. - * - * \param dimension The dimension for the vector - * \param The first float of the data for the vector - * \param arguments A va_list with data for the vector - * \return An initialized OFFloatVector - */ -- initWithDimension: (size_t)dimension - data: (float)data - arguments: (va_list)arguments; - -/** - * \brief Sets the value for the specified index. - * - * \param value The value - * \param index The index for the value - */ -- (void)setValue: (float)value - atIndex: (size_t)index; - -/** - * \brief Returns the value for the specified index. - * - * \param index The index for which the value should be returned - * \return The value for the specified index - */ -- (float)valueAtIndex: (size_t)index; - -/** - * \brief Returns the dimension of the vector. - * - * \return The dimension of the vector - */ -- (size_t)dimension; - -/** - * \brief Changes the dimension of the vector. - * - * If the new dimension is smaller, elements will be cut off. - * If the new dimension is bigger, new elements will be filled with zeros. - * - * \param dimension The new dimension for the vector - */ -- (void)setDimension: (size_t)dimension; - -/** - * \brief Returns an array of floats with the contents of the vector. - * - * Modifying the returned array directly is allowed and will change the vector. - * - * \return An array of floats with the contents of the vector - */ -- (float*)cArray; - -/** - * \brief Returns the magnitude or length of the vector. - * - * \return The magnitude or length of the vector - */ -- (float)magnitude; - -/** - * \brief Normalizes the vector. - */ -- (void)normalize; - -/** - * \brief Adds the specified vector to the receiver. - * - * \param vector The vector to add - */ -- (void)addVector: (OFFloatVector*)vector; - -/** - * \brief Subtracts the specified vector from the receiver. - * - * \param vector The vector to subtract - */ -- (void)subtractVector: (OFFloatVector*)vector; - -/** - * \brief Multiplies the receiver with the specified scalar. - * - * \param scalar The scalar to multiply with - */ -- (void)multiplyWithScalar: (float)scalar; - -/** - * \brief Divides the receiver by the specified scalar. - * - * \param scalar The scalar to divide by - */ -- (void)divideByScalar: (float)scalar; - -/** - * \brief Multiplies the components of the receiver with the components of the - * specified vector. - * - * \param vector The vector to multiply the receiver with - */ -- (void)multiplyWithComponentsOfVector: (OFFloatVector*)vector; - -/** - * \brief Divides the components of the receiver by the components of the - * specified vector. - * - * \param vector The vector to divide the receiver by - */ -- (void)divideByComponentsOfVector: (OFFloatVector*)vector; - -/** - * \brief Returns the dot product of the receiver and the specified vector. - * - * \return The dot product of the receiver and the specified vector - */ -- (float)dotProductWithVector: (OFFloatVector*)vector; - -/** - * \brief Returns the cross product of the receiver and the specified vector. - * - * This currently only works for 3D vectors. - * - * \return The cross product of the receiver and the specified vector - */ -- (OFFloatVector*)crossProductWithVector: (OFFloatVector*)vector; - -/** - * \brief Multiplies 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: (OFFloatMatrix*)matrix; -@end