示例#1
0
	Intersection(const LineSegment<T, 2>& l1, const LineSegment<T, 2>& l2) {
		lineSegment1 = l1;
		lineSegment2 = l2;
		auto intersection = Intersect(l1.Line(), l2.Line());
		if (intersection.Intersecting()) {
			param1 = intersection.LineParameter1() / l1.Length();
			param2 = intersection.LineParameter2() / l2.Length();
		}
		else {
			param1 = param2 = std::numeric_limits<T>::infinity();
		}
	}
示例#2
0
	Intersection(const LineSegment<T, 2>& line1, const Line<T, 2>& line2) {
		auto inter = Intersect(line1.Line(), line2);
		if (inter.Intersecting() && inter.LineParameter1() < line1.Length()) {
			param1 = inter.LineParameter1();
			param2 = inter.LineParameter2();
		}
		else {
			param1 = param2 = std::numeric_limits<T>::infinity();
		}
	}