⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 beta3d.java

📁 一个用于排队系统仿真的开源软件,有非常形象的图象仿真过程!
💻 JAVA
字号:
/**    
  * Copyright (C) 2006, Laboratorio di Valutazione delle Prestazioni - Politecnico di Milano

  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.

  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.

  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
  
package jmt.engine.jaba;

import Jama.Matrix;
import jmt.engine.jaba.Hull.Vertex;

import java.util.Vector;

/**
 * Created by IntelliJ IDEA.
 * User: PoliMi
 * Date: 27-lug-2005
 * Time: 11.56.37
 * To change this template use File | Settings | File Templates.
 */
public class Beta3D {

    private double EPSYLON = 0.00001;

    public Sector3D BetaTriangle(newFace f) {
        Vertex v1 = f.getV0();
        int[] v1c = v1.getCoords();
        int v1x = v1c[0];
        int v1y = v1c[1];
        int v1z = v1c[2];

        Vertex v2 = f.getV1();
        int[] v2c = v2.getCoords();
        int v2x = v2c[0];
        int v2y = v2c[1];
        int v2z = v2c[2];

        Vertex v3 = f.getV2();
        int[] v3c = v3.getCoords();
        int v3x = v3c[0];
        int v3y = v3c[1];
        int v3z = v3c[2];

        double[][] arraya =
                {
                    {1, 1, 1, 0, 0, 0, 0, 0, 0},
                    {0, 0, 0, 1, 1, 1, 0, 0, 0},
                    {0, 0, 0, 0, 0, 0, 1, 1, 1},
                    {v2x, 0, 0, -v1x, 0, 0, 0, 0, 0},
                    {0, v2y, 0, 0, -v1y, 0, 0, 0, 0},
                    {0, 0, v2z, 0, 0, -v1z, 0, 0, 0},
                    {0, 0, 0, v3x, 0, 0, -v2x, 0, 0},
                    {0, 0, 0, 0, v3y, 0, 0, -v2y, 0},
                    {0, 0, 0, 0, 0, v3z, 0, 0, -v2z}
                };

        double[][] arrayb = {{1}, {1}, {1}, {0}, {0}, {0}, {0}, {0}, {0}, };

        Matrix A = new Matrix(arraya);
        Matrix b = new Matrix(arrayb);
        Matrix x = A.solve(b);

        Sector3D out = new Sector3D(x.get(0, 0), x.get(1, 0), x.get(2, 0), x.get(3, 0), x.get(4, 0), x.get(5, 0), x.get(6, 0), x.get(7, 0), x.get(8, 0), 3, v1, v2, v3);

        return out;
    }

    public Vector BetaTriangles(Vector faces) {
        Vector triangles = new Vector();
        Sector3D s3d = new Sector3D();
        for (int i = 0; i < faces.size(); i++) {
            s3d = BetaTriangle((newFace) faces.get(i));
            // Controllo: se una classe 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -