state.java

来自「采用Java3D,基于L-system」· Java 代码 · 共 47 行

JAVA
47
字号
import javax.vecmath.Point3d;/** * This class is a packet of state information for the Interpreter "turtle". * (called by: Lsystem.java, Interpreter.java) *  * @author Scott Teresi, April 1999, www.teresi.us */public class State {  public Point3d curPos;          // current cursor position  public double angle;            // current direction the turtle is pointing  public double angleInc;         // angle increment value  public double lineLength;       // length of line segment drawn by turtle  public boolean swapDirections;  // swap the meaning of turn-right/turn-left?  public State () {    // initialize state to defaults    setState (new Point3d(0d, 0d, 0d), 0.0, 1.0, 10.0, false);  }  public State (Point3d pt, double a, double ai, double l, boolean s) {    setState(pt, a, ai, l, s);  }  public State (State s) {    setState (s.curPos, s.angle, s.angleInc, s.lineLength, s.swapDirections);  }  public void setState (Point3d pt, double a, double ai, double l, boolean s) {    curPos = pt;    angle = a;    angleInc = ai;    lineLength = l;    swapDirections = s;  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?