1 / 15

A project for Prof. George Wolberg’s Computer Graphics class Spring 2008

Geometry for Page Flipping. A project for Prof. George Wolberg’s Computer Graphics class Spring 2008. A. B. C. D. F. E. RightCorner. case (triangle). A = Mouse point (x,y) dx = AB dy = BD = a+b b = AC=CD a = BC. A. B. C. D. F. E. Point C. dx 2 +a 2 = b 2 a = dy - b

theriaultd
Download Presentation

A project for Prof. George Wolberg’s Computer Graphics class Spring 2008

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Geometry for Page Flipping A project for Prof. George Wolberg’s Computer Graphics class Spring 2008

  2. A B C D F E RightCorner. case (triangle) A = Mouse point (x,y) dx = AB dy = BD = a+b b = AC=CD a = BC

  3. A B C D F E Point C • dx2 +a2 = b2 • a = dy - b • Apply 2 to 1 • dx2 + (dy – b)2 = b2 • dx2 + (dy2– 2bdy + b2) = b2 • dx2 + dy2 = 2bdy • 4. b = (dx2 + dy2)/2dy ∴ Point C : x = width y = mouse point + a

  4. A B C D F E Point F • tan∠CAB = tan ∠FAE • a/dx = ?(FE)/dy • ?(FE) = a/dx * dy ∴ Point F : x = mouse point - ?(FE) y = height

  5. Check list K • AG ≤ width • AJ < width • to avoid stretching. • F > G • to avoid tearing • C > K • to check lifted part • is triangle or quadrilateral A J C D G F

  6. RightCorner. case (quadrilateral 1) C Point D A = Mouse point (x,y) dx = AB a = BC d = sqrt(dx2+a2) = AC D F H • cos∠DAE = cos ∠CAB • ? (AE)/h = dx/d • ?(AE) = dx/d * h • sin∠DAE = sin ∠CAB • ?(DE)/h = a/d • ? (DE) = a/d * h G A B E ∴ Point D : x = mouse point + AE y = mouse point + DE

  7. C Point H ∠DFG = ∠CAB ∠DFG = ∠HDG D F H • tan∠CAB = tan ∠HDG • ?(GH)/DG = a/dx • ?(GH) = a/dx * DG G A B E ∴ Point H : x = point D + ?(GH) y = top edge

  8. Check list • AL ≤ width • AK < width • to avoid stretching. • J > K • to avoid tearing A L K J

  9. H F D B G J E A RightCorner. case (quadrilateral 2) A = Mouse point (x,y) dx = GJ = a+b b = AE=EJ a = GE dy = AG

  10. H F D B G J E A Point E • dy2 +a2 = b2 • a = dx - b • Apply 2 to 1 • dy2 + (dx – b)2 = b2 • dy2 + (dx2– 2bdx + b2) = b2 • dy2 + dx2 = 2bdx • 4. b = (dy2 + dx2)/2dx ∴ Point E : x = mouse point + a y = height

  11. H F D B G K E J A Point D • cos∠EAG = cos ∠AKG • cos ∠ADF • ? (DF)/h = dy/b • ?(DF) = dy/b * h • sin∠EAG = sin ∠ADF • ?(AF)/h = a/b • ? (AF) = a/b * h ∴ Point D : x = mouse point + DF y = mouse point + AF

  12. C H M D B Point H dx = DB = a+b b = DH=HM a = CH dy = CD • dy2 +a2 = b2 • a = dx - b • Apply 2 to 1 • dy2 + (dx – b)2 = b2 • dy2 + (dx2– 2bdx + b2) = b2 • dy2 + dx2 = 2bdx • 4. b = (dy2 + dx2)/2dx ∴ Point H : x = point D + a y = top edge

  13. Check list L H D • DL ≤ width • AN < width • G < J • to avoid stretching. • H > L • to avoid tearing G N J A

  14. Texture Mapping A(0,0) B(1,0) 1.Draw page outline glTexCoord2f(D) glTexCoord2f(A) glTexCoord2f(B) glTexCoord2f(C) glTexCoord2f(E) 2.Draw lifted page glTexCoord2f(F) glTexCoord2f(C) glTexCoord2f(E’) F(0.1) C(0.BC/H) E’(FE/W,1) D(0,1) E(DE/W,1)

  15. B(AB/W,0) E(0,0) C(DF/W,1) F(0,1) A(0,0) 1.Draw main quadrilateral glTexCoord2f(D) glTexCoord2f(A) glTexCoord2f(B) glTexCoord2f(C) 2.Draw lifted page glTexCoord2f(F) glTexCoord2f(E) glTexCoord2f(B’) glTexCoord2f(C’) B’(EB/W,0) C’(FC/W,1) D(0,1)

More Related