OSDN Git Service

パッケージ変更。テスト整備。
[mikutoga/TogaGem.git] / src / main / java / jp / sfjp / mikutoga / math / EulerYXZ.java
@@ -5,7 +5,7 @@
  * Copyright(c) 2011 MikuToga Partners
  */
 
-package jp.sourceforge.mikutoga.math;
+package jp.sfjp.mikutoga.math;
 
 /**
  * YXZオイラー角。
@@ -69,58 +69,84 @@ public strictfp class EulerYXZ {
 
     /**
      * X軸回転量を設定する。
-     * @param xRot X軸回転量。(ラジアン)
+     * @param xRotArg X軸回転量。(ラジアン)
      */
-    public void setXRot(double xRot){
-        this.xRot = xRot;
+    public void setXRot(double xRotArg){
+        this.xRot = xRotArg;
         return;
     }
 
     /**
      * Y軸回転量を設定する。
-     * @param yRot Y軸回転量。(ラジアン)
+     * @param yRotArg Y軸回転量。(ラジアン)
      */
-    public void setYRot(double yRot){
-        this.yRot = yRot;
+    public void setYRot(double yRotArg){
+        this.yRot = yRotArg;
         return;
     }
 
     /**
      * Z軸回転量を設定する。
-     * @param zRot Z軸回転量。(ラジアン)
+     * @param zRotArg Z軸回転量。(ラジアン)
      */
-    public void setZRot(double zRot){
-        this.zRot = zRot;
+    public void setZRot(double zRotArg){
+        this.zRot = zRotArg;
         return;
     }
 
     /**
-     * {@inheritDoc}
-     * @return {@inheritDoc}
+     * 三軸の回転量を設定する。
+     * @param xRotArg X軸回転量。(ラジアン)
+     * @param yRotArg Y軸回転量。(ラジアン)
+     * @param zRotArg Z軸回転量。(ラジアン)
      */
-    @Override
-    public String toString(){
+    public void setRot(double xRotArg, double yRotArg, double zRotArg){
+        this.xRot = xRotArg;
+        this.yRot = yRotArg;
+        this.zRot = zRotArg;
+        return;
+    }
+
+    /**
+     * パラメータ情報の文字列化。
+     * @param x x値
+     * @param y y値
+     * @param z z値
+     * @return 文字列
+     */
+    private static String toString(double x, double y, double z){
         StringBuilder result = new StringBuilder();
 
-        result.append("x=") .append(this.xRot);
-        result.append(" y=").append(this.yRot);
-        result.append(" z=").append(this.zRot);
+        result.append("x=") .append(x);
+        result.append(" y=").append(y);
+        result.append(" z=").append(z);
 
         return result.toString();
     }
 
     /**
+     * {@inheritDoc}
+     * @return {@inheritDoc}
+     */
+    @Override
+    public String toString(){
+        String result;
+        result = toString(this.xRot, this.yRot, this.zRot);
+        return result;
+    }
+
+    /**
      * 度数法による文字列表現を返す。
      * @return 文字列表現
      */
     public String toDegString(){
-        StringBuilder result = new StringBuilder();
-
-        result.append("x=") .append(StrictMath.toDegrees(this.xRot));
-        result.append(" y=").append(StrictMath.toDegrees(this.yRot));
-        result.append(" z=").append(StrictMath.toDegrees(this.zRot));
+        double xDeg = StrictMath.toDegrees(this.xRot);
+        double yDeg = StrictMath.toDegrees(this.yRot);
+        double zDeg = StrictMath.toDegrees(this.zRot);
 
-        return result.toString();
+        String result;
+        result = toString(xDeg, yDeg, zDeg);
+        return result;
     }
 
 }