Logo by AGUS - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Did you know ? you can use LaTex inside Postings on fractalforums.com!
 
*
Welcome, Guest. Please login or register. March 29, 2024, 04:42:03 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Small error in Complex.frag  (Read 1420 times)
0 Members and 1 Guest are viewing this topic.
JosLeys
Strange Attractor
***
Posts: 258


WWW
« on: May 26, 2013, 01:16:12 PM »

The complex power function in Complex.frag is now
Code:
vec2 cPower(vec2 z, float n) {
float r2 = dot(z,z);
return pow(r2,n/2.0)*vec2(cos(n*atan(z.y/z.x)),sin(n*atan(z.y/z.x)));
}

The atan function does not return the angle in the right quadrant.

Changing it to:
Code:
vec2 cPower(vec2 z, float n) {
float r2 = dot(z,z);
return pow(r2,n/2.0)*vec2(cos(n*atan(z.y,z.x)),sin(n*atan(z.y,z.x)));
}
solves the problem.
Logged
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #1 on: May 30, 2013, 09:41:52 PM »

Good catch, Jos. I'll correct it in the repository.
Logged
Roquen
Iterator
*
Posts: 180


« Reply #2 on: June 08, 2013, 09:01:45 AM »

The version of log I have is remapping the angle away from torque minimal which gives unexpected results.  So a possible change including conversion to using log2:

Code:
const float LOG2O2 = 0.3465735903;

vec2 cLog(vec2 a) {
  float y = atan(a.y,a.x);
  float x = LOG2O2*log2(dot(a,a));

  return vec2(x, y);
}
Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Amazing Hybrid Complex Triplex (complex coloring scheme) Images Showcase (Rate My Fractal) M Benesi 0 3479 Last post June 28, 2010, 02:47:56 AM
by M Benesi
Error 500 - Internal server error Discuss Fractal Forums tomot 9 5691 Last post April 22, 2011, 04:06:24 PM
by lenord
Fixup for Glow in Raytracer.frag Fragmentarium 3dickulus 4 1283 Last post January 11, 2014, 05:35:46 AM
by 3dickulus
Frag to GPU asm dump Fragmentarium « 1 2 3 » 3dickulus 30 6857 Last post June 16, 2015, 02:02:23 AM
by 3dickulus
Abox minR2 tweaking frag Amazing Box, Amazing Surf and variations mclarekin 0 2375 Last post July 26, 2017, 03:18:00 PM
by mclarekin

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.247 seconds with 25 queries. (Pretty URLs adds 0.008s, 2q)