1
package jp.go.aist.hrp.simulator;
3
import javax.vecmath.*;
5
import com.sun.j3d.loaders.vrml97.impl.*;
8
* SensorInfoFactory class
9
* SensorInfo���������륯�饹��
10
* @author K Saito (Kernel Co.,Ltd.)
11
* @version 1.0 (2002/02/25)
13
public abstract class SensorInfoFactory
16
private double[] relPos_ = {0,0,0};
18
public SensorInfo_impl createSensorInfo(String defName, VrmlSceneEx scene){
19
SensorInfo_impl info = new SensorInfo_impl();
22
info.type_ = getType();
24
info.id_ = ProtoFieldGettor.getIntValue(defName,scene,"sensorId",-1);
26
//set translation value.
27
info.translation_ = ProtoFieldGettor.getVectorValue(defName, scene, "translation",relPos_);
30
double[] defAxis = {0,0,1,0};
31
AxisAngle4d axisangle4d = new AxisAngle4d(ProtoFieldGettor.getRotationValue(defName, scene, "rotation",defAxis));
33
Matrix4d matrix4d = new Matrix4d();
34
matrix4d.set(axisangle4d);
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;
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;
59
setParam(info,defName,scene);
64
abstract public void setParam(SensorInfo_impl info,String defName, VrmlSceneEx scene);
65
abstract public SensorType getType();