<< Chapter < Page
  Digital signal processing - dsp     Page 12 / 24
Chapter >> Page >

A 3D parabolic surface

The array of surface elevation data is populated by the code in Listing 2 .

Listing 2. A 3D parabolic surface,
for(int row = 0;row<numberRows;row++){ for(int col = 0;col<numberCols;col++){ int xSquare = col * col;int ySquare = row * row; data[row][col] = xSquare + ySquare;}//end col loop }//end row loop

I will allow you to evaluate this code on your own. It creates a 3D surface with the lowest elevation at the upper left corner and the highest elevation atthe lower right corner. The surface is a one-quarter section of a 3D parabola, as shown in Figure 3 .

Display six surface images

Listing 3 shows the code that causes the 3D surface elevation data to be displayed as six independent images (each statement in Listing 3 produces one output image) .

IMPORTANT: this is the same code that would be used by other programs to incorporate this 3D surface plottingcapability into those programs.
Listing 3. Display six surface images.
new ImgMod29(data,blockSize,true,0); new ImgMod29(data,blockSize,false,1);new ImgMod29(data,blockSize,true,2); new ImgMod29(data,blockSize,true,3);new ImgMod29(data,blockSize,false,4); new ImgMod29(data,blockSize,true,5);

Just instantiate an object

All that is necessary for another program to incorporate this class to display a 3D surface is to instantiate an object of the class named ImgMod29 passing four parameters to the constructor.

The parameters

The first parameter is a reference to the 2D array of type double containing the surface elevation values.

The second parameter is the blockSize . This int value specifies the size of one side of a square of pixels, (all of the same color) that will be used to represent each surface elevation value in the final display. As mentioned earlier, this value was set to 2 in the sampledisplays produced by the main method. However, it could have been any reasonable value such as 5, 10, or 15 for example.

The third parameter is true if you want the red axes to be drawn and is false otherwise (as shown in Figure 3 ) .

The fourth parameter is an integer value between 0 and 5 inclusive, which specifies the plotting format as follows:

  • 0 - Grayscale (linear)
  • 1 - Color Shift (linear)
  • 2 - Color Contour (linear)
  • 3 - Grayscale with logarithmic data conversion before plotting
  • 4 - Color Shift with logarithmic data conversion before plotting
  • 5 - Color Contour with logarithmic data conversion before plotting

Instantiate six separate objects

Listing 3 instantiates six such objects to display the same 3D surface, one for each plotting format as shown in Figure 3 . Some of the objects display the axes and others do not. All use a blockSize value of 2.

Each display object appears in the upper-left corner of the screen. Thus, when two or more such objects are instantiated, they appear as a stack. It isnecessary to physically move those on top of the stack to see those further down.

Listing 3 signals the end of the main method.

The ImgMod29 class

Listing 4 shows the beginning of the class named ImgMod29 and the beginning of the constructor for the class.

Questions & Answers

summarize halerambos & holbon
David Reply
the Three stages of Auguste Comte
Clementina Reply
what are agents of socialization
Antonio Reply
sociology of education
Nuhu Reply
definition of sociology of education
Nuhu
what is culture
Abdulrahim Reply
shared beliefs, values, and practices
AI-Robot
What are the two type of scientific method
ogunniran Reply
I'm willing to join you
Aceng Reply
what are the scientific method of sociology
Man
what is socialization
ogunniran Reply
the process wherein people come to understand societal norms and expectations, to accept society's beliefs, and to be aware of societal values
AI-Robot
scientific method in doing research
ogunniran
defimition of sickness in afica
Anita
Cosmology
ogunniran
Hmmm
ogunniran
list and explain the terms that found in society
REMMY Reply
list and explain the terms that found in society
Mukhtar
what are the agents of socialization
Antonio
Family Peer group Institution
Abdulwajud
I mean the definition
Antonio
ways of perceived deviance indifferent society
Naomi Reply
reasons of joining groups
SAM
to bring development to the nation at large
Hyellafiya
entails of consultative and consensus building from others
Gadama
World first Sociologist?
Abu
What is evolutionary model
Muhammad Reply
Evolution models refer to mathematical and computational representations of the processes involved in biological evolution. These models aim to simulate and understand how species change over time through mechanisms such as natural selection, genetic drift, and mutation. Evolutionary models can be u
faruk
what are the modern trends in religious behaviours
Selekeye Reply
what are social norms
Daniel Reply
shared standards of acceptable behavior by the group or appropriate behavior in a particular institution or those behaviors that are acceptable in a society
Lucius
that is how i understood it
Lucius
examples of societal norms
Diamond
Discuss the characteristics of the research located within positivist and the interpretivist paradigm
Tariro Reply
what is Industrialisation
Selekeye Reply
industrialization
Angelo
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Digital signal processing - dsp. OpenStax CNX. Jan 06, 2016 Download for free at https://legacy.cnx.org/content/col11642/1.38
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Digital signal processing - dsp' conversation and receive update notifications?

Ask