1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.android.torus.math 18 19 /** 20 * Interface to make sure that the Transform classes that implement it return a transform matrix. 21 */ 22 interface MatrixTransform { 23 /** 24 * Returns a 4x4 transform Matrix. The format of the matrix follows the OpenGL ES matrix format 25 * stored in float arrays. 26 * Matrices are 4 x 4 column-vector matrices stored in column-major order: 27 * 28 * <pre> 29 * m[0] m[4] m[8] m[12] 30 * m[1] m[5] m[9] m[13] 31 * m[2] m[6] m[10] m[14] 32 * m[3] m[7] m[11] m[15] 33 * </pre> 34 * 35 * @return a 16 value [FloatArray] representing the transform as a 4x4 matrix. 36 */ toMatrixnull37 fun toMatrix(): FloatArray 38 }