annotationarrowgroup.java

来自「JAVA网络三维技术3D的设计与实现」· Java 代码 · 共 55 行

JAVA
55
字号
//
//  CLASS
//    AnnotationArrowGroup	-  A group of parallel arrows
//
//  DESCRIPTION
//    This class creates one or more parallel 3D, unlighted arrows.
//    Such arrow groups can be used to indicate directional light
//    directions, and so forth.
//
//    The arrow group is drawn in the XY plane, pointing right.
//    The X start and end values, and the Y start and end values
//    can be set, along with the count of the number of arrows to
//    build.
//
//  SEE ALSO
//    AnnotationArrow
//    AnnotationArrowFan
//
//  AUTHOR
//    David R. Nadeau / San Diego Supercomputer Center
//
//
package Java3DApplet;
import javax.media.j3d.*;
import javax.vecmath.*;
import com.sun.j3d.utils.geometry.*;

public class AnnotationArrowGroup
	extends Group
{
	// 3D nodes
	AnnotationArrow[] arrows;

	//  Constructors
	public AnnotationArrowGroup( )
	{
		//    xStart  xEnd   yStart  yEnd   count
		this( -1.0f,  1.0f,  1.0f,   -1.0f, 3 );
	}

	public AnnotationArrowGroup( float xStart, float xEnd,
		float yStart, float yEnd, int count )
	{
		arrows = new AnnotationArrow[count];
		float y = yStart;
		float deltaY = (yEnd - yStart) / (float)(count-1);
		for ( int i = 0; i < count; i++ )
		{
			arrows[i] = new AnnotationArrow( xStart, y, 0.0f, xEnd, y, 0.0f);
			addChild( arrows[i] );
			y += deltaY;
		}
	}
}

⌨️ 快捷键说明

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