Class MatrixXY

java.lang.Object
by.andd3dfx.math.matrix.Matrix2D
by.andd3dfx.math.matrix.MatrixXY

public class MatrixXY extends Matrix2D
A specialized matrix for storing pairs of (x,y) coordinates. This class extends Matrix2D to provide a convenient interface for working with coordinate pairs, where the first row stores x-coordinates and the second row stores y-coordinates. The matrix has dimensions 2×N, where N is the number of coordinate pairs.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    MatrixXY(int n)
    Creates a new matrix for storing N coordinate pairs.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    setX(int i, double value)
    Sets the x-coordinate at the specified index.
    void
    setY(int i, double value)
    Sets the y-coordinate at the specified index.
    double
    x(int i)
    Returns the x-coordinate at the specified index.
    double
    y(int i)
    Returns the y-coordinate at the specified index.

    Methods inherited from class by.andd3dfx.math.matrix.Matrix2D

    fill, get, getRow, max, min, set, setRow, swapCols, swapRows

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MatrixXY

      public MatrixXY(int n)
      Creates a new matrix for storing N coordinate pairs.
      Parameters:
      n - number of coordinate pairs (must be positive)
      Throws:
      IllegalArgumentException - if n <= 0
  • Method Details

    • setX

      public void setX(int i, double value)
      Sets the x-coordinate at the specified index.
      Parameters:
      i - index of the coordinate pair (0 <= i < n)
      value - x-coordinate value
      Throws:
      IllegalArgumentException - if i < 0 or i >= n
    • x

      public double x(int i)
      Returns the x-coordinate at the specified index.
      Parameters:
      i - index of the coordinate pair (0 <= i < n)
      Returns:
      x-coordinate value
      Throws:
      IllegalArgumentException - if i < 0 or i >= n
    • setY

      public void setY(int i, double value)
      Sets the y-coordinate at the specified index.
      Parameters:
      i - index of the coordinate pair (0 <= i < n)
      value - y-coordinate value
      Throws:
      IllegalArgumentException - if i < 0 or i >= n
    • y

      public double y(int i)
      Returns the y-coordinate at the specified index.
      Parameters:
      i - index of the coordinate pair (0 <= i < n)
      Returns:
      y-coordinate value
      Throws:
      IllegalArgumentException - if i < 0 or i >= n