Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static double[] zRotate(double angle, double[] gVector) {
        double[][] matrix = { { Math.cos(angle), Math.sin(angle), 0, 0 },
                { -Math.sin(angle), Math.cos(angle), 0, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 1 } };
        double[] tempDot = { gVector[0], gVector[1], gVector[2], gVector[3], };
        for (int j = 0; j < tempDot.length; j++) {
            gVector[j] = (tempDot[0] * matrix[0][j] + tempDot[1] * matrix[1][j] + tempDot[2] * matrix[2][j]
                    + tempDot[3] * matrix[3][j]);
        }
        return gVector;
    }
}