Example #1
0
        private EPointF GetForceOnPoint(EPointF pnt)
        {
            //because of error in inclination bitmap edges:
            ERectangleF rct = this.Rect + new ERectangleF(2, 2, -4, -4);

            if (!rct.Contains(pnt))
            {
                return(new EPointF());
            }

            EPointF pntDiff   = pnt - this.Loc;
            EPoint  pntInside = pntDiff.ToEPoint();

            Color clr = this.bmpInclination.GetPixel(pntInside.X, pntInside.Y);
            //EPointF pntForce = EPointF.FromLengthAndAngle((float)clr.B/1000, (float)Math.Atan2((clr.R-128), -(clr.G-128)));
            EPointF pntForce = new EPointF(-(clr.R - 128), -(clr.G - 128)) / 600;

            return(pntForce);
        }
Example #2
0
        private EPoint GetPointBetween(EPoint pt1, EPoint pt2, float ratio)
        {
            EPointF ptMid = (pt2 - pt1).ToEPointF() * ratio + pt1.ToEPointF();

            return(ptMid.ToEPoint());
        }