// Construction. If the input controls is non-null, a copy is made of // the controls. To defer setting the control points or weights, pass // null pointers and later access the control points or weights via // GetControls(), GetWeights(), SetControl(), or SetWeight() member // functions. The 'controls' and 'weights' must be stored in // row-major order, attribute[i0 + numControls0*i1]. As a 2D array, // this corresponds to attribute2D[i1][i0]. public NURBSSurface(BasisFunctionInput input0, BasisFunctionInput input1, Vector3[] controls, double[] weights) : base(0 - 0, 1.0, 0.0, 1.0, true) { this.basisFunctions = new[] { new BasisFunction(input0), new BasisFunction(input1) }; this.numControls = new[] { input0.NumControls, input1.NumControls }; // The mBasisFunction stores the domain but so does ParametricSurface. this.uMin = this.basisFunctions[0].MinDomain; this.uMax = this.basisFunctions[0].MaxDomain; this.vMin = this.basisFunctions[1].MinDomain; this.vMax = this.basisFunctions[1].MaxDomain; // The replication of control points for periodic splines is // avoided by wrapping the i-loop index in Evaluate. this.controls = new Vector3[this.numControls[0] * this.numControls[1]]; if (controls != null) { controls.CopyTo(this.controls, 0); } this.weights = new double[this.numControls[0] * this.numControls[1]]; if (weights != null) { weights.CopyTo(this.weights, 0); } this.isConstructed = true; }
// Construction. If the input controls is non-null, a copy is made of // the controls. To defer setting the control points, pass a null // pointer and later access the control points via GetControls() or // SetControl() member functions. The domain is t in [t[d],t[n]], // where t[d] and t[n] are knots with d the degree and n the number of // control points. public BSplineCurve(BasisFunctionInput input, Vector3[] controls) : base(0.0, 1.0) { this.basisFunction = new BasisFunction(input); // The mBasisFunction stores the domain but so does ParametricCurve. this.SetTimeInterval(this.basisFunction.MinDomain, this.basisFunction.MaxDomain); // The replication of control points for periodic splines is // avoided by wrapping the i-loop index in Evaluate. this.controls = new Vector3[input.NumControls]; if (controls != null) { controls.CopyTo(this.controls, 0); } this.isConstructed = true; }