1 private void GetDimensionLineEndPoints(LineSeg3d firstSeg3d, LineSeg3d secondSeg3d, Point3d thirdPt, out Point3d firstCrossPt, out Point3d secondCrossPt)
2 {
3 Point3d centerPoint = GetIntersectPoint(firstSeg3d, secondSeg3d);
4 double radius = thirdPt.DistanceTo(centerPoint);
5
6 Vector3d firstLineVec = (firstSeg3d.EndPoint - centerPoint).Normal();
7 Vector3d secondLineVec = (secondSeg3d.EndPoint - centerPoint).Normal();
8 Vector3d thirdLineVec = (thirdPt - centerPoint).Normal();
9
10 if ((firstLineVec.CrossProduct(thirdLineVec)).DotProduct(thirdLineVec.CrossProduct(secondLineVec)) < 0)
11 secondLineVec = -secondLineVec;
12
13 if ((thirdLineVec.AngleTo(firstLineVec) + thirdLineVec.AngleTo(secondLineVec)) > Math.PI)
14 {
15 firstLineVec = -firstLineVec;
16 secondLineVec = -secondLineVec;
17 }
18
19 firstCrossPt = centerPoint + firstLineVec * radius;
20 secondCrossPt = centerPoint + secondLineVec * radius;
21 }
22