publish
This commit is contained in:
parent
f38388896d
commit
2f62a1a123
67 changed files with 4545 additions and 0 deletions
133
Roboter_Demo/roboter_demo/Hand.java
Normal file
133
Roboter_Demo/roboter_demo/Hand.java
Normal file
|
@ -0,0 +1,133 @@
|
|||
package roboter_demo;
|
||||
|
||||
import com.sun.j3d.utils.geometry.Box;
|
||||
import javax.media.j3d.Appearance;
|
||||
import javax.media.j3d.BranchGroup;
|
||||
import javax.media.j3d.Material;
|
||||
import javax.media.j3d.Node;
|
||||
import javax.media.j3d.Transform3D;
|
||||
import javax.media.j3d.TransformGroup;
|
||||
import javax.vecmath.Vector3d;
|
||||
|
||||
class Hand {
|
||||
private final float mWidth = 0.25F;
|
||||
|
||||
private final float mScale = 1.0F;
|
||||
|
||||
private final float mThumbWitdh = 0.025F;
|
||||
|
||||
private BranchGroup mBrGrp = new BranchGroup();
|
||||
|
||||
private TransformGroup mTfGrp = new TransformGroup();
|
||||
|
||||
private TransformGroup mThumbTfGrp = new TransformGroup();
|
||||
|
||||
private TransformGroup mFingersTfGrp = new TransformGroup();
|
||||
|
||||
private double mSpan;
|
||||
|
||||
private double mAngle;
|
||||
|
||||
private Vector3d mVec = new Vector3d();
|
||||
|
||||
private Transform3D mTrnTf = new Transform3D();
|
||||
|
||||
private Transform3D mRotTf = new Transform3D();
|
||||
|
||||
public BranchGroup getBrGrp() {
|
||||
return this.mBrGrp;
|
||||
}
|
||||
|
||||
public Hand() {
|
||||
Box box1 = new Box(0.125F, 0.125F, 0.125F, 1, null);
|
||||
Box box2 = new Box(0.0125F, 0.125F, 0.125F, 1, null);
|
||||
Box box3 = new Box(0.0125F, 0.125F, 0.125F, 1, null);
|
||||
TransformGroup transformGroup = new TransformGroup();
|
||||
Vector3d vector3d = new Vector3d();
|
||||
Transform3D transform3D = new Transform3D();
|
||||
Material material1 = new Material();
|
||||
Material material2 = new Material();
|
||||
Appearance appearance1 = new Appearance();
|
||||
Appearance appearance2 = new Appearance();
|
||||
this.mSpan = 0.25D;
|
||||
this.mAngle = 0.0D;
|
||||
transformGroup.addChild((Node)box1);
|
||||
this.mThumbTfGrp.addChild((Node)box2);
|
||||
this.mFingersTfGrp.addChild((Node)box3);
|
||||
this.mTfGrp.addChild((Node)transformGroup);
|
||||
this.mTfGrp.addChild((Node)this.mThumbTfGrp);
|
||||
this.mTfGrp.addChild((Node)this.mFingersTfGrp);
|
||||
this.mBrGrp.addChild((Node)this.mTfGrp);
|
||||
moveThumbAndFingers(this.mSpan);
|
||||
rotateHand(0.0D);
|
||||
material1.setDiffuseColor(0.0F, 1.0F, 1.0F);
|
||||
material1.setAmbientColor(0.0F, 0.4F, 0.4F);
|
||||
appearance1.setMaterial(material1);
|
||||
box1.setAppearance(appearance1);
|
||||
material2.setDiffuseColor(1.0F, 1.0F, 0.0F);
|
||||
material2.setAmbientColor(0.4F, 0.4F, 0.0F);
|
||||
appearance2.setMaterial(material2);
|
||||
box2.setAppearance(appearance2);
|
||||
box3.setAppearance(appearance2);
|
||||
this.mTfGrp.setCapability(18);
|
||||
this.mThumbTfGrp.setCapability(18);
|
||||
this.mFingersTfGrp.setCapability(18);
|
||||
this.mBrGrp.compile();
|
||||
}
|
||||
|
||||
public void moveThumbAndFingers(double paramDouble) {
|
||||
this.mVec.set(-paramDouble / 2.0D, 0.25D, 0.0D);
|
||||
this.mTrnTf.set(this.mVec);
|
||||
this.mThumbTfGrp.setTransform(this.mTrnTf);
|
||||
this.mVec.set(paramDouble / 2.0D, 0.25D, 0.0D);
|
||||
this.mTrnTf.set(this.mVec);
|
||||
this.mFingersTfGrp.setTransform(this.mTrnTf);
|
||||
}
|
||||
|
||||
public void incHandSpan() {
|
||||
if (this.mSpan < 0.25D)
|
||||
this.mSpan += 0.01D;
|
||||
moveThumbAndFingers(this.mSpan);
|
||||
}
|
||||
|
||||
public void incHandSpan(double paramDouble) {
|
||||
this.mSpan += paramDouble;
|
||||
if (this.mSpan <= 0.02500000037252903D)
|
||||
this.mSpan = 0.02500000037252903D;
|
||||
if (this.mSpan >= 0.25D)
|
||||
this.mSpan = 0.25D;
|
||||
moveThumbAndFingers(this.mSpan);
|
||||
}
|
||||
|
||||
public void decHandSpan() {
|
||||
if (this.mSpan > 0.02500000037252903D)
|
||||
this.mSpan -= 0.01D;
|
||||
moveThumbAndFingers(this.mSpan);
|
||||
}
|
||||
|
||||
public void rotateHand(double paramDouble) {
|
||||
this.mRotTf.rotX(paramDouble);
|
||||
this.mTfGrp.setTransform(this.mRotTf);
|
||||
}
|
||||
|
||||
public void incHandAngle() {
|
||||
this.mAngle += 0.02D;
|
||||
rotateHand(this.mAngle);
|
||||
}
|
||||
|
||||
public void incHandAngle(double paramDouble) {
|
||||
this.mAngle += paramDouble;
|
||||
rotateHand(this.mAngle);
|
||||
}
|
||||
|
||||
public void decHandAngle() {
|
||||
this.mAngle -= 0.02D;
|
||||
rotateHand(this.mAngle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: /opt/SpaceControl/Roboter_Demo.jar!/roboter_demo/Hand.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.2.1
|
||||
*/
|
Loading…
Add table
Add a link
Reference in a new issue