Author Topic: Pixel Math (circle functions)  (Read 2135 times)

Offline ngc1535

  • PixInsight Old Hand
  • ****
  • Posts: 326
Pixel Math (circle functions)
« on: 2017 October 13 14:17:27 »
Hi,

In PixelMath the definition for sin(x), cos(x)... etc the explicit range is not given.
If I understand correctly x is in the range of 0 to 2PI.
Some people might assume it is degrees.
Please let me know if I am on track.

thanks
-adam

Offline sharkmelley

  • PTeam Member
  • PixInsight Addict
  • ***
  • Posts: 241
    • Mark Shelley Astrophotography
Re: Pixel Math (circle functions)
« Reply #1 on: 2017 October 13 16:22:30 »
It's simple enough to test  :)

Tick "Use a single RGB/K expression" 
Put sin(0) in the RGB/K field and the resulting image is full of zeros
Put sin(3.1416/2)  in the RGB/K field and the resulting image is full of ones
Put sin(3.1416/4) in the  RGB/K field and the resulting image is full of 0.707

I guess that answers the question   ;)

Mark
Takahashi Epsilon 180ED
H-alpha modified Sony A7S
http://www.markshelley.co.uk/Astronomy/

Offline oldwexi

  • PixInsight Guru
  • ****
  • Posts: 627
    • Astronomy Pages G.W.
Re: Pixel Math (circle functions)
« Reply #2 on: 2017 October 13 16:27:48 »
Hi Adam!
I assum its radians.
Using the PixelMath Expression
iif(abs((1-(abs((sin((xpos()) * (pi()/180))))))*h) > ypos(), 0,abs((sin((xpos()) * (pi()/180)))))
draws the upper and the lower sinus curve side by side.
The expression uses the xposition as degrees,  it needs the conversion
from degrees to radians.
basic function is: (sin((xpos()) * (pi()/180)))
extended function is abs((sin((xpos()) * (pi()/180)))) to get the minus results in y as positiv values.
the rest is only for displaying the curve.
Screenshot here:


replacing sin with cos works also.

Gerald