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

📄 segment3d.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 jmt.engine.jaba.Hull.Vertex;

import java.util.Vector;

/**
 * Created by IntelliJ IDEA.
 * User: Andrea
 * Date: 5-ago-2005
 * Time: 15.01.25
 * To change this template use File | Settings | File Templates.
 */
public class Segment3D {

    private double beta11;
    private double beta12;
    private double beta13;
    private double beta21;
    private double beta22;
    private double beta23;
    private Vertex s1;
    private Vertex s2;

    public Segment3D()
    {

    }

    public Segment3D(double beta11,double beta12,double beta13,double beta21,double beta22,double beta23,Vertex s1,Vertex s2)
    {
        this.beta11=beta11;
        this.beta12=beta12;
        this.beta13=beta13;
        this.beta21=beta21;
        this.beta22=beta22;
        this.beta23=beta23;
        this.s1 = s1;
        this.s2 = s2;
    }
    public Segment3D(BetaVertex b1,BetaVertex b2,Vertex s1,Vertex s2)
    {
        beta11=b1.getX();
        beta12=b1.getY();
        beta13=b1.getZ();
        beta21=b2.getX();
        beta22=b2.getY();
        beta23=b2.getZ();
        this.s1 = s1;
        this.s2 = s2;
    }

    /**
     * Crea un vettore di segmenti. Viene usato per controllare di non utilizzare lo stesso
     * segmento due volte nella costruzione dello spazio 3D
     * @param tri
     * @return
     */
    public Vector CreateLt(Vector tri)
    {
        Vector out = new Vector();

        for (int i=0;i<tri.size();i++)
        {
        double[] abetas = ((Sector3D)tri.get(i)).getBetas(0);
        double[] bbetas = ((Sector3D)tri.get(i)).getBetas(1);
        double[] cbetas = ((Sector3D)tri.get(i)).getBetas(2);
        Vertex s0 = ((Sector3D)tri.get(i)).getS0();
        Vertex s1 = ((Sector3D)tri.get(i)).getS1();
        Vertex s2 = ((Sector3D)tri.get(i)).getS2();

        // Segmento S0-S1
        out.addElement(new Segment3D(
                abetas[0],abetas[1],abetas[2],
                bbetas[0],bbetas[1],bbetas[2],
                s0,
                s1)
        );
        // Segmento S0-S2
        out.addElement(new Segment3D(
                abetas[0],abetas[1],abetas[2],
                cbetas[0],cbetas[1],cbetas[2],
                s0,
                s2)
        );
        // Segmento S1-S2
        out.addElement(new Segment3D(
                bbetas[0],bbetas[1],bbetas[2],
                cbetas[0],cbetas[1],cbetas[2],
                s1,
                s2)
        );


        }

        return out;
    }

    
    public BetaVertex getBeta(int stat)
    {
        if (stat==0)
        return new BetaVertex(beta11,beta12,beta13);
        else if (stat==1)
        return new BetaVertex(beta21,beta22,beta23);
        else return new BetaVertex(-1,-1,-1);
    }

    public double getBeta11()
    {
        return beta11;
    }
    public double getBeta12()
    {
        return beta12;
    }
    public double getBeta13()
    {
        return beta13;
    }
    public double getBeta21()
    {
        return beta21;
    }
    public double getBeta22()
    {
        return beta22;
    }
    public double getBeta23()
    {
        return beta23;
    }

    public Vertex getS1()
    {
        return s1;
    }
    public Vertex getS2()
    {
        return s2;
    }

    public String toString()
    {
        return (s1+"["+beta11+","+beta12+"]"+"-"+s2+"["+beta21+","+beta22+"]");
    }

    /**
     * Partendo dai lati dei settori dove saturano 2 stazioni ottenute unendo quelle
     * dove saturano 3 stazioni aggiunge i segmenti creati e toglie quelli gi

⌨️ 快捷键说明

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