6
VECTOR-BASED LIBRARY FOR DISPLAYING BEZIER CURVES USING A LASER PROJECTOR MENENDEZ Francisco J., HALABI Osama, CHIBA Norishige Department of Computer Science Graduate School of Engineering Iwate University E-mail: [email protected], [ohalabi | nchiba] @cis.iwate-u.ac.jp ABSTRACT Although laser projectors are widely used in the practical field (e.g.: laser shows performed at music concerts and other various events), it has not yet been studied from the Computer Graphics research point of view. In this paper, we propose a small library to project Bezier curves using double buffering techniques. This is our first try to develop Computer Graphics technology for making use of laser projectors in an efficient way. 1. INTRODUCTION Displaying images using laser projectors is hardly a new topic. It was first introduced in 1969 by Lowell Cross, in collaboration with physicist Carson Jeffries [1]. Ever since then, the use of lasers for displaying images became widespread inside the music entertainment industry as part of laser shows, to enhance the visual appearance of live concert shows or as ambience inside dance clubs. For the most part, lasers have only move in rhythm to the music and recently, with the introduction of computers, it has been also possible to draw simple animations. Nonetheless, this usage is mainly practical. Laser hobbyists and entertainment companies develop their own equipments and software to create their laser shows, but do not attempt to establish a formal research base for laser graphics. In consequence, in this work, we will try to set up the basis for displaying graphics using a computer and a laser projection system, described, as in the section 1.2. Since it is our objective to create the basis for a formal research on laser graphics, we will present a “process library”. This library is in charge of transforming the user input so it can be displayed in a given screen, using a laser projector. It is made from modular nodes, each one with a different responsibility. These nodes share a common interface, allowing the library to add new nodes or change some according to the user’s needs. These nodes can be used to simplify some tasks for the user, while others can solve problems inherent to the laser projector [2][3], such as: Continuity and flickering: The first and more evident problem is to draw one complete drawing using only one beam of light without flickering. As the beam moves, it appears to the human eye that a line is being drawn. After a few moments, the effect starts to disappear, breaks the feeling of continuity and the flicker effect appears. Speed versus intensity: There is an inherent problem with laser projectors in general. The faster the beam moves, the less intense it looks to the eye. Slowing the beam down would make the beam look brighter, but the effect of continuity would fade faster. Shortest path: The mechanical parts of the projector require a minimum time to rotate from one position to the next. Larger rotations would mean longer times, as fast movements could damage the delicate galvanometers. For a given drawing, it is necessary to find the way to perform the least amount of rotations Inertia: As the galvanometers try to quickly switch from one position to the next, an associated problem of inertia comes into play, which produces a curved effect on straight corners. Communication delay and equipped memory usage: Most laser projectors include an in-board memory for pre-loading programs. However, the programming language of these devices is rather limited. Line-by-line control of the projector proves very slow because of communication delays between the projector and the computer. A hybrid solution where chunks of code are sent to the controller’s memory when needed should be implemented. Our first library can take user input such as control points for Bezier curves and, using a double-buffer approach, display them on a screen via a laser projector. 1.1 Previous Work Research on CG for vector-based devices was active until the booming of raster graphics, used mainly for X-Y plotters and Vector based displays [4]. As raster monitors and inkjet printers became more popular and widespread, the research on computer graphics for vector-based devices slowed down. Please note that, as vector-graphics can still be displayed in a raster screen, eventually, they are transformed into pixels. Vector-based devices have their own advantages and shortcomings that deserve their own research. It is one of our aims to retake the computer graphics for vector-based devices research, investigating new ways to 121

Vector-Based Library for Displaying Bezier Curves Using a ...Computer Graphics research point of view. In this paper, we propose a small library to project Bezier curves using double

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Vector-Based Library for Displaying Bezier Curves Using a ...Computer Graphics research point of view. In this paper, we propose a small library to project Bezier curves using double

VECTOR-BASED LIBRARY FOR DISPLAYING BEZIER CURVES

USING A LASER PROJECTOR

MENENDEZ Francisco J., HALABI Osama, CHIBA Norishige

Department of Computer Science Graduate School of Engineering

Iwate University E-mail: [email protected], [ohalabi | nchiba] @cis.iwate-u.ac.jp

ABSTRACT

Although laser projectors are widely used in the practical

field (e.g.: laser shows performed at music concerts and

other various events), it has not yet been studied from the

Computer Graphics research point of view. In this paper,

we propose a small library to project Bezier curves using

double buffering techniques. This is our first try to develop

Computer Graphics technology for making use of laser

projectors in an efficient way.

1. INTRODUCTION

Displaying images using laser projectors is hardly a new

topic. It was first introduced in 1969 by Lowell Cross, in

collaboration with physicist Carson Jeffries [1]. Ever since

then, the use of lasers for displaying images became

widespread inside the music entertainment industry as part

of laser shows, to enhance the visual appearance of live

concert shows or as ambience inside dance clubs. For the

most part, lasers have only move in rhythm to the music

and recently, with the introduction of computers, it has

been also possible to draw simple animations.

Nonetheless, this usage is mainly practical. Laser hobbyists

and entertainment companies develop their own

equipments and software to create their laser shows, but do

not attempt to establish a formal research base for laser

graphics. In consequence, in this work, we will try to set up

the basis for displaying graphics using a computer and a

laser projection system, described, as in the section 1.2.

Since it is our objective to create the basis for a formal

research on laser graphics, we will present a “process

library”. This library is in charge of transforming the user

input so it can be displayed in a given screen, using a laser

projector. It is made from modular nodes, each one with a

different responsibility. These nodes share a common

interface, allowing the library to add new nodes or change

some according to the user’s needs.

These nodes can be used to simplify some tasks for the user,

while others can solve problems inherent to the laser

projector [2][3], such as:

� Continuity and flickering: The first and more

evident problem is to draw one complete drawing using

only one beam of light without flickering. As the beam

moves, it appears to the human eye that a line is being

drawn. After a few moments, the effect starts to disappear,

breaks the feeling of continuity and the flicker effect

appears.

� Speed versus intensity: There is an inherent problem

with laser projectors in general. The faster the beam moves,

the less intense it looks to the eye. Slowing the beam down

would make the beam look brighter, but the effect of

continuity would fade faster.

� Shortest path: The mechanical parts of the projector

require a minimum time to rotate from one position to the

next. Larger rotations would mean longer times, as fast

movements could damage the delicate galvanometers. For

a given drawing, it is necessary to find the way to perform

the least amount of rotations

� Inertia: As the galvanometers try to quickly switch

from one position to the next, an associated problem of

inertia comes into play, which produces a curved effect on

straight corners.

� Communication delay and equipped memory usage:

Most laser projectors include an in-board memory for

pre-loading programs. However, the programming

language of these devices is rather limited. Line-by-line

control of the projector proves very slow because of

communication delays between the projector and the

computer. A hybrid solution where chunks of code are sent

to the controller’s memory when needed should be

implemented.

Our first library can take user input such as control points

for Bezier curves and, using a double-buffer approach,

display them on a screen via a laser projector.

1.1 Previous Work

Research on CG for vector-based devices was active until

the booming of raster graphics, used mainly for X-Y

plotters and Vector based displays [4]. As raster monitors

and inkjet printers became more popular and widespread,

the research on computer graphics for vector-based devices

slowed down. Please note that, as vector-graphics can still

be displayed in a raster screen, eventually, they are

transformed into pixels. Vector-based devices have their

own advantages and shortcomings that deserve their own

research.

It is one of our aims to retake the computer graphics for

vector-based devices research, investigating new ways to

121

Page 2: Vector-Based Library for Displaying Bezier Curves Using a ...Computer Graphics research point of view. In this paper, we propose a small library to project Bezier curves using double

implement algorithms (such as non-photorealistic

rendering) for vector-based hardware and, in particular,

laser displays. To achieve this, we need to create a solid

library for handling laser projectors and their related

problems. In this paper we set up the first steps towards

achieving this library.

Formally, there is little or none previous research done on

laser graphics. However, there has been a good amount of

work done for the industry, and music and laser hobbyists.

In the industry, lasers have been used for marking products

in a production line [5]. A printing laser is used to mark

things such as lot and serial numbers, as well as

manufacturing and expire dates. In the music field, lasers

have been used for a while as part of laser shows in dance

clubs [6]. Yet these shows usually employ very simple,

static animations (they do not change once they started and

repeat endlessly) or the lasers simply move to match the

rhythm of the music playing.

There is also an association that gathers various hobbyists,

laser display manufacturers and users called ILDA [7]

(International Laser Display Association), which main goal

is to be a trade group. Though it has shown some efforts

into moving towards a standard file format and hardware

specifications, these standards have a commercial goal only,

as they benefit the exchange of products and services.

2. EXPERIMENTAL LASER PROJECTOR

Most basic laser projectors (figure 1) consist of at least the

following parts: (a) A main controller unit, which

communicates with the PC, holds an amount of RAM for

storing programs and is responsible for processing the PC

commands into signals the servo controllers can execute. (b)

A laser beam of a given color and intensity. (c) Power units

to feed the projector. (d) Two servo controllers that convert

the digital signals from the main controller into analog

currents for the galvanometers. (e) Two galvanometers and

their respective mirrors, one for each axis.

Figure 1: Laser projection system. (a) Main controller. (b)

Laser. (c) Power source (d). Servo controllers. (e)

Galvanometers and mirrors

The operation of the projector is achieved by sending

instructions into the controller. These instructions are sent

to the corresponding servo controllers that rotate the X and

Y mirrors by changing the current on the galvanometers.

The laser beam stays static and it is the reflection on these

two fast moving mirrors that creates the illusion of lines

and shapes on the projection screen.

The projector used in our experiments was built using the

following components [8][9]:

Scan Controller: GSI Lumonics SC2000

Servo Controllers: GSI Lumonics MiniSAX (2 units)

Galvanometers: GSI Lumonics VM-500

Laser: Coherent MVP Control Diode Laser Module.

Wavelength: 670nm±10nm (Red). Power: 0.95mW

3. PROCESS LIBRARY

To create our Laser Graphics library, we split the problem

of displaying primitives into smaller parts. The sum of

these parts is what we call the “process library” and it is

shown in figure 2

3.1 Design Overview The library subdivides the problem into “nodes”, each

having a task to solve. It allows the user or programmer to

directly input polygon coordinates to create the shape they

need or use one of the added features to easily enter text or

draw Bezier curves. Upon finishing its process, each node

passes the result onto the next. This is possible because all

nodes share a minimal common interface, allowing them to

communicate with each other. Moreover, each node also

has a set of special functions to handle the particular

settings of a given node (for example, assigning a font to

the text processing node)

Normally the library only handles coordinates. The extra

features extend the library’s abilities, allowing the user to

enter more complex elements, such as text. These extra

features eventually transform the input data into

coordinates for the rest of the library to process.

The coordinates are then clipped and normalized before

they are sent to the hardware. There are three modes of

operation that will discuss in detail further ahead.

3.2 Adding features

As we previously mentioned, the library works only with

x-y coordinates. The next two features allow the user to

enter both text and Bezier curves, besides polygon

coordinates.

3.2.1 Bezier Curves

Bezier curves are an extremely useful tool to display

graphics [10]. The implemented node allows the

programmer to choose between a quadratic or cubic curve,

as well as the number of segments that will be used to

create the curve. Then it takes three points (or four, in the

case of cubic curves) and by applying the Bezier curve

equations, it obtains a set of segments that are sent as a

group of coordinates onto the next library node.

(c)

(d)

(a) (b)

(e)

122

Page 3: Vector-Based Library for Displaying Bezier Curves Using a ...Computer Graphics research point of view. In this paper, we propose a small library to project Bezier curves using double

Hardware Controller

Controller SRAM

Programmer / User Input

Polygoon

CoordinatesText Control Points

Extra Features

Font and Text

ProcessingBezier Curves

Coordinate Processing

Clipping

Normalizing

Hardware Communication

Double Buffer

Mode

Program

ModeDirect

Mode

X-Y Mirror Movement Commands

Figure 2: Process library

3.2.2 Displaying Text

Another vital feature is the ability to display text using

different fonts. For this task, we make use the FreeType

project [11], a freely available library for reading font files,

distributed under the GPL software license. This library

allows us to read any TrueType font, obtain the curve

information for a given glyph and, with help of the Bezier

curves node previously explained, we can transform a

given string into a set of coordinates ready to be processed

by the library

3.3 Clipping

Either as result of the Bezier curve or text processing nodes,

or by direct input of the user, the clipping node takes x-y

coordinates as input and clips them to the given boundary

values. This is especially helpful to ensure that the

coordinates do not exceed the displaying capabilities of the

projector. It also useful to create certain effects, like a

scrolling message, that appears from one border and

disappears on the other end.

The implemented clipping method is roughly based on the

Sutherland-Hodgman's polygon-clipping algorithm [12].

For each side of the clipping rectangle, there are four

possible cases.

a. The beam moves inside the bounding area. No

clipping happens and the coordinates are sent to the

next node

b. The beam moves from inside-out the bounding area.

The beam is clipped to the border and then the laser is

turned off. Clipped coordinates are sent to the next

node.

c. The beam moves outside the bounding area. The

coordinates are clipped completely and not sent to the

next node. The laser remains off.

d. The beam moves from outside-in the bounding area.

The beam is clipped from the border to the intended

coordinate. Laser is turned on at border. Clipped

coordinates are sent to the next node.

3.4 Normalizing

Most controllers for laser projectors have the ability to

control not only the coordinates of the laser beam

movement, but also the time in which this movement

happens. While this might be desirable to create some

effects, for most purposes it becomes a problem. This is

because, if left unchecked, different lines will have

different intensity. For example, given two lines of

different length drawn in the same interval, the shorter line

will look brighter than the longer one. This will happen

because the mirrors will have to speed up to draw the

longer line, resulting in weaker beam intensity.

The normalizing node is in charge of resolving this for the

user, by calculating the correct delay between movements,

according to the length of the lines to be drawn. In this way,

all the lines in the drawing appear to have the same

brightness. This calculation is shown in the following

equation

Segment LengthSegment Delay

Total Frame Length × FPS=

where “Segment Delay” is the delay in time units for a

given segment, and “Segment Length” its length in

distance units. “Total Frame Length” is the sum of the

lengths of all the segments for this frame, and “FPS” is the

desired speed in frames per second.

3.5 Sending to the projector

Once the coordinates have been clipped and normalized,

we need to send them to the projector to be displayed on a

screen. Most projectors can either accept direct commands,

or instead, group a number of commands into its embedded

memory and execute them in sequence as a program. Each

mode has its advantages and limitations, as we will show.

We will also introduce a hybrid method that combines the

strength of both modes. We called this method the

double-buffer mode.

3.5.1 Direct Mode

Direct mode is possibly the simplest way to interact with

the projector. In this mode, each instruction is sent after the

123

Page 4: Vector-Based Library for Displaying Bezier Curves Using a ...Computer Graphics research point of view. In this paper, we propose a small library to project Bezier curves using double

other, commanding the controller to move and to turn the

laser on or off as needed. One of the main advantages is

that we do not have to deal with in-board memory space.

Instructions are executed on demand, providing a fast

response and real-time interaction. However, the great flaw

of this method is synchronization. Each ‘move’ instruction

takes a few microseconds to execute. Sending another

instruction while the projector is busy, might result in the

running instruction getting overwritten with the new one,

or the new instruction simply gets ignored, producing

undesirable effects. In figure 3 we can see what happens

when we try to draw five corners of a star using this

method. New coordinates overwrite the ones being

executed, creating jumps to undesired positions.

Figure 3: Instructions overlapping

To avoid this overlapping of instructions, the computer

must wait for the first instruction to end, before sending the

next instruction. There is no way to assert whether the

projector has finished or not, since querying the controller

would require an overwriting instruction. The only

approach is estimating the duration of the command and

hold the next one until that lapse expires.

Since there is no accurate way to synchronize the computer

timer to match the exact period of time required by the

laser controller to execute an instruction, small fluctuations

will appear, creating small yet noticeable delays between

two instructions.

Despite of this setback, direct mode works great for testing

programs or drawings during the developing process. And

it is much easier to debug, since only move and laser on/off

instructions are being sent.

3.5.2 Program Mode

Opposite to the direct mode, the program mode sends a

group of instructions to the controller’s memory to be

executed in sequence, instead of being sent one at the time.

Similarly, the flaws of one mode become the strengths of

the other. In program mode we no longer need to worry

about synchronization, as the controller takes care to finish

one instruction before pulling the next from its memory.

However we lose the interactivity. Once the instructions

are stored in the controller’s RAM, there is no way to

modify the program. It will repeat continuously until

execution is broken with a specific command.

While this is becomes a clear disadvantage for interactive

applications, it still can be used to load text, designs and

animations that don’t require any changes after they have

been loaded.

3.5.3 Double Buffer Mode

Upon noticing the flaws and benefits from the previous

modes, we designed a hybrid approach that we called

‘double-buffer mode’. In this mode we combine the

flexibility of the direct mode and the ability to synchronize

of the memory mode.

In double-buffer mode, we create two empty programs in

memory, and by using a third main program, we tell the

controller to switch execution between these two empty

programs and repeat until told otherwise.

As instructions start to arrive, we send them to the first

program until a ‘swap buffers’ function of our library node

is called. When this happens, we save our changes to the

first program, overwriting the empty one and immediately

start writing the second program and repeat the process.

The laser controller then begins to displays the contents of

this first buffer. When a new call to ‘swap buffers’ happens,

we save the changes to our second program and start

overwriting the first. This repeats itself continuously until

the user commands the library to stop execution.

Figure 4: Correct image drawn using double buffers

As a result of this process, we can achieve real time

interactivity, just as in direct mode. If we need to refresh

the contents of the drawings, a call to ‘swap buffers’ will

place the new buffer on display. And at the same time,

synchronization between instructions is handled

automatically by the laser controller, like in program mode.

Also, as the buffers overwrite themselves as new data input,

there are no memory limitations. This is a very good

feature, since these devices usually count with limited

memory resources (usually between 256 KB and 2 MB).

The buffers that have already been displayed are erased

from memory, permitting more data into the controller and

allowing the user to make drawings and animations as big

as necessary.

Using the implemented double buffer method, we can now

draw the five-corner star without any problems, as shown

124

Page 5: Vector-Based Library for Displaying Bezier Curves Using a ...Computer Graphics research point of view. In this paper, we propose a small library to project Bezier curves using double

in figure 4.

4. RESULTS

We were able to display objects of different complexity by

using our proposed library. Simple objects made from a

few dozen coordinates seem to display quite nicely. But, as

the number of coordinates increase, so does the number of

movements the mirrors must do to create one drawing,

increasing the time needed to display it. Eventually the

retention ability of the human retina begins to fade with

time and the images seem to flicker for these highly

complex drawings. For a given projection speed, this can

be easily solved by replacing the laser beam with a brighter

one, extending the time the image stays in the retina.

None-the-less, we can show the effectiveness of our library

approach in the following pictures.

Figure 5 shows four different Bezier curves with using

different sets of control points. Twenty-five segments were

used to display each curve.

Figure 6 is an example of our text and font processing

feature. The text “Laser Graphics” was used as input and

we used three different types of fonts to display it. With the

help of the Bezier curves node, we could even achieve very

round shaped fonts, like the example in the middle of the

figure.

Figure 5: Drawing Bezier curves

In the experiment shown in figure 6, for the three types of

fonts, the number of segments the Bezier curve sections of

the font is always 3. The resulting number of vertices is

shown in table 1 (same order as in figure 6).

The shape of the font is a defining factor in the resulting

number of vertices required to draw the text. Straight-line

based fonts usually require much less vertices, as they do

not have curves that need to be broken down in smaller

parts.

This can be seen with both the ‘Algerian’ and

‘Haettenschweiler’ fonts, which are mostly made up of

straight segments. The final number of vertices is actually

less than the number of control points because of the

number of straight segments. In the case of the ‘Brush

Script’ font, which is mostly a curvy font, the final number

of vertices is higher than the number of control points, due

to the larger amount of curved segments.

Font name

Co

ntro

l

po

ints

Straig

ht

segm

ents

Cu

rve

segm

ents

Fin

al

vertices

Algerian

(alger.ttf) 1260 856 84 1108

Brush Script

(brushsci.ttf) 681 263 219 920

Haettenschweiler

(hatten.ttf) 310 222 12 258

Table 1: Font – vertex comparison

Finally, figure 7 shows a clipping example. Applying a

clipping rectangle to the same text shown in the bottom of

figure 6, we managed to remove the rest of the text. Even

sections of the letters have been clipped when necessary.

By using clipping and scrolling the message from right to

left, we managed to create a small scrolling banner.

5. CONCLUSIONS AND FUTURE WORK

In this work we have managed to give the first steps

towards establishing a new library for displaying computer

graphics using a laser projector. Basic yet fundamental

operations such as clipping, drawing Bezier curves and

displaying text were implemented and successfully

achieved. The modularity of our proposed library allows

the addition of new nodes, extending its functionality. It

also allows easily replacing of communication modules in

the eventual case of using it with new laser projection

hardware.

We also stated the benefits of our double-buffer approach,

as it lets the user obtain real-time interactivity and smooth

animations without delays, making best use of the

projector’s memory.

As for the future work, there is a lot of areas that this

research can be further extended. Things as calculating the

shortest path needed to draw a figure, improving the speed

the mirrors rotate will be taken into account. We also

contemplate the possibility of enhancing raster projection

using lasers (for instance, superposing a message or

enhancing the borders of a figure). Problems such as

auto-calibration will have to be taken into account for this

task.

ACKNOWLEDGEMENTS

We would like to thank Mr. Norihiro Nasukawa for his

valuable technical support by building and maintaining the

laser projection hardware.

REFERENCES

[1] Lowel Cross Homepage: http://www.lowellcross.com/

[2] MENENDEZ Francisco, ABDERYIM Purkhat,

125

Page 6: Vector-Based Library for Displaying Bezier Curves Using a ...Computer Graphics research point of view. In this paper, we propose a small library to project Bezier curves using double

NASUKAWA Norihiro, HALABI Osama,

CHIBA Norishige. 2A-16 Research Towards Laser

Graphics and Related Problems. Tohoku-Section Joint

Convention of Institutes of Electrical and Information

Engineers 2006.

[3] NASUKAWA Norihiro, ABDERYIM Purkhat,

MENENDEZ Francisco, HALABI Osama, CHIBA

Norishige, 1E-04, Development of Experimental Laser

Projector, Tohoku-Section Joint Convention of Institutes of

Electrical and Information Engineers 2006, (in Japanese)

[4] FOLEY J.D., VAN DAM A. Fundamentals of

Interactive Computer Graphics. Addison-Wesley (1982).

ISBN: 0201144689

[5] Laser Engraving article on Wikipedia:

http://en.wikipedia.org/wiki/Laser_engraving

[6] Laser Shows article on Wikipedia:

http://en.wikipedia.org/wiki/Laser_show

[7] International Laser Display Association (ILDA):

http://www.ilda.wa.org/

[8] GSI Lumonics. Optical Scanners and Controllers:

http://www.gsig.com/

[9] Coherent Lasers: http://www.coherent.com/

[10] PRAUTZSCH Hartmut, BOEHM Wolfgang,

PALUSZNY Marco. Bezier and B-Spline Techniques

Springer (2002). ISBN: 3540437614

[11] The FreeType Project: http://www.freetype.org/

[12] SUTHERLAND Ivan, HODGMAN Gary. Reentrant

polygon clipping. Communications of the ACM, Volume

17, Issue 1 (1974)

Figure 6: Displaying text

Figure 7: Scrolling text with clipping applied

126