Computer Graphics Lines and Planes Motivations Tekla T´Oth Lines [email protected] Planes

Computer Graphics Lines and Planes Motivations Tekla T´Oth Lines Tekla.Toth@Inf.Elte.Hu Planes

Introduction Computer Graphics Lines and planes Motivations Tekla T´oth Lines [email protected] Planes E¨otv¨osLor´andTudom´anyegyetem Faculty of Informatics Simple shapes 2019 fall (2019-2020-1) Curves Surfaces Motivation Curves and surfaces I Informally, the curves and surfaces are 'special' subsets of I We can now represent the points of the plane or space by space - i.e. they are sets of points numbers (their coordinates) I How can we define these - usually infinite - sets? I How can we represent 'nice' sets of points, e.g. a line in the I explicit: y = f (x) ! what happens when the curve should plane or a plane in space? 'head back'? x(t) parametric: p(t) = ; t 2 I We seek the answer to this in the Cartesian coordinate system I y(t) R I implicit: x 2 + y 2 − 9 = 0 The 'old school' explicit line Line with a point and normal T I Let p(px ; py ) be a point on the line and n = [nx ; ny ] 6= 0 a vector, a normal perpendicular to the line. I Highschool: y = mx + b I Then all x(x; y) points of the plane that satisfy the following are exactly the points of the line: I Problem: vertical lines! hx − p; ni = 0 (x − px )nx + (y − py )ny = 0 I Two half-planes: hx0 − p; ni < 0 ´es hx0 − p; ni > 0 The homogeneous implicit equation of the line on the plane Homogeneous implicit equation with determinant I Let p(px ; py ) and q(qx ; qy ) be two distinct points on the line. I The equation ax + by + c = 0 is the implicit equation of the A point x(x; y) belongs to the line iff: line on the plane x y 1 I From the previous representation, choosing a = nx , b = ny ´es 2 2 px py 1 = 0 c = −(px nx + py ny ), a + b 6= 0 we get the implicit equation qx qy 1 of the line going through p, with normal n I If a2 + b2 = 1 then this is the Hesse normal form I Remark: the determinant is the double of the signed area of the triangle spanned by x(x; y), p(px ; py ), q(qx ; qy ) Parametric equation for planar and space lines Parametric equation of the line through two points I Let p(px ; py ; pz ) be a point on the line and I Let p and q be two points of the line. The previous form can T v = [vx ; vy ; vz ] 6= 0 a direction vector of the line (a vector be attained by setting v = q − p : parallel to the line): x(t) = p + tv ! x(t) = p + tv ! x(t) = (1 − t)p + tq ! x(t) = px + tvx x(t) = (1 − t)px + tqx y(t) = py + tvy y(t) = (1 − t)py + tqy z(t) = pz + tvz z(t) = (1 − t)pz + tqz Homogeneous equation Implicit equation of the plane using a point and normal T I A line can be represented in the projective plane by the I Let p(px ; py ; pz ) be a point on the plane and n = [nx ; ny ; nz ] line-coordinate triplet e = [e1; e2; e3]. A point be a vector perpendicular to the plane. Then x is a point on T x = [x1; x2; x3] belongs to the line iff the plane iff: ex = e1x1 + e2x2 + e3x3 = 0 This goes for the ideal line of the projective plane: [0; 0; 1] are I hx − p; ni = 0 the line-coordinates of the ideal line, since all points of the form [x1; x2; 0] will satisfy ex I Half-spaces: hx − p; ni < 0, hx − p; ni > 0 Homogeneous implicit equation Homogeneous implicit equation with determinant Let p(p ; p ; p ), q(q ; q ; q ), r(r ; r ; r ) be three, affinely I The implicit equation of the plane is in the form I x y z x y z x y z ax + by + cz + d = 0 independent points. Then x lies on the plane spanned by p; q; r iff From the previous slide choosing a = n , b = n , c = n ´es I x y z x y z 1 d = −nx px − ny py − nz pz determines the plane on p, with n px py pz 1 perpendicular to it = 0 qx qy qz 1 2 2 2 I Hesse normal-form: a + b + c = 1 rx ry rz 1 Parametric equation of the plane - using three points Parametric equation of the plane - using a point and spanning vectors I Let p; q; r be three affinely independent points. Then all points x belonging to the plane spanned by p; q; r can be expressed in the form I Let p be a point of the plane and u; v two, linearly x(s; t) = p + s(q − p) + t(r − p) independent vectors in the plane where s; t 2 R. x(s; t) = p + su + tv This is a barycentric form, just like in the case of the I I We can get this from the previous one by setting u = q − p, parametric line through two points! v = r − p x(s; t) = (1 − s − t)p + sq + tr since (1 − s − t) + s + t = 1 Homogeneous form Some examples of homogeneous form I The 'plane coordinates' are analogous to the definition of the I [0; 0; 0; c] ideal plane line-coordinates. In the projective space the 4-tupple I [c; 0; 0; 0] the YZ plane s = [s1; s2; s3; s4] defines a plane, all points T I [0; c; 0; 0] the XZ plane x = [x1; x2; x3; x4] belong to it iff I [0; 0; c; 0] the XY plane sx = s1x1 + s2x2 + s3x3 + s4x4 = 0 Parabola Parabola I How can we translate this such that its focus point becomes I The parabola of focus point (0; p) about the Y axis can be (0; p) + c? written I implicitly as x 2 = 4py, I In implicit and explicit formulation one has to work the 2 I explicitly as y = x , t 2 , and coordinates of the translation (cx ; cy ) into the formulation 4p R 2 t2 T (e.g. (x − cx ) = 4p(y − cy ) in implicit) I parametrically as p(t) = [t; 4p ] , t 2 R. I In parametric form it is simply p(t) + c Circle Ellipse 2 2 I Let us consider the circle of origin c 2 E and radius r > 0. I The ellipse of center point c 2 E having the X and Y axes 2 2 2 as its major and minor axes, with major and minor radii a > 0, I Implicit: (x − cx ) + (y − cy ) = r I Explicit: impossible to express the entire circle! However,p a b > 0, respectively, can be written as 2 2 2 semi-circle is doable: c = 0; r = 1, where y = ± 1 − x , (x−cx ) (y−cy ) I Implicit: a2 + b2 = 1 x 2 [−1; 1] Explicit: same deal as with the circle... T I I Parametric: p(t) = r[cos t; sin t] + c, where t 2 [0; 2π) I Parametric: p(t) = [a cos t; b sin t]T + c, where t 2 [0; 2π) Ellipse Line segment 3 I The line connecting the two points a; b 2 E can be written I How about having major and minor axes different from the axes of the coordinate system? parametrically as I Implicit: seems kind of elaborate... (we are going to re-visit this during ray-surface intersections) I Parametric: mere change of basis { let the new major and p(t) = (1 − t)a + tb; minor axes be denoted by k; l. Then wheret 2 R. p(t) = a cos tk + b sin tl + c ; t 2 [0; 2π) I If t 2 [0; 1], then the above gives the line segment connecting a; b. Parametric form Representation I Explicit: z = f (x; y) I Derivatives are merely the vectors composed of the derivatives of the component functions: p(i)(t) = [x(i)(t); y (i)(t)]T , I Implicit: f (x; y; z) = 0 t 2 [:::], i = 0; 1; 2; ::: I Parametric: p(u; v) = [x(u; v); y(u; v); z(u; v)]T , (u; v) 2 [a; b] × [c; d] Surface normal Surface normal I Parametric surfaces: n(u; v) = @up(u; v) × @v p(u; v) I Implicit surfaces: n(x; y; z) = rf , that is, the gradient T rf = [fx ; fy ; fz ] : Sphere Ellipsoid The sphere of center o and radius r > 0 can be written 2 2 2 2 2 2 2 (x−cx ) (y−cy ) (z−cz ) I implicitly as f (x; y; z) = (x − cx ) + (y − cy ) + (z − cz ) = r I Implicit: a2 + b2 + c2 = 1 I parametrically as I Parametric: p(u; v) = [a cos u sin v; b sin u sin v; c cos v]T + c, (u; v) 2 [0; 2π) × [0; π] T p(u; v) = r[cos u sin v; sin u sin v; cos v] + c; Surface normal: 2(x−cx ) 2(y−cy ) 2(z−cz ) T (u; v) 2 [0; 2π) × [0; π] I implicit: rf = [ a2 ; b2 ; c2 ] Surface normal is I parametric: 2 2 T I implicit: rf = 2x + 2y + 2z n = [−bc cos u sin v ; −ac sin u sin v ; −ab cos v sin v] I parametric: n = [cos u sin v; sin u sin v; cos v]T Simple paraboloid Word of caution I Explicit: z = ax2 + by 2 2 2 I Implicit: ax + by − z = 0 I Most mathematical formulae treat axis z as the up direction 2 2 T I Parametric: p(u; v) = [u; v; au + bv ] + c, I This holds for the equations shown previously (u; v) 2 [0; 2π) × [0; π] I However, in computer graphics 'up' is many times axis y - Surface normal: swap the appropriate coordinates! I implicit: rf = [2ax; 2by; 2cz]T I parametric: n = [−2au; −2bv; 1]T.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us