RE: Drawing an Arc at an angle.

2004-01-08 Thread Dan Muey
 On Thu, 08 Jan 2004 09:44:31 -0500, [EMAIL PROTECTED] (Zentara)
 wrote:
 
 On Wed, 7 Jan 2004 10:53:20 -0600, [EMAIL PROTECTED] (Dan Muey)
 wrote:
 
 Thanks! Even more to add to my look into list!
 
 Yeah upon futher thought, you probably could use the Tk::Canvas and 
 actually plot your curve point-by-point from the equation of an 
 ellipse, rather than using the Oval function. Then export the 
 postscript.
 
 Run the widget demo, there are 2 examples for plot, one of them 
 exports ps.
 
 I'm not trying to hijack your thread, but the idea of 

No sweat! I can use all the ideas I can get. I think this is a pretty good one you 
have.

 rotated ellipse sort of appeals to me. So here is a simple 
 postscript file to make a rotated ellipse. Just save as a .ps 
 file and look at it with ghostview. Now all you have to do, 
 is play with it to see how to align it up, to your needs, 
 then in your perl script, use a here doc to write it out to a 
 file. Then use Image Magick or Imager to convert it to .jpg 
 or whatever. 
 I got this from this page: 
 http://www.redgrittybrick.org/postscript/ellip se.html
 
 
 
 %!PS-Adobe
 %%Pages: 1
 %%BoundingBox: 60 420 490 
 740
 %
 % canonical ellipse routine
 % credit: Holger Gehringer
 %
 
 /inch { 72 mul } def
 /ellipse {
 /endangle exch def
 /startangle exch def
 /yrad exch def
 /xrad exch def
 /y exch def
 /x exch def
 /savematrix matrix currentmatrix def
 x y translate
 xrad yrad scale
 0 0 1 startangle endangle arc
 savematrix setmatrix
 } def
 %%Page: One 1
 
 1 0 0 setrgbcolor
 4 inch 8 inch translate
 30 rotate 
 0 0 2.8 inch 1.4 inch 0 360 ellipse
 16 setlinewidth
 stroke
 
 showpage  
 %%EOF
 
 
 
 
 --
 When life conspires against you, and no longer floats your 
 boat, Don't waste your time with crying, just get on your 
 back and float.
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED] 
http://learn.perl.org/ http://learn.perl.org/first-response



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: Drawing an Arc at an angle.

2004-01-07 Thread Dan Muey
 On Tue, 6 Jan 2004 11:03:14 -0600, [EMAIL PROTECTED] (Dan Muey)
 wrote:
 
  Dan Muey wrote:
  
   I've made a funtion to calculate the Fresnal zone for wireless
   connections.
  
   What I'd like to do is generate an image based on that.
  Something like
   the example at: http://ydi.com/calculation/fresnel-zone.php
  
   However the two connected points are rarely going to be 
 at the same
   level so I'd need to draw the elipse At an angle instead of 
   horizontally.
  
   GD's elipse or arc function will probably do what I want
  but it seems
   all I can specify are the center point and width and height.
  
   Is there a way to also specify the x/y of each point on the
  left and
   right side of the elipse?
  
   Make sense?
  
  Yes, but you're out of luck I'm afraid Dan. The best I can
  suggest is that you use the 'filledPolygon' method and do the 
  maths yourself. (Sorry, that's 'math' over there isn't it.)
 
 
 Have you thought about trying to do this on a Tk canvas?
 The oval item lets you specify the diagonal corners of the
 oval's bounding box.
 Tk::canvas can export itself as postscript, so you
 could do your drawing, export it as ps, then convert it to
 whatever format you want.
 

Interesting I'm really workign on a dynamic system though, 
enter data into form and image is generated.
I wonder if those steps would be a bit rough that way.. I don't 
know, I'll look into it for sure.
Actually I guess I could do Tk::canvas save it to a temp .ps file and open 
the tmep file with GD or Imager or somethgin and conevrt it on the fly I 
guess it's not too impossible after all, I'll add this to my list of trick 
to try.

Thanks!

Dan

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: Drawing an Arc at an angle.

2004-01-07 Thread Dan Muey

 On Wed, 7 Jan 2004 08:55:56 -0600, [EMAIL PROTECTED] (Dan Muey)
 wrote:
  
  Have you thought about trying to do this on a Tk canvas?
  The oval item lets you specify the diagonal corners of the oval's 
  bounding box. Tk::canvas can export itself as postscript, so you
  could do your drawing, export it as ps, then convert it to
  whatever format you want.
  
 
 Interesting I'm really workign on a dynamic system though, 
 enter data into form and image is generated.
 I wonder if those steps would be a bit rough that way.. I don't 
 know, I'll look into it for sure.
 Actually I guess I could do Tk::canvas save it to a temp .ps 
 file and open 
 the tmep file with GD or Imager or somethgin and conevrt it 
 on the fly I 
 guess it's not too impossible after all, I'll add this to my 
 list of trick 
 to try.
 
 Thanks!
 
 Oops, I just tried it. The plain Tk::Canvas dosn't support 
 rotation yet.
 And the Oval bounding box only does x-y alignment.
 
 The Tk::Zinc canvas does do rotation, but outputting postscript
 is still on the planned to do list. ;-(
 
 Zinc can make just about anything you want, with clipping, zooming,
 and rotations. But without the ps output, you would have to capture
 it manually. 
 
 Just for fun, I tried tuxpaint, and it does make ellipses which can be
 rotated with the mouse, but I don't think it has a programming
 interface.
 
 Maybe something in script-fu with Gimp?  There is an enormous number
 of scripts for script-fu.
 
 I did a groups.google.com search for rotate ellipse GD and 
 there seems
 to be alot of C code to do it with the real GD c libs. Maybe you could
 get one to compile and call it from your perl script, passing your
 parameters to it?
 
 Or maybe you could do it programmatically by learning to write
 postscript directly from perl?
 
 Zinc makes it real easy to do it, and as a matter of fact, someone
 on the Zinc maillist today, just asked the developer to get going
 on the postscript output. I've even made a lobe shape 
 programmatically
 with Zinc, and it's bezier curves.
 
 Good luckall my ideas are done. :-)
 

Thanks! Even more to add to my look into list!

 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: Drawing an Arc at an angle.

2004-01-06 Thread Dan Muey
 Dan Muey wrote:
 
  I've made a funtion to calculate the Fresnal zone for wireless 
  connections.
 
  What I'd like to do is generate an image based on that. 
 Something like 
  the example at: http://ydi.com/calculation/fresnel-zone.php
 
  However the two connected points are rarely going to be at the same 
  level so I'd need to draw the elipse At an angle instead of 
  horizontally.
 
  GD's elipse or arc function will probably do what I want 
 but it seems 
  all I can specify are the center point and width and height.
 
  Is there a way to also specify the x/y of each point on the 
 left and 
  right side of the elipse?
 
  Make sense?
 
 Yes, but you're out of luck I'm afraid Dan. The best I can 
 suggest is that you use the 'filledPolygon' method and do the 
 maths yourself. (Sorry, that's 'math' over there isn't it.)

Where is your over there in relation to my over hear (St. Louis , MO USA)?

I'm doing all the math(s) :), I'm only seeing a way to draw the elipse 
or arc with a horizontal and vertical orientation only. 

I'll test some things out a bit more and show the group what's happening and have some 
url's.


 
 Cheers,
 
 Rob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Drawing an Arc at an angle.

2004-01-03 Thread Fred Nastos
On January 2, 2004 05:22 pm, Dan Muey wrote:
 Hello List,

 I've made a funtion to calculate the Fresnal zone for wireless connections.

 What I'd like to do is generate an image based on that. Something like the
 example at: http://ydi.com/calculation/fresnel-zone.php

 However the two connected points are rarely going to be at the same level
 so I'd need to draw the elipse At an angle instead of horizontally.

 GD's elipse or arc function will probably do what I want but it seems all I
 can specify are the center point and width and height.

 Is there a way to also specify the x/y of each point on the left and right
 side of the elipse? Make sense?

Must the image be entirely made within GD?  You can easily create a rotated
ellipse via xfig.  That is, you can use your perl script to make the .fig
file and then cconvert the fig file to other graphics formats.  It's jumping
through hoops, but it should be straightforward.  All you need to
make the .fig file is (i) coordinates of the ellipse center, (ii)
major/minor radii, and (iii) angle of rotation.

 TIA

 Dan

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Drawing an Arc at an angle.

2004-01-02 Thread Rob Dixon
Dan Muey wrote:

 I've made a funtion to calculate the Fresnal zone for wireless
 connections.

 What I'd like to do is generate an image based on that.
 Something like the example at:
 http://ydi.com/calculation/fresnel-zone.php

 However the two connected points are rarely going to be at the
 same level so I'd need to draw the elipse
 At an angle instead of horizontally.

 GD's elipse or arc function will probably do what I want but it
 seems all I can specify are the center point and width and
 height.

 Is there a way to also specify the x/y of each point on the left
 and right side of the elipse?

 Make sense?

Yes, but you're out of luck I'm afraid Dan. The best I can suggest
is that you use the 'filledPolygon' method and do the maths yourself.
(Sorry, that's 'math' over there isn't it.)

Cheers,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Drawing an Arc at an angle.

2004-01-02 Thread R. Joseph Newton
Rob Dixon wrote:

 Dan Muey wrote:
 
  I've made a funtion to calculate the Fresnal zone for wireless
  connections.
 
  What I'd like to do is generate an image based on that.
  Something like the example at:
  http://ydi.com/calculation/fresnel-zone.php
 
  However the two connected points are rarely going to be at the
  same level so I'd need to draw the elipse
  At an angle instead of horizontally.
 
  GD's elipse or arc function will probably do what I want but it
  seems all I can specify are the center point and width and
  height.
 
  Is there a way to also specify the x/y of each point on the left
  and right side of the elipse?
 
  Make sense?

 Yes, but you're out of luck I'm afraid Dan. The best I can suggest
 is that you use the 'filledPolygon' method and do the maths yourself.

There is another, more straightforward possibility here.  Not *that*
straightforward, I'm afraid | ;-o) but conceptually so.
I'm not sure about GD [I've never been able to get GD to load on my Win2K
box] but if you use a builtin to calculate an ellipse of the right
dimension, you could then use some basic angular rotation of the base
shape.  It certainly is not quick, which is probably why even high-end
graphics applications seem to lack facilities for drawing such ellipses,
but it can be pretty clear.

Unfortunately, I have done very little in the way of mathematical
operations in Perl, so I don't really know what functions Perl offers
readily.  Certainly an arctangent function could make this real swift. It
might help to convert your locus to polar coordinates once the base
ellipse is generated, then rotate it, then convert back to Cartesian.

I must say, it's a question that has sorta gnawed at me ever since my
first encounter with Win 3.11 PaintBrush.

Joseph


 (Sorry, that's 'math' over there isn't it.)

Boy, you do like to raise the interesting liguistic [ergo philosophical]
points, huh?  I'm firmly straddling the fence on this one.

So is mathematics a collection of discrete studies, or a many-faceted
exploration in the quest for fgood 'ol capital-T Truth...?
[...wandering off, eyes fixed on some distant horizon...]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response