OSDN Git Service

modify javadoc format.
[mikutoga/TogaGem.git] / src / main / java / jp / sfjp / mikutoga / math / EulerYXZ.java
1 /*
2  * YXZ Euler rotation
3  *
4  * License : The MIT License
5  * Copyright(c) 2011 MikuToga Partners
6  */
7
8 package jp.sfjp.mikutoga.math;
9
10 /**
11  * YXZオイラー角。
12  * 三次元空間での方向及び姿勢を定義する。
13  *
14  * <p>回転量はラジアンで表される。
15  *
16  * <p>※XYZオイラー角ではない。
17  */
18 public strictfp class EulerYXZ {
19
20     private double xRot;
21     private double yRot;
22     private double zRot;
23
24
25     /**
26      * コンストラクタ。
27      *
28      * <p>三軸とも回転量0の状態になる。
29      */
30     public EulerYXZ(){
31         this(0.0, 0.0, 0.0);
32         return;
33     }
34
35     /**
36      * コンストラクタ。
37      *
38      * @param xRot X軸回転量。(ラジアン)
39      * @param yRot Y軸回転量。(ラジアン)
40      * @param zRot Z軸回転量。(ラジアン)
41      */
42     public EulerYXZ(double xRot, double yRot, double zRot){
43         super();
44         this.xRot = xRot;
45         this.yRot = yRot;
46         this.zRot = zRot;
47         return;
48     }
49
50     /**
51      * X軸回転量を返す。
52      *
53      * @return X軸回転量を返す。(ラジアン)
54      */
55     public double getXRot(){
56         return this.xRot;
57     }
58
59     /**
60      * Y軸回転量を返す。
61      *
62      * @return Y軸回転量を返す。(ラジアン)
63      */
64     public double getYRot(){
65         return this.yRot;
66     }
67
68     /**
69      * Z軸回転量を返す。
70      *
71      * @return Z軸回転量を返す。(ラジアン)
72      */
73     public double getZRot(){
74         return this.zRot;
75     }
76
77     /**
78      * X軸回転量を設定する。
79      *
80      * @param xRotArg X軸回転量。(ラジアン)
81      */
82     public void setXRot(double xRotArg){
83         this.xRot = xRotArg;
84         return;
85     }
86
87     /**
88      * Y軸回転量を設定する。
89      *
90      * @param yRotArg Y軸回転量。(ラジアン)
91      */
92     public void setYRot(double yRotArg){
93         this.yRot = yRotArg;
94         return;
95     }
96
97     /**
98      * Z軸回転量を設定する。
99      *
100      * @param zRotArg Z軸回転量。(ラジアン)
101      */
102     public void setZRot(double zRotArg){
103         this.zRot = zRotArg;
104         return;
105     }
106
107     /**
108      * 三軸の回転量を設定する。
109      *
110      * @param xRotArg X軸回転量。(ラジアン)
111      * @param yRotArg Y軸回転量。(ラジアン)
112      * @param zRotArg Z軸回転量。(ラジアン)
113      */
114     public void setRot(double xRotArg, double yRotArg, double zRotArg){
115         this.xRot = xRotArg;
116         this.yRot = yRotArg;
117         this.zRot = zRotArg;
118         return;
119     }
120
121     /**
122      * パラメータ情報の文字列化。
123      *
124      * @param x x値
125      * @param y y値
126      * @param z z値
127      * @return 文字列
128      */
129     private static String toString(double x, double y, double z){
130         StringBuilder result = new StringBuilder();
131
132         result.append("x=") .append(x);
133         result.append(" y=").append(y);
134         result.append(" z=").append(z);
135
136         return result.toString();
137     }
138
139     /**
140      * {@inheritDoc}
141      * @return {@inheritDoc}
142      */
143     @Override
144     public String toString(){
145         String result;
146         result = toString(this.xRot, this.yRot, this.zRot);
147         return result;
148     }
149
150     /**
151      * 度数法による文字列表現を返す。
152      * @return 文字列表現
153      */
154     public String toDegString(){
155         double xDeg = StrictMath.toDegrees(this.xRot);
156         double yDeg = StrictMath.toDegrees(this.yRot);
157         double zDeg = StrictMath.toDegrees(this.zRot);
158
159         String result;
160         result = toString(xDeg, yDeg, zDeg);
161         return result;
162     }
163
164 }