In Cyrus-Beck algorithm for line clipping the value of t parameter is computed…
2014
In Cyrus-Beck algorithm for line clipping the value of t parameter is computed by the relation :
(Here P1 and P2 are the two end points of the line, f is a point on the boundary, n1 is inner normal)
- A.
\(\frac{(P_{1}-f_{i}).n_{i}}{(P_{2}-P_{1}).n_{i}}\) - B.
\(\frac{(f_{i}-P_{1}).n_{i}}{(P_{2}-P_{1}).n_{i}}\) - C.
\(\frac{(P_{2}-f_{i}).n_{i}}{(P_{1}-P_{2}).n_{i}}\) - D.
\(\frac{(f_{i}-P_{2}).n_{i}}{(P_{1}-P_{2}).n_{i}}\)
Attempted by 77 students.
Show answer & explanation
Correct answer: B
Key idea: find the parameter t where the parametric line intersects the clipping boundary defined by point f_i and inward normal n_i.
Write the parametric form of the line segment: P(t) = P1 + t (P2 - P1), where 0 ≤ t ≤ 1.
Point P(t) lies on the clipping boundary when the vector from the boundary point to P(t) is orthogonal to the inward normal: (f_i - P(t)) · n_i = 0.
Substitute P(t): (f_i - (P1 + t(P2 - P1))) · n_i = 0 → (f_i - P1) · n_i - t (P2 - P1) · n_i = 0.
Solve for t: t = (f_i - P1) · n_i / (P2 - P1) · n_i.
Notes: If (P2 - P1) · n_i = 0 the line is parallel to the boundary; if the numerator is also zero the line lies on the boundary. The sign of the denominator helps determine entering versus leaving intersections.