~hrg/hrg-packaging/openhrp3

« back to all changes in this revision

Viewing changes to server/ModelLoader.old/ModelLoader/SensorInfoFactory.java

  • Committer: nakaoka
  • Date: 2008-07-06 15:26:51 UTC
  • Revision ID: git-v1:fbb3ce756bbcedb021fed5d474b58ef092ea8b42
コンパイルに cmake を使用するようにし、MakefileをCMakeLists.txt で置き換えた。

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package jp.go.aist.hrp.simulator;
2
 
 
3
 
import javax.vecmath.*;
4
 
// VRML97
5
 
import com.sun.j3d.loaders.vrml97.impl.*;
6
 
 
7
 
/**
8
 
 * SensorInfoFactory class
9
 
 * SensorInfo���������륯�饹��
10
 
 * @author K Saito (Kernel Co.,Ltd.)
11
 
 * @version 1.0 (2002/02/25)
12
 
 */
13
 
public abstract class SensorInfoFactory
14
 
{
15
 
    //�ǥե������
16
 
    private double[] relPos_ = {0,0,0};
17
 
    
18
 
    public SensorInfo_impl createSensorInfo(String defName, VrmlSceneEx scene){
19
 
        SensorInfo_impl info = new SensorInfo_impl();
20
 
        info.name_ = defName;
21
 
        
22
 
        info.type_ = getType();
23
 
        
24
 
        info.id_ = ProtoFieldGettor.getIntValue(defName,scene,"sensorId",-1);
25
 
        
26
 
        //set translation value.
27
 
        info.translation_ = ProtoFieldGettor.getVectorValue(defName, scene, "translation",relPos_);
28
 
        
29
 
        //set rotation value.
30
 
        double[] defAxis = {0,0,1,0};
31
 
        AxisAngle4d axisangle4d = new AxisAngle4d(ProtoFieldGettor.getRotationValue(defName, scene, "rotation",defAxis));
32
 
 
33
 
        Matrix4d matrix4d = new Matrix4d();
34
 
        matrix4d.set(axisangle4d);
35
 
        
36
 
        info.rotation_[0] = matrix4d.m00;
37
 
        info.rotation_[1] = matrix4d.m01;
38
 
        info.rotation_[2] = matrix4d.m02;
39
 
        info.rotation_[3] = matrix4d.m10;
40
 
        info.rotation_[4] = matrix4d.m11;
41
 
        info.rotation_[5] = matrix4d.m12;
42
 
        info.rotation_[6] = matrix4d.m20;
43
 
        info.rotation_[7] = matrix4d.m21;
44
 
        info.rotation_[8] = matrix4d.m22;
45
 
 
46
 
        /*
47
 
        Quat4d quat4d = new Quat4d();
48
 
        quat4d.set(axisangle4d);
49
 
        info.relPosAtt_.px = info.translation_[0];
50
 
        info.relPosAtt_.py = info.translation_[1];
51
 
        info.relPosAtt_.pz = info.translation_[2];
52
 
        info.relPosAtt_.qx = quat4d.x;
53
 
        info.relPosAtt_.qy = quat4d.y;
54
 
        info.relPosAtt_.qz = quat4d.z;
55
 
        info.relPosAtt_.qw = quat4d.w;
56
 
        */
57
 
        
58
 
        //set each value.
59
 
        setParam(info,defName,scene);
60
 
        
61
 
        return info;
62
 
    }
63
 
    
64
 
    abstract public void setParam(SensorInfo_impl info,String defName, VrmlSceneEx scene);
65
 
    abstract public SensorType getType();
66
 
}