?? move_in_certain_path.java
字號:
/*
* Created on 2005-7-17
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package Move;
import javax.media.j3d.*;
import javax.vecmath.AxisAngle4f;
import javax.vecmath.Point3d;
import javax.vecmath.Point3f;
import javax.vecmath.Quat4f;
import com.sun.j3d.utils.geometry.ColorCube;
public class Move_in_Certain_path extends Shape3D {
public BranchGroup createAnimOfMove(
Point3f[] positions,//物體運動的詭計,從Axis_info()中獲取
TransformGroup target1//
){
BranchGroup objRoot = new BranchGroup();
Alpha alpha = new Alpha(-1, 10000);
TransformGroup target = new TransformGroup();
Transform3D axisOfRotPos = new Transform3D();
//target.setTransform(axisOfRotPos);
//knots give a array to determine..
float[] knots = {0.0f, 0.1f,0.5f, 0.8f, 0.9f, 1.0f};
Quat4f[] quats = new Quat4f[6];
//Point3f[] positions = new Point3f[6];
target.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
AxisAngle4f axis = new AxisAngle4f(1.0f,0.0f,0.0f,0.0f);
axisOfRotPos.set(axis);
quats[0] = new Quat4f(0.0f, 10.0f, 10.0f, 0.0f);
quats[1] = new Quat4f(1.0f, 0.0f, 0.0f, 0.0f);
quats[2] = new Quat4f(0.0f, 1.0f, 0.0f, 0.0f);
quats[3] = new Quat4f(0.0f, 1.0f, 1.0f, 0.0f);
quats[4] = new Quat4f(0.0f, 0.0f, 1.0f, 0.0f);
quats[5] = quats[0];
// RotPosPathInterpolator rotPosPath = new RotPosPathInterpolator(
PositionPathInterpolator rotPosPath = new PositionPathInterpolator(
alpha, target, axisOfRotPos, knots,
//quats,
positions);
rotPosPath.setSchedulingBounds(new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 400.0));
objRoot.addChild(target);
objRoot.addChild(rotPosPath);
target.addChild(target1);
Background background = new Background();
background.setColor(0.0f, 0.0f, 0.0f);
background.setApplicationBounds(new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 400.0));
objRoot.addChild(background);
/*
PointArray point_geom = new PointArray(9, GeometryArray.COORDINATES);
point_geom.setCoordinates(0, positions);
Appearance points_appear = new Appearance();
ColoringAttributes points_coloring = new ColoringAttributes();
points_coloring.setColor(1.0f, 0.0f, 0.0f);
points_appear.setColoringAttributes(points_coloring);
PointAttributes points_points = new PointAttributes(4.0f, true);
points_appear.setPointAttributes(points_points);
Shape3D points = new Shape3D(point_geom, points_appear);
objRoot.addChild(points);
*/
objRoot.compile();
return objRoot;
}
public Move_in_Certain_path(){
System.out.println("Move.Move_in_Certain_path Class give a movement in a Certain path");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -