/* * Copyright (c) 1997 ORC Incorporated. All Rights Reserved. * * Permission to use, copy, modify, and distribute this software * and its documentation for NON-COMMERCIAL purposes and without * fee is hereby granted provided that this copyright notice * appears in all copies. Please contact for * further information regarding copyright and licensing. * This code is provided without warranty, either expressed or implied. */ /* * Portions of this code appear in the book * "Late Night VRML 2.0 with Java", Ziff-Davis Press, 1997 * * NurbsRevolve.java * * author Timothy F. Rohaly * version 1.0, 01/15/97 */ import vrml.*; import vrml.field.*; import vrml.node.*; import nurbs.*; /** * VRML 2.0 Script node implementing the NurbsRevolve prototype. * @author Timothy F. Rohaly * @version 1.0, 1/15/97 */ public class NurbsRevolve extends Script { private SFBool debug; private SFInt32 segments; private SFFloat minAngle; private SFFloat maxAngle; private SFInt32 profileSegments; private MFFloat profileKnotSequence; private MFFloat profileControlPoints; private MFInt32 coordIndex_changed; private SFNode coord_changed; public void initialize() { debug = (SFBool) getField("debug"); segments = (SFInt32) getField("segments"); minAngle = (SFFloat) getField("minAngle"); maxAngle = (SFFloat) getField("maxAngle"); profileSegments = (SFInt32) getField("profileSegments"); profileKnotSequence = (MFFloat) getField("profileKnotSequence"); profileControlPoints = (MFFloat) getField("profileControlPoints"); coordIndex_changed = (MFInt32) getEventOut("coordIndex_changed"); coord_changed = (SFNode) getEventOut("coord_changed"); // // First create the Knots // int numControlPoints = profileControlPoints.getSize()/4; int numKnots = profileKnotSequence.getSize(); int order = numKnots - numControlPoints; float[] knot = new float[numKnots]; for (int i=0; i