0% found this document useful (0 votes)
14 views3 pages

Computer Graphic

The document discusses three forms of representing a line: explicit, implicit, and parametric. The explicit form gives the line as y=mx+b. The implicit form uses an equation f(x,y)=mx+b-y. The parametric form defines x and y as functions of a parameter t.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

Computer Graphic

The document discusses three forms of representing a line: explicit, implicit, and parametric. The explicit form gives the line as y=mx+b. The implicit form uses an equation f(x,y)=mx+b-y. The parametric form defines x and y as functions of a parameter t.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

Explicit form

The explicit form of a line is typically given as y=mx+b


y1 − y0
m=
x1 − x0

Substituting the gicen points: (2;3) and (7;10):

10 − 3 7
m= =
7−2 5
7
Now we have m = 5 fiding the y-intercept (b) by plugging in one of the points (use the first
point, (2;3)):

7
3= ×2+b
5
14 1
⇒ b=3− =
5 5
7 1
So, the explicit form of the line is: y = x +
5 5

2. Implicit form

We use the equation f(x, y) = mx + b − y to describe the implicit relationship between x and y
for the line passing through these points.
7
We already know the m = 5

Substituting into the equation f(x, y) = mx + b − y:

7
f(x, y) = x + b − y
5
7
Substituting (2;3) into the equation f(x, y) = 5 x + b − y, to solve for b:

7
3= ×2+b−3
5
16
⇒b= 5

7 16
So, we have the equation in implicit form: f(x, y) = 5 x + −y
5

3. Parametric form
In 2D, line segment:

x = (1 − t)x0 + tx1
(1) { t∈ [0,1]
y = (1 − t)y0 + ty1

Substituting (x0 , y0 )=(2;3), (x1 , y1 )=(7;10) into (1), we have the equation in parametric form:

x = 2 + 5t
{
y = 3 + 7t

 The list of pixels belong to the line


xi = x0 + i
{
yi = (1 − t)y0 + ty1

(x0 , y0 )=(2;3)

(x1 , y1 )=(7;10)

N=x1 − x0 = 7 − 2 = 5
1 2 3 4
⇒ t = {0, 5 , 5 , 5 , 5 , 1}

i=0,1,2,3,4,5

x0 = 2 + 0 x =2
i=0 ⇒ { ⇒ { 0
y0 = (1 − 0) × 3 + 0 × 10 y0 = 3

x1 = 2 + 1 x1 = 3
i=1 ⇒ { 1 1 ⇒ { 22 ⇒setPixel (3;4)
y1 = (1 − 5) × 3 + 5 × 10 y1 = 5

x2 = 2 + 2 x2 = 4
i=2 ⇒ { 2 2 ⇒ { 29 ⇒setPixel (4;6)
y2 = (1 − ) × 3 + × 10 y2 =
5 5 5

x3 = 2 + 3 x3 = 5
i=3 ⇒ { 3 3 ⇒ { 36 ⇒setPixel (5;7)
y3 = (1 − 5) × 3 + 5 × 10 y3 = 5

x4 = 2 + 4 x4 = 6
i=4 ⇒ { 4 4 ⇒ { 43 ⇒setPixel (6;9)
y4 = (1 − 5) × 3 + 5 × 10 y4 = 5

x5 = 2 + 5 x =7
i=5 ⇒ { ⇒ { 5
y5 = (1 − 1) × 3 + 1 × 10 y5 = 10

You might also like