fum

Math geeks and panel graphics unite
« on: October 01, 2004, 08:34:35 PM »
Hey there.  I'm workin on a decent way to print out scales ( other than buying a full scale graphics app like Corel Draw)

I've got the shell of an application created that will save stuff out to a jpg file.

I need help with the formulas to calculate the positions in an x y coordinate system for the scale values, for a given radius, based on degree.  If you can give me a rough formula, I can take it from there

For example:
Given radius of 30 , if you wanted a scale in 30 degree increments, I need to calculate x y coordinates where to place the graphic objects, given that the center of the scale will be 0,0.

Once I get this part going, I'll add on the other features to make it cool, and put it up for people to download.

Any help out there?  I'm googling at present, but thought I'd ask =)

Regards

ju


mcs

Math geeks and panel graphics unite
« Reply #1 on: October 01, 2004, 08:42:34 PM »
Don't save to jpeg - that's my advice. jpeg is not a format for graphics - it's for photos.

Saving stuff in PostScript is VERY easy - you can even calculate the scales etc. in the PS code. PostScript can be imported in a lot of drawing apps, you can open it in Photoshop and you can convert is to PDF format without loosing any quality.

I can help you with PostScript programming (I could also help with jpeg stuff, but I don't like that idea :wink:).

Best regards,

Mikkel C. Simonsen

fum

Math geeks and panel graphics unite
« Reply #2 on: October 01, 2004, 09:03:48 PM »
postscript should be fine, or perhaps a vector graphics format.

Regards

ju

mcs

Math geeks and panel graphics unite
« Reply #3 on: October 01, 2004, 09:17:45 PM »
Quote from: "fum"
postscript should be fine, or perhaps a vector graphics format.

PostScript is a vector graphics format - as well as a programming language :cool:

But do explain your idea a bit more detailed - what do you want to do?

I would probably make something web-based. Use a form to input values, and then spit out EPS, PDF or PNG files.

Best regards,

Mikkel C. Simonsen

fum

Math geeks and panel graphics unite
« Reply #4 on: October 01, 2004, 09:23:01 PM »
the idea is to write a java application(will work on any platform this way) with screen divided into two panels.  One to vary the parameters of the scale, and a display on the other side to show you realtime what your getting.  Variable radius, degrees, editable scale values, etc.

Once you've got your scale the way you like, save it to the file format of choice, from there you can import it to your application of choice.

One good option would be HPGL, for those who use Front panel express.  

I've been using Photoshop, so any format it supports gets me there.

ju

CJ

Math geeks and panel graphics unite
« Reply #5 on: October 01, 2004, 09:29:54 PM »
Darn I used to be able to convert Polar to x,y in my sleep.
 :sad:
I'm thinkin  tangent and unit circle.
wrong again!

 X= R*cos(Theta)
Y= R*sin(Theta)

r is radius
If I can't fix it, I can fix it so nobody else can!
Frank's Tube Page: www.mif.pg.gda.pl/homepages/frank/vs.html
Guitar Amps: http://bmamps.com/Tech_sch.html

mcs

Math geeks and panel graphics unite
« Reply #6 on: October 01, 2004, 10:19:24 PM »
I just played around a bit...

This bit of code:

Code: [Select]
/Xpos 100 def
/Ypos 100 def
/outrad 40 def
/inrad 25 def
/steps 9 def
/stepsize 300 steps div def
/deg 300 stepsize 2 div sub def

/Tegn
{
/deg deg stepsize add def
Xpos Ypos moveto
Xpos Ypos outrad deg deg arc
stroke
} def

steps {Tegn} repeat

1 setgray Xpos Ypos inrad 0 360 arc fill

showpage


Produces this scale:



No hard math needed :green:

Best regards,

Mikkel C. Simonsen

fum

Math geeks and panel graphics unite
« Reply #7 on: October 01, 2004, 10:50:42 PM »
ya gotta think like a computer for that one.   looks stack based. =)

we'll see what I come up with once I get the chillins sleepin

=)

ju

fum

Math geeks and panel graphics unite
« Reply #8 on: October 02, 2004, 01:29:12 AM »
Okay,

I've got something, it's gonna take me a few days to make it cool, but I've got the rough drawing mechanism worked out to so that I can print the scales on the screen.

After spending a couple hours or so working on this, I've decided that using PostScript is  cheating, as it really was designed to do this kinda thing  :grin: Good developers cheat  :thumb:

I'm ending up using radians in some of my calculations, and I honestly didn't know what a radian was when I started.

Stay tuned

ju

rafafredd

Math geeks and panel graphics unite
« Reply #9 on: October 02, 2004, 01:33:31 AM »
I think it´s a great idea to make this tool. It´s definetly needed...


CJ

Math geeks and panel graphics unite
« Reply #10 on: October 02, 2004, 01:39:05 AM »
Compare your printed results with what you are after.
I have done hours of graphics only to have them mis-scaled by the printer.
That way you catch it before commiting your expesive Lazzertran or whatever medium you use.
 :evil:
If I can't fix it, I can fix it so nobody else can!
Frank's Tube Page: www.mif.pg.gda.pl/homepages/frank/vs.html
Guitar Amps: http://bmamps.com/Tech_sch.html

fum

Math geeks and panel graphics unite
« Reply #11 on: October 02, 2004, 02:03:03 AM »
I hear ya.  I always print tests to paper, and hold it up to the light with the panel behind to make sure it looks spiffy.  :grin:

I'm doing panels for a pair of SSL clones at present, and I've got the words all lined up, but I want *****in scales around my knobs ( now don't be talkin about the scales around my knobs  :shock: )

ju

fum

Math geeks and panel graphics unite
« Reply #12 on: October 02, 2004, 02:12:49 AM »
okay, here's the first output as jpg ( sorry mcs, already had this part figured)

Nothin fancy, but.....


mcs

Math geeks and panel graphics unite
« Reply #13 on: October 02, 2004, 08:31:13 AM »
Quote from: "cjenrick"
I have done hours of graphics only to have them mis-scaled by the printer.

Which is why PostScript is great - the calculations are done BY the printer, so nothing gets "distorted"...

Best regards,

Mikkel C. Simonsen

mcs

Math geeks and panel graphics unite
« Reply #14 on: October 02, 2004, 08:38:38 AM »
Quote from: "fum"
ya gotta think like a computer for that one.   looks stack based. =)

Yes, PostScript is a great mind-exercise language :wink:

How does your code work? Do you calculate the start and end coordinates for the lines? If so writing that in PS or HPGL format shouldn't be too difficult. But adding text would be much easier in PS than in HPGL...

Best regards,

Mikkel C. Simonsen

mcs

Math geeks and panel graphics unite
« Reply #15 on: October 02, 2004, 12:01:12 PM »
Quote from: "mcs"
I would probably make something web-based. Use a form to input values, and then spit out EPS, PDF or PNG files.

I had to see how difficult it would be do make a CGI version. It wasn't difficult at all - it took half an hour... Here it is: http://stiftsbogtrykkeriet.dk/~mcs/Scale.html

EPS version only though...

Best regards,

Mikkel C. Simonsen

daArry

Math geeks and panel graphics unite
« Reply #16 on: October 02, 2004, 01:00:56 PM »
nice1 :thumb:

rafafredd

Math geeks and panel graphics unite
« Reply #17 on: October 02, 2004, 01:12:48 PM »
Mikkel, you are fast!

Can you implement the numbers?

mcs

Math geeks and panel graphics unite
« Reply #18 on: October 02, 2004, 01:14:32 PM »
Quote from: "rafafredd"
Mikkel, you are fast!

Can you implement the numbers?

What numbers? Numbers next to the lines? I can try...

Best regards,

Mikkel C. Simonsen

rafafredd

Math geeks and panel graphics unite
« Reply #19 on: October 02, 2004, 01:21:57 PM »
yeah, like a DB scale...

You know, something like starting number and steps, so we get a dB scale.

Lets say -20 starting and 5db steps, in a 12 position scale would output:

-20, -15, -10, -5, 0, 5, 10, 15, 20, 25, 30, 35 dB

Got that?


 

Related Topics

  Subject / Started by Replies Last post
14 Replies
4089 Views
Last post April 04, 2008, 06:01:36 PM
by okgb
11 Replies
3004 Views
Last post October 31, 2009, 07:49:33 AM
by dmlandrum
4 Replies
2528 Views
Last post January 21, 2011, 10:26:28 AM
by SimonB
7 Replies
3451 Views
Last post September 26, 2011, 05:30:22 AM
by Kingston