OSDN Git Service

テストセット整備
[mikutoga/Pmd2XML.git] / src / main / java / jp / sourceforge / 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.sourceforge.mikutoga.pmd.model;
9
10 import jp.sourceforge.mikutoga.corelib.I18nText;
11 import jp.sourceforge.mikutoga.math.MkPos3D;
12 import jp.sourceforge.mikutoga.pmd.Deg3d;
13 import jp.sourceforge.mikutoga.pmd.Rad3d;
14 import jp.sourceforge.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     public JointInfo(){
39         super();
40         return;
41     }
42
43     /**
44      * ジョイント名を返す。
45      * @return ジョイント名
46      */
47     public I18nText getJointName(){
48         return this.jointName;
49     }
50
51     /**
52      * 連結剛体Aを返す。
53      * @return 連結剛体A
54      */
55     public RigidInfo getRigidA(){
56         return this.rigidA;
57     }
58
59     /**
60      * 連結剛体Bを返す。
61      * @return 連結剛体B
62      */
63     public RigidInfo getRigidB(){
64         return this.rigidB;
65     }
66
67     /**
68      * 連結する剛体を設定する。
69      * @param rigidA 連結剛体A
70      * @param rigidB 連結剛体B
71      */
72     public void setRigidPair(RigidInfo rigidA, RigidInfo rigidB){
73         this.rigidA = rigidA;
74         this.rigidB = rigidB;
75         return;
76     }
77
78     /**
79      * ジョイントの位置を返す。
80      * @return ジョイントの位置
81      */
82     public MkPos3D getPosition(){
83         return this.position;
84     }
85
86     /**
87      * ジョイントの姿勢を返す。
88      * @return ジョイントの姿勢
89      */
90     public Rad3d getRotation(){
91         return this.rotation;
92     }
93
94     /**
95      * ジョイントのバネ位置を返す。
96      * @return ジョイントのバネ位置
97      */
98     public MkPos3D getElasticPosition(){
99         return this.elaPosition;
100     }
101
102     /**
103      * ジョイントのバネ姿勢を返す。
104      * @return ジョイントのバネ姿勢
105      */
106     public Deg3d getElasticRotation(){
107         return this.elaRotation;
108     }
109
110     /**
111      * ジョイントの位置制約を返す。
112      * @return ジョイントの位置制約
113      */
114     public TripletRange getPositionRange(){
115         return this.posRange;
116     }
117
118     /**
119      * ジョイントの姿勢制約を返す。
120      * @return ジョイントの姿勢制約
121      */
122     public TripletRange getRotationRange(){
123         return this.rotRange;
124     }
125
126     /**
127      * {@inheritDoc}
128      * @return {@inheritDoc}
129      */
130     @Override
131     public String toString(){
132         StringBuilder result = new StringBuilder();
133
134         result.append("Joint ");
135         result.append(this.jointName);
136         result.append("[")
137               .append(this.rigidA.getRigidName())
138               .append("<=>")
139               .append(this.rigidB.getRigidName())
140               .append("] ");
141         result.append(this.position).append(' ');
142         result.append(this.rotation).append(' ');
143
144         result.append("poslim{").append(this.posRange).append("} ");
145         result.append("rotlim{").append(this.rotRange).append("} ");
146
147         result.append("ela:").append(this.elaPosition).append(' ');
148         result.append("ela:").append(this.elaRotation);
149
150         return result.toString();
151     }
152
153 }