Equations equation of a line slope intercept explicit

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ines More efficient algorithms exist Solving Simultaneous Equations Equation of a line • Slope-intercept (explicit equation): y = mx + b • Implicit Equation: Ax + By + C = 0 • Parametric Equation: Line defined by two points, P0 and P1 – P(t) = P0 + (P1 - P0) t, where P is a vector [x, y]T (t) t, – x(t) = x0 + (x1 - x0) t – y(t) = x0 + (y1 - y0) t Parametric Line Equation Describes a finite line Works with vertical lines (like the viewport edge) 0 <=t <= 1 • Defines line between P0 and P1 t<0 • Defines line before P0 t>1 • Defines line after P1 Parametric Lines and Clipping Define each line in parametric form: Define • P0(t)…Pn-1(t) Define each edge of viewport in parametric form: • PL(t), PR(t), PT(t), PB(t) Could perform Cohen-Sutherland intersection Could tests using appropriate viewport edge and line tests Line / Edge Clipping Equations Faster line clippers use parametric equations Line 0: • x0 = x00 + (x01 - x00) t0 • y0 = y00 + (y01 - y00) t0 Viewport Edge L: • xL = xL0 + (xL1 - xL0) tL • yL = yL0 + (yL1 - yL0) tL x00 + (x01 - x00) t0 = xL0 + (xL1 - xL0) tL y00 + (y01 - y00) t0 = yL0 + (yL1 - yL0) tL • Solve for t0 and/or tL Cyrus-Beck Algorithm We wish to optimize line/line intersection • Start with parametric equation of line: – P(t) = P0 + (P1 - P0) t • And a point and normal for each edge – PL, NL Cyrus-Beck Algorithm Find t such that PL NL [P(t) - PL] = 0 P(t) P0 Substitute line equation for P(t) Solve for...
View Full Document

This document was uploaded on 01/29/2014.

Ask a homework question - tutors are online