Skip to content
Snippets Groups Projects
Commit 889c1173 authored by Håvard Daleng's avatar Håvard Daleng
Browse files

Created Matrix2x2-class.

parent f1053aa2
No related branches found
No related tags found
1 merge request!1Merge master and main
package edu.ntnu.stud.model;
/**
* Class representing a 2x2 matrix.
*/
public class Matrix2x2 {
/**
* The a00 component of the matrix.
*/
private double a00;
/**
* The a01 component of the matrix.
*/
private double a01;
/**
* The a10 component of the matrix.
*/
private double a10;
/**
* The a11 component of the matrix.
*/
private double a11;
/**
* Create a new 2x2 matrix.
*
* @param a00 The a00 component of the matrix.
* @param a01 The a01 component of the matrix.
* @param a10 The a10 component of the matrix.
* @param a11 The a11 component of the matrix.
*/
public Matrix2x2(double a00, double a01, double a10, double a11) {
this.a00 = a00;
this.a01 = a01;
this.a10 = a10;
this.a11 = a11;
}
/**
* Multiply the matrix by a vector., i.e. compute the product of the matrix and the vector.
*
* @return The a00 component of the matrix.
*/
public Vector2D multiply(Vector2D v) {
return new Vector2D(a00 * v.getX0() + a01 * v.getX1(), a10 * v.getX0() + a11 * v.getX1());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment