diff options
Diffstat (limited to 'src/PickTest')
30 files changed, 4306 insertions, 0 deletions
diff --git a/src/PickTest/BoltCG.java b/src/PickTest/BoltCG.java new file mode 100644 index 0000000..836305d --- /dev/null +++ b/src/PickTest/BoltCG.java @@ -0,0 +1,357 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class BoltCG extends CompressedGeometry { + + BoltCG() { + super(cgHeader, cgData) ; + } + + private static final byte cgData[] = { + 25, 0, -120, 16, -124, 64, 33, -35, + 0, 67, 60, 48, -121, 90, 1, 3, + 116, -62, 25, 105, -60, 60, -32, 8, + 5, -58, 16, -9, -114, 32, -1, -104, + 67, 16, 0, -117, -128, 97, 40, 62, + -62, -128, -122, 5, 67, 48, 10, -76, + -32, 21, 1, 6, 40, 10, -128, 86, + -123, 24, -96, 76, 65, 74, 88, 2, + -117, -80, -59, 21, 113, -118, -40, -28, + 21, 110, 6, 40, 27, 64, 81, 23, + -124, -7, 47, 54, 13, -3, -4, 69, + 40, 25, -69, -99, -123, 64, 8, 48, + 3, 64, 16, 23, 16, 97, -39, 8, + -20, -125, 0, 36, 2, 1, -123, 2, + 8, -120, 48, 27, 122, 91, 65, -67, + 108, 18, 26, 13, -12, -35, 95, -48, + 107, 63, -5, 91, -46, 12, 84, -44, + -53, -120, 54, -45, -98, 115, 64, -69, + 92, 126, -55, 1, 6, -80, 34, -49, + -24, 53, -30, 61, -19, 9, 6, -76, + 10, -115, -24, 53, 87, -54, -2, -127, + 113, 68, -15, -33, 16, 97, -9, 113, + -54, -30, 12, 75, 34, -48, -48, 107, + 86, -32, -10, -125, 97, -42, 19, -78, + 12, 0, -48, 4, 4, 68, 8, 12, + -67, -69, 32, -64, 9, 0, 0, 92, + 65, -121, 116, 42, 10, 13, 98, -52, + -97, 16, 34, 104, 114, 75, 66, 12, + -45, 11, -82, 32, -34, -74, -127, -15, + 6, 74, 51, 70, -81, 32, -42, 27, + 105, 13, 6, -97, 13, 111, -24, 22, + -12, 22, -19, -95, 6, -49, -85, -48, + 16, 107, 2, 44, -8, -125, 6, 73, + -123, -97, 16, 37, 40, 68, -22, -30, + 12, 58, 97, 80, -112, 104, -16, -104, + -72, -125, 122, -38, 22, -12, 25, -114, + -39, 124, 64, -111, -115, -112, -49, -24, + 53, -34, 85, -23, 5, 6, -82, -26, + 15, 104, 54, 1, -31, 62, 32, 68, + -17, 100, -58, 84, 27, 33, -54, -66, + -125, 55, -2, -89, 32, -119, 122, -73, + -25, -36, 105, -128, 8, 53, -128, 2, + 76, -71, 9, -56, -128, 30, 112, -59, + -48, 96, -37, 0, 0, 0, 9, -112, + 28, -117, 100, 64, 127, 58, 113, -58, + 13, 96, 0, -109, 46, 70, 50, 80, + 103, -88, 56, -86, 13, 96, 0, -109, + 46, 67, 114, -112, 95, -74, 49, 84, + 49, -74, -72, 15, 96, 2, 80, 6, + 55, 80, 0, -36, 82, 0, 40, 3, + 108, 1, -58, -95, -63, -84, 0, 18, + 101, -56, -74, 87, 10, 56, 39, 31, + -32, -43, -32, 9, 50, -28, 87, 46, + -125, 28, -61, -117, -48, 107, 0, 4, + -103, 114, 19, -105, -65, -98, 117, -60, + 32, -63, -84, 0, 18, 101, -116, -74, + 45, 1, -15, 1, -57, 0, -29, -116, + 26, -64, 1, 38, 92, -116, 101, 111, + 79, 124, 113, 83, -6, -68, 8, 37, + -36, -83, -4, -93, -4, 109, 46, 55, + 6, -81, 0, 73, -105, 33, -71, 63, + -57, -40, -36, 82, 28, 26, -64, 1, + 38, 92, -117, 100, -113, 71, 71, 113, + -2, 13, 96, 0, -109, 46, 69, 114, + 47, -41, -99, -72, -67, 6, -80, 0, + 73, -107, -63, 72, -64, -113, -83, 99, + 72, 53, 97, -6, 65, 57, -67, 60, + -38, -26, -63, -78, 105, 11, 112, 85, + 110, 101, -95, 58, -128, 16, 107, -125, + 90, -60, 3, 0, 0, 1, 0, 32, + 64, 67, -32, -54, -41, -103, 113, 6, + -55, -92, 45, -63, 85, -71, -106, -34, + -22, 0, 55, -79, -36, -28, 62, -95, + -68, 97, -73, -41, -70, -122, -13, 117, + -50, 94, -22, 32, 80, 21, 77, -39, + 6, 0, 48, 6, 2, 10, 13, 61, + 106, -104, 80, 32, -68, -125, 64, -75, + 100, 17, 91, -78, 90, -67, -42, 24, + 55, 27, -39, 61, 0, -56, 63, -40, + -71, -95, -124, 49, 74, 37, 3, 7, + -83, 118, -18, 13, -79, 30, -96, -126, + 80, 77, 53, 19, -32, -47, -121, -103, + 104, -122, 82, 89, -19, 56, 92, 45, + -96, -73, 42, -128, 16, 109, -120, -11, + 4, 18, -126, 105, -88, 126, 70, -127, + -56, -24, 48, -43, -36, 20, -25, -48, + -60, -115, -4, -98, -42, -31, -84, 8, + -35, -13, 59, -96, -36, 11, 1, 64, + 69, 65, -126, 80, -85, 10, 4, 22, + -48, 97, 109, -42, -114, 71, 112, -106, + -58, -51, 6, 104, 48, 82, 8, -19, + -74, -36, -81, -100, -56, -122, 85, 34, + -111, -37, 125, -83, 103, 65, -89, 125, + -30, -15, 36, -20, -5, 81, -63, 68, + 27, -17, -89, -83, 3, -63, -89, 33, + -24, 66, 0, 7, 50, 45, 2, -56, + 17, 6, -99, -9, -117, -60, -109, -77, + -19, 122, 5, 14, 96, 110, 114, 71, + -92, 117, 39, 107, 93, -50, 105, 49, + 110, -75, 80, 46, -125, -68, -18, -125, + 80, 60, 10, 1, -111, 6, -76, 10, + 48, -96, 65, 105, 6, -120, 27, 8, + 68, -77, -109, -59, 90, -64, 16, 106, + -61, -12, -26, 17, 26, 10, 54, -53, + 40, -88, 1, 6, -14, 124, 52, 32, + -39, 13, -117, 66, 13, 63, -111, -80, + -96, 65, 117, 6, 103, -11, -120, 104, + 54, -49, 116, 92, 65, -102, -84, -125, + 50, 12, 87, -109, 67, 64, -124, 106, + -22, -22, 12, 28, -24, -48, -48, 109, + 94, -22, -48, -125, 10, -96, 75, -120, + 17, 39, -119, 104, 65, -92, -110, 68, + 36, 27, 99, -87, -73, -96, -56, -42, + -85, 18, 12, 8, 3, -22, 0, 28, + 1, 120, 34, -112, -6, -81, 52, -64, + 4, 24, -88, 0, 0, 14, 0, -104, + 39, 32, 44, 23, -98, -125, 6, 44, + 0, 0, 3, -128, 38, 22, -56, 95, + 13, -25, 24, 49, 80, 0, 0, 28, + 1, 48, -58, -28, -38, -113, 42, -125, + 21, 0, 0, 1, -80, 19, 70, -24, + 73, -46, -13, 80, -32, -59, 64, 0, + 0, 108, 7, -94, -37, -127, -1, 30, + 127, -125, 21, 0, 0, 1, -64, 30, + -118, -18, -124, -124, 121, 122, 12, 84, + 0, 0, 7, 0, 78, 19, -81, -32, + 99, -56, 65, -125, 22, 0, 0, 1, + -64, 30, 11, 110, 64, 117, 0, 0, + 2, -106, 48, 106, 2, 56, -102, 99, + 126, 15, 53, 37, 65, -81, -8, -30, + 104, -36, -75, -8, -98, 82, 28, 24, + -88, 0, 0, 13, -128, -104, 91, 93, + -20, -41, -97, -32, -59, 64, 0, 0, + 112, 7, -94, -69, 31, 56, -98, 94, + -125, 21, 0, 0, 1, -64, 24, 77, + -96, -39, -12, 65, -125, 41, 86, -79, + 58, 14, -56, 87, 102, -112, 105, -50, + 18, -42, 11, 91, 10, -54, -9, 6, + 61, -1, -87, 3, 51, 55, -14, 86, + 108, 80, 111, -5, -18, -110, 55, 34, + 112, -43, 114, -123, 6, 1, 63, 9, + 32, -11, 21, 28, 87, 36, 4, 32, + -56, 83, -3, 36, -82, -1, -60, -86, + -31, -63, -88, -40, 98, 73, -99, -72, + 71, 27, 59, 6, 3, 38, -110, 12, + 111, -92, 4, -39, -8, 49, -111, 74, + -112, 51, 28, -18, -90, -64, 37, 6, + 80, -54, -38, -51, 106, -93, 73, -80, + 5, 8, 50, 119, 84, -116, 47, 110, + 123, -10, -60, 45, 6, 45, 104, 81, + -116, 106, 15, 126, -40, -40, 48, 101, + 42, -30, 109, 90, -16, 69, 123, -81, + -47, 6, 112, 0, 0, 9, 1, 4, + 78, 1, 17, -114, -67, 6, 12, -32, + 0, 0, 18, 2, 9, 108, -111, -28, + 29, 113, -125, 56, 0, 0, 4, -128, + -124, 99, 119, 92, 87, 85, 65, -100, + 0, 0, 2, 64, 106, 53, -112, 31, + 101, -80, 30, 13, -35, -80, 85, -86, + -95, -63, -109, -1, 117, -46, -38, 46, + -94, -70, 127, 6, -112, 0, 0, 119, + 1, 124, -82, 39, 15, 46, -113, 65, + -92, 0, 0, 29, -128, 127, 19, -67, + -4, -112, -82, -127, 6, 13, 40, 0, + 0, -18, 2, -15, 108, -81, -40, 29, + 49, -125, 72, 0, 0, 59, 0, -70, + 99, 9, -61, -106, -91, 65, -112, 31, + 102, -44, 27, 62, -118, 116, 65, -92, + 0, 0, 29, -64, 117, 65, -100, 0, + 0, 2, 64, 122, 27, -111, -127, -35, + -75, 33, -63, -80, 8, -92, 34, -40, + -52, 86, -70, -1, 6, 108, 0, 0, + 10, 1, 4, -82, 122, 114, -114, -81, + 65, -100, 0, 0, 2, 64, 115, 26, + -113, -107, -98, -115, -46, -95, -63, -71, + 0, 0, 28, -128, 87, 65, -123, -57, + -69, -22, 12, 4, 9, -32, 118, 65, + -128, 24, 7, -128, -96, -127, 27, -128, + 101, -12, 27, 36, 13, -93, -96, -50, + -29, 89, -31, 6, -114, 0, 0, 29, + -96, 48, -96, 65, -7, 6, -4, 72, + 30, -79, 32, -56, 32, 59, -32, 60, + 96, 23, -48, 110, -124, 50, -80, -127, + 116, -126, -89, 100, 25, -128, 0, 120, + 15, 72, 51, 119, -74, 52, 32, -38, + -8, -94, -70, 5, 65, -123, 30, 16, + 104, -96, 0, 1, -36, 3, 42, 13, + -1, 127, 124, 26, -122, -64, 5, -22, + -4, 74, 12, 0, 68, -102, -48, 99, + 117, 1, 73, 6, -72, -55, -17, -120, + 54, 115, -83, -3, 73, 6, -46, 15, + -85, -88, 50, 112, -91, 104, 65, -110, + 43, 22, -12, 27, 27, 83, 104, 65, + -114, -126, -105, -64, -119, -33, 105, -120, + -71, 76, 0, 65, -81, -99, -54, 82, + 13, 3, 78, 81, 80, 107, -25, 76, + -122, -125, 0, -60, 23, -28, 10, -17, + -97, 42, -24, -125, 112, 0, 0, 56, + -128, -76, -125, 32, -43, -89, -92, 27, + -65, 50, -99, -112, 96, 1, 0, -32, + 40, -96, 72, 49, -107, 57, 6, -34, + -109, 104, 40, 51, 12, 68, 67, 64, + -128, 98, 11, -78, 12, -64, 16, 24, + 7, -108, 25, -64, 0, 0, 9, -128, + -16, 109, 72, 0, 0, 14, -48, 30, + -20, 56, 55, -23, 7, 43, -96, -54, + -29, -35, 97, 6, -88, 69, 13, 8, + 49, 69, -46, -6, -127, 14, 68, -125, + -34, 80, 103, 0, 0, 0, 36, 2, + 58, 12, 110, 53, -44, 80, 110, -112, + 112, -54, -125, 127, -33, -40, 80, 32, + -68, -125, 59, -18, -74, 36, 25, 0, + 0, 0, 7, -66, 3, -14, 13, -1, + -12, 31, 104, 64, -118, 46, -105, 100, + 24, 1, 32, 104, 14, -120, 55, 32, + 0, 3, -112, 15, -29, 85, 84, -127, + 5, -120, 9, 65, -112, 0, 0, 0, + 123, -32, 63, 32, -38, -57, 127, 55, + -44, 24, -97, 40, 18, -4, -125, 105, + 56, -15, 95, 80, 96, -68, 16, -93, + 122, 5, 110, -88, 40, 32, -64, 20, + 113, -11, 6, 11, -59, 8, -69, 32, + -64, 12, 0, -64, 111, 64, -83, -43, + 7, 100, 24, -128, -96, 88, 12, 104, + 53, -4, 0, 0, 0, -124, 7, -64, + -118, -33, -106, -102, -13, -84, 0, 65, + -100, 0, 0, 0, -104, 9, 72, 50, + 13, 56, 126, 65, -70, -4, -6, -49, + -88, 50, 112, -39, -59, -115, 6, -83, + 1, -13, 1, -53, 0, -8, -125, 37, + 13, 34, -41, 16, 107, -25, 116, -122, + -125, 0, -60, 7, -16, -118, 102, 102, + -36, -66, -118, 0, 65, -67, -1, -30, + 10, 12, -99, 74, 94, -48, 110, -31, + 108, 104, 65, -102, -87, 103, -60, 8, + 34, -100, 36, -2, -125, 124, -84, -5, + -97, 16, 98, 43, -46, 27, 34, 12, + 127, -101, 127, 64, -80, -47, -16, -19, + 8, 53, -33, 88, -8, -125, 20, 109, + 19, 95, -48, 111, -111, -1, -117, 66, + 13, -57, 92, 63, -96, 93, -104, -99, + 119, -60, 24, 84, -16, 82, -8, -125, + 3, 80, 2, -38, 16, 103, -116, 101, + -19, 2, -18, 110, -26, 68, 24, -117, + -98, -56, -125, 5, -64, -35, -112, 96, + 4, 0, 32, 63, -102, 89, 15, 119, + -122, 112, 12, 32, -38, -68, 70, -110, + 91, -114, -68, 111, 2, 16, 96, -65, + -23, -123, 2, 13, 7, 118, -36, 104, + -127, 46, -26, -117, -92, -19, 36, 102, + 0, -128, -64, 61, -61, 84, 87, -73, + 74, 32, -24, 50, 11, 10, 111, 57, + -79, -36, -28, 10, 93, 24, 4, 22, + 106, -32, -42, 17, -42, -29, -104, -37, + 74, 105, -73, -9, -48, 112, -35, -82, + 107, 119, 73, 10, -33, 78, -4, -79, + -97, 96, -54, -14, 54, -128, 58, 97, + 8, 111, 4, 3, -50, -37, -53, 64, + -124, 0, 14, -103, 65, -41, -127, 8, + 53, 6, -14, 65, 65, -97, -48, 115, + 113, -51, -74, 42, 50, 82, 57, 40, + -86, -53, -100, -41, -66, -74, 106, -125, + 82, 116, -39, -48, 38, 51, 107, 121, + 44, 88, -28, 34, 96, 4, -78, 4, + 75, 118, -64, 16, 96, 4, -127, -96, + 45, -110, 88, 14, -31, 3, 0, 65, + -65, -128, 10, 25, 44, -61, 81, -40, + -16, 3, -85, -100, 0, 20, 6, -12, + 3, 49, -63, -107, 14, 15, 71, -16, + 99, 19, -81, -37, -102, -15, -37, 32, + -21, -7, 6, -91, -81, 91, -119, -4, + 88, -77, -20, 26, -49, -96, -54, 23, + 112, -72, -41, -35, 64, 8, 53, 11, + 14, 102, 65, -123, -35, -52, -94, 55, + 24, -7, -45, -72, -75, -123, 0, 0, + 22, -64, 111, -16, 2, 13, 97, -46, + 48, -96, 65, 0, 86, 40, 32, -120, + 21, -124, -115, 46, 54, 29, -69, 11, + 88, 0, -96, 96, 11, -32, 60, 20, + -94, 25, 99, 53, 97, -125, 8, 91, + -48, 2, 101, 113, -54, -128, -20, 0, + 10, -85, -70, -117, 50, 32, 1, 6, + 75, 84, 46, -99, -38, -53, -51, 9, + -59, -59, 52, 25, 121, 16, 0, 119, + 27, -114, -108, 39, 21, 4, -111, -26, + 116, 64, 2, 13, 121, -104, 105, 63, + -115, 58, -42, 122, -125, 106, -15, 25, + -112, 99, 35, -32, 8, 5, -96, 0 + } ; + + private static final CompressedGeometryHeader cgHeader ; + + static { + cgHeader = new CompressedGeometryHeader() ; + cgHeader.majorVersionNumber = 1 ; + cgHeader.minorVersionNumber = 0 ; + cgHeader.minorMinorVersionNumber = 1 ; + cgHeader.bufferType = CompressedGeometryHeader.TRIANGLE_BUFFER ; + cgHeader.bufferDataPresent = CompressedGeometryHeader.NORMAL_IN_BUFFER ; + cgHeader.start = 0 ; + cgHeader.size = cgData.length ; + } +} diff --git a/src/PickTest/ColorCube.java b/src/PickTest/ColorCube.java new file mode 100644 index 0000000..74758fb --- /dev/null +++ b/src/PickTest/ColorCube.java @@ -0,0 +1,121 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class ColorCube extends QuadArray { + private static final float[] verts = { + // front face + 1.0f, -1.0f, 1.0f, + 1.0f, 1.0f, 1.0f, + -1.0f, 1.0f, 1.0f, + -1.0f, -1.0f, 1.0f, + // back face + -1.0f, -1.0f, -1.0f, + -1.0f, 1.0f, -1.0f, + 1.0f, 1.0f, -1.0f, + 1.0f, -1.0f, -1.0f, + // right face + 1.0f, -1.0f, -1.0f, + 1.0f, 1.0f, -1.0f, + 1.0f, 1.0f, 1.0f, + 1.0f, -1.0f, 1.0f, + // left face + -1.0f, -1.0f, 1.0f, + -1.0f, 1.0f, 1.0f, + -1.0f, 1.0f, -1.0f, + -1.0f, -1.0f, -1.0f, + // top face + 1.0f, 1.0f, 1.0f, + 1.0f, 1.0f, -1.0f, + -1.0f, 1.0f, -1.0f, + -1.0f, 1.0f, 1.0f, + // bottom face + -1.0f, -1.0f, 1.0f, + -1.0f, -1.0f, -1.0f, + 1.0f, -1.0f, -1.0f, + 1.0f, -1.0f, 1.0f, + }; + + private static final float[] colors = { + // front face (red) + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + // back face (green) + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + // right face (blue) + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + // left face (yellow) + 1.0f, 1.0f, 0.0f, + 1.0f, 1.0f, 0.0f, + 1.0f, 1.0f, 0.0f, + 1.0f, 1.0f, 0.0f, + // top face (magenta) + 1.0f, 0.0f, 1.0f, + 1.0f, 0.0f, 1.0f, + 1.0f, 0.0f, 1.0f, + 1.0f, 0.0f, 1.0f, + // bottom face (cyan) + 0.0f, 1.0f, 1.0f, + 0.0f, 1.0f, 1.0f, + 0.0f, 1.0f, 1.0f, + 0.0f, 1.0f, 1.0f, + }; + + ColorCube() { + super(24, QuadArray.COORDINATES | QuadArray.COLOR_3); + + setCoordinates(0, verts); + setColors(0, colors); + } +} diff --git a/src/PickTest/ColorPyramidDown.java b/src/PickTest/ColorPyramidDown.java new file mode 100644 index 0000000..280b3fb --- /dev/null +++ b/src/PickTest/ColorPyramidDown.java @@ -0,0 +1,121 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class ColorPyramidDown extends QuadArray { + private static final float[] verts = { + // front face + 0.0f, -1.0f, 0.0f, + 1.0f, 1.0f, 1.0f, + -1.0f, 1.0f, 1.0f, + 0.0f, -1.0f, 0.0f, + // back face + 0.0f, -1.0f, 0.0f, + -1.0f, 1.0f, -1.0f, + 1.0f, 1.0f, -1.0f, + 0.0f, -1.0f, 0.0f, + // right face + 0.0f, -1.0f, 0.0f, + 1.0f, 1.0f, -1.0f, + 1.0f, 1.0f, 1.0f, + 0.0f, -1.0f, 0.0f, + // left face + 0.0f, -1.0f, 0.0f, + -1.0f, 1.0f, 1.0f, + -1.0f, 1.0f, -1.0f, + 0.0f, -1.0f, 0.0f, + // top face + 1.0f, 1.0f, 1.0f, + 1.0f, 1.0f, -1.0f, + -1.0f, 1.0f, -1.0f, + -1.0f, 1.0f, 1.0f, + // bottom face + 0.0f, -1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + }; + + private static final float[] colors = { + // front face (green) + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + // back face (red) + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + // right face (yellow) + 1.0f, 1.0f, 0.0f, + 1.0f, 1.0f, 0.0f, + 1.0f, 1.0f, 0.0f, + 1.0f, 1.0f, 0.0f, + // left face (magenta) + 1.0f, 0.0f, 1.0f, + 1.0f, 0.0f, 1.0f, + 1.0f, 0.0f, 1.0f, + 1.0f, 0.0f, 1.0f, + // top face (blue) + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + // bottom face (cyan) + 0.0f, 1.0f, 1.0f, + 0.0f, 1.0f, 1.0f, + 0.0f, 1.0f, 1.0f, + 0.0f, 1.0f, 1.0f, + }; + + ColorPyramidDown() { + super(24, QuadArray.COORDINATES | QuadArray.COLOR_3); + + setCoordinates(0, verts); + setColors(0, colors); + } +} diff --git a/src/PickTest/ColorPyramidUp.java b/src/PickTest/ColorPyramidUp.java new file mode 100644 index 0000000..4cca260 --- /dev/null +++ b/src/PickTest/ColorPyramidUp.java @@ -0,0 +1,123 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class ColorPyramidUp extends QuadArray { + private static final float[] verts = { + // front face + 1.0f, -1.0f, 1.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + -1.0f, -1.0f, 1.0f, + // back face + -1.0f, -1.0f, -1.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 1.0f, -1.0f, -1.0f, + // right face + 1.0f, -1.0f, -1.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 1.0f, -1.0f, 1.0f, + // left face + -1.0f, -1.0f, 1.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + -1.0f, -1.0f, -1.0f, + // top face + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + // bottom face + -1.0f, -1.0f, 1.0f, + -1.0f, -1.0f, -1.0f, + 1.0f, -1.0f, -1.0f, + 1.0f, -1.0f, 1.0f, + }; + + private static final float[] colors = { + + // front face (cyan) + 0.0f, 1.0f, 1.0f, + 0.0f, 1.0f, 1.0f, + 0.0f, 1.0f, 1.0f, + 0.0f, 1.0f, 1.0f, + // back face (magenta) + 1.0f, 0.0f, 1.0f, + 1.0f, 0.0f, 1.0f, + 1.0f, 0.0f, 1.0f, + 1.0f, 0.0f, 1.0f, + // right face (yellow) + 1.0f, 1.0f, 0.0f, + 1.0f, 1.0f, 0.0f, + 1.0f, 1.0f, 0.0f, + 1.0f, 1.0f, 0.0f, + // left face (blue) + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + // top face (green) + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + // bottom face (red) + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + + }; + + ColorPyramidUp() { + super(24, QuadArray.COORDINATES | QuadArray.COLOR_3); + + setCoordinates(0, verts); + setColors(0, colors); + } +} diff --git a/src/PickTest/CubeIQA.java b/src/PickTest/CubeIQA.java new file mode 100644 index 0000000..f1f6155 --- /dev/null +++ b/src/PickTest/CubeIQA.java @@ -0,0 +1,136 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class CubeIQA extends IndexedQuadArray { + CubeIQA() { + super(8, GeometryArray.COORDINATES | GeometryArray.COLOR_3, 24); + + + Point3f verts[] = new Point3f[8]; + Color3f colors[] = new Color3f[8]; + + verts[0] = new Point3f(1.0f, 1.0f, 1.0f); + verts[1] = new Point3f(-1.0f, 1.0f, 1.0f); + verts[2] = new Point3f(-1.0f,-1.0f, 1.0f); + verts[3] = new Point3f( 1.0f,-1.0f, 1.0f); + verts[4] = new Point3f( 1.0f, 1.0f,-1.0f); + verts[5] = new Point3f( -1.0f, 1.0f,-1.0f); + verts[6] = new Point3f( -1.0f,-1.0f,-1.0f); + verts[7] = new Point3f( 1.0f,-1.0f,-1.0f); + + colors[0] = new Color3f(1.0f, 0.0f, 0.0f); + colors[1] = new Color3f(0.0f, 1.0f, 0.0f); + colors[2] = new Color3f(0.0f, 0.0f, 1.0f); + colors[3] = new Color3f(1.0f, 1.0f, 0.0f); + colors[4] = new Color3f(1.0f, 0.0f, 1.0f); + colors[5] = new Color3f(0.0f, 1.0f, 1.0f); + colors[6] = new Color3f(0.0f, 1.0f, 1.0f); + colors[7] = new Color3f(0.0f, 1.0f, 1.0f); + + int pntsIndex[] = new int[24]; + int clrsIndex[] = new int[24]; + + pntsIndex[0] = 0; + clrsIndex[0] = 0; + pntsIndex[1] = 3; + clrsIndex[1] = 0; + pntsIndex[2] = 7; + clrsIndex[2] = 0; + pntsIndex[3] = 4; + clrsIndex[3] = 0; + + pntsIndex[4] = 1; + clrsIndex[4] = 1; + pntsIndex[5] = 5; + clrsIndex[5] = 1; + pntsIndex[6] = 6; + clrsIndex[6] = 1; + pntsIndex[7] = 2; + clrsIndex[7] = 1; + + pntsIndex[8] = 0; + clrsIndex[8] = 2; + pntsIndex[9] = 4; + clrsIndex[9] = 2; + pntsIndex[10] = 5; + clrsIndex[10] = 2; + pntsIndex[11] = 1; + clrsIndex[11] = 2; + + pntsIndex[12] = 3; + clrsIndex[12] = 3; + pntsIndex[13] = 2; + clrsIndex[13] = 3; + pntsIndex[14] = 6; + clrsIndex[14] = 3; + pntsIndex[15] = 7; + clrsIndex[15] = 3; + + pntsIndex[16] = 0; + clrsIndex[16] = 4; + pntsIndex[17] = 1; + clrsIndex[17] = 4; + pntsIndex[18] = 2; + clrsIndex[18] = 4; + pntsIndex[19] = 3; + clrsIndex[19] = 4; + + pntsIndex[20] = 7; + clrsIndex[20] = 5; + pntsIndex[21] = 6; + clrsIndex[21] = 5; + pntsIndex[22] = 5; + clrsIndex[22] = 5; + pntsIndex[23] = 4; + clrsIndex[23] = 5; + + setCoordinates(0, verts); + setCoordinateIndices(0, pntsIndex); + setColors(0, colors); + setColorIndices(0, clrsIndex); + } +} diff --git a/src/PickTest/CubeQA.java b/src/PickTest/CubeQA.java new file mode 100644 index 0000000..cf31111 --- /dev/null +++ b/src/PickTest/CubeQA.java @@ -0,0 +1,133 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class CubeQA extends QuadArray { + CubeQA() { + super(24, GeometryArray.COORDINATES | GeometryArray.COLOR_3); + + + Point3f verts[] = new Point3f[8]; + Color3f colors[] = new Color3f[6]; + + verts[0] = new Point3f(1.0f, 1.0f, 1.0f); + verts[1] = new Point3f(-1.0f, 1.0f, 1.0f); + verts[2] = new Point3f(-1.0f,-1.0f, 1.0f); + verts[3] = new Point3f( 1.0f,-1.0f, 1.0f); + verts[4] = new Point3f( 1.0f, 1.0f,-1.0f); + verts[5] = new Point3f( -1.0f, 1.0f,-1.0f); + verts[6] = new Point3f( -1.0f,-1.0f,-1.0f); + verts[7] = new Point3f( 1.0f,-1.0f,-1.0f); + + colors[0] = new Color3f(1.0f, 0.0f, 0.0f); + colors[1] = new Color3f(0.0f, 1.0f, 0.0f); + colors[2] = new Color3f(0.0f, 0.0f, 1.0f); + colors[3] = new Color3f(1.0f, 1.0f, 0.0f); + colors[4] = new Color3f(1.0f, 0.0f, 1.0f); + colors[5] = new Color3f(0.0f, 1.0f, 1.0f); + + Point3f pnts[] = new Point3f[24]; + Color3f clrs[] = new Color3f[24]; + + pnts[0] = verts[0]; + clrs[0] = colors[0]; + pnts[1] = verts[3]; + clrs[1] = colors[0]; + pnts[2] = verts[7]; + clrs[2] = colors[0]; + pnts[3] = verts[4]; + clrs[3] = colors[0]; + + pnts[4] = verts[1]; + clrs[4] = colors[1]; + pnts[5] = verts[5]; + clrs[5] = colors[1]; + pnts[6] = verts[6]; + clrs[6] = colors[1]; + pnts[7] = verts[2]; + clrs[7] = colors[1]; + + pnts[8] = verts[0]; + clrs[8] = colors[2]; + pnts[9] = verts[4]; + clrs[9] = colors[2]; + pnts[10] = verts[5]; + clrs[10] = colors[2]; + pnts[11] = verts[1]; + clrs[11] = colors[2]; + + pnts[12] = verts[3]; + clrs[12] = colors[3]; + pnts[13] = verts[2]; + clrs[13] = colors[3]; + pnts[14] = verts[6]; + clrs[14] = colors[3]; + pnts[15] = verts[7]; + clrs[15] = colors[3]; + + pnts[16] = verts[0]; + clrs[16] = colors[4]; + pnts[17] = verts[1]; + clrs[17] = colors[4]; + pnts[18] = verts[2]; + clrs[18] = colors[4]; + pnts[19] = verts[3]; + clrs[19] = colors[4]; + + pnts[20] = verts[7]; + clrs[20] = colors[5]; + pnts[21] = verts[6]; + clrs[21] = colors[5]; + pnts[22] = verts[5]; + clrs[22] = colors[5]; + pnts[23] = verts[4]; + clrs[23] = colors[5]; + + + setCoordinates(0, pnts); + setColors(0, clrs); + } +} diff --git a/src/PickTest/GullCG.java b/src/PickTest/GullCG.java new file mode 100644 index 0000000..78ec036 --- /dev/null +++ b/src/PickTest/GullCG.java @@ -0,0 +1,576 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class GullCG extends CompressedGeometry { + + GullCG() { + super(cgHeader, cgData) ; + } + + private static final byte cgData[] = { + 25, 0, -120, 16, -58, -52, 33, -35, + -128, 67, -36, 0, -127, -72, 97, 14, + 64, 2, 29, 104, 4, 2, -45, 8, + 125, -89, 16, 51, -116, 33, -1, -104, + 71, -64, 48, -106, 31, 1, 32, -52, + 2, -127, 6, 5, 5, 32, 10, -78, + -128, 20, 14, 6, 40, 74, -128, 81, + -43, 24, -94, 44, 1, 86, -104, 98, + -96, 49, 5, 34, 112, 10, -68, -29, + 21, -115, -56, 40, 8, -64, 81, -74, + -128, -90, 13, 49, 71, 30, 2, -81, + -68, -30, -62, 122, 56, 37, -107, 60, + -109, 120, 0, 0, 26, -32, 18, 85, + -128, 14, -16, 71, -13, 66, -33, 103, + 127, -81, 78, -61, -106, -112, 0, 1, + -32, 13, -86, -96, 4, -103, -36, 59, + -23, 25, 39, 18, 11, 122, -80, 1, + -34, -22, -112, -109, -80, -71, -7, -39, + -40, 0, -127, 0, 0, 0, 0, 43, + 97, -102, 118, 16, 83, -32, -121, -87, + -32, -86, -4, 32, 121, 8, 33, -48, + -100, -39, 64, 0, 0, 50, 0, -47, + -9, -97, -118, 53, 75, -122, 89, -54, + -10, 8, 0, 69, -98, 0, 0, 54, + 3, -67, 0, 29, -17, 2, 64, 0, + 5, 126, -93, -56, -31, 15, 74, -95, + -128, 5, -64, 0, 3, -46, 8, 0, + 36, 0, 0, 58, 93, -92, 0, 0, + 30, 0, 87, 4, 0, 23, 4, 68, + 36, 64, 30, -17, -25, -121, -40, 22, + 13, 48, 78, -43, 73, -64, -10, 48, + 51, -25, -1, -82, -65, 3, 55, -71, + 41, 124, -50, -118, -64, 4, -102, 112, + 0, 1, -20, 5, 98, 59, -58, -95, + -87, 42, -9, -112, -99, -107, -91, -11, + 127, 5, 36, -46, -112, 121, 9, -39, + -17, -1, -41, 0, 0, 0, 112, 4, + -121, -19, -124, -16, -44, 66, -40, 36, + 116, -83, -96, -128, 7, -37, 100, -37, + 121, 11, 123, -81, -106, 43, 82, 14, + -85, -8, 41, -95, 67, 81, 18, 125, + 15, 39, -114, -88, 63, -10, 0, -11, + 5, 4, 73, -38, 13, 80, -64, 7, + 64, 56, 14, -56, 108, 3, -64, 96, + 5, -33, 81, 24, 11, -115, 26, -95, + -104, 95, -69, -95, -112, 15, 0, -128, + 40, 30, 67, -27, 1, 107, -55, 102, + -39, 97, 67, 103, 66, 79, 67, 37, + -60, 62, -95, -88, -32, 105, 72, 106, + -113, -59, -108, 54, -64, 43, 50, 9, + 86, 30, 45, 72, 101, 31, -51, -120, + 106, -8, 75, -24, 98, 111, -106, -12, + 54, 104, 54, 47, 87, -115, -61, -106, + 64, -47, 13, -80, 10, -116, -122, 39, + -3, 118, -7, 0, 0, 0, 0, 42, + -13, -118, 27, 96, 9, 27, -20, 71, + -8, -96, -50, 61, 111, 87, 102, -83, + -93, -54, 47, -37, 51, -113, 27, 122, + 98, -52, -91, -75, 1, 53, -96, 8, + 97, -120, 54, -44, 55, -1, -10, 105, + -108, -84, -4, -101, -64, 67, 41, -4, + 105, 67, 117, -60, 92, 67, 115, -4, + -65, 124, -125, 90, 64, 118, -85, 97, + 67, 39, 126, 96, 67, 78, 80, 65, + -15, 12, -57, 61, 94, 67, 50, 3, + -93, 33, -107, -2, -44, 16, 91, -34, + -115, -88, 109, 24, 75, -120, 109, -113, + -108, 20, 49, 52, 59, 122, 25, 51, + -29, 23, -85, -39, 33, -50, -28, 104, + -122, -16, 2, 0, -128, 90, 67, 20, + 1, -93, 124, -122, 31, 91, 113, -59, + 13, -55, -7, 121, 12, -57, 10, -10, + -122, 120, 0, 1, -8, 8, -56, 33, + -49, -59, 94, -78, -45, -85, 6, -33, + 105, -55, -121, -77, 99, -113, 91, 105, + -2, 77, -37, 70, -118, -2, 52, 102, + -122, -45, -120, -66, -122, 25, -7, 65, + 65, 19, 67, -69, 33, -92, 1, 0, + 0, 23, 16, -37, 31, 40, 113, -90, + 120, 118, -84, -48, -55, -17, -37, 16, + -59, 62, -88, 28, -126, 21, 70, 1, + -108, 3, 80, 1, -96, 45, 107, -115, + 124, 58, -60, 102, -128, 0, 7, 64, + 27, -60, 125, -107, 127, 42, -40, -83, + 57, -15, -71, 1, -32, -50, -60, 42, + 123, 106, 60, -16, -32, -66, 85, 26, + -14, -31, 82, -20, -49, -128, -120, 94, + -64, 0, -25, 50, 85, 26, -52, -80, + 23, -21, 7, -120, 1, 118, 53, -55, + 75, -83, -96, 2, 24, -16, 0, 0, + 0, 4, 18, -77, 92, -101, -64, 8, + 84, 72, -22, -33, 85, -126, -42, -69, + -41, -79, -49, -69, 126, -128, 5, 0, + -1, -128, 125, 54, 0, -53, 47, 110, + 91, -59, 64, 13, 119, 115, -59, 63, + 93, -28, -6, -23, -61, -128, 1, 40, + 0, 0, 80, 75, 64, -18, -33, -123, + -2, -117, -74, -116, 26, -106, -80, 6, + 91, -70, 21, -23, -44, 0, -121, 12, + 7, 64, 0, 5, 38, -73, 118, -79, + -114, 104, 118, 0, -5, 87, 2, 85, + -46, 94, 115, -112, -117, 72, 124, 100, + -32, 106, 106, 81, -98, -121, -100, 116, + 76, -121, -23, -112, 40, 43, 40, -92, + 57, -96, 4, 121, 47, -29, -65, 81, + -26, 2, -128, 16, 6, 62, -85, 86, + -67, -8, 74, -35, -77, -62, -5, -81, + -106, 56, 0, 0, 31, 1, -91, -48, + 0, 67, 27, -62, 100, 43, 80, 68, + 61, -48, 1, 24, 0, 45, 1, -16, + 7, 18, 1, -23, -88, -84, 127, -6, + 11, 37, -98, 14, 57, 107, -61, -52, + -114, -128, 1, 91, -92, -95, -82, -128, + 16, -64, 1, 108, 0, -128, 55, 111, + -101, 96, -80, 61, -90, -94, 122, 49, + -21, 14, -2, -73, 99, 115, 81, 11, + 90, -118, 74, -99, 30, -9, -9, 67, + -57, 80, 42, 79, -14, 3, -86, -91, + -94, 51, -1, 83, 64, -118, 50, 53, + -59, 74, -89, 126, -23, 32, 13, 57, + 40, -123, 76, 97, -41, 91, -115, -23, + 107, -83, -37, 81, 67, 27, -73, -113, + 58, 22, -80, 4, 88, 64, 109, -10, + -64, 14, -80, -19, -43, 15, 62, -80, + -116, -14, -121, -11, 110, -25, 38, -109, + 3, 55, -103, 85, -65, -79, -117, -37, + 66, -102, 97, -70, -123, 43, 104, -128, + 21, 100, 40, 71, -55, -125, 104, 33, + -43, 82, 84, -102, 7, -3, -32, -114, + 20, -37, -27, -4, -107, 116, 67, 3, + -7, -91, -9, -99, -25, -44, -71, -57, + 4, 5, -75, 74, 0, 1, 107, -120, + -19, -92, 21, -66, 100, 8, -124, -6, + -79, 18, -44, -27, 12, 12, -112, -32, + -108, -68, 99, 123, -89, -39, 98, -53, + 51, -10, -128, 10, 42, -48, -9, -108, + -34, -100, -7, -52, -123, -39, 100, -46, + 85, 45, 16, 0, 12, 97, -58, -25, + 32, 111, -32, 0, -48, 0, -48, 10, + -73, 86, -18, 104, 114, -102, -80, 32, + 0, 88, 0, 64, 7, -25, -127, 66, + -6, -75, 74, 73, 78, -51, -125, 4, + -103, -88, 1, 78, -62, 54, 84, 90, + -14, 32, 35, -18, -40, -67, -44, 106, + -102, -128, 2, 107, -24, -124, -64, 66, + -51, 15, 100, -87, 44, 0, 70, 125, + -120, 95, 33, 50, 123, 70, 83, 0, + -115, 122, 22, -102, 35, 92, -112, 94, + -87, -121, -66, -64, -105, -65, -15, 17, + -22, 122, -80, 33, 94, -5, 5, 75, + -35, 114, 65, 99, 99, 94, 28, -52, + -3, -77, 42, -16, -24, -87, 84, 12, + -76, 76, 90, 110, -120, 0, 86, -36, + -95, 85, 0, -122, -62, -125, 97, 67, + 13, 0, -127, -78, -19, 63, -3, -46, + 80, 0, -84, 0, 10, -128, 46, 3, + 40, 4, 55, 114, -8, -38, 16, -59, + -12, 84, -90, -35, -83, 111, 64, 21, + -128, 3, 96, 30, 3, -112, 12, -111, + -120, 13, -24, 14, -32, 5, 29, 16, + 1, 12, 123, -6, -60, 86, 82, 25, + 59, -56, 11, -74, -16, 4, 0, -104, + -91, 0, 16, -53, 59, 29, 101, 43, + 119, -41, -23, -100, 6, 74, 81, 56, + 10, -6, 32, 1, 91, -27, -31, -124, + 5, -40, -22, -90, 46, -78, -128, 5, + 99, -64, 0, 0, 0, 19, -128, 33, + -106, 5, -44, -26, -57, -97, -113, -64, + 20, -93, 72, 2, 55, 48, 8, 111, + 80, 31, -32, 31, -16, 12, -30, -26, + -88, 9, -69, -128, 8, 98, 3, 64, + 120, 5, -67, 118, -12, 59, -118, -122, + -115, 122, -6, -122, -125, -95, -77, -95, + -105, 73, -28, -6, -122, -86, -127, 51, + -95, -105, 125, -22, -6, -122, -38, -31, + -65, 84, -86, -14, 95, 71, -97, 67, + 111, -66, -81, -47, -124, 92, 22, 1, + -43, 16, 1, 13, 97, -18, -63, -82, + -46, -120, 106, -110, -122, -17, 120, 97, + -87, 82, 67, -99, 75, -48, -33, 95, + 79, 2, -32, -32, -104, 13, 41, 0, + 8, 103, 79, -105, -115, 112, 112, 70, + 3, 21, 84, 51, -101, -53, 18, 8, + 14, -62, -83, 72, 100, 72, 72, -24, + 102, 71, -73, -117, 17, 30, -65, -32, + -40, 36, 4, 46, -51, 76, 44, 96, + -44, 0, -57, 102, 54, -31, -2, 80, + 0, -71, 98, -72, 80, 46, 82, -64, + 8, 96, -80, 0, 32, 0, 16, 8, + 55, 106, -98, -121, -19, 64, 11, -108, + 36, 103, 8, -88, 8, 0, 46, -116, + -101, 104, -128, 50, -54, 112, 93, 73, + 64, 0, 115, -128, 0, 3, -32, 14, + -100, 25, 96, 0, -66, 0, 0, 22, + 49, -64, 12, -76, -124, 35, -95, 56, + 1, -10, 0, 11, -32, 122, 1, 98, + 20, 114, -38, 16, -18, -124, -32, 7, + -40, 0, 47, -128, 0, 5, 104, 97, + -53, 8, 127, -70, 35, -128, 29, -32, + 0, -66, 0, 0, 20, 7, -17, 104, + 124, -70, 47, -34, 0, 11, -32, 0, + 1, 93, 124, -78, -121, -29, -93, 56, + 0, 22, 0, 11, -32, 0, 1, 82, + -58, 122, -38, 31, 110, -101, 125, -128, + 2, -8, 0, 0, 86, -26, 28, -74, + -121, -29, -92, 56, 1, -106, 0, 11, + -32, 0, 1, -2, -104, 0, 35, 53, + -127, 65, -82, 34, 38, -51, -74, -34, + 0, -71, 123, 66, 111, -63, -24, 16, + 1, 12, 0, 17, 0, 0, 21, 5, + -48, -125, 109, 48, 7, -118, -125, 83, + -68, 10, 115, -112, 1, 0, -128, 18, + -47, -89, 61, 121, -86, 77, 58, 16, + 109, 92, 65, 86, 127, -82, -100, 31, + 96, 0, 64, 0, 0, 30, -7, 68, + -116, 32, 0, 3, -32, 28, 72, 13, + -110, -125, 43, 0, 17, 107, -64, 23, + -92, 0, 46, -64, 1, -96, 13, 1, + 91, -112, 1, 12, 5, -2, -66, -122, + -110, -104, 81, 19, 30, -2, 60, 2, + 18, 96, 48, -112, 20, 51, 16, 38, + -51, 126, 67, 56, 33, -82, -78, -87, + -117, -10, 10, -52, -86, -18, -97, 120, + 62, -47, 67, -9, -86, 81, -17, 0, + 8, 0, 24, 5, -127, -5, -38, 0, + 47, 67, -9, -128, 4, 0, 0, 2, + -80, -1, 97, 7, -9, -82, 81, -53, + 0, 8, 0, 0, 5, 4, 112, 3, + -19, -96, -14, -11, -56, 57, 96, 1, + 0, 0, 0, -82, -116, 0, 125, -108, + 31, 30, -71, 71, -68, 0, 32, 0, + 0, 21, 7, -53, 104, 61, -67, 35, + 0, 5, 96, 1, 0, 0, 0, -84, + 3, 45, -96, -8, -11, 12, 0, 21, + -128, 4, 0, 0, 3, -8, 15, -77, + -64, -108, 16, -30, 14, 61, 105, -40, + -81, 27, 124, -75, 64, 40, 6, -11, + -54, 32, -32, 1, 0, 0, 0, -111, + -63, -106, -116, -125, 115, 5, 0, 33, + 76, 0, 1, -64, 61, -96, 25, 26, + -116, 24, 37, 66, -113, -55, 42, 77, + 19, -35, -4, -73, -111, -110, -14, 12, + -23, 12, 0, 101, -91, 0, 0, 1, + 0, 104, 70, 0, 43, -39, -99, -46, + 78, 45, -5, 58, -30, 2, -127, 27, + 44, -22, 80, -118, 53, -24, 58, -3, + -17, -76, -90, 95, 18, 55, -16, -39, + -4, -121, -55, -25, -11, -38, 85, 68, + 60, -76, 15, -5, 124, 40, 0, 86, + -14, 12, -2, 3, 124, -16, 63, 0, + -69, -91, 102, 2, -128, 16, 6, 48, + 31, 43, 94, -4, 50, 42, 14, 90, + -126, -95, 107, -18, -96, 0, -102, 71, + -11, -68, 16, -37, 11, -59, 122, -2, + 64, 1, -64, 59, 1, -38, 24, 80, + -48, 5, 64, 0, 15, -46, 104, -82, + -57, -19, -4, -115, 115, 112, 92, 20, + -28, -3, -127, 64, 125, -64, 127, -64, + 56, -125, -113, 74, 118, 43, 78, -35, + 107, 47, -18, 91, -121, -111, 0, 0, + 0, 126, -128, 63, -23, 31, 102, -65, + 32, 53, -30, -104, 102, 86, -16, -16, + 8, 86, 2, -20, 31, 24, -11, -56, + 1, 78, 0, 16, -127, -104, 10, 18, + 102, -51, 8, 122, 0, 86, 0, 19, + 1, -120, 10, -32, 34, -55, 65, 111, + 64, 16, 119, -128, 5, -128, 98, 3, + -82, -103, 100, -64, 0, 7, -80, 31, + -111, -128, 11, -108, 89, 16, 106, -107, + -56, 1, 118, -75, -10, 121, -92, 0, + -69, 121, 5, 32, -79, 43, -104, 2, + -20, 123, -2, -51, 72, 1, 118, -6, + 40, -5, -105, 48, 2, 24, 56, 0, + 4, 0, 4, 2, -15, 90, 90, 93, + -4, 1, -117, 86, -87, -89, 67, 0, + 86, -98, -94, 121, 1, -66, -34, 0, + -64, 18, 10, 86, -40, 21, 115, 0, + 70, -28, 1, -22, 1, -14, 0, -126, + 33, 12, -87, 38, -3, -30, -104, -28, + 124, 89, -63, -58, 77, -76, -79, -89, + 98, 8, -64, 7, 0, 56, 11, -62, + 59, -45, 18, 46, -62, -51, -128, 14, + 0, 96, 25, -128, -33, 93, 64, 45, + -35, -101, 120, 31, 0, -96, 58, -128, + -122, -120, 7, 0, 0, 1, -39, 12, + 0, 124, 2, 0, -80, 70, -36, -127, + 119, 16, -122, -16, 62, 0, -128, 126, + -19, 54, 70, 121, 108, 26, 17, -117, + 107, -52, -30, 35, -36, 19, 93, -128, + 28, 102, -39, -122, -61, 118, 1, 12, + 0, 28, 10, -128, -13, 114, -33, 14, + 66, -109, 7, 48, 2, 24, -24, 3, + -52, -92, 110, 123, 124, -96, 8, 67, + 40, 8, -87, -111, -117, -71, -98, -124, + 73, -128, 3, 96, 30, 2, 105, 8, + 32, 64, -74, 41, 48, -6, -67, -105, + -56, 43, 106, -53, -75, 0, 67, 113, + 2, 121, -89, 114, 4, -128, 57, -60, + 80, -50, 56, -107, 16, -46, -64, 45, + 72, 96, 88, 107, 8, 105, -64, 55, + -31, -112, 108, -89, -76, -59, 0, 107, + -124, 42, 26, -53, -21, -116, 92, 14, + -100, -107, -109, -62, 94, 64, 33, -75, + -128, -121, -12, -102, -122, 17, -119, 101, + 67, 88, 27, -27, 41, 13, -76, 22, + -20, -126, 0, 0, 0, 0, 71, 67, + 113, -66, 51, -95, -92, -122, 12, -94, + -126, 33, -13, 103, 35, 46, -1, -47, + 40, 68, -101, 48, 41, -100, -119, -79, + 47, 60, 83, 64, 67, 101, -122, 51, + -103, -119, 107, -62, -102, 1, 12, 8, + 22, -2, 42, -73, 77, 6, 91, 32, + 2, 49, -73, -89, -63, 8, 98, -45, + -21, -16, 10, 50, 41, -87, 74, -76, + 53, 91, 75, -43, -40, 0, 42, 1, + -96, 36, -46, 0, 111, -85, 57, 94, + 93, 119, -104, 116, 17, -104, -65, 84, + 97, 100, -102, 37, 15, -68, 126, 73, + 47, -111, 115, -53, -46, -72, 0, 102, + -60, -123, 119, 1, -54, 64, 4, 2, + 0, 118, 71, 92, 0, 12, 12, -128, + -34, -55, -65, 74, -85, -111, 78, -125, + -3, 127, -100, -111, -80, -128, 10, -108, + -56, 16, 1, -109, -24, 21, -44, -115, + -9, -32, -16, 35, 37, 14, -22, -69, + -106, -15, 64, 3, 45, -22, 33, 86, + -64, 32, -41, 32, 117, 52, 62, -27, + -101, -118, -74, -125, -66, 56, -13, 93, + 113, -56, 21, 79, -76, -128, 0, -103, + 122, 126, -48, 20, 93, -90, 47, 42, + -40, 8, 17, -83, -94, -33, 8, 93, + -113, 10, 79, 62, -128, 23, 109, -25, + -8, 1, 33, 90, 0, 33, -118, 5, + -44, -54, -64, 127, -113, 64, 16, -64, + 2, 80, 15, 1, -5, -27, -38, -16, + -83, 41, -118, 15, -37, -57, -79, -94, + -51, 50, -59, -47, 20, -59, 64, 15, + -75, 107, -53, -91, -96, -9, -128, 1, + 48, 0, 0, 80, 94, -19, 92, -10, + -127, -20, 0, 14, 82, 125, 83, -24, + -121, 56, -124, 61, -67, -88, -73, 64, + 120, 0, 0, 84, 0, -61, -19, 99, + 32, -33, -26, -76, -26, -17, -51, -122, + 38, -111, -84, -36, 12, 93, -77, -66, + -85, -86, 0, 107, -68, 6, -36, 92, + -74, 30, 102, 71, 64, 3, 93, 78, + -80, -75, -7, 5, 93, -6, -57, -74, + -79, 79, -109, 78, 22, 117, 108, -111, + 122, 52, 96, -49, 38, -117, -125, 123, + 10, 114, 121, 85, 96, -48, 0, -96, + 31, 16, 13, 39, -42, 113, 50, -109, + -9, 90, 59, 93, 15, -8, -79, 116, + -14, 77, -128, 29, 104, -19, -42, -97, + -94, -62, 6, -33, 44, 0, -5, 108, + -3, 91, -19, 7, -83, -27, 81, 49, + 24, -12, -109, 123, -51, 60, 39, 111, + -50, 23, -78, 53, -10, 14, -80, -93, + 122, -87, 33, -78, -30, 59, -95, -96, + 10, -128, 0, 30, 61, 92, -112, -53, + -25, 104, -76, 24, -79, 9, 37, 32, + 22, 4, -57, 1, 109, 65, 7, 26, + -98, 59, 106, -101, 103, -64, -116, -52, + 11, 29, 23, 106, 107, 106, -51, -15, + 120, -5, -20, 1, 54, -16, -47, -77, + 0, 38, -81, -54, 18, -8, 32, -122, + 69, 70, 117, 23, 44, 0, 0, 30, + 0, -68, 0, 109, -128, -45, -37, 80, + 48, 5, 118, -25, -85, 50, 110, 108, + -111, 51, -47, 23, 16, -96, 45, 99, + -51, -110, -12, 96, -63, -42, 20, 120, + 89, 86, 41, 120, 32, 5, 41, -5, + 0, 13, -99, 104, -100, -128, 10, -80, + 16, 0, 104, 15, -104, 5, 106, -85, + 125, 9, 57, -1, 91, -16, 0, 44, + 7, -32, 3, -10, 55, 40, -1, 80, + 65, -126, -64, 66, -20, -37, 66, -59, + 95, 64, 4, 55, -20, 26, 13, -37, + -126, 125, -106, -48, 1, 13, -48, -65, + -90, -126, -79, -123, 21, 32, 8, 108, + 95, -91, -111, 115, 44, -101, -112, 1, + 82, 16, 0, 103, 1, -51, 0, -112, + -14, 103, -112, -122, 98, 46, -43, -71, + 41, 126, -76, 0, -71, 79, 2, 127, + 108, -2, -128, 23, 109, 93, -111, -74, + 90, 0, 33, -96, 63, -94, -107, -86, + 70, 92, -64, 21, -67, 64, 0, -128, + 127, -64, 51, 0, 23, 126, -40, 69, + 68, 0, -101, 71, -5, -84, -127, -82, + 104, -123, 85, 80, -55, -81, 47, -88, + 109, -46, 27, -11, 74, -83, 49, -35, + 116, 113, 112, 0, 86, 0, -72, 15, + 32, 4, -37, 124, 11, 126, -116, -32, + 11, -113, 126, 40, -92, 0, 33, -110, + -2, 87, 53, -51, 64, -81, -51, 74, + -36, 121, -4, 102, -15, 117, -19, 4, + 93, -32, 4, 49, 0, 96, 60, 3, + -23, 26, 19, -124, -92, 33, 13, -94, + -16, -6, -122, -83, -127, 54, 33, -118, + -99, -79, 32, -107, 112, 30, -8, -122, + -125, -66, -77, -95, -91, 122, 16, -114, + -122, 92, 123, 113, 65, 69, 125, 125, + 67, 66, 48, -43, 80, -53, 78, -49, + 29, 37, 10, 121, -59, 36, -61, -114, + -109, -28, 103, -92, 0, 46, -57, -115, + 72, 127, -12, 0, -55, 101, -48, -119, + -117, 22, -64, 1, 25, -110, 21, -60, + 66, 26, 43, -21, -59, -55, -62, -58, + -21, 46, -96, -128, 25, 101, 0, 0, + 1, -64, 31, 9, 64, 1, -75, -73, + -55, 82, 0, -89, 94, 13, -76, -56, + 74, -1, 83, 115, 72, -21, -104, 43, + 56, -75, -32, -10, 74, -11, -66, 126, + 11, 72, 113, -40, 29, -51, -12, -127, + 6, -85, -116, -85, 78, 30, -65, -44, + -111, -1, -95, -111, 62, -33, 68, -55, + -29, -91, 112, -93, 37, 1, 72, -111, + -114, 0, 125, -96, -32, -38, 9, 70, + 76, -102, 5, -28, -116, -109, -53, -58, + -7, -37, -7, 0, 10, 114, 100, -105, + -47, -53, 59, 46, -37, -23, 64, 2, + -73, 112, 103, -16, 4, 102, -18, 104, + 21, -40, 70, -70, 0, 88, 0, 1, + -113, -123, 88, -89, -55, -112, -84, -45, + -107, -82, 28, -128, 40, 105, 24, 55, + 61, -73, -40, 15, -72, 0, 8, 4, + 47, -27, 88, -18, -3, 74, 50, 104, + -111, 31, -27, -4, -115, 115, 111, -92, + 22, -12, -10, -128, 3, -128, 10, 3, + 78, -56, 97, 127, 104, 8, 105, 24, + 53, -2, -43, 119, -21, -12, -13, 104, + -95, 71, -19, -4, 13, -13, -57, -20, + 16, -16, -36, -84, 95, 88, 52, -5, + 8, 1, 78, 97, -68, -67, 120, -40, + 0, 66, 1, -96, 40, 64, 2, -20, + -2, -57, -88, 2, -84, 0, 38, 0, + -16, 21, -2, 60, -102, -38, -12, -115, + 88, 0, 88, 1, -32, 43, 95, 57, + -9, -115, 32, -3, 113, -28, -45, 31, + -62, 57, 7, -5, -30, -105, 106, 102, + 59, -44, 32, 7, 56, 0, 52, 6, + 96, 61, 3, 54, -24, 0, 1, -56, + 11, 0, 92, -70, 40, 85, 113, 0, + 16, -42, -79, 73, -73, 106, 66, 21, + 104, 64, 11, -79, -20, 11, 14, 32, + 1, 88, 119, -60, 14, 96, 16, -34, + 64, 0, 32, 63, -32, 23, -48, -35, + 82, -20, -92, 110, -102, -15, 52, 8, + 67, 24, 17, 83, 35, 2, 58, -84, + -120, -41, 50, -55, -65, 123, 39, -42, + 6, -71, 71, 19, 1, 126, 60, 2, + 4, 98, 87, 124, 19, 60, -112, -41, + 111, 63, -96, 9, -119, -109, 47, 24, + 113, -108, -126, 55, 2, -66, 88, -60, + 120, -127, -24, 18, -64, 78, 40, 99, + 32, -21, 56, -5, -66, 100, -80, 19, + -116, -37, 77, -75, -18, -64, 33, -128, + 3, -128, -80, 25, -4, 71, -122, 61, + 103, 39, 20, 54, -81, -54, -99, -112, + -64, 7, 0, -56, 11, -63, 106, -71, + -25, 100, -103, 51, 0, 28, 3, 64, + 51, 0, -33, 90, -44, 89, -39, -101, + 8, 31, 3, 96, 44, 0, -122, 101, + 9, 114, 67, 0, 0, -1, -64, -1, + 0, 88, 35, 82, 67, -71, 8, 43, + 0, 64, -1, -64, -1, -128, 126, 1, + -110, 101, 95, -6, -37, 113, 0, 9, + -79, 19, -26, 112, 41, -51, -83, 18, + 113, -108, 52, -113, -25, -44, 54, 33, + 13, -59, 13, 5, -11, 97, 12, -58, + 8, -50, -122, 90, -17, -102, -46, 26, + -82, 9, -80, -116, 83, -23, -56, 69, + 73, 84, 0, -28, 7, -12, 3, 47, + 17, -68, 43, -26, -62, 32, 92, 25, + -15, -43, 24, 1, 13, -98, -18, -64, + -122, -51, 120, 98, -102, 24, 71, -35, + -127, 5, 90, 48, -42, -92, 49, -36, + 36, 116, 52, -29, -21, -11, 72, -59, + 21, -22, 106, -14, -73, -16, 36, 16, + 19, 105, 110, -105, -16, 41, 71, 54, + 80, -38, 109, 73, -110, -63, 21, 72, + 35, 38, 59, 49, 8, -109, 24, 88, + 29, 72, -125, 50, 91, -93, 16, 9, + -77, -53, 126, 20, -64, 33, 2, 58, + -90, 8, -109, 102, 61, 41, -112, 70, + 65, -9, 75, 17, 38, 22, -12, 83, + 35, 125, -4, -14, -62, -95, -106, -103, + -66, -82, 70, -60, -16, 115, 17, 30, + -4, 0, 11, 1, -8, 0, -126, -120, + 75, 65, -47, -42, -58, 126, -55, -128, + 0, 15, 96, 52, 115, 14, -37, 79, + -70, 71, 10, 60, -102, 74, 34, 124, + -25, 10, 5, 112, -24, -46, -68, 105, + 23, -34, -3, 4, 95, -20, 69, -37, + 50, -98, 8, 17, -113, 97, 20, 72, + 33, -107, 88, -45, -56, -49, -80, -85, + -30, 36, 85, -77, 9, 68, 33, -94, + -67, -97, 72, -52, 35, -108, -95, 23, + 96, 40, 22, 40, 64, 12, 87, -122, + -9, 27, -23, 2, 8, -73, -6, -26, + -112, 22, 4, -44, 116, 85, 2, -116, + -109, -24, -101, -34, 56, 1, -74, 16, + 0, 1, -16, 14, 61, 89, 56, 51, + -21, -107, -101, -72, -17, 64, 46, -64, + 2, -80, 13, 1, -37, 16, 1, 4, + 0, 0, 0, 0, -63, 118, 101, -103, + 91, -60, 32, 4, -40, 52, 58, 119, + 64, 32, 0, -52, 0, 0, 0, -120 + } ; + + private static final CompressedGeometryHeader cgHeader ; + + static { + cgHeader = new CompressedGeometryHeader() ; + cgHeader.majorVersionNumber = 1 ; + cgHeader.minorVersionNumber = 0 ; + cgHeader.minorMinorVersionNumber = 1 ; + cgHeader.bufferType = CompressedGeometryHeader.TRIANGLE_BUFFER ; + cgHeader.bufferDataPresent = CompressedGeometryHeader.NORMAL_IN_BUFFER ; + cgHeader.start = 0 ; + cgHeader.size = cgData.length ; + } +} diff --git a/src/PickTest/IcosahedronITSA.java b/src/PickTest/IcosahedronITSA.java new file mode 100644 index 0000000..13ee53e --- /dev/null +++ b/src/PickTest/IcosahedronITSA.java @@ -0,0 +1,178 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class IcosahedronITSA extends IndexedTriangleStripArray { + + private static final int[] sVertCnt = { + 3, 11, 5, 4, 5, 4 + }; + + IcosahedronITSA() { + super(12, GeometryArray.COORDINATES | GeometryArray.COLOR_3, 32, sVertCnt); + + Point3f verts[] = new Point3f[12]; + Color3f colors[] = new Color3f[12]; + + verts[0] = new Point3f(0.0f, 1.4f, 0.8652f); + verts[1] = new Point3f(0.0f, 1.4f, -0.8652f); + verts[2] = new Point3f(1.4f, 0.8652f, 0.0f); + verts[3] = new Point3f(1.4f, -0.8652f, 0.0f); + verts[4] = new Point3f(0.0f, -1.4f, -0.8652f); + verts[5] = new Point3f(0.0f, -1.4f, 0.8652f); + verts[6] = new Point3f(0.8652f, 0.0f, 1.4f); + verts[7] = new Point3f(-0.8652f, 0.0f, 1.4f); + verts[8] = new Point3f(0.8652f, 0.0f, -1.4f); + verts[9] = new Point3f(-0.8652f, 0.0f, -1.4f); + verts[10] = new Point3f(-1.4f, 0.8652f, 0.0f); + verts[11] = new Point3f(-1.4f, -0.8652f, 0.0f); + + colors[0] = new Color3f(1.0f, 0.0f, 0.0f); + colors[1] = new Color3f(0.0f, 1.0f, 0.0f); + colors[2] = new Color3f(0.0f, 0.0f, 1.0f); + colors[3] = new Color3f(1.0f, 1.0f, 0.0f); + colors[4] = new Color3f(0.0f, 1.0f, 1.0f); + colors[5] = new Color3f(1.0f, 0.0f, 1.0f); + colors[6] = new Color3f(0.0f, 0.5f, 0.0f); + colors[7] = new Color3f(0.0f, 0.0f, 0.5f); + colors[8] = new Color3f(0.5f, 0.5f, 0.0f); + colors[9] = new Color3f(0.0f, 0.5f, 0.5f); + colors[10] = new Color3f(0.5f, 0.0f, 0.5f); + colors[11] = new Color3f(0.5f, 0.5f, 0.5f); + + int pntsIndex[] = new int[32]; + int clrsIndex[] = new int[32]; + + pntsIndex[0] = 4; + clrsIndex[0] = 4; + pntsIndex[1] = 5; + clrsIndex[1] = 5; + pntsIndex[2] = 11; + clrsIndex[2] = 11; + + pntsIndex[3] = 11; + clrsIndex[3] = 11; + pntsIndex[4] = 5; + clrsIndex[4] = 5; + pntsIndex[5] = 7; + clrsIndex[5] = 7; + + pntsIndex[6] = 6; + clrsIndex[6] = 6; + + pntsIndex[7] = 0; + clrsIndex[7] = 0; + + pntsIndex[8] = 2; + clrsIndex[8] = 2; + + pntsIndex[9] = 1; + clrsIndex[9] = 1; + + pntsIndex[10] = 8; + clrsIndex[10] = 8; + + pntsIndex[11] = 9; + clrsIndex[11] = 9; + + pntsIndex[12] = 4; + clrsIndex[12] = 4; + + pntsIndex[13] = 11; + clrsIndex[13] = 11; + + pntsIndex[14] = 2; + clrsIndex[14] = 2; + pntsIndex[15] = 6; + clrsIndex[15] = 6; + pntsIndex[16] = 3; + clrsIndex[16] = 3; + + pntsIndex[17] = 5; + clrsIndex[17] = 5; + + pntsIndex[18] = 4; + clrsIndex[18] = 4; + + pntsIndex[19] = 4; + clrsIndex[19] = 4; + pntsIndex[20] = 8; + clrsIndex[20] = 8; + pntsIndex[21] = 3; + clrsIndex[21] = 3; + + pntsIndex[22] = 2; + clrsIndex[22] = 2; + + pntsIndex[23] = 0; + clrsIndex[23] = 0; + pntsIndex[24] = 1; + clrsIndex[24] = 1; + pntsIndex[25] = 10; + clrsIndex[25] = 10; + + pntsIndex[26] = 9; + clrsIndex[26] = 9; + + pntsIndex[27] = 11; + clrsIndex[27] = 11; + + pntsIndex[28] = 0; + clrsIndex[28] = 0; + pntsIndex[29] = 10; + clrsIndex[29] = 10; + pntsIndex[30] = 7; + clrsIndex[30] = 7; + + pntsIndex[31] = 11; + clrsIndex[31] = 11; + + setCoordinates(0, verts); + setCoordinateIndices(0, pntsIndex); + setColors(0, colors); + setColorIndices(0, clrsIndex); + } +} diff --git a/src/PickTest/IcosahedronTSA.java b/src/PickTest/IcosahedronTSA.java new file mode 100644 index 0000000..f46ba75 --- /dev/null +++ b/src/PickTest/IcosahedronTSA.java @@ -0,0 +1,175 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class IcosahedronTSA extends TriangleStripArray { + private static final int[] sVertCnt = { + 3, 11, 5, 4, 5, 4 + }; + + IcosahedronTSA() { + super(32, GeometryArray.COORDINATES | GeometryArray.COLOR_3, sVertCnt); + + Point3f verts[] = new Point3f[12]; + Color3f colors[] = new Color3f[12]; + + verts[0] = new Point3f(0.0f, 1.4f, 0.8652f); + verts[1] = new Point3f(0.0f, 1.4f, -0.8652f); + verts[2] = new Point3f(1.4f, 0.8652f, 0.0f); + verts[3] = new Point3f(1.4f, -0.8652f, 0.0f); + verts[4] = new Point3f(0.0f, -1.4f, -0.8652f); + verts[5] = new Point3f(0.0f, -1.4f, 0.8652f); + verts[6] = new Point3f(0.8652f, 0.0f, 1.4f); + verts[7] = new Point3f(-0.8652f, 0.0f, 1.4f); + verts[8] = new Point3f(0.8652f, 0.0f, -1.4f); + verts[9] = new Point3f(-0.8652f, 0.0f, -1.4f); + verts[10] = new Point3f(-1.4f, 0.8652f, 0.0f); + verts[11] = new Point3f(-1.4f, -0.8652f, 0.0f); + + colors[0] = new Color3f(1.0f, 0.0f, 0.0f); + colors[1] = new Color3f(0.0f, 1.0f, 0.0f); + colors[2] = new Color3f(0.0f, 0.0f, 1.0f); + colors[3] = new Color3f(1.0f, 1.0f, 0.0f); + colors[4] = new Color3f(0.0f, 1.0f, 1.0f); + colors[5] = new Color3f(1.0f, 0.0f, 1.0f); + colors[6] = new Color3f(0.0f, 0.5f, 0.0f); + colors[7] = new Color3f(0.0f, 0.0f, 0.5f); + colors[8] = new Color3f(0.5f, 0.5f, 0.0f); + colors[9] = new Color3f(0.0f, 0.5f, 0.5f); + colors[10] = new Color3f(0.5f, 0.0f, 0.5f); + colors[11] = new Color3f(0.5f, 0.5f, 0.5f); + + Point3f pnts[] = new Point3f[32]; + Color3f clrs[] = new Color3f[32]; + + pnts[0] = verts[4]; + clrs[0] = colors[4]; + pnts[1] = verts[5]; + clrs[1] = colors[5]; + pnts[2] = verts[11]; + clrs[2] = colors[11]; + + pnts[3] = verts[11]; + clrs[3] = colors[11]; + pnts[4] = verts[5]; + clrs[4] = colors[5]; + pnts[5] = verts[7]; + clrs[5] = colors[7]; + + pnts[6] = verts[6]; + clrs[6] = colors[6]; + + pnts[7] = verts[0]; + clrs[7] = colors[0]; + + pnts[8] = verts[2]; + clrs[8] = colors[2]; + + pnts[9] = verts[1]; + clrs[9] = colors[1]; + + pnts[10] = verts[8]; + clrs[10] = colors[8]; + + pnts[11] = verts[9]; + clrs[11] = colors[9]; + + pnts[12] = verts[4]; + clrs[12] = colors[4]; + + pnts[13] = verts[11]; + clrs[13] = colors[11]; + + pnts[14] = verts[2]; + clrs[14] = colors[2]; + pnts[15] = verts[6]; + clrs[15] = colors[6]; + pnts[16] = verts[3]; + clrs[16] = colors[3]; + + pnts[17] = verts[5]; + clrs[17] = colors[5]; + + pnts[18] = verts[4]; + clrs[18] = colors[4]; + + pnts[19] = verts[4]; + clrs[19] = colors[4]; + pnts[20] = verts[8]; + clrs[20] = colors[8]; + pnts[21] = verts[3]; + clrs[21] = colors[3]; + + pnts[22] = verts[2]; + clrs[22] = colors[2]; + + pnts[23] = verts[0]; + clrs[23] = colors[0]; + pnts[24] = verts[1]; + clrs[24] = colors[1]; + pnts[25] = verts[10]; + clrs[25] = colors[10]; + + pnts[26] = verts[9]; + clrs[26] = colors[9]; + + pnts[27] = verts[11]; + clrs[27] = colors[11]; + + pnts[28] = verts[0]; + clrs[28] = colors[0]; + pnts[29] = verts[10]; + clrs[29] = colors[10]; + pnts[30] = verts[7]; + clrs[30] = colors[7]; + + pnts[31] = verts[11]; + clrs[31] = colors[11]; + + setCoordinates(0, pnts); + setColors(0, clrs); + } +} diff --git a/src/PickTest/IntersectInfoBehavior.java b/src/PickTest/IntersectInfoBehavior.java new file mode 100644 index 0000000..226c6a4 --- /dev/null +++ b/src/PickTest/IntersectInfoBehavior.java @@ -0,0 +1,254 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.media.j3d.*; +import javax.vecmath.*; +import com.sun.j3d.utils.picking.*; +import com.sun.j3d.utils.geometry.*; + +/** + * Class: IntersectInfoBehavior + * + * Description: Used to respond to mouse pick and drag events + * in the 3D window. Displays information about the pick. + * + * Version: 1.0 + * + */ +public class IntersectInfoBehavior extends Behavior { + + float size; + PickCanvas pickCanvas; + PickResult[] pickResult; + Appearance oldlook, redlookwf, redlook, greenlook, bluelook; + Node oldNode = null; + GeometryArray oldGeom = null; + Color3f redColor = new Color3f (1.0f, 0.0f, 0.0f); + TransformGroup[] sphTrans = new TransformGroup [6]; + Sphere[] sph = new Sphere [6]; + Transform3D spht3 = new Transform3D(); + + public IntersectInfoBehavior(Canvas3D canvas3D, BranchGroup branchGroup, + float size) { + pickCanvas = new PickCanvas(canvas3D, branchGroup); + pickCanvas.setTolerance(5.0f); + pickCanvas.setMode(PickCanvas.GEOMETRY_INTERSECT_INFO); + this.size = size; + // Create an Appearance. + redlook = new Appearance(); + Color3f objColor = new Color3f(0.5f, 0.0f, 0.0f); + Color3f black = new Color3f(0.0f, 0.0f, 0.0f); + Color3f white = new Color3f(1.0f, 1.0f, 1.0f); + redlook.setMaterial(new Material(objColor, black, objColor, white, 50.0f)); + redlook.setCapability (Appearance.ALLOW_MATERIAL_WRITE); + + redlookwf = new Appearance (); + redlookwf.setMaterial(new Material(objColor, black, objColor, white, 50.0f)); + PolygonAttributes pa = new PolygonAttributes(); + pa.setPolygonMode(pa.POLYGON_LINE); + pa.setCullFace(pa.CULL_NONE); + redlookwf.setPolygonAttributes(pa); + + oldlook = new Appearance(); + objColor = new Color3f(1.0f, 1.0f, 1.0f); + oldlook.setMaterial(new Material(objColor, black, objColor, white, 50.0f)); + + greenlook = new Appearance(); + objColor = new Color3f(0.0f, 0.8f, 0.0f); + greenlook.setMaterial(new Material(objColor, black, objColor, white, 50.0f)); + bluelook = new Appearance(); + objColor = new Color3f(0.0f, 0.0f, 0.8f); + bluelook.setMaterial(new Material(objColor, black, objColor, white, 50.0f)); + for (int i=0;i<6;i++) { + switch (i) { + case 0: + sph[i] = new Sphere(size*1.15f, redlook); + break; + case 1: + sph[i] = new Sphere(size*1.1f, greenlook); + break; + default: + sph[i] = new Sphere(size, bluelook); + break; + } + sph[i].setPickable (false); + sphTrans[i] = new TransformGroup (); + sphTrans[i].setCapability (TransformGroup.ALLOW_TRANSFORM_READ); + sphTrans[i].setCapability (TransformGroup.ALLOW_TRANSFORM_WRITE); + + // Add sphere, transform + branchGroup.addChild (sphTrans[i]); + sphTrans[i].addChild (sph[i]); + } + } + + public void initialize() { + wakeupOn (new WakeupOnAWTEvent(MouseEvent.MOUSE_PRESSED)); + } + + public void processStimulus (Enumeration criteria) { + WakeupCriterion wakeup; + AWTEvent[] event; + int eventId; + + while (criteria.hasMoreElements()) { + wakeup = (WakeupCriterion) criteria.nextElement(); + if (wakeup instanceof WakeupOnAWTEvent) { + event = ((WakeupOnAWTEvent)wakeup).getAWTEvent(); + for (int i=0; i<event.length; i++) { + eventId = event[i].getID(); + if (eventId == MouseEvent.MOUSE_PRESSED) { + int x = ((MouseEvent)event[i]).getX(); + int y = ((MouseEvent)event[i]).getY(); + pickCanvas.setShapeLocation(x, y); + + Point3d eyePos = pickCanvas.getStartPosition (); + pickResult = pickCanvas.pickAllSorted(); + // Use this to do picking benchmarks + /* + long start = System.currentTimeMillis(); + for (int l=0;l<3;l++) { + if (l == 0) System.out.print ("BOUNDS: "); + if (l == 1) System.out.print ("GEOMETRY: "); + if (l == 2) System.out.print ("GEOMETRY_INTERSECT_INFO: "); + + for (int k=0;k<1000;k++) { + if (l == 0) { + pickCanvas.setMode(PickTool.BOUNDS); + pickResult = pickCanvas.pickAllSorted(); + } + if (l == 1) { + pickCanvas.setMode(PickTool.GEOMETRY); + pickResult = pickCanvas.pickAllSorted(); + } + if (l == 2) { + pickCanvas.setMode(PickTool.GEOMETRY_INTERSECT_INFO); + pickResult = pickCanvas.pickAllSorted(); + } + } + long delta = System.currentTimeMillis() - start; + System.out.println ("\t"+delta+" ms / 1000 picks"); + } + */ + if (pickResult != null) { + + // Get closest intersection results + PickIntersection pi = + pickResult[0].getClosestIntersection(eyePos); + + GeometryArray curGeomArray = pi.getGeometryArray(); + + // Position sphere at intersection point + Vector3d v = new Vector3d(); + Point3d intPt = pi.getPointCoordinatesVW(); + v.set(intPt); + spht3.setTranslation (v); + sphTrans[0].setTransform (spht3); + + // Position sphere at closest vertex + Point3d closestVert = pi.getClosestVertexCoordinatesVW(); + v.set(closestVert); + spht3.setTranslation (v); + sphTrans[1].setTransform (spht3); + + Point3d []ptw = pi.getPrimitiveCoordinatesVW(); + Point3d []pt = pi.getPrimitiveCoordinates(); + int []coordidx = pi.getPrimitiveCoordinateIndices(); + Point3d ptcoord = new Point3d(); + for (int k=0;k<pt.length;k++) { + v.set(ptw[k]); + spht3.setTranslation (v); + sphTrans[k+2].setTransform (spht3); + } + + // Get interpolated color (if available) + Color4f iColor4 = null; + Color3f iColor = null; + Vector3f iNormal = null; + + if (curGeomArray != null) { + int vf = curGeomArray.getVertexFormat(); + + if (((vf & + (GeometryArray.COLOR_3 | + GeometryArray.COLOR_4)) != 0) && + (null != (iColor4 = + pi.getPointColor()))) { + iColor = + new Color3f(iColor4.x, iColor4.y, iColor4.z); + + // Change the point's color + redlook.setMaterial(new Material(iColor, new Color3f (0.0f, 0.0f, 0.0f), iColor, new Color3f(1.0f, 1.0f, 1.0f), 50.0f)); + } + if (((vf & GeometryArray.NORMALS) != 0) && + (null != (iNormal = + pi.getPointNormal()))) { + System.out.println ("Interpolated normal: "+iNormal); + } + } + + System.out.println ("============="); + System.out.println ("Coordinates of intersection pt:"+intPt); + System.out.println ("Coordinates of vertices: "); + for (int k=0;k<pt.length;k++) { + System.out.println (k + ":" + ptw[k].x + " " + ptw[k].y + " " + ptw[k].z); + } + System.out.println ("Closest vertex: "+closestVert); + if (iColor != null) { + System.out.println ("Interpolated color: "+iColor); + } + if (iNormal != null) { + System.out.println ("Interpolated normal: "+iNormal); + } + } + } + } + } + } + wakeupOn (new WakeupOnAWTEvent(MouseEvent.MOUSE_PRESSED)); + } +} diff --git a/src/PickTest/IntersectTest.html b/src/PickTest/IntersectTest.html new file mode 100644 index 0000000..46752f6 --- /dev/null +++ b/src/PickTest/IntersectTest.html @@ -0,0 +1,17 @@ +<HTML> + <HEAD> + <TITLE>IntersectTest</TITLE> + </HEAD> + <BODY BGCOLOR="#0C0C33"> + <applet align=middle code="IntersectTest.class" width=500 height=500> + <blockquote> + <hr> + If you were using a Java-capable browser, + you would see "IntersectTest" instead of this paragraph. + <hr> + </blockquote> + </applet> + </BODY> +</HTML> + + diff --git a/src/PickTest/IntersectTest.java b/src/PickTest/IntersectTest.java new file mode 100644 index 0000000..206ea8f --- /dev/null +++ b/src/PickTest/IntersectTest.java @@ -0,0 +1,241 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import java.applet.Applet; +import java.awt.BorderLayout; +import java.awt.event.*; +import java.awt.GraphicsConfiguration; +import com.sun.j3d.utils.applet.MainFrame; +import com.sun.j3d.utils.universe.*; +import javax.media.j3d.*; +import javax.vecmath.*; +import com.sun.j3d.utils.behaviors.keyboard.*; +import com.sun.j3d.utils.picking.PickTool; + +public class IntersectTest extends Applet { + + BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 1000.0); + + private SimpleUniverse u = null; + + public BranchGroup createSceneGraph () { + + // Create the root of the branch graph + BranchGroup objRoot = new BranchGroup(); + + // Set up the ambient light + Color3f ambientColor = new Color3f(0.1f, 0.1f, 0.1f); + AmbientLight ambientLightNode = new AmbientLight(ambientColor); + ambientLightNode.setInfluencingBounds(bounds); + objRoot.addChild(ambientLightNode); + + // Set up the directional lights + Color3f light1Color = new Color3f(1.0f, 1.0f, 0.9f); + Vector3f light1Direction = new Vector3f(4.0f, -7.0f, -12.0f); + Color3f light2Color = new Color3f(0.3f, 0.3f, 0.4f); + Vector3f light2Direction = new Vector3f(-6.0f, -2.0f, -1.0f); + + DirectionalLight light1 + = new DirectionalLight(light1Color, light1Direction); + light1.setInfluencingBounds(bounds); + objRoot.addChild(light1); + + DirectionalLight light2 + = new DirectionalLight(light2Color, light2Direction); + light2.setInfluencingBounds(bounds); + objRoot.addChild(light2); + + Transform3D t3 = new Transform3D (); + + // Shapes + for (int x=0;x<3;x++) { + for (int y=0;y<3;y++) { + for (int z=0;z<3;z++) { + t3.setTranslation (new Vector3d(-4+x*4.0, -4+y*4.0, -20-z*4.0)); + TransformGroup objTrans = new TransformGroup(t3); + + objRoot.addChild(objTrans); + + // Create a simple shape leaf node, add it to the scene graph. + GeometryArray geom = null; + + if (((x+y+z) % 2) == 0) { + geom = new RandomColorCube(); + } + else { + geom = new RandomColorTetrahedron(); + } + + Shape3D shape = new Shape3D(geom); + + // use the utility method to set the capabilities + PickTool.setCapabilities(shape, PickTool.INTERSECT_FULL); + + objTrans.addChild(shape); + } + } + } + + // Lines + Point3f[] verts = { + new Point3f (-2.0f, 0.0f, 0.0f),new Point3f(2.0f, 0.0f, 0.0f) + }; + Color3f grey = new Color3f (0.7f, 0.7f, 0.7f); + Color3f[] colors = { + grey, grey + }; + + for (int y=0;y<5;y++) { + for (int z=0;z<5;z++) { + t3.setTranslation (new Vector3d(7.0, -4+y*2.0, -20.0-z*2.0)); + TransformGroup objTrans = new TransformGroup(t3); + + objRoot.addChild(objTrans); + + LineArray la = new LineArray (verts.length, + LineArray.COORDINATES | + LineArray.COLOR_3); + la.setCoordinates (0, verts); + la.setColors (0, colors); + + + Shape3D shape = new Shape3D(); + shape.setGeometry (la); + + // use the utility method to set the capabilities + PickTool.setCapabilities(shape, PickTool.INTERSECT_FULL); + + objTrans.addChild(shape); + } + } + + // Points + for (double x=-2.0;x<=2.0;x+=1.0) { + for (double y=-2.0;y<=2.0;y+=1.0) { + for (double z=-2.0;z<=2.0;z+=1.0) { + t3.setTranslation (new Vector3d(-10.0+2.0*x, 0.0+2.0*y,-20.0+2.0*z)); + TransformGroup objTrans = new TransformGroup(t3); + + objRoot.addChild(objTrans); + + PointArray pa = new PointArray (1, + PointArray.COORDINATES | + PointArray.COLOR_3); + + pa.setCoordinate (0, new Point3d (0.0, 0.0, 0.0)); + pa.setColor (0, grey); + + Shape3D shape = new Shape3D(); + shape.setGeometry (pa); + + // use the utility method to set the capabilities + PickTool.setCapabilities(shape, PickTool.INTERSECT_FULL); + + objTrans.addChild(shape); + } + } + } + + return objRoot; + } + + public IntersectTest () { + } + + public void init() { + setLayout(new BorderLayout()); + + GraphicsConfiguration config = + SimpleUniverse.getPreferredConfiguration(); + + Canvas3D c = new Canvas3D(config); + add("Center", c); + + // Create a simple scene and attach it to the virtual universe + BranchGroup scene = createSceneGraph(); + u = new SimpleUniverse(c); + + // Add picking behavior + IntersectInfoBehavior behavior = + new IntersectInfoBehavior (c, scene,0.05f); + behavior.setSchedulingBounds (bounds); + scene.addChild (behavior); + + TransformGroup vpTrans = + u.getViewingPlatform().getViewPlatformTransform(); + + KeyNavigatorBehavior keybehavior = new KeyNavigatorBehavior (vpTrans); + keybehavior.setSchedulingBounds (bounds); + scene.addChild (keybehavior); + scene.setCapability (Group.ALLOW_CHILDREN_EXTEND); + scene.compile(); + u.addBranchGraph(scene); + + View view = u.getViewer().getView(); + view.setBackClipDistance (100000); + + } + + public void destroy() { + u.cleanup(); + } + + // + // The following allows IntersectTest to be run as an application + // as well as an applet + // + public static void main(String[] args) { + String s = "\n\nIntersectTest:\n-----------\n"; + s += "Pick with the mouse over the primitives\n"; + s += "- A sphere will be placed to indicate the picked point.\n"; + s += "If color information is available, the sphere will change color to reflect\n"; + s += "the interpolated color.\n"; + s += "- Other spheres will be placed to show the vertices of the selected polygon\n"; + s += "- Information will be displayed about the picking operation\n\n\n"; + + System.out.println (s); + + new MainFrame(new IntersectTest(), 640, 640); + } +} diff --git a/src/PickTest/IntersectTest_plugin.html b/src/PickTest/IntersectTest_plugin.html new file mode 100644 index 0000000..4a04bef --- /dev/null +++ b/src/PickTest/IntersectTest_plugin.html @@ -0,0 +1,41 @@ +<HTML> + <HEAD> + <TITLE>IntersectTest</TITLE> + </HEAD> + <BODY BGCOLOR="#0C0C33"> + <!--"CONVERTED_APPLET"--> +<!-- CONVERTER VERSION 1.3 --> +<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" +WIDTH = 500 HEIGHT = 500 ALIGN = middle codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"> +<PARAM NAME = CODE VALUE = "IntersectTest.class" > + +<PARAM NAME="type" VALUE="application/x-java-applet;version=1.2.2"> +<PARAM NAME="scriptable" VALUE="false"> +<COMMENT> +<EMBED type="application/x-java-applet;version=1.2.2" CODE = "IntersectTest.class" WIDTH = 500 HEIGHT = 500 ALIGN = middle scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED></COMMENT> +<blockquote> + <hr> + If you were using a Java-capable browser, + you would see "IntersectTest" instead of this paragraph. + <hr> + </blockquote> +</NOEMBED></EMBED> +</OBJECT> + +<!-- +<APPLET CODE = "IntersectTest.class" WIDTH = 500 HEIGHT = 500 ALIGN = middle> +<blockquote> + <hr> + If you were using a Java-capable browser, + you would see "IntersectTest" instead of this paragraph. + <hr> + </blockquote> + +</APPLET> +--> +<!--"END_CONVERTED_APPLET"--> + + </BODY> +</HTML> + + diff --git a/src/PickTest/MorphingBehavior.java b/src/PickTest/MorphingBehavior.java new file mode 100644 index 0000000..730434c --- /dev/null +++ b/src/PickTest/MorphingBehavior.java @@ -0,0 +1,97 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import java.util.Enumeration; +import javax.media.j3d.*; +import javax.vecmath.*; + +// User-defined morphing behavior class +public class MorphingBehavior extends Behavior { + + Alpha alpha; + Morph morph; + double weights[]; + + WakeupOnElapsedFrames w = new WakeupOnElapsedFrames(0); + + // Override Behavior's initialize method to setup wakeup criteria + public void initialize() { + alpha.setStartTime(System.currentTimeMillis()); + + // Establish initial wakeup criteria + wakeupOn(w); + } + + // Override Behavior's stimulus method to handle the event + public void processStimulus(Enumeration criteria) { + + // NOTE: This assumes 3 objects. It should be generalized to + // "n" objects. + + double val = alpha.value(); + if (val < 0.5) { + double a = val * 2.0; + weights[0] = 1.0 - a; + weights[1] = a; + weights[2] = 0.0; + } + else { + double a = (val - 0.5) * 2.0; + weights[0] = 0.0; + weights[1] = 1.0f - a; + weights[2] = a; + } + + morph.setWeights(weights); + + // Set wakeup criteria for next time + wakeupOn(w); + } + + public MorphingBehavior(Alpha a, Morph m) { + alpha = a; + morph = m; + weights = morph.getWeights(); + } +} diff --git a/src/PickTest/OctahedronITFA.java b/src/PickTest/OctahedronITFA.java new file mode 100644 index 0000000..c5d6f3a --- /dev/null +++ b/src/PickTest/OctahedronITFA.java @@ -0,0 +1,113 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class OctahedronITFA extends IndexedTriangleFanArray { + private static final int[] sVertCnt = { + 6, 6 + }; + + OctahedronITFA() { + super(6, GeometryArray.COORDINATES | GeometryArray.COLOR_3, 12, sVertCnt); + + Point3f verts[] = new Point3f[6]; + Color3f colors[] = new Color3f[6]; + + verts[0] = new Point3f(0.0f,0.0f,-1.5f); + verts[1] = new Point3f(0.0f,0.0f,1.5f); + verts[2] = new Point3f(0.0f,-1.5f,0.0f); + verts[3] = new Point3f(0.0f,1.5f,0.0f); + verts[4] = new Point3f(1.5f,0.0f,0.0f); + verts[5] = new Point3f(-1.5f,0.0f,0.0f); + + colors[0] = new Color3f(1.0f, 0.0f, 0.0f); + colors[1] = new Color3f(0.0f, 1.0f, 0.0f); + colors[2] = new Color3f(0.0f, 0.0f, 1.0f); + colors[3] = new Color3f(1.0f, 1.0f, 0.0f); + colors[4] = new Color3f(1.0f, 0.0f, 1.0f); + colors[5] = new Color3f(0.0f, 1.0f, 1.0f); + + int pntsIndex[] = new int[12]; + int clrsIndex[] = new int[12]; + + pntsIndex[0] = 4; + clrsIndex[0] = 4; + pntsIndex[1] = 2; + clrsIndex[1] = 2; + pntsIndex[2] = 0; + clrsIndex[2] = 0; + + pntsIndex[3] = 3; + clrsIndex[3] = 3; + + pntsIndex[4] = 1; + clrsIndex[4] = 1; + + pntsIndex[5] = 2; + clrsIndex[5] = 2; + + pntsIndex[6] = 5; + clrsIndex[6] = 5; + pntsIndex[7] = 1; + clrsIndex[7] = 1; + pntsIndex[8] = 3; + clrsIndex[8] = 3; + + pntsIndex[9] = 0; + clrsIndex[9] = 0; + + pntsIndex[10] = 2; + clrsIndex[10] = 2; + + pntsIndex[11] = 1; + clrsIndex[11] = 1; + + setCoordinates(0, verts); + setCoordinateIndices(0, pntsIndex); + setColors(0, colors); + setColorIndices(0, clrsIndex); + } +} diff --git a/src/PickTest/OctahedronTFA.java b/src/PickTest/OctahedronTFA.java new file mode 100644 index 0000000..57ecd89 --- /dev/null +++ b/src/PickTest/OctahedronTFA.java @@ -0,0 +1,112 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class OctahedronTFA extends TriangleFanArray { + private static final int[] sVertCnt = { + 6, 6 + }; + + OctahedronTFA() { + super(12, GeometryArray.COORDINATES | GeometryArray.COLOR_3, sVertCnt); + + Point3f verts[] = new Point3f[6]; + Color3f colors[] = new Color3f[6]; + + verts[0] = new Point3f(0.0f,0.0f,-1.5f); + verts[1] = new Point3f(0.0f,0.0f,1.5f); + verts[2] = new Point3f(0.0f,-1.5f,0.0f); + verts[3] = new Point3f(0.0f,1.5f,0.0f); + verts[4] = new Point3f(1.5f,0.0f,0.0f); + verts[5] = new Point3f(-1.5f,0.0f,0.0f); + + colors[0] = new Color3f(1.0f, 0.0f, 0.0f); + colors[1] = new Color3f(0.0f, 1.0f, 0.0f); + colors[2] = new Color3f(0.0f, 0.0f, 1.0f); + colors[3] = new Color3f(1.0f, 1.0f, 0.0f); + colors[4] = new Color3f(1.0f, 0.0f, 1.0f); + colors[5] = new Color3f(0.0f, 1.0f, 1.0f); + + + Point3f pnts[] = new Point3f[12]; + Color3f clrs[] = new Color3f[12]; + + pnts[0] = verts[4]; + clrs[0] = colors[4]; + pnts[1] = verts[2]; + clrs[1] = colors[2]; + pnts[2] = verts[0]; + clrs[2] = colors[0]; + + pnts[3] = verts[3]; + clrs[3] = colors[3]; + + pnts[4] = verts[1]; + clrs[4] = colors[1]; + + pnts[5] = verts[2]; + clrs[5] = colors[2]; + + pnts[6] = verts[5]; + clrs[6] = colors[5]; + pnts[7] = verts[1]; + clrs[7] = colors[1]; + pnts[8] = verts[3]; + clrs[8] = colors[3]; + + pnts[9] = verts[0]; + clrs[9] = colors[0]; + + pnts[10] = verts[2]; + clrs[10] = colors[2]; + + pnts[11] = verts[1]; + clrs[11] = colors[1]; + + setCoordinates(0, pnts); + setColors(0, clrs); + } +} diff --git a/src/PickTest/PickTest.html b/src/PickTest/PickTest.html new file mode 100644 index 0000000..938125c --- /dev/null +++ b/src/PickTest/PickTest.html @@ -0,0 +1,15 @@ +<HTML> +<HEAD> +<TITLE>PickTest</TITLE> +</HEAD> +<BODY BGCOLOR="#000000"> + <applet align=middle code="PickTest.class" width=750 height=550> +<blockquote> +<hr> +If you were using a Java-capable browser, +you would see Hello Universe! instead of this paragraph. +<hr> +</blockquote> +</applet> +</BODY> +</HTML> diff --git a/src/PickTest/PickTest.java b/src/PickTest/PickTest.java new file mode 100644 index 0000000..144eccd --- /dev/null +++ b/src/PickTest/PickTest.java @@ -0,0 +1,420 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import com.sun.j3d.utils.picking.behaviors.*; +import com.sun.j3d.utils.picking.*; + +import java.applet.Applet; +import java.awt.BorderLayout; +import java.awt.event.*; +import java.awt.Component; +import com.sun.j3d.utils.applet.MainFrame; +import com.sun.j3d.utils.universe.*; +import javax.media.j3d.*; +import javax.vecmath.*; +import java.awt.Point; +import javax.swing.*; +import javax.swing.border.BevelBorder; + +/** + * PickTest shows how to use the Picking utilities on various GeometryArray + * subclasses and Morph object. + * Type of Geometry : CompressedGeometry ( GullCG.java ) + * IndexedQuadArray ( CubeIQA.java ) + * TriangleArray ( TetrahedronTA.java ) + * IndexedTriangleArray ( TetrahedronITA.java ) + * TriangleFanArray ( OctahedronTFA.java ) + * IndexedTriangleFanArray ( OctahedronITA.java ) + * TriangleStripArray ( IcosahedronTFA.java ) + * IndexedTriangleStripArray ( IcosahedronITA.java ) + * PointArray( TetrahedronPA.java ) + * LineArray( TetrahedronLA.java ) + * IndexLineArray( TetrahedronILA.java ) + * LineStripArray( TetrahedronLSA.java ) + * IndexLineStripArray( TetrahedronILSA.java ) + * + * Morph Object uses : QuadArray ( ColorCube.java, ColorPyramidDown.java, + * and ColorPyramidUp.java ). + */ + +public class PickTest extends Applet implements ActionListener { + + private View view = null; + private QuadArray geomMorph[] = new QuadArray[3]; + private Morph morph; + + private PickRotateBehavior behavior1; + private PickZoomBehavior behavior2; + private PickTranslateBehavior behavior3; + + private SimpleUniverse u = null; + + public BranchGroup createSceneGraph(Canvas3D canvas) + { + // Create the root of the branch graph + BranchGroup objRoot = new BranchGroup(); + + // Create a Transformgroup to scale all objects so they + // appear in the scene. + TransformGroup objScale = new TransformGroup(); + Transform3D t3d = new Transform3D(); + t3d.setScale(1.0); + objScale.setTransform(t3d); + objRoot.addChild(objScale); + + // Create a bunch of objects with a behavior and add them + // into the scene graph. + + int row, col; + int numRows = 4, numCols = 4; + + for (int i = 0; i < numRows; i++) { + double ypos = (double)(i - numRows/2) * 0.45 + 0.25; + for (int j = 0; j < numCols; j++) { + double xpos = (double)(j - numCols/2) * 0.45 + 0.25; + objScale.addChild(createObject(i * numCols + j, 0.1, xpos, ypos)); + } + } + + BoundingSphere bounds = + new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0); + + // Add a light. + Color3f lColor = new Color3f(1.0f, 1.0f, 1.0f) ; + Vector3f lDir = new Vector3f(0.0f, 0.0f, -1.0f) ; + + DirectionalLight lgt = new DirectionalLight(lColor, lDir) ; + lgt.setInfluencingBounds(bounds) ; + objRoot.addChild(lgt) ; + + + // Now create the Alpha object that controls the speed of the + // morphing operation. + Alpha morphAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE | + Alpha.DECREASING_ENABLE, + 0, 0, + 4000, 1000, 500, + 4000, 1000, 500); + + // Finally, create the morphing behavior + MorphingBehavior mBeh = new MorphingBehavior(morphAlpha, morph); + mBeh.setSchedulingBounds(bounds); + objRoot.addChild(mBeh); + + behavior1 = new PickRotateBehavior(objRoot, canvas, bounds); + objRoot.addChild(behavior1); + + behavior2 = new PickZoomBehavior(objRoot, canvas, bounds); + objRoot.addChild(behavior2); + + behavior3 = new PickTranslateBehavior(objRoot, canvas, bounds); + objRoot.addChild(behavior3); + + // Let Java 3D perform optimizations on this scene graph. + objRoot.compile(); + + return objRoot; + } + + + private Group createObject(int index, double scale, double xpos, double ypos){ + + Shape3D shape = null; + Geometry geom = null; + + // Create a transform group node to scale and position the object. + Transform3D t = new Transform3D(); + t.set(scale, new Vector3d(xpos, ypos, 0.0)); + TransformGroup objTrans = new TransformGroup(t); + objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); + objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); + objTrans.setCapability(TransformGroup.ENABLE_PICK_REPORTING); + + // Create a second transform group node and initialize it to the + // identity. Enable the TRANSFORM_WRITE capability so that + // our behavior code can modify it at runtime. + TransformGroup spinTg = new TransformGroup(); + spinTg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); + spinTg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); + spinTg.setCapability(TransformGroup.ENABLE_PICK_REPORTING); + + Appearance appearance = new Appearance(); + + switch(index) { + case 0: + geom = new GullCG(); + break; + case 1: + geom = new TetrahedronTA(); + break; + case 2: + geom = new OctahedronTFA(); + break; + case 3: + geom = new IcosahedronTSA(); + break; + case 4: + geom = new CubeIQA(); + break; + case 5: + geom = new TetrahedronITA(); + break; + case 6: + geom = new OctahedronITFA(); + break; + case 7: + geom = new IcosahedronITSA(); + break; + case 8: + geomMorph[0] = new ColorPyramidUp(); + geomMorph[1] = new ColorCube(); + geomMorph[2] = new ColorPyramidDown(); + break; + case 9: + geom = new TetrahedronLA(); + break; + case 10: + geom = new TetrahedronILA(); + break; + case 11: + geom = new TetrahedronLSA(); + break; + case 12: + geom = new TetrahedronILSA(); + break; + case 13: + geom = new TetrahedronPA(); + break; + case 14: + geom = new TetrahedronIPA(); + break; + // TODO: other geo types, Text3D? + case 15: + geom = new TetrahedronTA(); + break; + } + + Material m = new Material() ; + + if(index == 8) { + m.setLightingEnable(false) ; + appearance.setMaterial(m) ; + morph = new Morph((GeometryArray[]) geomMorph, appearance); + morph.setCapability(Morph.ALLOW_WEIGHTS_READ); + morph.setCapability(Morph.ALLOW_WEIGHTS_WRITE); + PickTool.setCapabilities(morph, PickTool.INTERSECT_FULL); + spinTg.addChild(morph); + } else { + // Geometry picking require this to be set. + if (index == 0) + m.setLightingEnable(true) ; + else + m.setLightingEnable(false) ; + appearance.setMaterial(m) ; + + if ((index == 13) || (index == 14)) { + PointAttributes pa = new PointAttributes(); + pa.setPointSize(4.0f); + appearance.setPointAttributes(pa); + } + + shape = new Shape3D(geom,appearance); + shape.setCapability(Shape3D.ALLOW_APPEARANCE_READ); + shape.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE); + shape.setCapability(Shape3D.ENABLE_PICK_REPORTING); + PickTool.setCapabilities(shape, PickTool.INTERSECT_FULL); + spinTg.addChild(shape); + } + + // add it to the scene graph. + objTrans.addChild(spinTg); + + return objTrans; + } + + private void setPickMode(int mode) { + behavior1.setMode(mode); + behavior2.setMode(mode); + behavior3.setMode(mode); + } + + private void setPickTolerance(float tolerance) { + behavior1.setTolerance(tolerance); + behavior2.setTolerance(tolerance); + behavior3.setTolerance(tolerance); + } + + private void setViewMode(int mode) { + view.setProjectionPolicy(mode); + } + + // GUI stuff + + String pickModeString = new String("Pick Mode"); + String boundsString = new String("BOUNDS"); + String geometryString = new String("GEOMETRY"); + String geometryIntersectString = new String("GEOMETRY_INTERSECT_INFO"); + String toleranceString = new String("Pick Tolerance"); + String tolerance0String = new String("0"); + String tolerance2String = new String("2"); + String tolerance4String = new String("4"); + String tolerance8String = new String("8"); + String viewModeString = new String("View Mode"); + String perspectiveString = new String("Perspective"); + String parallelString = new String("Parallel"); + + private void addRadioButton(JPanel panel, ButtonGroup bg, String ownerName, + String buttonName, boolean selected) { + JRadioButton item; + item = new JRadioButton(buttonName); + item.setName(ownerName); + item.addActionListener(this); + if (selected) { + item.setSelected(true); + } + panel.add(item); + bg.add(item); + } + + private void setupGUI(JPanel panel) { + ButtonGroup bg; + + panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); + panel.setBorder(new BevelBorder(BevelBorder.RAISED)); + + panel.add(new JLabel(pickModeString)); + bg = new ButtonGroup(); + addRadioButton(panel, bg, pickModeString, boundsString, true); + addRadioButton(panel, bg, pickModeString, geometryString, false); + addRadioButton(panel, bg, pickModeString, geometryIntersectString, false); + + panel.add(new JLabel(toleranceString)); + bg = new ButtonGroup(); + addRadioButton(panel, bg, toleranceString, tolerance0String,false); + addRadioButton(panel, bg, toleranceString, tolerance2String,true); + addRadioButton(panel, bg, toleranceString, tolerance4String,false); + addRadioButton(panel, bg, toleranceString, tolerance8String,false); + + panel.add(new JLabel(viewModeString)); + bg = new ButtonGroup(); + addRadioButton(panel, bg, viewModeString, perspectiveString, true); + addRadioButton(panel, bg, viewModeString, parallelString, false); + + } + + public void actionPerformed(ActionEvent e) { + String name = ((Component)e.getSource()).getName(); + String value = e.getActionCommand(); + //System.out.println("action: name = " + name + " value = " + value); + if (name == pickModeString) { + if (value == boundsString) { + setPickMode(PickCanvas.BOUNDS); + } else if (value == geometryString) { + setPickMode(PickCanvas.GEOMETRY); + } else if (value == geometryIntersectString) { + setPickMode(PickCanvas.GEOMETRY_INTERSECT_INFO); + } else { + System.out.println("Unknown pick mode: " + value); + } + } else if (name == toleranceString) { + if (value == tolerance0String) { + setPickTolerance(0.0f); + } else if (value == tolerance2String) { + setPickTolerance(2.0f); + } else if (value == tolerance4String) { + setPickTolerance(4.0f); + } else if (value == tolerance8String) { + setPickTolerance(8.0f); + } else { + System.out.println("Unknown tolerance: " + value); + } + } else if (name == viewModeString) { + if (value == perspectiveString) { + setViewMode(View.PERSPECTIVE_PROJECTION); + } else if (value == parallelString) { + setViewMode(View.PARALLEL_PROJECTION); + } + } else { + System.out.println("Unknown action name: " + name); + } + } + + public PickTest (){ + } + + public void init() { + setLayout(new BorderLayout()); + Canvas3D c = new Canvas3D(SimpleUniverse.getPreferredConfiguration()); + add("Center", c); + + JPanel guiPanel = new JPanel(); + setupGUI(guiPanel); + add(guiPanel, BorderLayout.EAST); + + // Create a scene and attach it to the virtual universe + BranchGroup scene = createSceneGraph(c); + u = new SimpleUniverse(c); + + // This will move the ViewPlatform back a bit so the + // objects in the scene can be viewed. + u.getViewingPlatform().setNominalViewingTransform(); + view = u.getViewer().getView(); + + u.addBranchGraph(scene); + } + + public void destroy() { + u.cleanup(); + } + + + public static void main(String argv[]) + { + + BranchGroup group; + + new MainFrame(new PickTest(), 750, 550); + } +} + diff --git a/src/PickTest/PickTest_plugin.html b/src/PickTest/PickTest_plugin.html new file mode 100644 index 0000000..c8e8168 --- /dev/null +++ b/src/PickTest/PickTest_plugin.html @@ -0,0 +1,39 @@ +<HTML> +<HEAD> +<TITLE>PickTest</TITLE> +</HEAD> +<BODY BGCOLOR="#000000"> + <!--"CONVERTED_APPLET"--> +<!-- CONVERTER VERSION 1.3 --> +<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" +WIDTH = 750 HEIGHT = 550 ALIGN = middle codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"> +<PARAM NAME = CODE VALUE = "PickTest.class" > + +<PARAM NAME="type" VALUE="application/x-java-applet;version=1.2.2"> +<PARAM NAME="scriptable" VALUE="false"> +<COMMENT> +<EMBED type="application/x-java-applet;version=1.2.2" CODE = "PickTest.class" WIDTH = 750 HEIGHT = 550 ALIGN = middle scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED></COMMENT> +<blockquote> +<hr> +If you were using a Java-capable browser, +you would see Hello Universe! instead of this paragraph. +<hr> +</blockquote> +</NOEMBED></EMBED> +</OBJECT> + +<!-- +<APPLET CODE = "PickTest.class" WIDTH = 750 HEIGHT = 550 ALIGN = middle> +<blockquote> +<hr> +If you were using a Java-capable browser, +you would see Hello Universe! instead of this paragraph. +<hr> +</blockquote> + +</APPLET> +--> +<!--"END_CONVERTED_APPLET"--> + +</BODY> +</HTML> diff --git a/src/PickTest/RandomColorCube.java b/src/PickTest/RandomColorCube.java new file mode 100644 index 0000000..c9a91ee --- /dev/null +++ b/src/PickTest/RandomColorCube.java @@ -0,0 +1,129 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class RandomColorCube extends QuadArray { + RandomColorCube() { + super(24, GeometryArray.COORDINATES | GeometryArray.COLOR_3); + + Point3f verts[] = new Point3f[8]; + Color3f colors[] = new Color3f[3]; + + verts[0] = new Point3f(0.5f, 0.5f, 0.5f); + verts[1] = new Point3f(-0.5f, 0.5f, 0.5f); + verts[2] = new Point3f(-0.5f,-0.5f, 0.5f); + verts[3] = new Point3f( 0.5f,-0.5f, 0.5f); + verts[4] = new Point3f( 0.5f, 0.5f,-0.5f); + verts[5] = new Point3f( -0.5f, 0.5f,-0.5f); + verts[6] = new Point3f( -0.5f,-0.5f,-0.5f); + verts[7] = new Point3f( 0.5f,-0.5f,-0.5f); + + colors[0] = new Color3f(1.0f, 0.0f, 0.0f); + colors[1] = new Color3f(0.0f, 1.0f, 0.0f); + colors[2] = new Color3f(0.0f, 0.0f, 1.0f); + + Point3f pnts[] = new Point3f[24]; + Color3f clrs[] = new Color3f[24]; + + pnts[0] = verts[0]; + clrs[0] = colors[(int)(Math.random()*3.0)]; + pnts[1] = verts[3]; + clrs[1] = colors[(int)(Math.random()*3.0)]; + pnts[2] = verts[7]; + clrs[2] = colors[(int)(Math.random()*3.0)]; + pnts[3] = verts[4]; + clrs[3] = colors[(int)(Math.random()*3.0)]; + + pnts[4] = verts[1]; + clrs[4] = colors[(int)(Math.random()*3.0)]; + pnts[5] = verts[5]; + clrs[5] = colors[(int)(Math.random()*3.0)]; + pnts[6] = verts[6]; + clrs[6] = colors[(int)(Math.random()*3.0)]; + pnts[7] = verts[2]; + clrs[7] = colors[(int)(Math.random()*3.0)]; + + pnts[8] = verts[0]; + clrs[8] = colors[(int)(Math.random()*3.0)]; + pnts[9] = verts[4]; + clrs[9] = colors[(int)(Math.random()*3.0)]; + pnts[10] = verts[5]; + clrs[10] = colors[(int)(Math.random()*3.0)]; + pnts[11] = verts[1]; + clrs[11] = colors[(int)(Math.random()*3.0)]; + + pnts[12] = verts[3]; + clrs[12] = colors[(int)(Math.random()*3.0)]; + pnts[13] = verts[2]; + clrs[13] = colors[(int)(Math.random()*3.0)]; + pnts[14] = verts[6]; + clrs[14] = colors[(int)(Math.random()*3.0)]; + pnts[15] = verts[7]; + clrs[15] = colors[(int)(Math.random()*3.0)]; + + pnts[16] = verts[0]; + clrs[16] = colors[(int)(Math.random()*3.0)]; + pnts[17] = verts[1]; + clrs[17] = colors[(int)(Math.random()*3.0)]; + pnts[18] = verts[2]; + clrs[18] = colors[(int)(Math.random()*3.0)]; + pnts[19] = verts[3]; + clrs[19] = colors[(int)(Math.random()*3.0)]; + + pnts[20] = verts[7]; + clrs[20] = colors[(int)(Math.random()*3.0)]; + pnts[21] = verts[6]; + clrs[21] = colors[(int)(Math.random()*3.0)]; + pnts[22] = verts[5]; + clrs[22] = colors[(int)(Math.random()*3.0)]; + pnts[23] = verts[4]; + clrs[23] = colors[(int)(Math.random()*3.0)]; + + + setCoordinates(0, pnts); + setColors(0, clrs); + } +} diff --git a/src/PickTest/RandomColorTetrahedron.java b/src/PickTest/RandomColorTetrahedron.java new file mode 100644 index 0000000..940a7c1 --- /dev/null +++ b/src/PickTest/RandomColorTetrahedron.java @@ -0,0 +1,99 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class RandomColorTetrahedron extends TriangleArray { + + RandomColorTetrahedron() { + super(12, GeometryArray.COORDINATES | GeometryArray.COLOR_3); + + Point3f verts[] = new Point3f[4]; + Color3f colors[] = new Color3f[4]; + + verts[0] = new Point3f(0.5f,0.5f,0.5f); + verts[1] = new Point3f(0.5f,-0.5f,-0.5f); + verts[2] = new Point3f(-0.5f,-0.5f,0.5f); + verts[3] = new Point3f(-0.5f,0.5f,-0.5f); + + colors[0] = new Color3f(1.0f, 0.0f, 0.0f); + colors[1] = new Color3f(0.0f, 1.0f, 0.0f); + colors[2] = new Color3f(0.0f, 0.0f, 1.0f); + + Point3f pnts[] = new Point3f[12]; + Color3f clrs[] = new Color3f[12]; + + pnts[0] = verts[2]; + clrs[0] = colors[(int)(Math.random() * 3.0)]; + pnts[1] = verts[1]; + clrs[1] = colors[(int)(Math.random() * 3.0)]; + pnts[2] = verts[0]; + clrs[2] = colors[(int)(Math.random() * 3.0)]; + + pnts[3] = verts[3]; + clrs[3] = colors[(int)(Math.random() * 3.0)]; + pnts[4] = verts[2]; + clrs[4] = colors[(int)(Math.random() * 3.0)]; + pnts[5] = verts[0]; + clrs[5] = colors[(int)(Math.random() * 3.0)]; + + pnts[6] = verts[1]; + clrs[6] = colors[(int)(Math.random() * 3.0)]; + pnts[7] = verts[2]; + clrs[7] = colors[(int)(Math.random() * 3.0)]; + pnts[8] = verts[3]; + clrs[8] = colors[(int)(Math.random() * 3.0)]; + + pnts[9] = verts[1]; + clrs[9] = colors[(int)(Math.random() * 3.0)]; + pnts[10] = verts[3]; + clrs[10] = colors[(int)(Math.random() * 3.0)]; + pnts[11] = verts[0]; + clrs[11] = colors[(int)(Math.random() * 3.0)]; + + setCoordinates(0, pnts); + setColors(0, clrs); + } +} diff --git a/src/PickTest/TetrahedronILA.java b/src/PickTest/TetrahedronILA.java new file mode 100644 index 0000000..1558a4d --- /dev/null +++ b/src/PickTest/TetrahedronILA.java @@ -0,0 +1,104 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class TetrahedronILA extends IndexedLineArray { + + TetrahedronILA() { + super(4, GeometryArray.COORDINATES | GeometryArray.COLOR_3, 12); + + Point3f verts[] = new Point3f[4]; + Color3f colors[] = new Color3f[4]; + + verts[0] = new Point3f(1.0f,1.0f,1.0f); + verts[1] = new Point3f(1.0f,-1.0f,-1.0f); + verts[2] = new Point3f(-1.0f,-1.0f,1.0f); + verts[3] = new Point3f(-1.0f,1.0f,-1.0f); + + colors[0] = new Color3f(1.0f, 0.0f, 0.0f); + colors[1] = new Color3f(0.0f, 1.0f, 0.0f); + colors[2] = new Color3f(0.0f, 0.0f, 1.0f); + colors[3] = new Color3f(1.0f, 1.0f, 0.0f); + + int[] pntsIndex = new int[12]; + int[] clrsIndex = new int[12]; + + pntsIndex[0] = 0; + clrsIndex[0] = 0; + pntsIndex[1] = 1; + clrsIndex[1] = 1; + + pntsIndex[2] = 1; + clrsIndex[2] = 1; + pntsIndex[3] = 2; + clrsIndex[3] = 2; + + pntsIndex[4] = 2; + clrsIndex[4] = 2; + pntsIndex[5] = 0; + clrsIndex[5] = 0; + + pntsIndex[6] = 1; + clrsIndex[6] = 1; + pntsIndex[7] = 3; + clrsIndex[7] = 3; + + pntsIndex[8] = 2; + clrsIndex[8] = 2; + pntsIndex[9] = 3; + clrsIndex[9] = 3; + + pntsIndex[10] = 0; + clrsIndex[10] = 0; + pntsIndex[11] = 3; + clrsIndex[11] = 3; + + setCoordinates(0, verts); + setCoordinateIndices(0, pntsIndex); + setColors(0, colors); + setColorIndices(0, clrsIndex); + } +} diff --git a/src/PickTest/TetrahedronILSA.java b/src/PickTest/TetrahedronILSA.java new file mode 100644 index 0000000..8086f30 --- /dev/null +++ b/src/PickTest/TetrahedronILSA.java @@ -0,0 +1,95 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class TetrahedronILSA extends IndexedLineStripArray { + + private static final int[] lineLengths = { + 4, 4 + }; + TetrahedronILSA() { + super(4, GeometryArray.COORDINATES | GeometryArray.COLOR_3, 8, lineLengths); + + Point3f verts[] = new Point3f[4]; + Color3f colors[] = new Color3f[4]; + + verts[0] = new Point3f(1.0f,1.0f,1.0f); + verts[1] = new Point3f(1.0f,-1.0f,-1.0f); + verts[2] = new Point3f(-1.0f,-1.0f,1.0f); + verts[3] = new Point3f(-1.0f,1.0f,-1.0f); + + colors[0] = new Color3f(1.0f, 0.0f, 0.0f); + colors[1] = new Color3f(0.0f, 1.0f, 0.0f); + colors[2] = new Color3f(0.0f, 0.0f, 1.0f); + colors[3] = new Color3f(1.0f, 1.0f, 0.0f); + + int pntsIndex[] = new int[8]; + int clrsIndex[] = new int[8]; + + pntsIndex[0] = 0; + clrsIndex[0] = 0; + pntsIndex[1] = 1; + clrsIndex[1] = 1; + pntsIndex[2] = 3; + clrsIndex[2] = 3; + pntsIndex[3] = 2; + clrsIndex[3] = 2; + + pntsIndex[4] = 1; + clrsIndex[4] = 1; + pntsIndex[5] = 2; + clrsIndex[5] = 2; + pntsIndex[6] = 0; + clrsIndex[6] = 0; + pntsIndex[7] = 3; + clrsIndex[7] = 3; + + setCoordinates(0, verts); + setCoordinateIndices(0, pntsIndex); + setColors(0, colors); + setColorIndices(0, clrsIndex); + } +} diff --git a/src/PickTest/TetrahedronIPA.java b/src/PickTest/TetrahedronIPA.java new file mode 100644 index 0000000..117960d --- /dev/null +++ b/src/PickTest/TetrahedronIPA.java @@ -0,0 +1,79 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class TetrahedronIPA extends IndexedPointArray { + + TetrahedronIPA() { + super(4, GeometryArray.COORDINATES | GeometryArray.COLOR_3, 4); + + Point3f verts[] = new Point3f[4]; + Color3f colors[] = new Color3f[4]; + + verts[0] = new Point3f(1.0f,1.0f,1.0f); + verts[1] = new Point3f(1.0f,-1.0f,-1.0f); + verts[2] = new Point3f(-1.0f,-1.0f,1.0f); + verts[3] = new Point3f(-1.0f,1.0f,-1.0f); + + colors[0] = new Color3f(1.0f, 0.0f, 0.0f); + colors[1] = new Color3f(0.0f, 1.0f, 0.0f); + colors[2] = new Color3f(0.0f, 0.0f, 1.0f); + colors[3] = new Color3f(1.0f, 1.0f, 0.0f); + + int pntsIndex[] = new int[4]; + int clrsIndex[] = new int[4]; + + pntsIndex[0] = clrsIndex[0] = 0; + pntsIndex[1] = clrsIndex[1] = 1; + pntsIndex[2] = clrsIndex[2] = 2; + pntsIndex[3] = clrsIndex[3] = 3; + + setCoordinates(0, verts); + setCoordinateIndices(0, pntsIndex); + setColors(0, colors); + setColorIndices(0, clrsIndex); + } +} diff --git a/src/PickTest/TetrahedronITA.java b/src/PickTest/TetrahedronITA.java new file mode 100644 index 0000000..795796d --- /dev/null +++ b/src/PickTest/TetrahedronITA.java @@ -0,0 +1,102 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class TetrahedronITA extends IndexedTriangleArray { + + TetrahedronITA() { + super(4, GeometryArray.COORDINATES | GeometryArray.COLOR_3, 12); + + Point3f verts[] = new Point3f[4]; + Color3f colors[] = new Color3f[4]; + + verts[0] = new Point3f(1.0f,1.0f,1.0f); + verts[1] = new Point3f(1.0f,-1.0f,-1.0f); + verts[2] = new Point3f(-1.0f,-1.0f,1.0f); + verts[3] = new Point3f(-1.0f,1.0f,-1.0f); + + colors[0] = new Color3f(1.0f, 0.0f, 0.0f); + colors[1] = new Color3f(0.0f, 1.0f, 0.0f); + colors[2] = new Color3f(0.0f, 0.0f, 1.0f); + colors[3] = new Color3f(1.0f, 1.0f, 0.0f); + + int pntsIndex[] = new int[12]; + int clrsIndex[] = new int[12]; + + pntsIndex[0] = 2; + clrsIndex[0] = 0; + pntsIndex[1] = 1; + clrsIndex[1] = 0; + pntsIndex[2] = 0; + clrsIndex[2] = 0; + + pntsIndex[3] = 3; + clrsIndex[3] = 1; + pntsIndex[4] = 2; + clrsIndex[4] = 1; + pntsIndex[5] = 0; + clrsIndex[5] = 1; + + pntsIndex[6] = 1; + clrsIndex[6] = 2; + pntsIndex[7] = 2; + clrsIndex[7] = 2; + pntsIndex[8] = 3; + clrsIndex[8] = 2; + + pntsIndex[9] = 1; + clrsIndex[9] = 3; + pntsIndex[10] = 3; + clrsIndex[10] = 3; + pntsIndex[11] = 0; + clrsIndex[11] = 3; + + setCoordinates(0, verts); + setCoordinateIndices(0, pntsIndex); + setColors(0, colors); + setColorIndices(0, clrsIndex); + } +} diff --git a/src/PickTest/TetrahedronLA.java b/src/PickTest/TetrahedronLA.java new file mode 100644 index 0000000..858f88c --- /dev/null +++ b/src/PickTest/TetrahedronLA.java @@ -0,0 +1,102 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class TetrahedronLA extends LineArray { + + TetrahedronLA() { + super(12, GeometryArray.COORDINATES | GeometryArray.COLOR_3); + + Point3f verts[] = new Point3f[4]; + Color3f colors[] = new Color3f[4]; + + verts[0] = new Point3f(1.0f,1.0f,1.0f); + verts[1] = new Point3f(1.0f,-1.0f,-1.0f); + verts[2] = new Point3f(-1.0f,-1.0f,1.0f); + verts[3] = new Point3f(-1.0f,1.0f,-1.0f); + + colors[0] = new Color3f(1.0f, 0.0f, 0.0f); + colors[1] = new Color3f(0.0f, 1.0f, 0.0f); + colors[2] = new Color3f(0.0f, 0.0f, 1.0f); + colors[3] = new Color3f(1.0f, 1.0f, 0.0f); + + Point3f pnts[] = new Point3f[12]; + Color3f clrs[] = new Color3f[12]; + + pnts[0] = verts[0]; + clrs[0] = colors[0]; + pnts[1] = verts[1]; + clrs[1] = colors[1]; + + pnts[2] = verts[1]; + clrs[2] = colors[1]; + pnts[3] = verts[2]; + clrs[3] = colors[2]; + + pnts[4] = verts[2]; + clrs[4] = colors[2]; + pnts[5] = verts[0]; + clrs[5] = colors[0]; + + pnts[6] = verts[1]; + clrs[6] = colors[1]; + pnts[7] = verts[3]; + clrs[7] = colors[3]; + + pnts[8] = verts[2]; + clrs[8] = colors[2]; + pnts[9] = verts[3]; + clrs[9] = colors[3]; + + pnts[10] = verts[0]; + clrs[10] = colors[0]; + pnts[11] = verts[3]; + clrs[11] = colors[3]; + + setCoordinates(0, pnts); + setColors(0, clrs); + } +} diff --git a/src/PickTest/TetrahedronLSA.java b/src/PickTest/TetrahedronLSA.java new file mode 100644 index 0000000..9317387 --- /dev/null +++ b/src/PickTest/TetrahedronLSA.java @@ -0,0 +1,92 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class TetrahedronLSA extends LineStripArray { + private static final int[] lineLengths = { + 4, 4 + }; + TetrahedronLSA() { + super(8, GeometryArray.COORDINATES | GeometryArray.COLOR_3, lineLengths); + + Point3f verts[] = new Point3f[4]; + Color3f colors[] = new Color3f[4]; + + verts[0] = new Point3f(1.0f,1.0f,1.0f); + verts[1] = new Point3f(1.0f,-1.0f,-1.0f); + verts[2] = new Point3f(-1.0f,-1.0f,1.0f); + verts[3] = new Point3f(-1.0f,1.0f,-1.0f); + + colors[0] = new Color3f(1.0f, 0.0f, 0.0f); + colors[1] = new Color3f(0.0f, 1.0f, 0.0f); + colors[2] = new Color3f(0.0f, 0.0f, 1.0f); + colors[3] = new Color3f(1.0f, 1.0f, 0.0f); + + Point3f pnts[] = new Point3f[8]; + Color3f clrs[] = new Color3f[8]; + + pnts[0] = verts[0]; + clrs[0] = colors[0]; + pnts[1] = verts[1]; + clrs[1] = colors[1]; + pnts[2] = verts[3]; + clrs[2] = colors[3]; + pnts[3] = verts[2]; + clrs[3] = colors[2]; + + pnts[4] = verts[1]; + clrs[4] = colors[1]; + pnts[5] = verts[2]; + clrs[5] = colors[2]; + pnts[6] = verts[0]; + clrs[6] = colors[0]; + pnts[7] = verts[3]; + clrs[7] = colors[3]; + + setCoordinates(0, pnts); + setColors(0, clrs); + } +} diff --git a/src/PickTest/TetrahedronPA.java b/src/PickTest/TetrahedronPA.java new file mode 100644 index 0000000..d1bcda9 --- /dev/null +++ b/src/PickTest/TetrahedronPA.java @@ -0,0 +1,69 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class TetrahedronPA extends PointArray { + + TetrahedronPA() { + super(4, GeometryArray.COORDINATES | GeometryArray.COLOR_3); + + Point3f verts[] = new Point3f[4]; + Color3f colors[] = new Color3f[4]; + + verts[0] = new Point3f(1.0f,1.0f,1.0f); + verts[1] = new Point3f(1.0f,-1.0f,-1.0f); + verts[2] = new Point3f(-1.0f,-1.0f,1.0f); + verts[3] = new Point3f(-1.0f,1.0f,-1.0f); + + colors[0] = new Color3f(1.0f, 0.0f, 0.0f); + colors[1] = new Color3f(0.0f, 1.0f, 0.0f); + colors[2] = new Color3f(0.0f, 0.0f, 1.0f); + colors[3] = new Color3f(1.0f, 1.0f, 0.0f); + + setCoordinates(0, verts); + setColors(0, colors); + } +} diff --git a/src/PickTest/TetrahedronTA.java b/src/PickTest/TetrahedronTA.java new file mode 100644 index 0000000..f2ba169 --- /dev/null +++ b/src/PickTest/TetrahedronTA.java @@ -0,0 +1,100 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import javax.media.j3d.*; +import javax.vecmath.*; + +class TetrahedronTA extends TriangleArray { + + TetrahedronTA() { + super(12, GeometryArray.COORDINATES | GeometryArray.COLOR_3); + + Point3f verts[] = new Point3f[4]; + Color3f colors[] = new Color3f[4]; + + verts[0] = new Point3f(1.0f,1.0f,1.0f); + verts[1] = new Point3f(1.0f,-1.0f,-1.0f); + verts[2] = new Point3f(-1.0f,-1.0f,1.0f); + verts[3] = new Point3f(-1.0f,1.0f,-1.0f); + + colors[0] = new Color3f(1.0f, 0.0f, 0.0f); + colors[1] = new Color3f(0.0f, 1.0f, 0.0f); + colors[2] = new Color3f(0.0f, 0.0f, 1.0f); + colors[3] = new Color3f(1.0f, 1.0f, 0.0f); + + Point3f pnts[] = new Point3f[12]; + Color3f clrs[] = new Color3f[12]; + + pnts[0] = verts[2]; + clrs[0] = colors[0]; + pnts[1] = verts[1]; + clrs[1] = colors[0]; + pnts[2] = verts[0]; + clrs[2] = colors[0]; + + pnts[3] = verts[3]; + clrs[3] = colors[1]; + pnts[4] = verts[2]; + clrs[4] = colors[1]; + pnts[5] = verts[0]; + clrs[5] = colors[1]; + + pnts[6] = verts[1]; + clrs[6] = colors[2]; + pnts[7] = verts[2]; + clrs[7] = colors[2]; + pnts[8] = verts[3]; + clrs[8] = colors[2]; + + pnts[9] = verts[1]; + clrs[9] = colors[3]; + pnts[10] = verts[3]; + clrs[10] = colors[3]; + pnts[11] = verts[0]; + clrs[11] = colors[3]; + + setCoordinates(0, pnts); + setColors(0, clrs); + } +} diff --git a/src/PickTest/build.xml b/src/PickTest/build.xml new file mode 100644 index 0000000..cbf53a8 --- /dev/null +++ b/src/PickTest/build.xml @@ -0,0 +1,66 @@ +<?xml version="1.0"?> + +<!-- +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + --> + +<project basedir="." default="compile"> + <target name="compile"> + <javac debug="true" deprecation="true" destdir="." srcdir="."> + </javac> + </target> + + <target name="all" depends="compile"> + </target> + + <target description="Clean all build products." name="clean"> + <delete> + <fileset dir="."> + <include name="**/*.class"/> + </fileset> + </delete> + </target> + +</project> |