Exemplo n.º 1
0
        private static void MovePointHandleAlongLine(GenericPosture posture, int handle, PointF point, GenericPostureConstraintLineSlide constraint)
        {
            if (constraint == null)
            {
                MovePointHandleFreely(posture, handle, point);
                return;
            }

            PointF start = posture.PointList[constraint.Start];
            PointF end   = posture.PointList[constraint.End];

            posture.PointList[posture.Handles[handle].Reference] = GeometryHelper.GetClosestPoint(start, end, point, constraint.AllowedPosition, constraint.Margin);
        }
Exemplo n.º 2
0
        private static void AlignPointSegment(GenericPosture posture, GenericPostureImpactLineAlign impact)
        {
            if (impact == null)
            {
                return;
            }

            PointF start = posture.PointList[impact.Start];
            PointF end   = posture.PointList[impact.End];

            if (start == end)
            {
                posture.PointList[impact.PointToAlign] = start;
                return;
            }

            PointF result = GeometryHelper.GetClosestPoint(start, end, posture.PointList[impact.PointToAlign], PointLinePosition.Anywhere, 10);

            posture.PointList[impact.PointToAlign] = result;
        }