Specify individually the translation and scaling matrices required to transform a 2D window of [Xmin=-234, Ymin=156] and [Xmax=66, Ymax=456] to a display viewport of [Umin=45, Vmin=35] and [Umax=245, Vmax=185].
Ignore the question above since I solved the matrix, the information is just relevant for the question I'm stuck on
I was asked to compute the view-port positions (U1,V1) and (U2,V2) for two points A (-100,300) and B (30,-40) in a 2D window and determine if these two points are inside the view-port.
Based on the transformation Matrix I found (U1,V1) to be (403/3, 407) and (U2,v2) to be (221, -103). It turns out that both these points are outside our view-port but part of the line between them is inside.
Now I'm confused about this part below:
Apply a 2D clipping method to the line segment between the two points A and B as given in above.
delta x = 221-(403/3) = 260/3
delta y = -103 - 406 = -510
m = delta y / delta x = -5.88
I started with U1,V1 since it is above our viewport:
Y = 185
X = 403/3 + (185-407)*(delta x/ delta y)
X = 279.48
Point 1 - (172, 185)
Is this correct? Since the point is now within the view-port. Do I then do the same for the second point?