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

📄 vertice.java

📁 基于面向对象的数据库编程
💻 JAVA
字号:
package brgeometry;

/**
 * <p>Title: Broundary Rrepresentaion</p>
 * <p>Description: this is the Use of OODB based Broundary Representaion</p>
 * 在这个类中定义了一个基本的点类,它是一个具体的类
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: USTC</p>
 * @author unascribed
 * @version 1.0
 */

public class Vertice {
  public double x;
  public double y;
  public double z;

  public Vertice() {
  }

  public Vertice(double x, double y, double z) {
    this.x = x;
    this.y = y;
    this.z = z;
  }

  public Vertice(Vertice v) {
    this.x = v.x;
    this.y = v.y;
    this.z = v.z;
  }


    //属性操作
    public void setX(double x) {
      this.x = x;
    }
    public double getX() {
      return this.x;
    }
    public void setY(double y) {
      this.y = y;
    }
    public double getY() {
      return this.y;
    }
    public void setZ(double z) {
      this.z = z;
    }
    public double getZ() {
      return this.z;
    }

  public double distance(Vertice v) {
    return Math.sqrt( (this.x - v.x) * (this.x - v.x) +
                     (this.y - v.y) * (this.y - v.y) +
                     (this.z - v.z) * (this.z - v.z));

  }

  public Vertice midVertice(Vertice v) {
    return new Vertice( (this.x + v.x) / 2, (this.y + v.y) / 2,
                       (this.z + v.z) / 2);
  }

  //实现以下的操作
  public void translate(Vertice v) {
    this.x = this.x + v.x;
    this.y = this.y + v.y;
    this.z = this.z + v.z;
  }

  public void translate(double x, double y, double z) {
    this.x = this.x + x;
    this.y = this.y + y;
    this.z = this.z + z;
  }

  public void scale(double times) {
    this.x = this.x * times;
    this.y = this.y * times;
    this.z = this.z * times;
  }

  public Vertice mirror() {
    return new Vertice( -this.x, -this.y, -this.z);
  }

  public void rotate() {}

  private boolean inOrigin() {
    return true;
  }

}

⌨️ 快捷键说明

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