Math geeks and panel graphics unite

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

fum

Well-known member
Joined
Jun 3, 2004
Messages
861
Location
Seattle
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
 
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
 
postscript should be fine, or perhaps a vector graphics format.

Regards

ju
 
[quote author="fum"]postscript should be fine, or perhaps a vector graphics format.[/quote]
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
 
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
 
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
 
I just played around a bit...

This bit of code:

Code:
/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:

Scale.gif


No hard math needed :green:

Best regards,

Mikkel C. Simonsen
 
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
 
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
 
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:
 
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 bitchin scales around my knobs ( now don't be talkin about the scales around my knobs :shock: )

ju
 
okay, here's the first output as jpg ( sorry mcs, already had this part figured)

Nothin fancy, but.....

scale.jpg
 
[quote author="cjenrick"]I have done hours of graphics only to have them mis-scaled by the printer.[/quote]
Which is why PostScript is great - the calculations are done BY the printer, so nothing gets "distorted"...

Best regards,

Mikkel C. Simonsen
 
[quote author="fum"]ya gotta think like a computer for that one. looks stack based. =)[/quote]
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
 
[quote author="mcs"]I would probably make something web-based. Use a form to input values, and then spit out EPS, PDF or PNG files.[/quote]
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
 
[quote author="rafafredd"]Mikkel, you are fast!

Can you implement the numbers?[/quote]
What numbers? Numbers next to the lines? I can try...

Best regards,

Mikkel C. Simonsen
 
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?
 
Back
Top