1 /* 2 * Copyright (C) 2009 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 android.renderscript; 18 19 import java.lang.Math; 20 import android.util.Log; 21 22 23 /** 24 * @hide 25 * 26 **/ 27 public class Matrix3f { 28 29 public Matrix3f() { 30 mMat = new float[9]; 31 loadIdentity(); 32 } 33 34 public float get(int i, int j) { 35 return mMat[i*3 + j]; 36 } 37 38 public void set(int i, int j, float v) { 39 mMat[i*3 + j] = v; 40 } 41 42 public void loadIdentity() { 43 mMat[0] = 1; 44 mMat[1] = 0; 45 mMat[2] = 0; 46 47 mMat[3] = 0; 48 mMat[4] = 1; 49 mMat[5] = 0; 50 51 mMat[6] = 0; 52 mMat[7] = 0; 53 mMat[8] = 1; 54 } 55 56 public void load(Matrix3f src) { 57 System.arraycopy(mMat, 0, src, 0, 9); 58 } 59 60 final float[] mMat; 61 } 62 63 64