001 /*
002 * GeoAPI - Java interfaces for OGC/ISO standards
003 * http://www.geoapi.org
004 *
005 * Copyright (C) 2004-2012 Open Geospatial Consortium, Inc.
006 * All Rights Reserved. http://www.opengeospatial.org/ogc/legal
007 *
008 * Permission to use, copy, and modify this software and its documentation, with
009 * or without modification, for any purpose and without fee or royalty is hereby
010 * granted, provided that you include the following on ALL copies of the software
011 * and documentation or portions thereof, including modifications, that you make:
012 *
013 * 1. The full text of this NOTICE in a location viewable to users of the
014 * redistributed or derivative work.
015 * 2. Notice of any changes or modifications to the OGC files, including the
016 * date changes were made.
017 *
018 * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
019 * NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
020 * TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT
021 * THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
022 * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
023 *
024 * COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
025 * CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
026 *
027 * The name and trademarks of copyright holders may NOT be used in advertising or
028 * publicity pertaining to the software without specific, written prior permission.
029 * Title to copyright in this software and any associated documentation will at all
030 * times remain with copyright holders.
031 */
032 package org.opengis.referencing.operation;
033
034 import org.opengis.annotation.UML;
035
036 import static org.opengis.annotation.Specification.*;
037
038
039 /**
040 * A two dimensional array of numbers. Row and column numbering begins with zero. The API for
041 * this interface matches closely the API in various {@linkplain javax.vecmath.GMatrix matrix}
042 * implementations available in <A HREF="https://java3d.dev.java.net/">Java3D</A>,
043 * which should enable straightforward implementations. Java3D provides matrix for the general
044 * case and optimized versions for 3×3 and 4×4 cases, which are quite common in a
045 * transformation package.
046 *
047 * @author Martin Desruisseaux (IRD)
048 * @version 3.0
049 * @since 1.0
050 *
051 * @see javax.vecmath.Matrix3d
052 * @see javax.vecmath.Matrix4d
053 * @see javax.vecmath.GMatrix
054 * @see java.awt.geom.AffineTransform
055 * @see javax.media.jai.PerspectiveTransform
056 * @see javax.media.j3d.Transform3D
057 * @see <A HREF="http://math.nist.gov/javanumerics/jama/">Jama matrix</A>
058 * @see <A HREF="http://jcp.org/jsr/detail/83.jsp">JSR-83 Multiarray package</A>
059 */
060 @UML(identifier="PT_Matrix", specification=OGC_01009)
061 public interface Matrix {
062 /**
063 * Returns the number of rows in this matrix.
064 *
065 * @return The number of rows in this matrix.
066 *
067 * @departure integration
068 * Needed for making the matrix usable. The method signature matches the one of
069 * <code>GMatrix</code> in the <cite>vecmath</cite> package, for straightforward
070 * implementation.
071 */
072 int getNumRow();
073
074 /**
075 * Returns the number of columns in this matrix.
076 *
077 * @return The number of columns in this matrix.
078 *
079 * @departure integration
080 * Needed for making the matrix usable. The method signature matches the one of
081 * <code>GMatrix</code> in the <cite>vecmath</cite> package, for straightforward
082 * implementation.
083 */
084 int getNumCol();
085
086 /**
087 * Retrieves the value at the specified row and column of this matrix.
088 *
089 * @param row The row number to be retrieved (zero indexed).
090 * @param column The column number to be retrieved (zero indexed).
091 * @return The value at the indexed element.
092 *
093 * @departure integration
094 * Needed for making the matrix usable. The method signature matches the one of
095 * <code>GMatrix</code> in the <cite>vecmath</cite> package, for straightforward
096 * implementation.
097 */
098 double getElement(int row, int column);
099
100 /**
101 * Modifies the value at the specified row and column of this matrix.
102 *
103 * @param row The row number to be retrieved (zero indexed).
104 * @param column The column number to be retrieved (zero indexed).
105 * @param value The new matrix element value.
106 *
107 * @departure integration
108 * Needed for making the matrix usable. The method signature matches the one of
109 * <code>GMatrix</code> in the <cite>vecmath</cite> package, for straightforward
110 * implementation.
111 */
112 void setElement(int row, int column, double value);
113
114 /**
115 * Returns {@code true} if this matrix is an identity matrix.
116 *
117 * @return {@code true} if this matrix is an identity matrix.
118 *
119 * @departure easeOfUse
120 * Added as a convenience for a frequently requested operation.
121 */
122 boolean isIdentity();
123
124 /**
125 * Returns a clone of this matrix.
126 *
127 * @return A clone of this matrix.
128 */
129 Matrix clone();
130 }