protected override void CreateDirectionalSurfaceSampling( Func <Point3D, Point3D, double> estimateScreenDistanceWithoutClip, Func <int, int, Tuple <int, int> > mapping, int subdivisions, List <Vertex> vertices, List <IndexedLine> lines ) { if (vertices.Count > 0) { return; } var builder = new WireframeBuilder(); var surfaceSampler = new SurfaceConstantParameterLinesBuilder( builder ); var bezierPatch = new BernsteinPatch(); for (var i = 0; i < 16; ++i) { bezierPatch.ControlPoints[i / 4, i % 4] = ControlPoints[i].Position; } surfaceSampler.Build(bezierPatch); vertices.AddRange(builder.Vertices.ToList()); lines.AddRange(builder.Lines.ToList()); }
public void UpdateGeometry( Func <Point3D, Point3D, double> estimateScreenDistanceWithoutClip, Predicate <Point3D> isInsideProjectiveCubePredicate ) { var isLooped = ControlPoints.Count / (3 * SegmentsU + 1) != 3 * SegmentsV + 1; _surface.SegmentsU = SegmentsU; _surface.SegmentsV = SegmentsV; _surface.ControlPoints = ControlPoints .Select(t => t.Position) .ToList(); var builder = new WireframeBuilder(); var sampler = new SurfaceConstantParameterLinesBuilder(builder); sampler.Build(_surface); if (IsPolygonRenderingEnabled) { var netBuilder = new ControlNetBuilder(builder); netBuilder.BuildControlNet( ControlPoints, 3 * SegmentsU + 1, isLooped ); } Vertices = builder.Vertices.ToList(); Lines = builder.Lines.ToList(); MarkerPoints = ControlPoints.Select(t => new Vertex( t.Position, t.ColorOverride ?? Colors.White )).ToList(); RawPoints = new List <Vertex>(); }
public void UpdateGeometry( Func <Point3D, Point3D, double> estimateScreenDistanceWithoutClip, Predicate <Point3D> isInsideProjectiveCubePredicate ) { var dataRowLength = 3 + SegmentsU; var dataRowsCount = ControlPoints.Count / dataRowLength; var isLooped = dataRowsCount != 3 + SegmentsV; var builder = new WireframeBuilder(); var sampler = new SurfaceConstantParameterLinesBuilder(builder); var bsplineSurf = GetParametricSurface(); sampler.Build(bsplineSurf); if (IsPolygonRenderingEnabled) { var netBuilder = new ControlNetBuilder(builder); netBuilder.BuildControlNet( ControlPoints, 3 + SegmentsU, isLooped ); } Vertices = builder.Vertices.ToList(); Lines = builder.Lines.ToList(); MarkerPoints = ControlPoints .Select(t => new Vertex( t.Position, t.ColorOverride ?? Colors.White )).ToList(); RawPoints = new List <Vertex>(); }