OSDN Git Service

checkstyle対応
[mikutoga/Pmd2XML.git] / src / main / java / jp / sfjp / mikutoga / pmd / model / JointInfo.java
1 /*
2  * joint information
3  *
4  * License : The MIT License
5  * Copyright(c) 2010 MikuToga Partners
6  */
7
8 package jp.sfjp.mikutoga.pmd.model;
9
10 import jp.sfjp.mikutoga.corelib.I18nText;
11 import jp.sfjp.mikutoga.math.MkPos3D;
12 import jp.sfjp.mikutoga.pmd.Deg3d;
13 import jp.sfjp.mikutoga.pmd.Rad3d;
14 import jp.sfjp.mikutoga.pmd.TripletRange;
15
16 /**
17  * 剛体間ジョイント情報。
18  */
19 public class JointInfo {
20
21     private final I18nText jointName = new I18nText();
22
23     private RigidInfo rigidA;
24     private RigidInfo rigidB;
25
26     private final MkPos3D position = new MkPos3D();
27     private final Rad3d rotation = new Rad3d();
28
29     private final MkPos3D elaPosition = new MkPos3D();
30     private final Deg3d elaRotation = new Deg3d();
31
32     private final TripletRange posRange = new TripletRange();
33     private final TripletRange rotRange = new TripletRange();
34
35
36     /**
37      * コンストラクタ。
38      */
39     public JointInfo(){
40         super();
41         return;
42     }
43
44
45     /**
46      * ジョイント名を返す。
47      * @return ジョイント名
48      */
49     public I18nText getJointName(){
50         return this.jointName;
51     }
52
53     /**
54      * 連結剛体Aを返す。
55      * @return 連結剛体A
56      */
57     public RigidInfo getRigidA(){
58         return this.rigidA;
59     }
60
61     /**
62      * 連結剛体Bを返す。
63      * @return 連結剛体B
64      */
65     public RigidInfo getRigidB(){
66         return this.rigidB;
67     }
68
69     /**
70      * 連結する剛体を設定する。
71      * @param rigidAArg 連結剛体A
72      * @param rigidBArg 連結剛体B
73      */
74     public void setRigidPair(RigidInfo rigidAArg, RigidInfo rigidBArg){
75         this.rigidA = rigidAArg;
76         this.rigidB = rigidBArg;
77         return;
78     }
79
80     /**
81      * ジョイントの位置を返す。
82      * @return ジョイントの位置
83      */
84     public MkPos3D getPosition(){
85         return this.position;
86     }
87
88     /**
89      * ジョイントの姿勢を返す。
90      * @return ジョイントの姿勢
91      */
92     public Rad3d getRotation(){
93         return this.rotation;
94     }
95
96     /**
97      * ジョイントのバネ位置を返す。
98      * @return ジョイントのバネ位置
99      */
100     public MkPos3D getElasticPosition(){
101         return this.elaPosition;
102     }
103
104     /**
105      * ジョイントのバネ姿勢を返す。
106      * @return ジョイントのバネ姿勢
107      */
108     public Deg3d getElasticRotation(){
109         return this.elaRotation;
110     }
111
112     /**
113      * ジョイントの位置制約を返す。
114      * @return ジョイントの位置制約
115      */
116     public TripletRange getPositionRange(){
117         return this.posRange;
118     }
119
120     /**
121      * ジョイントの姿勢制約を返す。
122      * @return ジョイントの姿勢制約
123      */
124     public TripletRange getRotationRange(){
125         return this.rotRange;
126     }
127
128     /**
129      * {@inheritDoc}
130      * @return {@inheritDoc}
131      */
132     @Override
133     public String toString(){
134         StringBuilder result = new StringBuilder();
135
136         result.append("Joint ");
137         result.append(this.jointName);
138         result.append("[")
139               .append(this.rigidA.getRigidName())
140               .append("<=>")
141               .append(this.rigidB.getRigidName())
142               .append("] ");
143         result.append(this.position).append(' ');
144         result.append(this.rotation).append(' ');
145
146         result.append("poslim{").append(this.posRange).append("} ");
147         result.append("rotlim{").append(this.rotRange).append("} ");
148
149         result.append("ela:").append(this.elaPosition).append(' ');
150         result.append("ela:").append(this.elaRotation);
151
152         return result.toString();
153     }
154
155 }