Beispiel #1
0
        public IVector3 RotateZ(IVector3 rotationPt, double angleRad)
        {
            IVector3 ptTrans = Translate(rotationPt.MultiplyBy(-1));
            Rotation rot     = new Rotation();
            IVector3 ptRot   = rot.AboutZ(angleRad) * ptTrans;
            IVector3 ptOut   = ptRot.Translate(rotationPt);

            ptOut.Col = Col;
            return(ptOut);
        }
Beispiel #2
0
        public IVector2 RotateZ(IVector3 rotationPt, double angleRad)
        {
            IVector2 ptTrans = Translate(rotationPt.MultiplyBy(-1));
            Rotation rot     = new Rotation();
            var      sinR    = Math.Sin(angleRad);
            var      cosR    = Math.Cos(angleRad);
            Vector2  ptRot   = new Vector2(ptTrans.X * cosR - ptTrans.Y * sinR, ptTrans.X * sinR + ptTrans.Y * cosR);
            IVector2 ptOut   = ptRot.Translate(rotationPt);

            ptOut.Col = Col;
            return(ptOut);
        }
Beispiel #3
0
        public List <IVector3> BreakMany(double breakLen)
        {
            try
            {
                var points = new List <IVector3>();

                if (Length <= breakLen)
                {
                    points.Add(Point1);
                    points.Add(Point2);
                    return(points);
                }

                int parseCount = (int)Math.Round(Length / breakLen);
                if (parseCount == 0)
                {
                    parseCount = 1;
                }

                IVector3 delta = Point2.Minus(Point1);

                double dpc = parseCount;
                for (int i = 0; i <= parseCount; i++)
                {
                    double di = i;

                    IVector3 v = Point1.Plus(delta.MultiplyBy(di / dpc));
                    points.Add(v);
                }
                return(points);
            }
            catch (Exception)
            {
                throw;
            }
        }