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; }
private void ParseImpacts(XmlReader r) { r.ReadStartElement(); while (r.NodeType == XmlNodeType.Element) { if (r.Name == "Align") { GenericPostureImpactLineAlign impact = new GenericPostureImpactLineAlign(r); if (impact != null) { Impacts.Add(impact); } } else if (r.Name == "VerticalAlign") { GenericPostureImpactVerticalAlign impact = new GenericPostureImpactVerticalAlign(r); if (impact != null) { Impacts.Add(impact); } } else if (r.Name == "HorizontalAlign") { GenericPostureImpactHorizontalAlign impact = new GenericPostureImpactHorizontalAlign(r); if (impact != null) { Impacts.Add(impact); } } else if (r.Name == "Pivot") { GenericPostureImpactPivot impact = new GenericPostureImpactPivot(r); if (impact != null) { Impacts.Add(impact); } } else if (r.Name == "KeepAngle") { GenericPostureImpactKeepAngle impact = new GenericPostureImpactKeepAngle(r); if (impact != null) { Impacts.Add(impact); } } else if (r.Name == "HorizontalSymmetry") { GenericPostureImpactHorizontalSymmetry impact = new GenericPostureImpactHorizontalSymmetry(r); if (impact != null) { Impacts.Add(impact); } } else if (r.Name == "SegmentCenter") { GenericPostureImpactSegmentCenter impact = new GenericPostureImpactSegmentCenter(r); if (impact != null) { Impacts.Add(impact); } } else if (r.Name == "PerdpendicularAlign") { GenericPosturePerpendicularAlign impact = new GenericPosturePerpendicularAlign(r); if (impact != null) { Impacts.Add(impact); } } else if (r.Name == "ParallelAlign") { GenericPostureParallelAlign impact = new GenericPostureParallelAlign(r); if (impact != null) { Impacts.Add(impact); } } else { string outerXml = r.ReadOuterXml(); log.DebugFormat("Unparsed content in XML: {0}", outerXml); } } r.ReadEndElement(); }