public void BuildControlNet( List <SurfaceControlPoint> controlPoints, int controlPointsUAxis, bool looped ) { var dataRowsCount = controlPoints.Count / controlPointsUAxis; var controlPointsVAxis = dataRowsCount + (looped ? 1 : 0); for (var x = 0; x < controlPointsUAxis; ++x) { for (var y = 0; y < controlPointsVAxis; ++y) { var ym = y % dataRowsCount; var fromPoint = controlPoints[controlPointsUAxis * ym + x].Position; if (x < controlPointsUAxis - 1) { var toPointIndex = controlPointsUAxis * ym + x + 1; _builder.Connect(fromPoint, NetColor); _builder.Connect( controlPoints[toPointIndex].Position, NetColor ); _builder.FinishChain(); } if (y < controlPointsVAxis - 1) { var toPointIndex = controlPointsUAxis * ((ym + 1) % dataRowsCount) + x; _builder.Connect(fromPoint, NetColor); _builder.Connect( controlPoints[toPointIndex].Position, NetColor ); _builder.FinishChain(); } } } }
protected void ScanConstantParameter( Func <int, double> uCoordGenerator, Func <int, double> vCoordGenerator, int samples) { for (var i = 0; i < samples; ++i) { var u = uCoordGenerator(i); var v = vCoordGenerator(i); if (_sampledSurface.Trimmer != null && !_sampledSurface.Trimmer.VerifyParametrisation(u, v)) { _builder.FinishChain(); } else { _builder.Connect(_sampledSurface.Evaluate(u, v)); } } _builder.FinishChain(); }