comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Create curves
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Create curves [message #92129 is a reply to message #92124] Fri, 16 October 2015 07:46 Go to previous messageGo to previous message
Russell[1] is currently offline  Russell[1]
Messages: 101
Registered: August 2011
Senior Member
This is probably going to sound more complicated than it actually is. But all you need to do is the rotation matrix to rotate your coordinate system.

https://en.wikipedia.org/wiki/Rotation_matrix

so if the center of your ellipse is at (xc,yc) then the coordinates of the new ellipse will be

theta=45.
s=sin(theta*!PI/180)
c=cos(theta*!PI/180.)
dx=x-xc
dy=y-yc

x = xc + c*dx+s*dy
y = yc - s*dx+c*dy

and now you use the definition of an ellipse:

r^2 = (x/a)^2 + (y/b)^2

This is all tvellipse does. If you don't want to use tvellipse, then just open it up and you'll see pretty much the same equations there. I didn't test this cause I didn't understand exactly what you want, so you'll need to work it over a bit (but it's the correct idea). I think I used a negative angle (when wiki uses a positive one) and used the fact that sin is an odd function.





On Friday, October 16, 2015 at 9:41:08 AM UTC-4, g.na...@gmail.com wrote:
> Hi
>
> I created an ellipsoid shape as follows
>
> NX=128
> NY=128
> Ellipxe = fltarr(NX,NY)
>
> for i=0L, NX-1 do begin
> for j=0L, NY-1 do begin
> if (0.1*(j-50)^2.+0.23*(i-95)^2. LT 100) then begin
> Ellipse[i,j] = 10.
> endif
> endfor
> endfor
> tvscl, Ellipse
>
>
> I wanted to change the direction of the ellipse to be diagonal (i.e. not plotted vertically). Does anyone knows how to do that?
>
>
> Also I found that the bean curve in Cartesian coordinates has the following form:
>
> (x^2+y^2)^2 = x^3+y^3
>
> I tried the following but it doesn't work
>
> NX=128
> NY=128
> Bean_curve = fltarr(NX,NY)
>
> for i=0L, NX-1 do begin
> for j=0L, NY-1 do begin
> if ((0.1*(j)^2.+0.23*(i)^2.)^2. EQ (0.1*(j)^3.+0.23*(i)^3.)) then begin
> Bean_Curve[i,j] = 10.
> endif
> endfor
> endfor
>
> tvscl, bean_Curve
>
> Can anyone help with this?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Plotting symbols filled with pattern(s)
Next Topic: Read ENVI file

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:59:42 PDT 2025

Total time taken to generate the page: 0.00358 seconds