/// <summary> /// 計算線與線的角度 /// </summary> /// <param name="LineA"></param> /// <param name="LineB"></param> /// <returns></returns> public static AngleResult AngleLineToLine(Measurement LineA, Measurement LineB) { //get value var line1 = LineA.GetViewModel(); var line2 = LineB.GetViewModel(); return AngleLineToLine(line1, line2); }
private DistanceResult LineToLine(Measurement first, Measurement second) { var line1 = first.GetViewModel(); var line2 = second.GetViewModel(); HTuple distanceMin, distanceMax; HOperatorSet.DistanceSs(line1.Row1, line1.Col1, line1.Row2, line1.Col2, line2.Row1, line2.Col1, line2.Row2, line2.Col2 , out distanceMin, out distanceMax); return new DistanceResult() { FirstRowBegin = new HTuple(line1.Row1), FirstColBegin = new HTuple(line1.Col1), FirstRowEnd = new HTuple(line1.Row2), FirstColEnd = new HTuple(line1.Col2), SecondRowBegin = new HTuple(line2.Row1), SecondColBegin = new HTuple(line2.Col1), SecondRowEnd = new HTuple(line2.Row2), SecondColEnd = new HTuple(line2.Col2), Direction = LineDirection.Vertical, Distance = new HTuple(distanceMin), Angle = this.hv_AllModelAngle, }; }
private DistanceResult PointToLine(Measurement first, Measurement second) { var firstData = first.GetViewModel(); // GetMeasureResultDataModle(first.getMeasureResultData()); var secData = second.GetViewModel(); //GetMeasureResultDataModle(second.getMeasureResultData()); HTuple distanceMin, distanceMax; var point = (firstData.Row2 != null) ? secData : firstData; var line = (firstData.Row2 != null) ? firstData : secData; HOperatorSet.DistancePs(point.Row1, point.Col1, line.Row1, line.Col1, line.Row2, line.Col2, out distanceMin, out distanceMax); return new DistanceResult() { FirstRowBegin = new HTuple(line.Row1), FirstColBegin = new HTuple(line.Col1), FirstRowEnd = new HTuple(line.Row2), FirstColEnd = new HTuple(line.Col2), SecondRowBegin = new HTuple(point.Row1), SecondColBegin = new HTuple(point.Col1), //SecondRowEnd = new HTuple(line2.Row2), //SecondColEnd = new HTuple(line2.Col2), Direction = LineDirection.Vertical, Distance = new HTuple(distanceMin), Angle = this.hv_AllModelAngle, }; }
public static DistanceResult PointToPoint(Measurement first, Measurement second, HTuple angle, LineDirection direction) { DistanceResult result = null; var p1 = first.GetViewModel(); var p2 = second.GetViewModel(); if (p1 == null || p2 == null) return null; if (p1.Row1 != null && p1.Row1.TupleLength() > 0 && p2.Row1 != null && p2.Row1.TupleLength() > 0) { HTuple distanceMin; HOperatorSet.DistancePp(p1.Row1, p1.Col1, p2.Row1, p2.Col1, out distanceMin); result = new DistanceResult() { Distance = distanceMin, Direction = direction, Angle = angle, FirstRowBegin = p1.Row1, FirstColBegin = p1.Col1, FirstRowEnd = p2.Row1, FirstColEnd = p2.Col1, }; } return result; }
public static DistanceResult PointToLine(Measurement first, Measurement second, HTuple angle) { DistanceResult result = null; var firstData = first.GetViewModel(); var secData = second.GetViewModel(); if (firstData.Row1 != null && firstData.Row1.TupleLength() > 0 && secData.Row1 != null && secData.Row1.TupleLength() > 0) { HTuple distanceMin, distanceMax; var point = (firstData.Row2 != null) ? secData : firstData; var line = (firstData.Row2 != null) ? firstData : secData; HOperatorSet.DistancePs(point.Row1, point.Col1, line.Row1, line.Col1, line.Row2, line.Col2, out distanceMin, out distanceMax); result = new DistanceResult() { FirstRowBegin = new HTuple(line.Row1), FirstColBegin = new HTuple(line.Col1), FirstRowEnd = new HTuple(line.Row2), FirstColEnd = new HTuple(line.Col2), SecondRowBegin = new HTuple(point.Row1), SecondColBegin = new HTuple(point.Col1), //SecondRowEnd = new HTuple(line2.Row2), //SecondColEnd = new HTuple(line2.Col2), Direction = LineDirection.Vertical, Distance = new HTuple(distanceMin), Angle = angle, }; } return result; }
public static DistanceResult LineToLine(Measurement first, Measurement second, HTuple angle, LineDirection direction) { //get value var line1 = first.GetViewModel(); var line2 = second.GetViewModel(); //check if (line1 == null || line2 == null) return null; if (line1.Row1 == null && line1.Row1.TupleLength() == 0 && line2.Row1 == null && line2.Row1.TupleLength() == 0) return null; //act HTuple distanceMin, distanceMax; HOperatorSet.DistanceSs(line1.Row1, line1.Col1, line1.Row2, line1.Col2, line2.Row1, line2.Col1, line2.Row2, line2.Col2 , out distanceMin, out distanceMax); return new DistanceResult() { FirstRowBegin = new HTuple(line1.Row1), FirstColBegin = new HTuple(line1.Col1), FirstRowEnd = new HTuple(line1.Row2), FirstColEnd = new HTuple(line1.Col2), SecondRowBegin = new HTuple(line2.Row1), SecondColBegin = new HTuple(line2.Col1), SecondRowEnd = new HTuple(line2.Row2), SecondColEnd = new HTuple(line2.Col2), Direction = direction, Distance = new HTuple(distanceMin), Angle = angle, }; }