Vous êtes sur la page 1sur 4

Name: Rajesh Katram Jag No: J00338801

CSC 413/513 Computer Graphics Homework 2 (100 pts)


Assigned: 02/07/2012 Due Date: 02/14/2012
(Attention: In your solution, do not change the original layout or delete any contents in this file. However, it is fine to add empty lines, when necessary.)

1.

(35 pts) Given a point ( x0 , y0 ) and a line rx + sy + t = 0 with r 2 + s 2 = 1 . Calculate the distance from the point to the line. Detailed procedures are required. The final result itself does NOT give you any credit.

A)

Let (x,y) be the point of intersection between rx+sy+t =0 and the line segment joining the points (x,y) and (xo,yo) . As we observe both these line segments are perpendicular to each other therefore, Equation of the line passing through (xo,yo) and having slope perpendicular to rx+sy+t =0 y = -(r/s)x t/s. (1) (y= mx +c where m = -r/s and b =-t/s) Perpendicular slope = - 1/m = s/r Point Slope Form Of a Line y y1 = m(x x1) y yo = s/r (x xo) r(y-yo) = s(x xo) ry ryo= sx sxo ry= sx sxo + ryo y=s/r(x) +(yo (s/r)xo) (2)

Name: Rajesh Katram Jag No: J00338801

The above equation is of the form y = mx + b. Where m = s/r and b = yo (s/r)xo Now we have to find the point of intersection between (1) and (2) i.e. y = -(r/s)x t/s and y=s/r(x) +(yo (s/r)xo) m1 = -(r/s) b1 = -t/s m2= s/r b2=(yo (s/r)xo) now the point of intersection is

X-coordinate(x1) =

(yo - (s/r)xo) + t/s - (r/s) - (s/r)

= (sryo s2xo + rt)/(s2-r2) Y-coordinate(y1) = (-(s/r)xo + yo) . (-r/s) + t/r)/ (-(r/s)-(s/r)) = (srxo yor2 + ts) /(s2-r2) Now the Distance between the point (xo,yo) and the line rx+sy+t = 0 is L Which is the distance between two points (x1,y1) and (xo,yo) i.e. Two Point Distance Formula:

d = ( (xo ((sryo s2xo + rt)/(s2-r2))2 + (yo ((srxo yor2 + ts) /(s2-r2))2)1/2 by substituting the values of xo,yo, r,s,t , we can obtain the distance between the point and the line segment .

Name: Rajesh Katram Jag No: J00338801 2.

(5 pts) Prove that the vector dot product is commutative. That is, A B = B A .

A)

= |A|. |B| Cos . Where is the angle between A and B. Now the angle between B and A is - . = |B|.|A|.Cos(-) (Since Cos(-) = Cos ) = B|.|A|.Cos() =

3.

(10 pts) Prove that A A = A .


A)

= |A|. |B| Cos. Replace |B| with |A| = |A|.|A| .Cos. (Angle Subtended between A and A = 0o) =|A|.|A| .Cos (0o). (Cos 0o = 1) =|A|2.

4.

(25 pts) Prove that ( A B = 0) A B Given i.e. |A|. |B| Cos . = 0 From above equation is possible when Cos . = 0 This is possible when = 90o . ( which is the angle between A and B ) Therefore =0.

A)

5.

(20 pts) If A B = A C , do we have B = C ? If yes, why? If no, what should we have

Name: Rajesh Katram Jag No: J00338801

then?
A)

No, Because B and C can be in two different directions. (i.e. angle subtended between A and B , A and C is different ) Instead we can have |B| = |C|.

6.

(5 pts) Prove that the vector cross product is not commutative. That is, A B B A .

A) = |A|. |B|.Sin. Where is the angle between A and B. Now the angle between B and A is - . = |B|.|A|.Sin(-) (Since Sin(-) = -Sin ) =- B|.|A|.Sin() = Therfore A B B A (i.e. Not Commutative but anti-commutative.)

Vous aimerez peut-être aussi