LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-16-2011, 07:17 AM   #31
zenbo
Member
 
Registered: Dec 2011
Posts: 32

Original Poster
Rep: Reputation: Disabled

Quote:
Originally Posted by Dark_Helmet View Post
To draw a two-point perspective grid of a "floor" you could do this (with the revised script):
Code:
./grid -point 1 4.5 -radials 30 -anglestart 180 -point 10 4.5 -radials 30 -anglestart 180
ok mate, ill try it later, all grids have a horizont line where first and second vanishingpoints are put onto, the third point is above them.if you have time it would be nice if you could explain me the proper usage of the program,

see you later

Last edited by zenbo; 12-16-2011 at 07:26 AM.
 
Old 12-16-2011, 12:43 PM   #32
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Quote:
Originally Posted by zenbo
ok mate, ill try it later, all grids have a horizont line where first and second vanishingpoints are put onto, the third point is above them.if you have time it would be nice if you could explain me the proper usage of the program
When you open your terminal to run the script, the revised script will print a length usage message if you run the script with no arguments (e.g. "./grid"). You'll need to scroll up in the terminal window to read it all.

Here's the high-level view of how the script works--what it's actually doing. Gnuplot is what draws the image. The script simply creates the data files that tell gnuplot what to draw.

Because gnuplot is more-or-less a tool designed to plot functions, the data files contain information in the form of coordinates and offsets. So, that is why the script requires vanishing points be given with coordinates. The script tries to simplify using coordinates by treating gnuplot's center-point/origin at the bottom left of the produced image. That way, the user will always be entering positive coordinates--no worrying about negatives (except for specific reasons). If you use the defaults, you can visualize this by drawing a graph-paper-grid on a sheet of paper (in landscape--i.e. longest dimension horizontal) with the grid lines 1 inch apart. That's the coordinate system.

When you specify a point to the script, you're giving the coordinate for a vanishing point. By default, a vanishing point is illustrated by drawing radial lines extending from the point you specify. If you take all the defaults, a radial will be drawn at 0 degrees (a horizontal line extending to the right) and additional radial lines will be drawn every 5 degrees counter-clockwise for a full rotation (i.e. all the way back to 0 degrees).

In a nutshell, that's it. That's all the script does. It calculates the coordinates needed for gnuplot to draw the radials. It gives you options to control how many radials are drawn, but it's all just a variation on the process above.

For two vanishing points to share a horizontal line: specify two points to the script with both points having the same y-coordinate (e.g. (1, 5) and (10, 5) --or-- (2, 7) and (7, 7))
Example command:
Code:
./grid -point 1 5 -point 10 5
That will draw two vanishing points with each having a radial drawn at 5 degree increments for the full 360 degrees. Both are on a horizontal line because their y-coordinates are the same value (5).

Example command:
Code:
./grid -point 1 5 -anglestart 180 -point 10 5
That will draw two vanishing points like the previous command. The difference is, the first vanishing point will NOT have any radials drawn above its horizon. This is caused by the "-anglestart" option. In this case, the starting angle for drawing radials for the first vanishing point is 180 degrees (which is a horizontal line extending to the left of the paper) and each additional radial will be drawn 5 degrees apart.

You can add as many points as you like:
Code:
./grid -point 1 3 -anglestart 180 -point 10 3 -anglestart 180 -point 5.5 7
Whether that produces the type of grid you want is up to you. You can play with the options. It's probably quicker for you to run an experiment with the script than waiting for me to see a question and respond.

Some "tricks":
To draw a horizontal line, include this as part of the script's options:
Code:
./grid -point 1 4 -radials 1
You interpret that as "draw one radial between 0 degrees and 360 degrees. The result is a radial drawn at 180. So, it draws a horizontal line 4 "inches" up from the bottom of the image.

To have a vanishing point have more radials at certain degrees. Try this:
Code:
./grid -point 4 4 -anglestop 45 -radials 50 -point 4 4 -anglestart 45 -anglestop 135 -radials 50 -point 4 4 -anglestart 135 -anglestop 180 -radials 50
 
Old 12-16-2011, 02:17 PM   #33
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
And, rather than add an edit to the previous post, here's a sample command that creates something sort of like the bottom half of the image from the original web page you linked to.

Code:
./grid -point 5.5 3.5 -radials 40 -anglestart 180 -point 0 3.25 -radials 1 -point 0 3 -radials 1 -point 0 2.5 -radials 1 -point 0 1.5 -radials 1
The first point-radials-anglestart sequence gives the radial lines. The following point-radials sequences define the horizontal lines: one point-radials sequence per horizontal line. The spacing of the horizontal lines is controlled by their respective y-coodinates. So, that command illustrates that you can get as complex or as simple as you like.

Something similar to the top half of the original image could be created by swapping things around. For instance:
Code:
./grid -point 5.5 5.5 -radials 40 -anglestop 180 -point 0 5.75 -radials 1 -point 0 6 -radials 1 -point 0 6.5 -radials 1 -point 0 7.5 -radials 1
You could also combine all those options in one really long command:
Code:
./grid -point 5.5 3.5 -radials 40 -anglestart 180 -point 0 3.25 -radials 1 -point 0 3 -radials 1 -point 0 2.5 -radials 1 -point 0 1.5 -radials 1 -point 5.5 5.5 -radials 40 -anglestop 180 -point 0 5.75 -radials 1 -point 0 6 -radials 1 -point 0 6.5 -radials 1 -point 0 7.5 -radials 1
Lastly, I should point out that gnuplot does support "true" 3D plot drawing. Though, I approached it from a straight 2D framework. Using gnuplot's 3D plotting abilities might give better results, but would require some significant re-working of the script to support. Or creating the necessary files for gnuplot by hand.

Last edited by Dark_Helmet; 12-16-2011 at 02:22 PM.
 
Old 12-16-2011, 04:04 PM   #34
zenbo
Member
 
Registered: Dec 2011
Posts: 32

Original Poster
Rep: Reputation: Disabled
dark helmet

i installed the script, it works fine, im trying all the options you includet, ill get back to you if i have more questions.
most of all i wanna say thank you for your effort, this was really cool of you, im having a buddy helping me, who is better on computers than me.

again thanks alot, ill let you know what i think of it. catch you later.

zenbo
 
Old 12-16-2011, 04:26 PM   #35
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
No problem. I hope it works for you.

Every so often I get a "programming itch." It just so happened that I had one right around the time you posted your original message and it dawned on me that the process could be automated (somewhat) with gnuplot.

So, as crazy as it might sound, I was entertained by the challenge of it. In addition to having entertained me, I hope it's ends up being useful for you
 
Old 12-16-2011, 05:18 PM   #36
zenbo
Member
 
Registered: Dec 2011
Posts: 32

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Dark_Helmet View Post
No problem. I hope it works for you.

Every so often I get a "programming itch." It just so happened that I had one right around the time you posted your original message and it dawned on me that the process could be automated (somewhat) with gnuplot.

So, as crazy as it might sound, I was entertained by the challenge of it. In addition to having entertained me, I hope it's ends up being useful for you
how come you can program so well, is it a job? are programing-languages for linux the same as say mac or windows?
 
Old 12-20-2011, 12:04 AM   #37
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
In all honesty, that script is not much of a programming feat, but I appreciate the compliment

As to your other questions, I've programmed here and there for a long time. Some in grade school, some in my university degree program, some professionally, and some just as a personal hobby. Though, I would not classify myself as a "professional" programmer. The work I did professionally was not the "software development" that most people think of.

And yes, programming languages are computer-independent. A computer language just specifies the "vocabulary and grammar" to use when programming. Any computer can then interpret that code as long as the computer has a compiler--a translator of sorts (keeping with the analogy).

If you ever decide to get into programming, you'll notice that there may be some cosmetic differences, but almost all programming languages support some core "features." Once you're proficient with one language, you probably won't need much time to become "competent" in another language.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
opengl perspective question Valkyrie_of_valhalla Programming 2 12-14-2009 12:13 PM
How window in programm can be resized by another programm. rexStart Programming 1 09-23-2008 03:47 AM
LXer: Perspective is as Perspective Does LXer Syndicated Linux News 0 07-21-2006 09:03 AM
Eclipse has no Java perspective netjack SUSE / openSUSE 1 05-01-2006 10:33 AM
Noobs perspective on install aikidoist72 Debian 2 02-04-2005 11:26 PM


All times are GMT -5. The time now is 09:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration