📄 bbox.java
字号:
/*
*M3DEA - MOBILE 3D ENGINE API
*Copyright (C) 2006 Alexandre Watanabe alexandre_sw@yahoo.com.br
* Diego de Freitas zenon_cc@yahoo.com.br
* Paulo Rodrigo Priszculnik paulorp@paulorp.trix.net
* Rodrigo Arthur Lopes raspl@terra.com.br
*
* This library is free software; you can redistribute it
* and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* This library 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite
* 330, Boston, MA 02111-1307 USA
*
*/
package m3dea.util;
/** Classe que representa um Bounding Box utilizado para fazer c醠culos de colis鉶 nas entidades do engine.
*/
public class BBox
{
/* Limites do Bounding Box */
private float xmin;
private float xmax;
private float ymin;
private float ymax;
private float zmin;
private float zmax;
/** Construtor que copia um outro Bounding Box
* @param box Bounding Box para copiar atributos
*/
public BBox(BBox box)
{
this(box.xmin, box.xmax, box.ymin, box.ymax, box.zmin, box.zmax);
}
/** Cria uma nova inst鈔cia da classe
* @param xMin Limite inferior do eixo x
* @param xMax Limite superior do eixo x
* @param yMin Limite inferior do eixo y
* @param yMax Limite superior do eixo y
* @param zMin Limite inferior do eixo z
* @param zMax Limite superior do eixo z
*/
public BBox(float xMin, float xMax, float yMin, float yMax, float zMin, float zMax)
{
this.xmin = xMin;
this.xmax = xMax;
this.ymin = yMin;
this.ymax = yMax;
this.zmin = zMin;
this.zmax = zMax;
}
/** Realiza uma transla玢o no objeto
* @param tx transla玢o no eixo x
* @param ty transla玢o no eixo y
* @param tz transla玢o no eixo z
*/
public void translate(float tx, float ty, float tz)
{
this.xmin += tx;
this.xmax += tx;
this.ymin += ty;
this.ymax += ty;
this.zmin += tz;
this.zmax += tz;
}
/** Realiza uma transla玢o no objeto
* @param vec vetor de transla玢o
*/
public void translate(float[] vec)
{
translate( vec[0], vec[1], vec[2] );
}
/**
* Checa colis鉶 do Bounding Box com outro Bounding Box
* @param box Bounding Box para checar colis鉶
* @param vec Vetor diretor do bounding Box que est
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -