示例#1
0
        public List <Coord3d> getDecimatedVertices(double dstep)
        {
            List <Coord3d> steps   = new List <Coord3d>();
            int            num     = vertices.Count;
            int            i       = 0;
            double         segLen  = 0;
            Coord3d        a       = default(Coord3d);
            Coord3d        dir     = default(Coord3d);
            Coord3d        stepDir = default(Coord3d);
            Coord3d        b       = vertices[0];
            Coord3d        curr    = b.Clone();

            while (i < num - 1)
            {
                a       = b;
                b       = vertices[i + 1];
                dir     = b.substract(a);
                segLen  = 1 / dir.magSquared();
                stepDir = dir.normalizeTo(dstep);
                curr    = a.interpolateTo(b, curr.substract(a).dot(dir) * segLen);
                while (curr.substract(a).dot(dir) / segLen <= 1)
                {
                    steps.Add(curr.Clone());
                    curr.addSelf(stepDir);
                }
                i += 1;
            }
            return(steps);
        }
示例#2
0
        public Coord3d Compute(Coord3d input)
        {
            Coord3d output = (Coord3d)input.Clone();

            foreach (ITransformer nextT in _sequence)
            {
                output = nextT.Compute(output);
            }
            return(output);
        }
示例#3
0
        public View(Scene scene, ICanvas canvas, Quality quality)
        {
            BoundingBox3d sceneBounds = scene.Graph.Bounds;

            _viewpoint  = (Coord3d)DEFAULT_VIEW.Clone();
            _center     = (Coord3d)sceneBounds.getCenter();
            _scaling    = (Coord3d)Coord3d.IDENTITY.Clone();
            _viewmode   = ViewPositionMode.FREE;
            _boundmode  = ViewBoundMode.AUTO_FIT;
            _cameraMode = CameraMode.ORTHOGONAL;
            _axe        = (IAxe)AxeFactory.getInstance(sceneBounds, this);
            _cam        = CameraFactory.getInstance(_center);
            _scene      = scene;
            _canvas     = canvas;
            _quality    = quality;
            _renderers  = new List <IRenderer2D>();
            //_tooltips = New List(Of ITooltipRenderer)
            _bgViewport                = new ImageViewport();
            _viewOnTopListeners        = new List <IViewIsVerticalEventListener>();
            _viewPointChangedListeners = new List <IViewPointChangedListener>();
            _wasOnTopAtLastRendering   = false;
            //_overlay = New Overlay
            View.Current = this;
        }