📄 lineshape.java
字号:
package line3d;import javax.media.j3d.*;/** * <p>Title: 输出显示三维线</p> * <p>Description: 应用Java 3D API生成三维线</p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: 北京师范大学计算机系</p> * @author 王大伟 * @version 1.0 */public class lineShape extends Shape3D { int StripCount[] = new int[3]; int[] index={ 0 , 1 , 3 , 2 , 3 , 5 , 4 , 6 , 7 , 8 , 6 } ; int vertexCount = 11; private float vert[] = { -.3f , .8f , .0f, .3f , .8f , .0f, -.3f , .4f , .0f, .3f , .4f , .0f, -.3f , .0f , .0f, .3f , .0f , .0f, -.3f , -.4f , .0f, .3f , -.4f , .0f, -.3f , -.8f , .0f, .3f , -.8f , .0f, }; private float color[] = { 0.0f, 0.5f, 1.0f, 0.5f, 0.0f, 1.0f, 0.0f, 0.8f, 2.0f, 1.0f, 0.0f, 0.3f, 0.0f, 1.0f, 0.3f, 0.3f, 0.8f, 0.0f, 0.0f, 0.5f, 1.0f, 0.5f, 0.0f, 1.0f, 0.0f, 0.8f, 2.0f, 1.0f, 0.0f, 0.3f }; public lineShape() { StripCount[0] = 4; StripCount[1] = 3; StripCount[2] = 4; IndexedLineStripArray line = new IndexedLineStripArray(10 ,IndexedLineStripArray.COORDINATES|IndexedLineStripArray.COLOR_3, vertexCount , StripCount); line.setCoordinates(0,vert); line.setColors(0,color); line.setCoordinateIndices(0,index); line.setColorIndices(0,index); LineAttributes la = new LineAttributes(); la.setLineWidth(10.0f); la.setLineAntialiasingEnable(true); la.setLinePattern(LineAttributes.PATTERN_DASH); Appearance ap = new Appearance(); ap.setLineAttributes(la); this.setGeometry(line); this.setAppearance(ap); }}//end of lineShape.java
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -