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