/* * 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 * * NurbsSurface.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 NurbsSurface prototype. * @author Timothy F. Rohaly * @version 1.0, 1/15/97 */ public class NurbsSurface extends Script { private SFBool debug; private SFInt32 uSegments; private SFInt32 vSegments; private MFFloat uKnotSequence; private MFFloat vKnotSequence; private SFInt32 numUControlPoints; private SFInt32 numVControlPoints; private MFFloat controlPoints; private MFInt32 coordIndex_changed; private SFNode coord_changed; public void initialize() { debug = (SFBool) getField("debug"); uSegments = (SFInt32) getField("uSegments"); vSegments = (SFInt32) getField("vSegments"); uKnotSequence = (MFFloat) getField("uKnotSequence"); vKnotSequence = (MFFloat) getField("vKnotSequence"); numUControlPoints = (SFInt32) getField("numUControlPoints"); numVControlPoints = (SFInt32) getField("numVControlPoints"); controlPoints = (MFFloat) getField("controlPoints"); coordIndex_changed = (MFInt32) getEventOut("coordIndex_changed"); coord_changed = (SFNode) getEventOut("coord_changed"); // // First create the Knots // int numControlPoints = numUControlPoints.getValue(); int numKnots = uKnotSequence.getSize(); int order = numKnots - numControlPoints; float[] knot = new float[numKnots]; for (int i=0; i