OSDN Git Service

数学パッケージの整理
authorOlyutorskii <olyutorskii@users.osdn.me>
Wed, 24 Aug 2011 09:11:48 +0000 (18:11 +0900)
committerOlyutorskii <olyutorskii@users.osdn.me>
Wed, 24 Aug 2011 09:11:48 +0000 (18:11 +0900)
18 files changed:
src/main/java/jp/sourceforge/mikutoga/math/MkPos2D.java [moved from src/main/java/jp/sourceforge/mikutoga/pmd/Pos2d.java with 56% similarity]
src/main/java/jp/sourceforge/mikutoga/math/MkPos3D.java
src/main/java/jp/sourceforge/mikutoga/math/MkVec3D.java [moved from src/main/java/jp/sourceforge/mikutoga/pmd/Vec3d.java with 64% similarity]
src/main/java/jp/sourceforge/mikutoga/pmd/Pos3d.java [deleted file]
src/main/java/jp/sourceforge/mikutoga/pmd/model/BoneInfo.java
src/main/java/jp/sourceforge/mikutoga/pmd/model/JointInfo.java
src/main/java/jp/sourceforge/mikutoga/pmd/model/MorphVertex.java
src/main/java/jp/sourceforge/mikutoga/pmd/model/RigidInfo.java
src/main/java/jp/sourceforge/mikutoga/pmd/model/Vertex.java
src/main/java/jp/sourceforge/mikutoga/pmd/model/binio/BoneBuilder.java
src/main/java/jp/sourceforge/mikutoga/pmd/model/binio/JointBuilder.java
src/main/java/jp/sourceforge/mikutoga/pmd/model/binio/MorphBuilder.java
src/main/java/jp/sourceforge/mikutoga/pmd/model/binio/PmdExporterBase.java
src/main/java/jp/sourceforge/mikutoga/pmd/model/binio/PmdExporterExt3.java
src/main/java/jp/sourceforge/mikutoga/pmd/model/binio/RigidBuilder.java
src/main/java/jp/sourceforge/mikutoga/pmd/model/binio/ShapeBuilder.java
src/main/java/jp/sourceforge/mikutoga/pmd/model/xml/PmdXmlExporter.java
src/main/java/jp/sourceforge/mikutoga/pmd/model/xml/Xml2PmdLoader.java

@@ -5,22 +5,24 @@
  * Copyright(c) 2010 MikuToga Partners
  */
 
-package jp.sourceforge.mikutoga.pmd;
+package jp.sourceforge.mikutoga.math;
 
 /**
  * 二次元空間座標及び変量を表す。
+ * <p>直交座標を二つの倍精度値で表す。
+ * <p>主な用途はUVマッピングなど。
  */
-public class Pos2d {
+public class MkPos2D {
 
-    private float xPos;
-    private float yPos;
+    private double xPos;
+    private double yPos;
 
     /**
      * コンストラクタ。
      * [0,0]が設定される
      */
-    public Pos2d(){
-        this(0.0f, 0.0f);
+    public MkPos2D(){
+        this(0.0, 0.0);
         return;
     }
 
@@ -29,7 +31,7 @@ public class Pos2d {
      * @param xPos X座標
      * @param yPos Y座標
      */
-    public Pos2d(float xPos, float yPos){
+    public MkPos2D(double xPos, double yPos){
         super();
         this.xPos = xPos;
         this.yPos = yPos;
@@ -40,7 +42,7 @@ public class Pos2d {
      * X座標を設定する。
      * @param xPos X座標
      */
-    public void setXPos(float xPos){
+    public void setXpos(double xPos){
         this.xPos = xPos;
         return;
     }
@@ -49,7 +51,7 @@ public class Pos2d {
      * X座標を返す。
      * @return X座標
      */
-    public float getXPos(){
+    public double getXpos(){
         return this.xPos;
     }
 
@@ -57,7 +59,7 @@ public class Pos2d {
      * Y座標を設定する。
      * @param yPos Y座標
      */
-    public void setYPos(float yPos){
+    public void setYpos(double yPos){
         this.yPos = yPos;
         return;
     }
@@ -66,11 +68,32 @@ public class Pos2d {
      * Y座標を返す。
      * @return Y座標
      */
-    public float getYPos(){
+    public double getYpos(){
         return this.yPos;
     }
 
     /**
+     * 座標を設定する。
+     * @param xPosArg X軸座標
+     * @param yPosArg Y軸座標
+     */
+    public void setPosition(double xPosArg, double yPosArg){
+        this.xPos = xPosArg;
+        this.yPos = yPosArg;
+        return;
+    }
+
+    /**
+     * この点が原点(0,0)か否か判定する。
+     * @return 原点ならtrue
+     */
+    public boolean isOriginPoint(){
+        if(this.xPos != 0.0) return false;
+        if(this.yPos != 0.0) return false;
+        return true;
+    }
+
+    /**
      * {@inheritDoc}
      * @return {@inheritDoc}
      */
index ba52647..da4cecb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * position
+ * 3D position
  *
  * License : The MIT License
  * Copyright(c) 2011 MikuToga Partners
@@ -5,21 +5,21 @@
  * Copyright(c) 2010 MikuToga Partners
  */
 
-package jp.sourceforge.mikutoga.pmd;
+package jp.sourceforge.mikutoga.math;
 
 /**
  * XYZ三次元ベクトル。
  */
-public class Vec3d {
+public class MkVec3D {
 
-    private float xVal;
-    private float yVal;
-    private float zVal;
+    private double xVal;
+    private double yVal;
+    private double zVal;
 
     /**
      * コンストラクタ。
      */
-    public Vec3d(){
+    public MkVec3D(){
         super();
         return;
     }
@@ -28,7 +28,7 @@ public class Vec3d {
      * X値を設定する。
      * @param xVal X値
      */
-    public void setXVal(float xVal){
+    public void setXVal(double xVal){
         this.xVal = xVal;
         return;
     }
@@ -37,7 +37,7 @@ public class Vec3d {
      * X値を返す。
      * @return X値
      */
-    public float getXVal(){
+    public double getXVal(){
         return this.xVal;
     }
 
@@ -45,7 +45,7 @@ public class Vec3d {
      * Y値を設定する。
      * @param yVal Y値
      */
-    public void setYVal(float yVal){
+    public void setYVal(double yVal){
         this.yVal = yVal;
         return;
     }
@@ -54,7 +54,7 @@ public class Vec3d {
      * Y値を返す。
      * @return Y値
      */
-    public float getYVal(){
+    public double getYVal(){
         return this.yVal;
     }
 
@@ -62,7 +62,7 @@ public class Vec3d {
      * Z値を設定する。
      * @param zVal Z値
      */
-    public void setZVal(float zVal){
+    public void setZVal(double zVal){
         this.zVal = zVal;
         return;
     }
@@ -71,11 +71,24 @@ public class Vec3d {
      * Z値を返す。
      * @return Z値
      */
-    public float getZVal(){
+    public double getZVal(){
         return this.zVal;
     }
 
     /**
+     * ベクトル成分を設定する。
+     * @param xValArg X値
+     * @param yValArg Y値
+     * @param zValArg Z値
+     */
+    public void setVector(double xValArg, double yValArg, double zValArg){
+        this.xVal = xValArg;
+        this.yVal = yValArg;
+        this.zVal = zValArg;
+        return;
+    }
+
+    /**
      * {@inheritDoc}
      * @return {@inheritDoc}
      */
diff --git a/src/main/java/jp/sourceforge/mikutoga/pmd/Pos3d.java b/src/main/java/jp/sourceforge/mikutoga/pmd/Pos3d.java
deleted file mode 100644 (file)
index 12d6afc..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 3D position
- *
- * License : The MIT License
- * Copyright(c) 2010 MikuToga Partners
- */
-
-package jp.sourceforge.mikutoga.pmd;
-
-/**
- * 三次元空間座標及び変量を表す。
- */
-public class Pos3d {
-
-    private float xPos;
-    private float yPos;
-    private float zPos;
-
-    /**
-     * コンストラクタ。
-     * [0,0,0]が設定される。
-     */
-    public Pos3d(){
-        this(0.0f, 0.0f, 0.0f);
-        return;
-    }
-
-    /**
-     * コンストラクタ。
-     * @param xPos X座標
-     * @param yPos Y座標
-     * @param zPos Z座標
-     */
-    public Pos3d(float xPos, float yPos, float zPos){
-        super();
-        this.xPos = xPos;
-        this.yPos = yPos;
-        this.zPos = zPos;
-        return;
-    }
-
-    /**
-     * X座標を設定する。
-     * @param xPos X座標
-     */
-    public void setXPos(float xPos){
-        this.xPos = xPos;
-        return;
-    }
-
-    /**
-     * X座標を返す。
-     * @return X座標
-     */
-    public float getXPos(){
-        return this.xPos;
-    }
-
-    /**
-     * Y座標を設定する。
-     * @param yPos Y座標
-     */
-    public void setYPos(float yPos){
-        this.yPos = yPos;
-        return;
-    }
-
-    /**
-     * Y座標を返す。
-     * @return Y座標
-     */
-    public float getYPos(){
-        return this.yPos;
-    }
-
-    /**
-     * Z座標を設定する。
-     * @param zPos Z座標
-     */
-    public void setZPos(float zPos){
-        this.zPos = zPos;
-        return;
-    }
-
-    /**
-     * Z座標を返す。
-     * @return Z座標
-     */
-    public float getZPos(){
-        return this.zPos;
-    }
-
-    /**
-     * {@inheritDoc}
-     * @return {@inheritDoc}
-     */
-    @Override
-    public String toString(){
-        StringBuilder result = new StringBuilder();
-
-        result.append("pos=[")
-              .append(this.xPos).append(", ")
-              .append(this.yPos).append(", ")
-              .append(this.zPos).append(']');
-
-        return result.toString();
-    }
-
-}
index 35452a8..5f17397 100644 (file)
@@ -8,8 +8,8 @@
 package jp.sourceforge.mikutoga.pmd.model;
 
 import jp.sourceforge.mikutoga.corelib.I18nText;
+import jp.sourceforge.mikutoga.math.MkPos3D;
 import jp.sourceforge.mikutoga.pmd.BoneType;
-import jp.sourceforge.mikutoga.pmd.Pos3d;
 
 /**
  * ボーン情報。
@@ -23,7 +23,7 @@ public class BoneInfo implements SerialNumbered {
     private BoneInfo nextBone;
     private BoneInfo ikBone;
 
-    private final Pos3d position = new Pos3d();
+    private final MkPos3D position = new MkPos3D();
 
     private int rotationRatio;
 
@@ -123,7 +123,7 @@ public class BoneInfo implements SerialNumbered {
      * ボーン位置を返す。
      * @return ボーン位置
      */
-    public Pos3d getPosition(){
+    public MkPos3D getPosition(){
         return this.position;
     }
 
index 76f9f8d..38967ae 100644 (file)
@@ -8,8 +8,8 @@
 package jp.sourceforge.mikutoga.pmd.model;
 
 import jp.sourceforge.mikutoga.corelib.I18nText;
+import jp.sourceforge.mikutoga.math.MkPos3D;
 import jp.sourceforge.mikutoga.pmd.Deg3d;
-import jp.sourceforge.mikutoga.pmd.Pos3d;
 import jp.sourceforge.mikutoga.pmd.Rad3d;
 import jp.sourceforge.mikutoga.pmd.TripletRange;
 
@@ -23,10 +23,10 @@ public class JointInfo {
     private RigidInfo rigidA;
     private RigidInfo rigidB;
 
-    private final Pos3d position = new Pos3d();
+    private final MkPos3D position = new MkPos3D();
     private final Rad3d rotation = new Rad3d();
 
-    private final Pos3d elaPosition = new Pos3d();
+    private final MkPos3D elaPosition = new MkPos3D();
     private final Deg3d elaRotation = new Deg3d();
 
     private final TripletRange posRange = new TripletRange();
@@ -79,7 +79,7 @@ public class JointInfo {
      * ジョイントの位置を返す。
      * @return ジョイントの位置
      */
-    public Pos3d getPosition(){
+    public MkPos3D getPosition(){
         return this.position;
     }
 
@@ -95,7 +95,7 @@ public class JointInfo {
      * ジョイントのバネ位置を返す。
      * @return ジョイントのバネ位置
      */
-    public Pos3d getElasticPosition(){
+    public MkPos3D getElasticPosition(){
         return this.elaPosition;
     }
 
index 0a32e9a..1fd04b7 100644 (file)
@@ -8,7 +8,7 @@
 package jp.sourceforge.mikutoga.pmd.model;
 
 import java.util.Comparator;
-import jp.sourceforge.mikutoga.pmd.Pos3d;
+import jp.sourceforge.mikutoga.math.MkPos3D;
 
 /**
  * モーフアニメーションを構成する個別の頂点移動の情報。
@@ -20,7 +20,7 @@ public class MorphVertex implements SerialNumbered{
             new VertexIdComparator();
 
     private Vertex baseVertex;
-    private final Pos3d offset = new Pos3d();
+    private final MkPos3D offset = new MkPos3D();
 
     private int serialNo = -1;
 
@@ -55,7 +55,7 @@ public class MorphVertex implements SerialNumbered{
      * 頂点移動量を返す。
      * @return 頂点移動量
      */
-    public Pos3d getOffset(){
+    public MkPos3D getOffset(){
         return this.offset;
     }
 
index b196dfd..ff5bd34 100644 (file)
@@ -10,7 +10,7 @@ package jp.sourceforge.mikutoga.pmd.model;
 import java.util.ArrayList;
 import java.util.Collection;
 import jp.sourceforge.mikutoga.corelib.I18nText;
-import jp.sourceforge.mikutoga.pmd.Pos3d;
+import jp.sourceforge.mikutoga.math.MkPos3D;
 import jp.sourceforge.mikutoga.pmd.Rad3d;
 import jp.sourceforge.mikutoga.pmd.RigidBehaviorType;
 
@@ -24,7 +24,7 @@ public class RigidInfo implements SerialNumbered {
     private RigidBehaviorType behaviorType = RigidBehaviorType.FOLLOWBONE;
 
     private final RigidShape rigidShape = new RigidShape();
-    private final Pos3d position = new Pos3d();
+    private final MkPos3D position = new MkPos3D();
     private final Rad3d rotation = new Rad3d();
 
     private BoneInfo linkedBone;
@@ -86,7 +86,7 @@ public class RigidInfo implements SerialNumbered {
      * 剛体位置を返す。
      * @return 剛体位置
      */
-    public Pos3d getPosition(){
+    public MkPos3D getPosition(){
         return this.position;
     }
 
index 0e565eb..7ba6949 100644 (file)
@@ -7,9 +7,9 @@
 
 package jp.sourceforge.mikutoga.pmd.model;
 
-import jp.sourceforge.mikutoga.pmd.Pos2d;
-import jp.sourceforge.mikutoga.pmd.Pos3d;
-import jp.sourceforge.mikutoga.pmd.Vec3d;
+import jp.sourceforge.mikutoga.math.MkPos2D;
+import jp.sourceforge.mikutoga.math.MkPos3D;
+import jp.sourceforge.mikutoga.math.MkVec3D;
 
 /**
  * 頂点情報。
@@ -19,10 +19,10 @@ public class Vertex implements SerialNumbered {
     private static final int MIN_WEIGHT = 0;
     private static final int MAX_WEIGHT = 100;
 
-    private final Pos3d position = new Pos3d();
-    private final Vec3d normal = new Vec3d();
+    private final MkPos3D position = new MkPos3D();
+    private final MkVec3D normal = new MkVec3D();
 
-    private final Pos2d uvPosition = new Pos2d();
+    private final MkPos2D uvPosition = new MkPos2D();
 
     private BoneInfo boneA = null;
     private BoneInfo boneB = null;
@@ -45,7 +45,7 @@ public class Vertex implements SerialNumbered {
      * 頂点位置座標を返す。
      * @return 頂点の位置座標
      */
-    public Pos3d getPosition(){
+    public MkPos3D getPosition(){
         return this.position;
     }
 
@@ -53,7 +53,7 @@ public class Vertex implements SerialNumbered {
      * 法線ベクトルを返す。
      * @return 法線ベクトル
      */
-    public Vec3d getNormal(){
+    public MkVec3D getNormal(){
         return this.normal;
     }
 
@@ -61,7 +61,7 @@ public class Vertex implements SerialNumbered {
      * UVマップ座標を返す。
      * @return UVマップ情報
      */
-    public Pos2d getUVPosition(){
+    public MkPos2D getUVPosition(){
         return this.uvPosition;
     }
 
index 8b50024..c82d97f 100644 (file)
@@ -11,9 +11,9 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import jp.sourceforge.mikutoga.corelib.ListUtil;
+import jp.sourceforge.mikutoga.math.MkPos3D;
 import jp.sourceforge.mikutoga.parser.ParseStage;
 import jp.sourceforge.mikutoga.pmd.BoneType;
-import jp.sourceforge.mikutoga.pmd.Pos3d;
 import jp.sourceforge.mikutoga.pmd.model.BoneGroup;
 import jp.sourceforge.mikutoga.pmd.model.BoneInfo;
 import jp.sourceforge.mikutoga.pmd.model.IKChain;
@@ -225,10 +225,10 @@ class BoneBuilder implements PmdBoneHandler {
      */
     @Override
     public void pmdBonePosition(float xPos, float yPos, float zPos){
-        Pos3d position = this.currentBone.getPosition();
-        position.setXPos(xPos);
-        position.setYPos(yPos);
-        position.setZPos(zPos);
+        MkPos3D position = this.currentBone.getPosition();
+        position.setXpos(xPos);
+        position.setYpos(yPos);
+        position.setZpos(zPos);
         return;
     }
 
index a4531e1..ed4caac 100644 (file)
@@ -10,9 +10,9 @@ package jp.sourceforge.mikutoga.pmd.model.binio;
 import java.util.Iterator;
 import java.util.List;
 import jp.sourceforge.mikutoga.corelib.ListUtil;
+import jp.sourceforge.mikutoga.math.MkPos3D;
 import jp.sourceforge.mikutoga.parser.ParseStage;
 import jp.sourceforge.mikutoga.pmd.Deg3d;
-import jp.sourceforge.mikutoga.pmd.Pos3d;
 import jp.sourceforge.mikutoga.pmd.Rad3d;
 import jp.sourceforge.mikutoga.pmd.TripletRange;
 import jp.sourceforge.mikutoga.pmd.model.JointInfo;
@@ -117,10 +117,10 @@ class JointBuilder implements PmdJointHandler {
      */
     @Override
     public void pmdJointPosition(float posX, float posY, float posZ){
-        Pos3d position = this.currentJoint.getPosition();
-        position.setXPos(posX);
-        position.setYPos(posY);
-        position.setZPos(posZ);
+        MkPos3D position = this.currentJoint.getPosition();
+        position.setXpos(posX);
+        position.setYpos(posY);
+        position.setZpos(posZ);
         return;
     }
 
@@ -189,10 +189,10 @@ class JointBuilder implements PmdJointHandler {
     public void pmdElasticPosition(float elasticPosX,
                                    float elasticPosY,
                                    float elasticPosZ){
-        Pos3d position = this.currentJoint.getElasticPosition();
-        position.setXPos(elasticPosX);
-        position.setYPos(elasticPosY);
-        position.setZPos(elasticPosZ);
+        MkPos3D position = this.currentJoint.getElasticPosition();
+        position.setXpos(elasticPosX);
+        position.setYpos(elasticPosY);
+        position.setZpos(elasticPosZ);
         return;
     }
 
index 725068d..6e8e297 100644 (file)
@@ -13,9 +13,9 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import jp.sourceforge.mikutoga.corelib.ListUtil;
+import jp.sourceforge.mikutoga.math.MkPos3D;
 import jp.sourceforge.mikutoga.parser.ParseStage;
 import jp.sourceforge.mikutoga.pmd.MorphType;
-import jp.sourceforge.mikutoga.pmd.Pos3d;
 import jp.sourceforge.mikutoga.pmd.model.MorphPart;
 import jp.sourceforge.mikutoga.pmd.model.MorphVertex;
 import jp.sourceforge.mikutoga.pmd.model.PmdModel;
@@ -153,10 +153,10 @@ class MorphBuilder implements PmdMorphHandler {
                                    float xPos, float yPos, float zPos){
         MorphVertex morphVertex;
         morphVertex = new MorphVertex();
-        Pos3d position = morphVertex.getOffset();
-        position.setXPos(xPos);
-        position.setYPos(yPos);
-        position.setZPos(zPos);
+        MkPos3D position = morphVertex.getOffset();
+        position.setXpos(xPos);
+        position.setYpos(yPos);
+        position.setZpos(zPos);
 
         Vertex vertex;
         if(this.currentMorphPart.getMorphType().isBase()){
index 416bb81..f4eced9 100644 (file)
@@ -15,11 +15,11 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import jp.sourceforge.mikutoga.math.MkPos2D;
+import jp.sourceforge.mikutoga.math.MkPos3D;
+import jp.sourceforge.mikutoga.math.MkVec3D;
 import jp.sourceforge.mikutoga.pmd.BoneType;
 import jp.sourceforge.mikutoga.pmd.MorphType;
-import jp.sourceforge.mikutoga.pmd.Pos2d;
-import jp.sourceforge.mikutoga.pmd.Pos3d;
-import jp.sourceforge.mikutoga.pmd.Vec3d;
 import jp.sourceforge.mikutoga.pmd.model.BoneGroup;
 import jp.sourceforge.mikutoga.pmd.model.BoneInfo;
 import jp.sourceforge.mikutoga.pmd.model.IKChain;
@@ -220,13 +220,13 @@ public class PmdExporterBase extends AbstractExporter{
      */
     private void dumpVertex(Vertex vertex)
             throws IOException{
-        Pos3d position = vertex.getPosition();
-        dumpPos3d(position);
+        MkPos3D position = vertex.getPosition();
+        dumpPos3D(position);
 
-        Vec3d normal = vertex.getNormal();
-        dumpVec3d(normal);
+        MkVec3D normal = vertex.getNormal();
+        dumpVec3D(normal);
 
-        Pos2d uv = vertex.getUVPosition();
+        MkPos2D uv = vertex.getUVPosition();
         dumpPos2d(uv);
 
         BoneInfo boneA = vertex.getBoneA();
@@ -416,8 +416,8 @@ public class PmdExporterBase extends AbstractExporter{
             else           dumpShort(NOIKBONE_ID);
         }
 
-        Pos3d position = bone.getPosition();
-        dumpPos3d(position);
+        MkPos3D position = bone.getPosition();
+        dumpPos3D(position);
 
         return;
     }
@@ -510,7 +510,7 @@ public class PmdExporterBase extends AbstractExporter{
         for(MorphVertex morphVertex : mergedMorphVertexList){
             Vertex baseVertex = morphVertex.getBaseVertex();
             dumpInt(baseVertex.getSerialNumber());
-            dumpPos3d(baseVertex.getPosition());
+            dumpPos3D(baseVertex.getPosition());
         }
 
         for(MorphType type : typeSet){
@@ -525,7 +525,7 @@ public class PmdExporterBase extends AbstractExporter{
 
                 for(MorphVertex morphVertex : morphVertexList){
                     dumpInt(morphVertex.getSerialNumber());
-                    dumpPos3d(morphVertex.getOffset());
+                    dumpPos3D(morphVertex.getOffset());
                 }
             }
         }
@@ -627,9 +627,9 @@ public class PmdExporterBase extends AbstractExporter{
      * @param position 2次元位置情報
      * @throws IOException 出力エラー
      */
-    protected void dumpPos2d(Pos2d position) throws IOException{
-        float xPos = position.getXPos();
-        float yPos = position.getYPos();
+    protected void dumpPos2d(MkPos2D position) throws IOException{
+        float xPos = (float) position.getXpos();
+        float yPos = (float) position.getYpos();
 
         dumpFloat(xPos);
         dumpFloat(yPos);
@@ -642,10 +642,10 @@ public class PmdExporterBase extends AbstractExporter{
      * @param position 3次元位置情報
      * @throws IOException 出力エラー
      */
-    protected void dumpPos3d(Pos3d position) throws IOException{
-        float xPos = position.getXPos();
-        float yPos = position.getYPos();
-        float zPos = position.getZPos();
+    protected void dumpPos3D(MkPos3D position) throws IOException{
+        float xPos = (float) position.getXpos();
+        float yPos = (float) position.getYpos();
+        float zPos = (float) position.getZpos();
 
         dumpFloat(xPos);
         dumpFloat(yPos);
@@ -659,10 +659,10 @@ public class PmdExporterBase extends AbstractExporter{
      * @param vector 3次元ベクトル
      * @throws IOException 出力エラー
      */
-    protected void dumpVec3d(Vec3d vector) throws IOException{
-        float xVal = vector.getXVal();
-        float yVal = vector.getYVal();
-        float zVal = vector.getZVal();
+    protected void dumpVec3D(MkVec3D vector) throws IOException{
+        float xVal = (float) vector.getXVal();
+        float yVal = (float) vector.getYVal();
+        float zVal = (float) vector.getZVal();
 
         dumpFloat(xVal);
         dumpFloat(yVal);
index f5738f0..2f978ec 100644 (file)
@@ -112,7 +112,7 @@ public class PmdExporterExt3 extends PmdExporterExt2{
 
         dumpRigidShape(rigid.getRigidShape());
 
-        dumpPos3d(rigid.getPosition());
+        dumpPos3D(rigid.getPosition());
         dumpRad3d(rigid.getRotation());
 
         dumpDynamics(rigid.getDynamicsInfo());
@@ -203,13 +203,13 @@ public class PmdExporterExt3 extends PmdExporterExt2{
         dumpInt(rigidA.getSerialNumber());
         dumpInt(rigidB.getSerialNumber());
 
-        dumpPos3d(joint.getPosition());
+        dumpPos3D(joint.getPosition());
         dumpRad3d(joint.getRotation());
 
         dumpTripletRange(joint.getPositionRange());
         dumpTripletRange(joint.getRotationRange());
 
-        dumpPos3d(joint.getElasticPosition());
+        dumpPos3D(joint.getElasticPosition());
         dumpDeg3d(joint.getElasticRotation());
 
         return;
index efccc62..3859c45 100644 (file)
@@ -10,8 +10,8 @@ package jp.sourceforge.mikutoga.pmd.model.binio;
 import java.util.Iterator;
 import java.util.List;
 import jp.sourceforge.mikutoga.corelib.ListUtil;
+import jp.sourceforge.mikutoga.math.MkPos3D;
 import jp.sourceforge.mikutoga.parser.ParseStage;
-import jp.sourceforge.mikutoga.pmd.Pos3d;
 import jp.sourceforge.mikutoga.pmd.Rad3d;
 import jp.sourceforge.mikutoga.pmd.RigidBehaviorType;
 import jp.sourceforge.mikutoga.pmd.RigidShapeType;
@@ -155,10 +155,10 @@ class RigidBuilder implements PmdRigidHandler {
      */
     @Override
     public void pmdRigidPosition(float posX, float posY, float posZ){
-        Pos3d position = this.currentRigid.getPosition();
-        position.setXPos(posX);
-        position.setYPos(posY);
-        position.setZPos(posZ);
+        MkPos3D position = this.currentRigid.getPosition();
+        position.setXpos(posX);
+        position.setYpos(posY);
+        position.setZpos(posZ);
         return;
     }
 
index 8a0c119..3bef415 100644 (file)
@@ -11,10 +11,10 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.RandomAccess;
 import jp.sourceforge.mikutoga.corelib.ListUtil;
+import jp.sourceforge.mikutoga.math.MkPos2D;
+import jp.sourceforge.mikutoga.math.MkPos3D;
+import jp.sourceforge.mikutoga.math.MkVec3D;
 import jp.sourceforge.mikutoga.parser.ParseStage;
-import jp.sourceforge.mikutoga.pmd.Pos2d;
-import jp.sourceforge.mikutoga.pmd.Pos3d;
-import jp.sourceforge.mikutoga.pmd.Vec3d;
 import jp.sourceforge.mikutoga.pmd.model.BoneInfo;
 import jp.sourceforge.mikutoga.pmd.model.PmdModel;
 import jp.sourceforge.mikutoga.pmd.model.Surface;
@@ -140,10 +140,10 @@ class ShapeBuilder implements PmdShapeHandler {
      */
     @Override
     public void pmdVertexPosition(float xPos, float yPos, float zPos){
-        Pos3d position = this.currentVertex.getPosition();
-        position.setXPos(xPos);
-        position.setYPos(yPos);
-        position.setZPos(zPos);
+        MkPos3D position = this.currentVertex.getPosition();
+        position.setXpos(xPos);
+        position.setYpos(yPos);
+        position.setZpos(zPos);
         return;
     }
 
@@ -155,7 +155,7 @@ class ShapeBuilder implements PmdShapeHandler {
      */
     @Override
     public void pmdVertexNormal(float xVec, float yVec, float zVec){
-        Vec3d normal = this.currentVertex.getNormal();
+        MkVec3D normal = this.currentVertex.getNormal();
         normal.setXVal(xVec);
         normal.setYVal(yVec);
         normal.setZVal(zVec);
@@ -169,9 +169,9 @@ class ShapeBuilder implements PmdShapeHandler {
      */
     @Override
     public void pmdVertexUV(float uVal, float vVal){
-        Pos2d uv = this.currentVertex.getUVPosition();
-        uv.setXPos(uVal);
-        uv.setYPos(vVal);
+        MkPos2D uv = this.currentVertex.getUVPosition();
+        uv.setXpos(uVal);
+        uv.setYpos(vVal);
         return;
     }
 
index 3cd685a..2fe76b5 100644 (file)
@@ -13,15 +13,15 @@ import java.io.OutputStream;
 import java.util.List;
 import java.util.Map;
 import jp.sourceforge.mikutoga.corelib.I18nText;
+import jp.sourceforge.mikutoga.math.MkPos2D;
+import jp.sourceforge.mikutoga.math.MkPos3D;
+import jp.sourceforge.mikutoga.math.MkVec3D;
 import jp.sourceforge.mikutoga.pmd.BoneType;
 import jp.sourceforge.mikutoga.pmd.Deg3d;
 import jp.sourceforge.mikutoga.pmd.MorphType;
-import jp.sourceforge.mikutoga.pmd.Pos2d;
-import jp.sourceforge.mikutoga.pmd.Pos3d;
 import jp.sourceforge.mikutoga.pmd.Rad3d;
 import jp.sourceforge.mikutoga.pmd.RigidShapeType;
 import jp.sourceforge.mikutoga.pmd.TripletRange;
-import jp.sourceforge.mikutoga.pmd.Vec3d;
 import jp.sourceforge.mikutoga.pmd.model.BoneGroup;
 import jp.sourceforge.mikutoga.pmd.model.BoneInfo;
 import jp.sourceforge.mikutoga.pmd.model.DynamicsInfo;
@@ -217,11 +217,12 @@ public class PmdXmlExporter extends BasicXmlExporter{
      * @return this本体
      * @throws IOException 出力エラー
      */
-    protected PmdXmlExporter putPosition(Pos3d position) throws IOException{
+    protected PmdXmlExporter putPosition(MkPos3D position)
+            throws IOException{
         put("<position ");
-        putFloatAttr("x", position.getXPos()).put(' ');
-        putFloatAttr("y", position.getYPos()).put(' ');
-        putFloatAttr("z", position.getZPos()).put(' ');
+        putFloatAttr("x", (float) position.getXpos()).put(' ');
+        putFloatAttr("y", (float) position.getYpos()).put(' ');
+        putFloatAttr("z", (float) position.getZpos()).put(' ');
         put("/>");
         return this;
     }
@@ -704,20 +705,20 @@ public class PmdXmlExporter extends BasicXmlExporter{
         put(">").ln();
         pushNest();
 
-        Pos3d position = vertex.getPosition();
+        MkPos3D position = vertex.getPosition();
         ind().putPosition(position).ln();
 
-        Vec3d normal = vertex.getNormal();
+        MkVec3D normal = vertex.getNormal();
         ind().put("<normal ");
-        putFloatAttr("x", normal.getXVal()).put(' ');
-        putFloatAttr("y", normal.getYVal()).put(' ');
-        putFloatAttr("z", normal.getZVal()).put(' ');
+        putFloatAttr("x", (float) normal.getXVal()).put(' ');
+        putFloatAttr("y", (float) normal.getYVal()).put(' ');
+        putFloatAttr("z", (float) normal.getZVal()).put(' ');
         put("/>").ln();
 
-        Pos2d uvPos = vertex.getUVPosition();
+        MkPos2D uvPos = vertex.getUVPosition();
         ind().put("<uvMap ");
-        putFloatAttr("u", uvPos.getXPos()).put(' ');
-        putFloatAttr("v", uvPos.getYPos()).put(' ');
+        putFloatAttr("u", (float) uvPos.getXpos()).put(' ');
+        putFloatAttr("v", (float) uvPos.getYpos()).put(' ');
         put("/>").ln();
 
         BoneInfo boneA = vertex.getBoneA();
@@ -779,7 +780,7 @@ public class PmdXmlExporter extends BasicXmlExporter{
 
         putI18nName(i18nName);
 
-        Pos3d position = bone.getPosition();
+        MkPos3D position = bone.getPosition();
         ind().putPosition(position).ln();
 
         BoneInfo ikBone = bone.getIKBone();
@@ -986,14 +987,14 @@ public class PmdXmlExporter extends BasicXmlExporter{
         putI18nName(i18nName);
 
         for(MorphVertex mvertex : part){
-            Pos3d offset = mvertex.getOffset();
+            MkPos3D offset = mvertex.getOffset();
             Vertex base = mvertex.getBaseVertex();
 
             ind().put("<morphVertex ");
             putNumberedIdAttr("vtxIdRef", PFX_VERTEX, base).put(' ');
-            putFloatAttr("xOff", offset.getXPos()).put(' ');
-            putFloatAttr("yOff", offset.getYPos()).put(' ');
-            putFloatAttr("zOff", offset.getZPos()).put(' ');
+            putFloatAttr("xOff", (float) offset.getXpos()).put(' ');
+            putFloatAttr("yOff", (float) offset.getYpos()).put(' ');
+            putFloatAttr("zOff", (float) offset.getZpos()).put(' ');
             put("/>");
             ln();
         }
@@ -1060,7 +1061,7 @@ public class PmdXmlExporter extends BasicXmlExporter{
         RigidShape shape = rigid.getRigidShape();
         putRigidShape(shape);
 
-        Pos3d position = rigid.getPosition();
+        MkPos3D position = rigid.getPosition();
         ind().putPosition(position).ln();
 
         Rad3d rotation = rigid.getRotation();
@@ -1235,7 +1236,7 @@ public class PmdXmlExporter extends BasicXmlExporter{
                 + " <=> [" + rigidB.getRigidName().getText() + "]");
         ln(2);
 
-        Pos3d position = joint.getPosition();
+        MkPos3D position = joint.getPosition();
         ind().putPosition(position).ln();
 
         TripletRange posRange = joint.getPositionRange();
@@ -1270,11 +1271,11 @@ public class PmdXmlExporter extends BasicXmlExporter{
         popNest();
         ind().put("/>").ln(2);
 
-        Pos3d elaPosition = joint.getElasticPosition();
+        MkPos3D elaPosition = joint.getElasticPosition();
         ind().put("<elasticPosition ");
-        putFloatAttr("x", elaPosition.getXPos()).put(' ');
-        putFloatAttr("y", elaPosition.getYPos()).put(' ');
-        putFloatAttr("z", elaPosition.getZPos()).put(' ');
+        putFloatAttr("x", (float) elaPosition.getXpos()).put(' ');
+        putFloatAttr("y", (float) elaPosition.getYpos()).put(' ');
+        putFloatAttr("z", (float) elaPosition.getZpos()).put(' ');
         put("/>").ln();
 
         Deg3d elaRotation = joint.getElasticRotation();
index 87e0395..452d9e4 100644 (file)
@@ -17,16 +17,16 @@ import java.util.Map;
 import javax.xml.parsers.DocumentBuilder;
 import jp.sourceforge.mikutoga.corelib.I18nText;
 import jp.sourceforge.mikutoga.corelib.ListUtil;
+import jp.sourceforge.mikutoga.math.MkPos2D;
+import jp.sourceforge.mikutoga.math.MkPos3D;
+import jp.sourceforge.mikutoga.math.MkVec3D;
 import jp.sourceforge.mikutoga.pmd.BoneType;
 import jp.sourceforge.mikutoga.pmd.Deg3d;
 import jp.sourceforge.mikutoga.pmd.MorphType;
-import jp.sourceforge.mikutoga.pmd.Pos2d;
-import jp.sourceforge.mikutoga.pmd.Pos3d;
 import jp.sourceforge.mikutoga.pmd.Rad3d;
 import jp.sourceforge.mikutoga.pmd.RigidBehaviorType;
 import jp.sourceforge.mikutoga.pmd.RigidShapeType;
 import jp.sourceforge.mikutoga.pmd.TripletRange;
-import jp.sourceforge.mikutoga.pmd.Vec3d;
 import jp.sourceforge.mikutoga.pmd.model.BoneGroup;
 import jp.sourceforge.mikutoga.pmd.model.BoneInfo;
 import jp.sourceforge.mikutoga.pmd.model.DynamicsInfo;
@@ -375,10 +375,10 @@ public class Xml2PmdLoader {
             float xPos = getFloatAttr(positionElem, "x");
             float yPos = getFloatAttr(positionElem, "y");
             float zPos = getFloatAttr(positionElem, "z");
-            Pos3d position = boneInfo.getPosition();
-            position.setXPos(xPos);
-            position.setYPos(yPos);
-            position.setZPos(zPos);
+            MkPos3D position = boneInfo.getPosition();
+            position.setXpos(xPos);
+            position.setYpos(yPos);
+            position.setZpos(zPos);
         }
 
         ListUtil.assignIndexedSerial(boneList);
@@ -438,16 +438,16 @@ public class Xml2PmdLoader {
             xVal = getFloatAttr(positionElem, "x");
             yVal = getFloatAttr(positionElem, "y");
             zVal = getFloatAttr(positionElem, "z");
-            Pos3d position = vertex.getPosition();
-            position.setXPos(xVal);
-            position.setYPos(yVal);
-            position.setZPos(zVal);
+            MkPos3D position = vertex.getPosition();
+            position.setXpos(xVal);
+            position.setYpos(yVal);
+            position.setZpos(zVal);
 
             Element normalElem = getChild(vertexElem, "normal");
             xVal = getFloatAttr(normalElem, "x");
             yVal = getFloatAttr(normalElem, "y");
             zVal = getFloatAttr(normalElem, "z");
-            Vec3d normal = vertex.getNormal();
+            MkVec3D normal = vertex.getNormal();
             normal.setXVal(xVal);
             normal.setYVal(yVal);
             normal.setZVal(zVal);
@@ -455,9 +455,9 @@ public class Xml2PmdLoader {
             Element uvElem = getChild(vertexElem, "uvMap");
             float uVal = getFloatAttr(uvElem, "u");
             float vVal = getFloatAttr(uvElem, "v");
-            Pos2d uv = vertex.getUVPosition();
-            uv.setXPos(uVal);
-            uv.setYPos(vVal);
+            MkPos2D uv = vertex.getUVPosition();
+            uv.setXpos(uVal);
+            uv.setYpos(vVal);
 
             Element skinningElem = getChild(vertexElem, "skinning");
             String boneId1 = getStringAttr(skinningElem, "boneIdRef1");
@@ -659,10 +659,10 @@ public class Xml2PmdLoader {
 
                 MorphVertex morphVertex = new MorphVertex();
                 morphVertex.setBaseVertex(baseVertex);
-                Pos3d position = morphVertex.getOffset();
-                position.setXPos(xOff);
-                position.setYPos(yOff);
-                position.setZPos(zOff);
+                MkPos3D position = morphVertex.getOffset();
+                position.setXpos(xOff);
+                position.setYpos(yOff);
+                position.setZpos(zOff);
 
                 morphVertexList.add(morphVertex);
             }
@@ -786,10 +786,10 @@ public class Xml2PmdLoader {
             xVal = getFloatAttr(positionElem, "x");
             yVal = getFloatAttr(positionElem, "y");
             zVal = getFloatAttr(positionElem, "z");
-            Pos3d position = rigid.getPosition();
-            position.setXPos(xVal);
-            position.setYPos(yVal);
-            position.setZPos(zVal);
+            MkPos3D position = rigid.getPosition();
+            position.setXpos(xVal);
+            position.setYpos(yVal);
+            position.setZpos(zVal);
 
             Element radRotationElem = getChild(rigidElem, "radRotation");
             xVal = getFloatAttr(radRotationElem, "xRad");
@@ -908,14 +908,14 @@ public class Xml2PmdLoader {
             float zFrom;
             float zTo;
 
-            Pos3d position = joint.getPosition();
+            MkPos3D position = joint.getPosition();
             Element positionElem = getChild(jointElem, "position");
             xVal = getFloatAttr(positionElem, "x");
             yVal = getFloatAttr(positionElem, "y");
             zVal = getFloatAttr(positionElem, "z");
-            position.setXPos(xVal);
-            position.setYPos(yVal);
-            position.setZPos(zVal);
+            position.setXpos(xVal);
+            position.setYpos(yVal);
+            position.setZpos(zVal);
 
             TripletRange limitPosition = joint.getPositionRange();
             Element limitPositionElem = getChild(jointElem, "limitPosition");
@@ -950,15 +950,15 @@ public class Xml2PmdLoader {
             limitRotation.setYRange(yFrom, yTo);
             limitRotation.setZRange(zFrom, zTo);
 
-            Pos3d elasticPosition = joint.getElasticPosition();
+            MkPos3D elasticPosition = joint.getElasticPosition();
             Element elasticPositionElem =
                     getChild(jointElem, "elasticPosition");
             xVal = getFloatAttr(elasticPositionElem, "x");
             yVal = getFloatAttr(elasticPositionElem, "y");
             zVal = getFloatAttr(elasticPositionElem, "z");
-            elasticPosition.setXPos(xVal);
-            elasticPosition.setYPos(yVal);
-            elasticPosition.setZPos(zVal);
+            elasticPosition.setXpos(xVal);
+            elasticPosition.setYpos(yVal);
+            elasticPosition.setZpos(zVal);
 
             Deg3d elasticRotation = joint.getElasticRotation();
             Element elasticRotationElem =