Esempio n. 1
0
        public void DrawCenterLines(TsPart tsPart, TsView tsView)
        {
            double scale = tsView.scale;
            double delta = 2 * scale;

            Point o = tsPart.origin;

            CoordinateSystem partCS = tsPart.partCS;

            double width  = tsPart.width;
            double height = tsPart.height;
            double length = tsPart.length;

            var x = new Point(o);
            var y = new Point(o);
            var z = new Point(o);

            var nx = new Point(o);
            var ny = new Point(o);
            var nz = new Point(o);

            Vector rX = Extensions.RoundVector(partCS.AxisX.GetNormal()) * length * 0.5;
            Vector rY = Extensions.RoundVector(partCS.AxisY.GetNormal()) * height * 0.5;
            Vector rZ =
                Extensions.RoundVector(Vector.Cross(partCS.AxisX, partCS.AxisY).GetNormal()) * width * 0.5;

            rX = Extensions.ExtendVector(rX, delta);
            rY = Extensions.ExtendVector(rY, delta);
            rZ = Extensions.ExtendVector(rZ, delta);

            Vector nrX = (-1) * rX;
            Vector nrY = (-1) * rY;
            Vector nrZ = (-1) * rZ;

            x.Translate(rX.X, rX.Y, rX.Z);
            y.Translate(rY.X, rY.Y, rY.Z);
            z.Translate(rZ.X, rZ.Y, rZ.Z);

            nx.Translate(nrX.X, nrX.Y, nrX.Z);
            ny.Translate(nrY.X, nrY.Y, nrY.Z);
            nz.Translate(nrZ.X, nrZ.Y, nrZ.Z);

            ViewBase view = tsView._viewBase;

            Inserter.InsertLine(view, nx, x);
            Inserter.InsertLine(view, ny, y);
            Inserter.InsertLine(view, nz, z);
        }