4 * License : The MIT License
5 * Copyright(c) 2011 MikuToga Partners
8 package jp.sourceforge.mikutoga.vmd.model;
10 import jp.sourceforge.mikutoga.math.MkPos3D;
11 import jp.sourceforge.mikutoga.math.MkQuat;
12 import jp.sourceforge.mikutoga.vmd.AbstractNumbered;
16 * <p>ボーン名、ボーン位置、ボーン回転量、及び補間カーブ情報を持つ。
18 public class BoneMotion extends AbstractNumbered {
20 private String boneName;
22 private final MkQuat rotation = new MkQuat();
23 private final BezierParam intpltRotation = new BezierParam();
25 private final MkPos3D position = new MkPos3D();
26 private final PosCurve posCurve = new PosCurve();
42 public String getBoneName(){
48 * @param boneName ボーン名
50 public void setBoneName(String boneName){
51 this.boneName = boneName;
59 public MkQuat getRotation(){
65 * @return ボーン回転の補間曲線情報
67 public BezierParam getIntpltRotation(){
68 return this.intpltRotation;
75 public MkPos3D getPosition(){
81 * @return ボーン位置移動の補間情報
83 public PosCurve getPosCurve(){
88 * このモーションが暗黙の位置情報を持つか判定する。
89 * <p>ボーン位置が原点(0,0,0)にあり、
90 * XYZ3軸の移動補間カーブがデフォルト直線補間の場合、
92 * <p>MMDは、位置情報を持たないボーンのモーションに対し
93 * 便宜的にこの暗黙の位置情報を割り当てる。
94 * <p>通常の位置モーションが暗黙の位置情報と一致する場合もありうる。
95 * @return 暗黙の位置情報であるならtrue
97 public boolean hasImplicitPosition(){
98 if(this.position.isOriginPoint() && this.posCurve.isDefaultLinear()){
106 * @return {@inheritDoc}
109 public String toString(){
110 StringBuilder result = new StringBuilder();
112 result.append("bone name : [").append(this.boneName);
113 result.append("] #").append(getFrameNumber()).append('\n');
115 result.append("rotation ").append(this.rotation);
116 result.append(" R-Bezier ").append(this.intpltRotation).append('\n');
118 result.append("position ").append(this.position).append('\n');
119 result.append(this.posCurve);
121 return result.toString();