OSDN Git Service

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