ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalCOMP31452d Geometric Objects
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    COMP3145

    HCI & Computer Graphics

    Progress0 / 73 done
    Topics73
    1Input-output channels2Human memory3Thinking, Reasoning, Problem solving4Emotions and Individual differences5Psychology and design of interacting systems
    6Text entry devices7Positioning, Pointing, and drawing devices8Display devices9Devices for virtual reality and 3D interaction10Physical controls, Sensors and special devices11Paper printing and scanning12Memory, Processing and networks
    13Models of interaction14Frameworks and HCI15Ergonomics16Interaction styles17Elements of the WIMP interfaces18Interactivity and Context of interaction
    19Introduction20Paradigms for interaction
    21What is design22Process of design and User focus23Navigation design24Screen design and layout25Iteration and prototyping
    26Software life cycle27Usability engineering28Iterative design and prototyping29Design rationale30Design rules and Guidelines31Golden rules and heuristics32HCI patterns33Evaluation techniques and methods34Task analysis35Universal design36User support systems37Computer Supported Cooperative Work38Groupware systems39Implementation of synchronous groupware40Ubiquitous computing41History of Computer Graphics42Graphics architectures and software
    43Pinhole camera, Human vision, Synthetic camera44Modeling vs. rendering45OpenGL Architecture46Displaying simple two-dimensional geometric objects47Positioning systems and windowed environment48Color perception and models49RGB, CMY, HLS color models50Color transformations
    51RGB and indexed color
    52Network environment and client-server computing
    53event, sample and request input54Using callbacks and picking
    55translation, rotation, scaling, shear56Homogeneous coordinates and concatenation57Current transformation and matrix stacks
    58Classical viewing59Specifying views in 3D60Affine transformation in 3D61Projective transformations62Ray tracing
    63Illumination and surface modeling64Phong shading model65Polygon shading
    66Line drawing via Bresenham's algorithm67Clipping and polygonal fill68BitBlt operations69Hidden surface removal (z buffer)
    70Buffers71Reading and writing bitmaps and pixel maps72Texture mapping73Compositing
    5 min read
    Topic 46 of 73
    Topic Study Note Illustration
    46

    Displaying simple two-dimensional geometric objects

    Definition: Displaying 2D geometric objects involves drawing basic shapes such as points, lines, circles, and polygons on a 2D plane using computer graphics systems. These are fundamental...

    1. Introduction

    Definition: Displaying 2D geometric objects involves drawing basic shapes such as points, lines, circles, and polygons on a 2D plane using computer graphics systems. These are fundamental building blocks for graphics applications like CAD, UI design, plotting, and games.

    Key Concept: 2D graphics rely on a coordinate system, typically the Cartesian (x,y)(x, y)(x,y) plane, to position and render shapes.


    2. Coordinate Systems in 2D Graphics

    1. World Coordinates:

      • Defines positions relative to a logical scene
      • Independent of the screen or device resolution
    2. Device Coordinates:

      • Maps world coordinates to actual screen pixels
      • Conversion from world → device coordinates is necessary for rendering
    3. Viewport:

      • Specifies the rectangular portion of the window where objects are drawn

    3. Basic 2D Geometric Primitives

    A. Point

    • Definition: The simplest object in 2D graphics, defined by a single coordinate (x,y)(x, y)(x,y).
    • Usage: Plotting data, vertices of polygons, or markers.

    B. Line

    • Definition: A straight connection between two points (x1,y1)(x_1, y_1)(x1​,y1​) and (x2,y2)(x_2, y_2)(x2​,y2​).

    • Drawing Algorithms:

      1. DDA (Digital Differential Analyzer): Incremental algorithm using floating-point arithmetic.
      2. Bresenham’s Line Algorithm: Efficient integer-based algorithm for raster devices.

    C. Circle

    • Definition: Set of points equidistant from a center (xc,yc)(x_c, y_c)(xc​,yc​) with radius rrr.

    • Equation: (x−xc)2+(y−yc)2=r2(x - x_c)^2 + (y - y_c)^2 = r^2(x−xc​)2+(y−yc​)2=r2

    • Drawing Algorithms:

      • Midpoint Circle Algorithm
      • Bresenham’s Circle Algorithm

    D. Ellipse

    • Definition: Set of points where the sum of distances from two foci is constant.
    • Equation: (x−xc)2a2+(y−yc)2b2=1\frac{(x - x_c)^2}{a^2} + \frac{(y - y_c)^2}{b^2} = 1a2(x−xc​)2​+b2(y−yc​)2​=1
    • Drawing Algorithm: Midpoint Ellipse Algorithm

    E. Polygon

    • Definition: Closed shape made of lines connecting a sequence of points.

    • Types: Triangles, rectangles, pentagons, etc.

    • Filling Algorithms:

      • Scanline fill algorithm
      • Flood-fill algorithm

    4. Transformations of 2D Objects

    To manipulate 2D shapes, several transformations are applied:

    1. Translation: Move object by (dx,dy)(dx, dy)(dx,dy)
    x′=x+dx,y′=y+dy x' = x + dx, \quad y' = y + dyx′=x+dx,y′=y+dy
    1. Scaling: Resize object relative to origin or a reference point
    x′=Sx⋅x,y′=Sy⋅y x' = S_x \cdot x, \quad y' = S_y \cdot yx′=Sx​⋅x,y′=Sy​⋅y
    1. Rotation: Rotate object around the origin by angle θ\thetaθ
    x′=xcos⁡θ−ysin⁡θ,y′=xsin⁡θ+ycos⁡θ x' = x \cos\theta - y \sin\theta, \quad y' = x \sin\theta + y \cos\thetax′=xcosθ−ysinθ,y′=xsinθ+ycosθ
    1. Reflection: Mirror object along x-axis, y-axis, or a line

    2. Shearing: Skew object along x or y-axis


    5. Rendering 2D Objects

    Steps to Display:

    1. Convert world coordinates to device coordinates.
    2. Apply transformation matrices if needed.
    3. Use a rasterization algorithm to generate pixels.
    4. Store pixels in the framebuffer and display on the screen.

    Example in OpenGL (Pseudocode):

    // Draw a triangle
    glBegin(GL_TRIANGLES);
       glVertex2f(0.0, 0.0);
       glVertex2f(0.5, 0.0);
       glVertex2f(0.25, 0.5);
    glEnd();
    glFlush();
    

    6. Applications

    • User Interface Elements: Buttons, sliders, icons
    • Computer-Aided Design (CAD): Basic drafting and modeling
    • Graph Plotting: Charts, graphs, and scientific visualization
    • Games: Sprites, backgrounds, and simple 2D animations

    Key Takeaways

    • 2D geometric objects are the building blocks of computer graphics.
    • Efficient algorithms are used for drawing primitives like lines, circles, and polygons.
    • Transformations allow manipulation of objects for animation, design, and interaction.
    • Mastering 2D graphics is essential before moving to 3D graphics and rendering pipelines.
    ← Previous topic 45
    OpenGL Architecture
    Next topic 47 →
    Positioning systems and windowed environment

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    5mremaining
    780words
    Beginnerlevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    HCI & Computer Graphics