Esempio n. 1
0
        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>();
        }
Esempio n. 2
0
        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>();
        }