예제 #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;
        }
예제 #2
0
 public void UpdateOrigin()
 {
     if (CalibrationHelper != null)
     {
         points["0"] = CalibrationHelper.GetImagePoint(PointF.Empty);
     }
 }
        public void UpdateOrigin()
        {
            // The coordinate system origin was updated from the outside.
            // Make sure the drawing reflects the new origin.
            if (CalibrationHelper != null)
            {
                points["0"] = CalibrationHelper.GetImagePoint(PointF.Empty);

                // Also ensure the trackability manager is up to date.
                // This is necessary to make sure it correctly imports the original value after KVA load.
                // But avoid calling it if the new origin is because we are reading the tracking timeline.
                if (!trackingUpdate)
                {
                    SignalTrackablePointMoved();
                }
            }
        }
예제 #4
0
        private static void MovePointHandleAlongParallel(GenericPosture posture, CalibrationHelper calibrationHelper, int handle, PointF point, GenericPostureConstraintParallelSlide constraint)
        {
            if (constraint == null)
            {
                return;
            }

            PointF a = posture.PointList[constraint.A];
            PointF b = posture.PointList[constraint.B];
            PointF c = posture.PointList[constraint.C];

            PointF aPlane     = calibrationHelper.GetPoint(a);
            PointF bPlane     = calibrationHelper.GetPoint(b);
            PointF cPlane     = calibrationHelper.GetPoint(c);
            PointF pointPlane = calibrationHelper.GetPoint(point);

            PointF resultPlane = GeometryHelper.GetPointOnParallel(aPlane, bPlane, cPlane, pointPlane);
            PointF result      = calibrationHelper.GetImagePoint(resultPlane);

            posture.PointList[posture.Handles[handle].Reference] = result;
        }
예제 #5
0
        private static void SegmentCenter(GenericPosture posture, CalibrationHelper calibrationHelper, GenericPostureImpactSegmentCenter impact)
        {
            // The point is moved so that it stays at the center of the specified segment.
            // This should take perspective into account.

            if (impact == null)
            {
                return;
            }

            PointF p1 = posture.PointList[impact.Point1];
            PointF p2 = posture.PointList[impact.Point2];

            PointF p1Plane = calibrationHelper.GetPoint(p1);
            PointF p2Plane = calibrationHelper.GetPoint(p2);

            PointF resultPlane = GeometryHelper.GetMiddlePoint(p1Plane, p2Plane);

            PointF result = calibrationHelper.GetImagePoint(resultPlane);

            posture.PointList[impact.PointToMove] = result;
        }
예제 #6
0
        private static void AlignPointParallel(GenericPosture posture, CalibrationHelper calibrationHelper, GenericPostureParallelAlign impact)
        {
            // The point is moved so that it stays on a segment parallel to another segment.

            if (impact == null)
            {
                return;
            }

            PointF a           = posture.PointList[impact.A];
            PointF b           = posture.PointList[impact.B];
            PointF c           = posture.PointList[impact.C];
            PointF pointToMove = posture.PointList[impact.PointToMove];

            PointF aPlane     = calibrationHelper.GetPoint(a);
            PointF bPlane     = calibrationHelper.GetPoint(b);
            PointF cPlane     = calibrationHelper.GetPoint(c);
            PointF pointPlane = calibrationHelper.GetPoint(pointToMove);

            PointF resultPlane = GeometryHelper.GetPointOnParallel(aPlane, bPlane, cPlane, pointPlane);
            PointF result      = calibrationHelper.GetImagePoint(resultPlane);

            posture.PointList[impact.PointToMove] = result;
        }
예제 #7
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;
        }
        private void MoveVerticalAxis(PointF p)
        {
            PointF point = CalibrationHelper.GetPoint(p);

            points["0"] = CalibrationHelper.GetImagePoint(new PointF(point.X, 0));
        }
        private void MoveHorizontalAxis(PointF p)
        {
            PointF point = CalibrationHelper.GetPoint(p);

            points["0"] = CalibrationHelper.GetImagePoint(new PointF(0, point.Y));
        }