annotate src/samer/j3d/Axes.java @ 8:5e3cbbf173aa tip

Reorganise some more
author samer
date Fri, 05 Apr 2019 22:41:58 +0100
parents bf79fb79ee13
children
rev   line source
samer@0 1 /*
samer@0 2 * Axis.java 1.0 98/11/25
samer@0 3 *
samer@0 4 * Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved.
samer@0 5 *
samer@0 6 * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
samer@0 7 * modify and redistribute this software in source and binary code form,
samer@0 8 * provided that i) this copyright notice and license appear on all copies of
samer@0 9 * the software; and ii) Licensee does not utilize the software in a manner
samer@0 10 * which is disparaging to Sun.
samer@0 11 *
samer@0 12 * This software is provided "AS IS," without a warranty of any kind. ALL
samer@0 13 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
samer@0 14 * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
samer@0 15 * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
samer@0 16 * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
samer@0 17 * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
samer@0 18 * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
samer@0 19 * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
samer@0 20 * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
samer@0 21 * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
samer@0 22 * POSSIBILITY OF SUCH DAMAGES.
samer@0 23 *
samer@0 24 * This software is not designed or intended for use in on-line control of
samer@0 25 * aircraft, air traffic, aircraft navigation or aircraft communications; or in
samer@0 26 * the design, construction, operation or maintenance of any nuclear
samer@0 27 * facility. Licensee represents and warrants that it will not use or
samer@0 28 * redistribute the Software for such purposes.
samer@0 29 */
samer@0 30
samer@0 31 /*
samer@0 32 * Getting Started with the Java 3D API
samer@0 33 * written in Java 3D
samer@0 34 *
samer@0 35 * This program demonstrates:
samer@0 36 * 1. writing a visual object class
samer@0 37 * In this program, Axis class defines a visual object
samer@0 38 * This particular class extends Shape3D
samer@0 39 * See the text for a discussion.
samer@0 40 * 2. Using LineArray to draw 3D lines.
samer@0 41 */
samer@0 42
samer@0 43 package samer.j3d;
samer@0 44 import javax.media.j3d.*;
samer@0 45 import javax.vecmath.*;
samer@0 46
samer@0 47
samer@0 48 public class Axes extends Shape3D{
samer@0 49
samer@0 50 ////////////////////////////////////////////
samer@0 51 //
samer@0 52 // create axis visual object
samer@0 53 //
samer@0 54 public Axes() {
samer@0 55
samer@0 56 this.setGeometry(createGeometry());
samer@0 57
samer@0 58 }
samer@0 59
samer@0 60 private Geometry createGeometry(){
samer@0 61 // create line for X axis
samer@0 62 IndexedLineArray axisLines = new IndexedLineArray(18, GeometryArray.COORDINATES, 30);
samer@0 63
samer@0 64 axisLines.setCoordinate( 0, new Point3f(-1.0f, 0.0f, 0.0f));
samer@0 65 axisLines.setCoordinate( 1, new Point3f( 1.0f, 0.0f, 0.0f));
samer@0 66 axisLines.setCoordinate( 2, new Point3f( 0.9f, 0.1f, 0.1f));
samer@0 67 axisLines.setCoordinate( 3, new Point3f( 0.9f,-0.1f, 0.1f));
samer@0 68 axisLines.setCoordinate( 4, new Point3f( 0.9f, 0.1f,-0.1f));
samer@0 69 axisLines.setCoordinate( 5, new Point3f( 0.9f,-0.1f,-0.1f));
samer@0 70 axisLines.setCoordinate( 6, new Point3f( 0.0f,-1.0f, 0.0f));
samer@0 71 axisLines.setCoordinate( 7, new Point3f( 0.0f, 1.0f, 0.0f));
samer@0 72 axisLines.setCoordinate( 8, new Point3f( 0.1f, 0.9f, 0.1f));
samer@0 73 axisLines.setCoordinate( 9, new Point3f(-0.1f, 0.9f, 0.1f));
samer@0 74 axisLines.setCoordinate(10, new Point3f( 0.1f, 0.9f,-0.1f));
samer@0 75 axisLines.setCoordinate(11, new Point3f(-0.1f, 0.9f,-0.1f));
samer@0 76 axisLines.setCoordinate(12, new Point3f( 0.0f, 0.0f,-1.0f));
samer@0 77 axisLines.setCoordinate(13, new Point3f( 0.0f, 0.0f, 1.0f));
samer@0 78 axisLines.setCoordinate(14, new Point3f( 0.1f, 0.1f, 0.9f));
samer@0 79 axisLines.setCoordinate(15, new Point3f(-0.1f, 0.1f, 0.9f));
samer@0 80 axisLines.setCoordinate(16, new Point3f( 0.1f,-0.1f, 0.9f));
samer@0 81 axisLines.setCoordinate(17, new Point3f(-0.1f,-0.1f, 0.9f));
samer@0 82
samer@0 83 axisLines.setCoordinateIndex( 0, 0);
samer@0 84 axisLines.setCoordinateIndex( 1, 1);
samer@0 85 axisLines.setCoordinateIndex( 2, 2);
samer@0 86 axisLines.setCoordinateIndex( 3, 1);
samer@0 87 axisLines.setCoordinateIndex( 4, 3);
samer@0 88 axisLines.setCoordinateIndex( 5, 1);
samer@0 89 axisLines.setCoordinateIndex( 6, 4);
samer@0 90 axisLines.setCoordinateIndex( 7, 1);
samer@0 91 axisLines.setCoordinateIndex( 8, 5);
samer@0 92 axisLines.setCoordinateIndex( 9, 1);
samer@0 93 axisLines.setCoordinateIndex(10, 6);
samer@0 94 axisLines.setCoordinateIndex(11, 7);
samer@0 95 axisLines.setCoordinateIndex(12, 8);
samer@0 96 axisLines.setCoordinateIndex(13, 7);
samer@0 97 axisLines.setCoordinateIndex(14, 9);
samer@0 98 axisLines.setCoordinateIndex(15, 7);
samer@0 99 axisLines.setCoordinateIndex(16,10);
samer@0 100 axisLines.setCoordinateIndex(17, 7);
samer@0 101 axisLines.setCoordinateIndex(18,11);
samer@0 102 axisLines.setCoordinateIndex(19, 7);
samer@0 103 axisLines.setCoordinateIndex(20,12);
samer@0 104 axisLines.setCoordinateIndex(21,13);
samer@0 105 axisLines.setCoordinateIndex(22,14);
samer@0 106 axisLines.setCoordinateIndex(23,13);
samer@0 107 axisLines.setCoordinateIndex(24,15);
samer@0 108 axisLines.setCoordinateIndex(25,13);
samer@0 109 axisLines.setCoordinateIndex(26,16);
samer@0 110 axisLines.setCoordinateIndex(27,13);
samer@0 111 axisLines.setCoordinateIndex(28,17);
samer@0 112 axisLines.setCoordinateIndex(29,13);
samer@0 113
samer@0 114 return axisLines;
samer@0 115
samer@0 116 } // end of Axis createGeometry()
samer@0 117
samer@0 118
samer@0 119 } // end of class Axis