Exemplo n.º 1
0
        private static void AlignPointPerpendicular(GenericPosture posture, CalibrationHelper calibrationHelper, GenericPosturePerpendicularAlign impact)
        {
            // The point is moved so that it stays on a perpendicular segment relatively to another segment.

            if (impact == null)
            {
                return;
            }

            PointF pivot       = posture.PointList[impact.Origin];
            PointF leg1        = posture.PointList[impact.Leg1];
            PointF pointToMove = posture.PointList[impact.PointToMove];

            if (pivot == leg1)
            {
                return;
            }

            PointF pivotPlane = calibrationHelper.GetPoint(pivot);
            PointF leg1Plane  = calibrationHelper.GetPoint(leg1);
            PointF pointPlane = calibrationHelper.GetPoint(pointToMove);

            PointF resultPlane = GeometryHelper.GetPointAtAngle(pivotPlane, leg1Plane, pointPlane, 90);
            PointF result      = calibrationHelper.GetImagePoint(resultPlane);

            posture.PointList[impact.PointToMove] = result;
        }
Exemplo n.º 2
0
        private static void MovePointHandleAlongPerpendicular(GenericPosture posture, CalibrationHelper calibrationHelper, int handle, PointF point, GenericPostureConstraintPerpendicularSlide constraint)
        {
            if (constraint == null)
            {
                return;
            }

            PointF pivot = posture.PointList[constraint.Origin];
            PointF leg1  = posture.PointList[constraint.Leg1];

            if (pivot == leg1)
            {
                return;
            }

            PointF pivotPlane = calibrationHelper.GetPoint(pivot);
            PointF leg1Plane  = calibrationHelper.GetPoint(leg1);
            PointF pointPlane = calibrationHelper.GetPoint(point);

            PointF resultPlane = GeometryHelper.GetPointAtAngle(pivotPlane, leg1Plane, pointPlane, 90);
            PointF result      = calibrationHelper.GetImagePoint(resultPlane);

            posture.PointList[posture.Handles[handle].Reference] = result;
        }