0% found this document useful (0 votes)
27 views

Computer Graphics(clipping and window viewport mapping)

The document discusses clipping and windowing in computer graphics, explaining the process of removing undesired parts of an image and the various types of clipping techniques such as point, line, and polygon clipping. It also covers window-to-viewport transformation, mathematical calculations for mapping coordinates, and different methods for text clipping. Additionally, it outlines graphics software standards, including GKS and PHIGS, and emphasizes the importance of simplicity, consistency, and performance in graphics software design.

Uploaded by

soyangsiddha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Computer Graphics(clipping and window viewport mapping)

The document discusses clipping and windowing in computer graphics, explaining the process of removing undesired parts of an image and the various types of clipping techniques such as point, line, and polygon clipping. It also covers window-to-viewport transformation, mathematical calculations for mapping coordinates, and different methods for text clipping. Additionally, it outlines graphics software standards, including GKS and PHIGS, and emphasizes the importance of simplicity, consistency, and performance in graphics software design.

Uploaded by

soyangsiddha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

UNIT-2

Clipping and Windowing:


Clipping is the process of removing undesired parts of an image and displaying only a
certain portion of the image. Clipping is used to remove lines or objects that are not inside
the viewing pane. The portion that is being removed or clipped is called the clipped part.
In computer graphics, clipping can be applied to various graphics primitives such as lines,
polygons, points, and curves.

Applications of clipping:
1. It will extract part we desire.
2. For identifying the visible and invisible area in the 3D object.
3. For creating objects using solid modeling.
4. For drawing operations.
5. Operations related to the pointing of an object.
6. For deleting, copying, moving part of an object.
Types of Clipping:
1. Point Clipping
2. Line Clipping
3. Area Clipping (Polygon)
4. Curve Clipping
5. Text Clipping
6. Exterior Clipping
Point Clipping is used to determining, whether the point is inside the window or not. For this
following conditions are checked.
1. x ≤ xmax
2. x ≥ xmin
3. y ≤ ymax
4. y ≥ ymin

The (x, y) is coordinate of the point. If anyone from the above inequalities is false, then the
point will fall outside the window and will not be considered to be visible
Line Clipping:
It is performed by using the line clipping algorithm. The line clipping algorithms are:
1. Cohen Sutherland Line Clipping Algorithm.
2. Midpoint Subdivision Line Clipping Algorithm
Cohen Sutherland Line Clipping Algorithm:
In the algorithm, first of all, it is detected whether line lies inside the screen or it is outside
the screen. All lines come under any one of the following categories:
1. Visible
2. Not Visible
3. Clipping Case
1. Visible: If a line lies within the window, i.e., both endpoints of the line lies within the
window. A line is visible and will be displayed as it is.
2. Not Visible: If a line lies outside the window it will be invisible and rejected. Such lines will
not display. If any one of the following inequalities is satisfied, then the line is considered
invisible. Let A (x1,y2) and B (x2,y2) are endpoints of line.
xmin,xmax are coordinates of the window.
ymin,ymax are also coordinates of the window.
x1>xmax
x2>xmax
y1>ymax
y2>ymax
x1<xmin
x2<xmin
y1<ymin
y2<ymin
3. Clipping Case: If the line is neither visible case nor invisible case. It is considered to be
clipped case. First of all, the category of a line is found based on nine regions given below. All
nine regions are assigned codes. Each code is of 4 bits. If both endpoints of the line have end
bits zero, then the line is considered to be visible.

The center area is having the code, 0000, i.e., region 5 is considered a rectangle window.
Now let’s understand what is Windowing. Before that, we must know the concept of
Windows and Viewports.
A world-coordinate system selected for display is called a Window and the area on the
device coordinate to which a Window is mapped is called a Viewport.
The mapping of a part of the World-coordinate system to a device coordinate is called
viewing transformation or Window-to-viewport transformation or simply, windowing
transformation.
Algorithm
Step 1 − Assign a region code for each endpoints.
Step 2 − If both endpoints have a region code 0000 then accept this line.
Step 3 − Else, perform the logical AND operation for both region codes.
Step 3.1 − If the result is not 0000, then reject the line.
Step 3.2 − Else you need clipping.
Step 3.2.1 − Choose an endpoint of the line that is outside the window.
Step 3.2.2 − Find the intersection point at the window boundary (base on region code).
Step 3.2.3 − Replace endpoint with the intersection point and update the region code.
Step 3.2.4 − Repeat step 2 until we find a clipped line either trivially accepted or trivially
rejected.
Step 4 − Repeat step 1 for other lines.
Polygon Clipping (Sutherland Hodgman Algorithm):
A polygon can also be clipped by specifying the clipping window. Sutherland Hodgeman
polygon clipping algorithm is used for polygon clipping. In this algorithm, all the vertices of
the polygon are clipped against each edge of the clipping window.
First the polygon is clipped against the left edge of the polygon window to get new vertices
of the polygon. These new vertices are used to clip the polygon against right edge, top edge,
bottom edge, of the clipping window as shown in the following figure.

While processing an edge of a polygon with clipping window, an intersection point is found if
edge is not completely inside clipping window and the a partial edge from the intersection
point to the outside edge is clipped. The following figures show left, right, top and bottom
edge clippings −
There are four possible cases for any given edge of given polygon against current clipping
edge e.
1. Both vertices are inside : Only the second vertex is added to the output list
2. First vertex is outside while second one is inside : Both the point of intersection of
the edge with the clip boundary and the second vertex are added to the output list
3. First vertex is inside while second one is outside : Only the point of intersection of
the edge with the clip boundary is added to the output list
4. Both vertices are outside : No vertices are added to the output list.
Window to Viewport Transformation :
Window to Viewport Transformation is the process of transforming 2D world-coordinate
objects to device coordinates. Objects inside the world or clipping window are mapped to
the viewport which is the area on the screen where world coordinates are mapped to be
displayed.
General Terms:
• World coordinate – It is the Cartesian coordinate w.r.t which we define the diagram,
like Xwmin, Xwmax, Ywmin, Ywmax
• Device Coordinate –It is the screen coordinate where the objects are to be displayed,
like Xvmin, Xvmax, Yvmin, Yvmax
• Window –It is the area on the world coordinate selected for display.
• ViewPort –It is the area on the device coordinate where graphics is to be displayed.
Mathematical Calculation of Window to Viewport:
It may be possible that the size of the Viewport is much smaller or greater than the Window.
In these cases, we have to increase or decrease the size of the Window according to the
Viewport and for this, we need some mathematical calculations.
(xw, yw): A point on Window
(xv, yv): Corresponding point on Viewport
We have to calculate the point (xv, yv)
Now the relative position of the object in Window and Viewport are same.
For x coordinate,

For y coordinate,

So, after calculating for x and y coordinate, we get

Where sx is the scaling factor of x coordinate and sy is the scaling factor of y coordinate

Example: Let us assume,


• for window, Xwmin = 20, Xwmax = 80, Ywmin = 40, Ywmax = 80.
• for viewport, Xvmin = 30, Xvmax = 60, Yvmin = 40, Yvmax = 60.
• Now a point ( Xw, Yw ) be ( 30, 80 ) on the window. We have to calculate that point on
the viewport
i.e ( Xv, Yv ).
• First of all, calculate the scaling factor of x coordinate Sx and the scaling factor of y
coordinate Sy using the above-mentioned formula.
Sx = ( 60 - 30 ) / ( 80 - 20 ) = 30 / 60
Sy = ( 60 - 40 ) / ( 80 - 40 ) = 20 / 40
• So, now calculate the point on the viewport ( Xv, Yv ).
Xv = 30 + ( 30 - 20 ) * ( 30 / 60 ) = 35
Yv = 40 + ( 80 - 40 ) * ( 20 / 40 ) = 60
• So, the point on window ( Xw, Yw ) = ( 30, 80 ) will be ( Xv, Yv ) = ( 35, 60 ) on viewport.

Matrix Representation of the above steps of


Transformation:
• Step1:Translate window to origin 1
Tx=-Xwmin Ty=-Ywmin
• Step2:Scaling of the window to match its size to the viewport
Sx=(Xymax-Xvmin)/(Xwmax-Xwmin)
Sy=(Yvmax-Yvmin)/(Ywmax-Ywmin)
• Step3:Again translate viewport to its correct position on screen.
Tx=Xvmin
Ty=Yvmin
• Above three steps can be represented in matrix form:
VT=T * S * T1
• T = Translate window to the origin
• S=Scaling of the window to viewport size

• T1=Translating viewport on screen.


• Viewing Transformation= T * S * T1

Text Clipping
Various techniques are used to provide text clipping in a computer graphics. It depends on
the methods used to generate characters and the requirements of a particular application.
There are three methods for text clipping which are listed below −
• All or none string clipping
• All or none character clipping
• Text clipping
The following figure shows all or none string clipping −
In all or none string clipping method, either we keep the entire string or we reject entire
string based on the clipping window. As shown in the above figure, STRING2 is entirely inside
the clipping window so we keep it and STRING1 being only partially inside the window, we
reject.
The following figure shows all or none character clipping −

This clipping method is based on characters rather than entire string. In this method if the
string is entirely inside the clipping window, then we keep it. If it is partially outside the
window, then −
• You reject only the portion of the string being outside
• If the character is on the boundary of the clipping window, then we discard that
entire character and keep the rest string.
The following figure shows text clipping −
This clipping method is based on characters rather than the entire string. In this method if
the string is entirely inside the clipping window, then we keep it. If it is partially outside the
window, then
• You reject only the portion of string being outside.
• If the character is on the boundary of the clipping window, then we discard only that
portion of character that is outside of the clipping window.
Graphics Software Standards in Computer Graphics
Graphics software standards help to create and set a standard for the development of
computer graphics, as there are mainly two categories or general classes of computer
graphics:
General programming packages and Special-purpose applications packages.
Each of these classes has its software standard, so understanding these standards is
important to get an overview of how standards are defined in computer graphics. by
understanding the classes for computer graphics it becomes easier to understand the
standards for them, lets look at two of the graphics packages in computer graphics.
Graphics Packages
Computer graphics are divided into two package classes and each of these two packages
contains one graphics software standard which is used in the computer graphics to create
working software for the graphics in computers:
General Graphics Programming Package
A general graphics programming package helps in providing a set of functions for the
graphics that are used in high-level programming languages such as C or FORTRAN etc. real-
life example of a general graphics programming package can be the GL which stands for the
graphics library system, it's used in the silicon graphics.
Some of the basic functions for a general package can include the following criteria:
• generating picture components (such as polygons, circles, lines, and other figures)
• setting color values.
• setting intensity values.
• selecting views and managing transformations etc.
Application graphics packages
Application graphics packages are those packages that are designed for non-programmers to
use, it'sthat are aredesigned so that the users can easily generate and display the graphics
without having to worry about the operations and calculations of the graphics.
Interface in these types of graphics allows the users to easily communicate with the
programs by having their own set of terms.
Some examples of the application packages are the painting programs used by various
artists such as AutoCAD etc. along with some other business and medical art softwares.
Graphics Standards in Computer Graphics
The primary goal for the graphics software's standard is portability so whenever a package is
designed with some standards for the computer graphics, then the software can be moved
from hardware system one to hardware system two in an easy way and also be implemented
more easily.
Without the standards for the programs, it becomes a complex and even impossible task to
transfer the programs which are designed for a particular hardware to be moved to another
system hardware. to solve this issue two standards were developed in computer graphics:
• GKS
• PHIGS
Understanding each of these graphics standards is important to know how the graphics
standards work for computer graphics.
GKS (Graphical Kernel System)
Graphical Kernel System is recognized as one of the first graphics software standards by the
ISO (International Standards Organization) which is the most important organization that
manages the top-level two-dimensional two-dimensional three-dimensional standards
related to computer study. the GKS standard was also recognized by the ANSI or American
National Standards Institute later.
Graphical Kernel System was originally designed as a graphics package for the two-
dimensional three-dimensional view but another extension of the GKS was later developed
that supports the three dimensional view as well.
Graphical kernel system has a 2-dimensional view which is related to the six of the output
functions used, they are as follows:
GKS (Graphical Kernel System)

PHIGS (Programmer's Hierarchical Interactive Graphics Standard)


PHIGS is the second standard developed in, computer graphics for the development of
computer systems and software, it is known as an advancement to the previous standard
because it supports more increased capabilities for the modeling of objects, better picture
manipulation and other color specification guides.PHIGS (Programmer's Hierarchical
Interactive Graphics Standard)
Just like the GKS, PHIGS also comes with its extension which is named PHIGS+ which was
developed to provide the 3-dimensional surface shading capabilities which was not available
in the PHIGS.
Ground rules for graphics software design:

• Simplicity:The graphics software should be easy to use.


• Consistency:The package should operate in a consistent and predictable way to the
user.
• Completenes:There should be no inconvenient omissions in the set of graphics
functions.
• Robustness:The graphics system should be tolerant of minor instances of misuse by
the operator.
• Performance:Within limitations imposed by the system hardware, the performance
should be exploited as much as possible by software. Graphics programs should be
efficient and speed of response should be fast and consistent.
• Economy: Graphics programs should not be so large or expensive as to make their
use prohibitive.
Graphic Primitives
Graphic primitives are the foundational elements of any graphical representation.
a. Points
• Represented as (x, y) in 2D or (x, y, z) in 3D space.
• Point Clouds: Used in 3D modeling and LiDAR data representation.
b. Lines
• Line Drawing Algorithms:
o Bresenham’s Algorithm: For rasterized lines with high efficiency.
o Midpoint Algorithm: Another efficient rasterization approach.
• Line Attributes: Include thickness, color, and style (e.g., solid, dashed).
c. Curves
• Mathematical Representations:
o Bézier Curves: Defined by control points for smooth transitions.
o Splines (e.g., B-splines, NURBS): Used for designing complex, smooth curves.
• Applications: Path animation, font design, and CAD software.
d. Polygons
• Defined by a series of vertices and edges.
• Rendering Techniques:
o Scanline Fill Algorithm: For efficient rendering of filled polygons.
o Tessellation: Breaking polygons into simpler triangles for rendering.
e. Text
• Font Rendering: Bitmap-based or vector-based text representation.
• Styling: Includes bold, italic, underlined text, and kerning adjustments.
f. Colors and Shading
• Color Models: RGB, CMYK, HSL, and HSV for varied applications.
• Shading Models:
o Flat Shading: Applies a uniform color to each face.
o Gouraud Shading: Interpolates vertex colors across surfaces.
o Phong Shading: Calculates pixel-specific lighting for realism.
Windowing Functions
a. Viewport Management
• Defines a rectangular area for rendering on the screen.
• Viewport Transformation: Maps normalized device coordinates to screen
coordinates.
b. Clipping
• Line Clipping Algorithms:
o Cohen-Sutherland Algorithm: Simple region-based clipping.
o Liang-Barsky Algorithm: More efficient for line clipping.
• Polygon Clipping:
o Sutherland-Hodgman Algorithm: Common for convex polygons.
c. Resizing and Panning
• Dynamically adjust the rendering area or move the viewpoint over a scene.
d. Zooming
• Implemented through scaling transformations, often with smooth transitions.
e. Event Handling
• Detect and process user inputs like:
o Mouse clicks, drags, or scrolls.
o Keyboard shortcuts or key presses.
o Touch gestures or multi-touch inputs.

Miscellaneous Functions
a. Transformations
• Translation: Moving objects along x, y, or z axes.
• Scaling: Resizing objects proportionally or non-proportionally.
• Rotation: Rotating objects about a fixed axis.
• Shearing: Skewing shapes along one or more axes.
b. Pattern Filling
• Apply predefined or custom patterns, textures, or gradients to surfaces.
c. Lighting and Shading
• Lighting Types:
o Ambient Light: Evenly distributed light in the scene.
o Point Light: Emitted from a specific location.
o Directional Light: Uniform light from a direction.
• Shadow Mapping: Simulates realistic shadows for 3D objects.
d. Exporting
• Save outputs in formats like:
o Raster Formats: PNG, BMP, TIFF.
o Vector Formats: SVG, PDF, EPS.

6. Display Code Generator


a. Coordinate Mapping
• Converts application coordinates to device-specific coordinates (e.g., screen
resolution adjustments).
b. Rasterization
• Converts geometric data (points, lines, polygons) into pixel data:
o Anti-Aliasing: Reduces visual artifacts for smoother images.
o Alpha Blending: Combines pixel colors with transparency.
c. Optimization Techniques
• Backface Culling: Avoid rendering faces of objects not visible to the camera.
• Level of Detail (LOD): Simplifies distant objects to save resources.
• Occlusion Culling: Skip rendering objects hidden behind others.
d. Device Independence
• Ensures compatibility with various display types:
o Monitors, VR headsets, or projectors.
Input Devices
The Input Devices are the hardware that is used to transfer transfers input to the computer.
The data can be in the form of text, graphics, sound, and text. Output device display data
from the memory of the computer. Output can be text, numeric data, line, polygon, and
other objects.
These Devices include:
1. Keyboard
2. Mouse
3. Trackball
4. Spaceball
5. Joystick
6. Light Pen
7. Digitizer
8. Touch Panels
9. Voice Recognition
10. Image Scanner
Keyboard:
The most commonly used input device is a keyboard. The data is entered by pressing the set
of keys. All keys are labeled. A keyboard with 101 keys is called a QWERTY keyboard.
The keyboard has alphabetic as well as numeric keys. Some special keys are also available.
1. Numeric Keys: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
2. Alphabetic keys: a to z (lower case), A to Z (upper case)
3. Special Control keys: Ctrl, Shift, Alt
4. Special Symbol Keys: ; , " ? @ ~ ? :
5. Cursor Control Keys: ↑ → ← ↓
6. Function Keys: F1 F2 F3....F9.
7. Numeric Keyboard: It is on the right-hand side of the keyboard and used for fast
entry of numeric data.
Function of Keyboard:
1. Alphanumeric Keyboards are used in CAD. (Computer Aided Drafting)
2. Keyboards are available with special features line screen co-ordinates entry, Menu
selection or graphics functions, etc.
3. Special purpose keyboards are available having buttons, dials, and switches. Dials are
used to enter scalar values. Dials also enter real numbers. Buttons and switches are
used to enter predefined function values.
Advantage:
1. Suitable for entering numeric data.
2. Function keys are a fast and effective method of using commands, with fewer errors.
Disadvantage:
1. Keyboard is not suitable for graphics input.
Mouse:
A Mouse is a pointing device and used to position the pointer on the screen. It is a small
palm size box. There are two or three depression switches on the top. The movement of the
mouse along the x-axis helps in the horizontal movement of the cursor and the movement
along the y-axis helps in the vertical movement of the cursor on the screen. The mouse
cannot be used to enter text. Therefore, they are used in conjunction with a keyboard.

Advantage:
1. Easy to use
2. Not very expensive
Trackball
It is a pointing device. It is similar to a mouse. This is mainly used in notebook or laptop
computer, instead of a mouse. This is a ball which is half inserted, and by changing fingers on
the ball, the pointer can be moved.

Advantage:
1. Trackball is stationary, so it does not require much space to use it.
2. Compact Size

Spaceball:
It is similar to trackball, but it can move in six directions where trackball can move in two
directions only. The movement is recorded by the strain gauge. Strain gauge is applied with
pressure. It can be pushed and pulled in various directions. The ball has a diameter around
7.5 cm. The ball is mounted in the base using rollers. One-third of the ball is an inside box,
the rest is outside.
Applications:
1. It is used for three-dimensional positioning of the object.
2. It is used to select various functions in the field of virtual reality.
3. It is applicable in CAD applications.
4. Animation is also done using spaceball.
5. It is used in the area of simulation and modeling.
Joystick:
A Joystick is also a pointing device which is used to change cursor position on a monitor
screen. Joystick is a stick having a spherical ball as its both lower and upper ends as shown in
fig. The lower spherical ball moves in a socket. The joystick can be changed in all four
directions. The function of a joystick is similar to that of the mouse. It is mainly used in
Computer Aided Designing (CAD) and playing computer games.

Light Pen
Light Pen (similar to the pen) is a pointing device which is used to select a displayed menu
item or draw pictures on the monitor screen. It consists of a photocell and an optical system
placed in a small tube. When its tip is moved over the monitor screen, and pen button is
pressed, its photocell sensing element detects the screen location and sends the
corresponding signals to the CPU.

Uses:
1. Light Pens can be used as input coordinate positions by providing necessary
arrangements.
2. If background color or intensity, a light pen can be used as a locator.
3. It is used as a standard pick device with many graphics system.
4. It can be used as stroke input devices.
5. It can be used as valuators

Digitizers:
The digitizer is an operator input device, which contains a large, smooth board (the
appearance is similar to the mechanical drawing board) & an electronic tracking device,
which can be changed over the surface to follow existing lines. The electronic tracking device
contains a switch for the user to record the desire x & y coordinate positions. The
coordinates can be entered into the computer memory or stored or an off-line storage
medium such as magnetic tape.

Advantages:
1. Drawing can easily be changed.
2. It provides the capability of interactive graphics.
Disadvantages:
1. Costly
2. Suitable only for applications which required high-resolution graphics.
Touch Panels:
Touch Panels is a type of display screen that has a touch-sensitive transparent panel covering
the screen. A touch screen registers input when a finger or other object comes in contact
with the screen.
When the wave signals are interrupted by some contact with the screen, that located is
recorded. Touch screens have long been used in military applications.

Voice Systems (Voice Recognition):


Voice Recognition is one of the newest, most complex input techniques used to interact with
the computer. The user inputs data by speaking into a microphone. The simplest form of
voice recognition is a one-word command spoken by one person. Each command is isolated
with pauses between the words.
Voice Recognition is used in some graphics workstations as input devices to accept voice
commands. The voice-system input can be used to initiate graphics operations or to enter
data. These systems operate by matching an input against a predefined dictionary of words
and phrases.
Advantage:
1. More efficient device.
2. Easy to use
3. Unauthorized speakers can be identified
Disadvantages:
1. Very limited vocabulary
2. Voice of different operators can't be distinguished.

Image Scanner
It is an input device. The data or text is written on paper. The paper is feeded to scanner. The
paper written information is converted into electronic format; this format is stored in the
computer. The input documents can contain text, handwritten material, picture extra.
By storing the document in a computer document became safe for longer period of time.
The document will be permanently stored for the future. We can change the document
when we need. The document can be printed when needed.
Scanning can be of the black and white or colored picture. On stored picture 2D or 3D
rotations, scaling and other operations can be applied.
Types of image Scanner:
1. Flat Bed Scanner: It resembles a photocopy machine. It has a glass top on its top. Glass
top in further covered using a lid. The document to be scanned is kept on glass plate. The
light is passed underneath side of glass plate. The light is moved left to right. The scanning is
done the line by line. The process is repeated until the complete line is scanned. Within 20-
25 seconds a document of 4" * 6" can be scanned.

2. Hand Held Scanner: It has a number of LED's (Light Emitting Diodes) the LED's are
arranged in the small case. It is called a Hand held Scanner because it can be kept in hand
which performs scanning. For scanning the scanner is moved over document from the top
towards the bottom. Its light is on, while we move it on document. It is dragged very slowly
over document. If dragging of the scanner over the document is not proper, the conversion
will not correct.

Pointing and Positioning Techniques


Pointing technique refers to look at the items already on the screen whereas the positioning
technique refers to position the item on the screen to a new position, i.e., the old current
position. The user indicates a position on the screen with an input device, and this position is
used to insert a symbol.
There are various pointing and positioning devices which are discussed below:
1. Light Pen
2. Mouse
3. Tablet
4. Joystick
5. Trackball and spaceball
1. Light Pen: It is a pointing device. When light pen is pointed at an item on the screen, it
generates information from which the item can be identified by the program. It does not
have any associated tracking hardware instead tracking is performed by software, making
use of the output function of the display. All light pen programs depend on a rapid response
from the pen when it is pointed at the screen fast response light pens can be build by using a
highly sensitive photocell such as a photomultiplier tube.
2. Mouse: It is a positioning device which consists of a small plastic box resting on two metal
wheels whose axes are at right angles. Each wheel of the mouse is linked to a shaft encoder
that delivers an electrical pulse for every incremental rotation of the wheel. As the mouse is
rolled around on a flat surface, its movement in two orthogonal directions is translated into
rotation of the wheels. These rotations can be measured by counting the pulses received
from the shaft encoders. The connected values may be held in registers accessible to the
computer on written directly into the computer memory. It is simple and low cost, and there
is no need to pick it up to use it. The mouse sits on the table surface. But the mouse cannot
be used for tracing data from paper since a small rotation of the mouse will cause an error in
all the reading and it is complicated handprint character for recognition by the computer.

3. Tablet: It is also a positioning device and is used to describe a flat surface separate from
the display, on which the user draws with a stylus. There are two types of tablets:
1. Acoustic Tablet: It depends on the use of strip microphones which are mounted
along two adjacent edges of the tablet. The styles have a small piece of ceramic
mounted close to its tip, and at regular intervals, a small spark is generated across
the surface of the ceramic between two electrodes. The microphones pick up the
pulse of sound produced by the spark and two counters record the delay between
creating the spark and receiving the sound. These two delays are proportional to the
stylus distance from the two edges of the tablet where the microphones are
mounted.
2. Electro-acoustic Tablet: In this technique, the writing surface is a sheet of
magnetostrictive material acting as a row of delay lines. An electric pulse travels
through the sheet first horizontally and then vertically and is detected by a sensor in
the stylus. A counter is used to determine the delay from the time the pulse is issued
to the time it is detected; from this value, the position of the stylus can be
determined. The electro-acoustic tablet is quieter in operation than its acoustic
counterpart and is less affected by noise or air movement.
4. Joystick: A joystick consists of a small that is used to steer the screen cursor around. The
distance that the stick is moved in any direction from its center position corresponds to the
screen-cursor movement in that direction. Pressure sensitive joysticks have a non-moveable
stick. Pressure on the stick is measured with strain gauges and converted to the movement
of the cursor in the direction specified.
5. Trackball and spaceball: Trackball is a ball that can be rotated with the fingers to produces
screen-cursor movement potentiometers, attached to the ball, measure the amount and
direction of rotation. Trackballs are after mounted on keyboards, whereas space-ball
provides six degrees of freedom. Spaceballs is used for three-dimensional positioning and
selection operation in virtual reality system, modeling, animation, CAD and other
applications.
Elastic or Rubber Band Techniques
Rubber banding is a popular technique of drawing geometric primitives such as line,
polylines, rectangle, circle and ellipse on the computer screen.
It becomes an integral part and de facto standard with the graphical user interface (GUI) for
drawing and is almost universally accepted by all windows based applications.
The user specifies the line in the usual way by positioning its two endpoints. As we move
from the first endpoint to the second, the program displays a line from the first endpoint to
the cursor position, thus he can see the lie of the line before he finishes positioning it.
The effect is of an elastic line stretched between the first endpoint and the cursor; hence the
name for these techniques.
Consider the different linear structures in fig (a) and fig (d), depending on the position of the
cross-hair cursor. The user may move the cursor to generate more possibilities and select the
one which suits him for a specific application.

Selection of Terminal Point of the Line:


The user moves the cursor to the appropriate position and selects.
Then, as the cursor is moved, the line changes taking the latest positions of the cursors as
the end-point.
As long as the button is held down, the state of the rubber band is active.
The process is explained with the state transition diagram of rubber banding in fig:

When the user is happy with the final position, the pressed button is released, and the line is
drawn between the start and the last position of the cursor.

Example: This is widely followed in MS-Window based Applications like in the case of a
paintbrush drawing package.
Other geometric entities can be drawn in a rubber-band fashion:
- Horizontally or vertically constructed lines
- Rectangles
- Arcs of circles
This technique is very helpful in drawing relatively complex entities such as rectangles and
arcs.

Advantage:
1. It is used for drawing all geometric entities such as line, polygon, circle, rectangle,
ellipse, and other curves.
2. It is easy to understand and implement.
Disadvantage:
1. It requires computational resources like software and CPU speed.
2. Expensive

Dragging
Dragging is used to move an object from one position to another position on the computer
screen. To drag any other object, first, we have to select the object that we want to move on
the screen by holding the mouse button down. As cursor moved on the screen, the object is
also moved with the cursor position. When the cursor reached the desired position, the
button is released.

You might also like