Jump to content

Possible plugin request-curly q swirly thingy generator


Recommended Posts

That appears to be made using Photoshop brushes, I would think. But I'm not sure.

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

actually its not too hard to do something almost like this already.

use the tree gen plug in

you'll need to do the end of each branch separately with twist but if you keep the number of branches low and just copy and move around on several layers

then

run conditional hue/saturation (like in ASH lava lamp tut)

you could come up with something fairly similar. a bit more work to get the first set of curls done, but it would be your own work entirely not just a brush.

Link to comment
Share on other sites

Uh oh. The wheels are turning. :-P

Prunes, anyone?

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

pyrochild is that a hmmm you don't think so or yes its possible to modify. if you do modify I'd like to be able to have longer branch ratio to trunk size. as it stands now using this method you get chunky results but fairly similar and oh so time consuming.

It's a "hmmm, I wonder if I can do this...."

If I do take it on, though, it'll be at least a couple months out, though.

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

pyrochild is that a hmmm you don't think so or yes its possible to modify. if you do modify I'd like to be able to have longer branch ratio to trunk size. as it stands now using this method you get chunky results but fairly similar and oh so time consuming.

It's a "hmmm, I wonder if I can do this...."

If I do take it on, though, it'll be at least a couple months out, though.

OMG do this, but please finish your current work...

Link to comment
Share on other sites

Here's some VB code for a spiral. Not sure what it looks like though...

Also:

Archimedean Spiral

Quick Codelab, need more time to make it faster...

int Amount1=15;  //[0,1000]a (/100)
int Amount2=15;  //[0,1000]b (/100)
int Amount3=100; //[0,1000]quantity of points (*100)

double e = 2.718281828;
double kPi = 3.14159265358979 / 620.0;

void Render(Surface dst, Surface src, Rectangle rect)
{
 double  X,Y;
 double  Xs, Ys;

 // Delete any of these lines you don't need
 Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
 long cX = (long)(((selection.Right - selection.Left) / 2)+selection.Left);
 long cY = (long)(((selection.Bottom - selection.Top) / 2)+selection.Top);
 double a = (double)Amount1 / 100.0;
 double b = (double)Amount2 / 100.0;

 long MaxiP = Amount3 * 100;

 ColorBgra PrimColor = (ColorBgra)EnvironmentParameters.PrimaryColor;
 int BrushWidth = (int)EnvironmentParameters.BrushWidth;

 SolidBrush Brush1 = new SolidBrush(Color.FromArgb(PrimColor.A, PrimColor.R, PrimColor.G, PrimColor.);
 Pen Pen1 = new Pen(Brush1, BrushWidth);

 // Copy existing image (source) to destination
 for (int y = rect.Top; y < rect.Bottom; ++y)
   for (int x = rect.Left; x < rect.Right; ++x)
     dst[x, y] = src[x, y];

 Graphics g = new RenderArgs(dst).Graphics; 
 g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
 g.Clip = new Region(rect);
 Xs = cX + (a * (Math.Cos(0)) * Math.Pow(e , (b * 0)));
 Ys = cY - (a * (Math.Sin(0)) * Math.Pow(e , (b * 0)));
 for (int i = 1; i < MaxiP; ++i)
 {
   double ang = kPi * i;
   X = cX + (a * (Math.Cos(ang)) * Math.Pow(e , (b * ang)));
   Y = cY - (a * (Math.Sin(ang)) * Math.Pow(e , (b * ang)));
   g.DrawLine(Pen1, (float)X, (float)Y, (float)Xs, (float)Ys);
   Xs=X;
   Ys=Y;
 }
}

pyrochild is that a hmmm you don't think so or yes its possible to modify. if you do modify I'd like to be able to have longer branch ratio to trunk size. as it stands now using this method you get chunky results but fairly similar and oh so time consuming.

It's a "hmmm, I wonder if I can do this...."

If I do take it on, though, it'll be at least a couple months out, though.

I would be pleased if any other coder could improve this plugin, I could cooperate and give any help for that one!

Link to comment
Share on other sites

Crash:

File: C:\Program Files\Paint.NET\Effects\curlicue.dll
     Effect Name: PaintDotNet.Effects.UserScript
     Full error message: PaintDotNet.WorkerThreadException: Worker thread threw an exception ---> System.OverflowException: Overflow error.
  at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
  at System.Drawing.Graphics.DrawLine(Pen pen, Single x1, Single y1, Single x2, Single y2)
  at PaintDotNet.Effects.UserScript.Render(Surface dst, Surface src, Rectangle rect)
  at PaintDotNet.Effects.UserScript.Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, Int32 startIndex, Int32 length)
  at PaintDotNet.Effects.BackgroundEffectRenderer.ThreadFunction()
  --- End of inner exception stack trace ---
  at PaintDotNet.Effects.BackgroundEffectRenderer.Join()
  at PaintDotNet.Effects.BackgroundEffectRenderer.Start()
  at PaintDotNet.Menus.EffectMenuBase.<>c__DisplayClassa.b__8(Object sender, EventArgs e)

Now, I did compile the CodeLab into a DLL, which I've never done before, so it could be my fault, I suppose...

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

Crash:

Now, I did compile the ScriptLab into a DLL, which I've never done before, so it could be my fault, I suppose...

WrongLab ;)

Anyhoo, the crash isn't your fault, the plugin is, after all, only a "Quick CodeLab" :D

@MadJik: you can use Math.PI and Math.E rather than defining them yourself

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

actually although the two spirals are similar the original spiral example is more rounded along the back edge and doesn't just spiral outwards from the centre as in the archimedean spiral.

its more like a tailors french curve.

pyro if you take a long time to do this one is it possible to work in these alternatives?

http://mathworld.wolfram.com/CornuSpiral.html

Link to comment
Share on other sites

pyro if you take a long time to do this one is it possible to work in these alternatives?

http://mathworld.wolfram.com/CornuSpiral.html

I'll look into it, but the math in there is more advanced than anything I've learned in school. I'll have to try to learn it on my own or just wait for the math class to catch up :?

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

I'll look into it, but the math in there is more advanced than anything I've learned in school. I'll have to try to learn it on my own or just wait for the math class to catch up :?

no wonder that's college level math, I recognized it from my own classes... but... are you in college?

Link to comment
Share on other sites

no problem I'd help you with the math but its been over 40 years since I've done any of this type of work. just barely remember any of it, get the odd snippet of inspiration once in awhile but the old noodle just doesn't function like it used to.

Could you explain the formulas (3) and (5) in the link you gave earlier? Especially what is 'du' ?

http://mathworld.wolfram.com/CornuSpiral.html

Thanks

@all: bug could be due to the Amount2 in the first version...

this is a second version (could still have bugs!)

new:

...two curves (primary color + secondary color)

...Amount1 for X / Amount2 for Y (should solve previous bug!)

...Precalculation in tables (faster)

next to do:

...symetry (like Cornu's curve)

...center offset

...randomisation?

int Amount1=50;  //[0,1000]a (/100)
int Amount2=25;  //[0,1000]b (/100)
int Amount3=10; //[0,1000]quantity of points (*100)

bool init = false;
int sAmount1=-1;
int sAmount2=-1;
int sAmount3=-1;

double kPi = Math.PI / 640.0;

void Render(Surface dst, Surface src, Rectangle rect)
{
 int Xa1,Ya1,Xa2,Ya2;
 int Xb1,Yb1,Xb2,Yb2;

 // Delete any of these lines you don't need
 Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
 long cX = (long)(((selection.Right - selection.Left) / 2)+selection.Left);
 long cY = (long)(((selection.Bottom - selection.Top) / 2)+selection.Top);
 double ax = (double)Amount1 / 100.0;
 double ay = (double)Amount2 / 100.0;
 double b = 15.0 / 100.0;

 long MaxiP = Amount3 * 100;

 if ((!init) || (sAmount1 != Amount1) || (sAmount2 != Amount2) || (sAmount3 != Amount3))
 {
   init = false;
   sAmount1 = Amount1;
   sAmount2 = Amount2;
   sAmount3 = Amount3;
 }

 ColorBgra PrimColor = (ColorBgra)EnvironmentParameters.PrimaryColor;
 ColorBgra BackColor = (ColorBgra)EnvironmentParameters.SecondaryColor;
 int BrushWidth = (int)EnvironmentParameters.BrushWidth;

 SolidBrush Brush1 = new SolidBrush(Color.FromArgb(PrimColor.A, PrimColor.R, PrimColor.G, PrimColor.);
 SolidBrush Brush2 = new SolidBrush(Color.FromArgb(BackColor.A, BackColor.R, BackColor.G, BackColor.);
 Pen Pen1 = new Pen(Brush1, BrushWidth);
 Pen Pen2 = new Pen(Brush2, BrushWidth);

 // Calculate the X,Y coords of the curve
 int[] sx1 = new int[1 + MaxiP];
 int[] sy1 = new int[1 + MaxiP];
 int[] sx2 = new int[1 + MaxiP];
 int[] sy2 = new int[1 + MaxiP];

 if (!init) 
 {
   for (int j = 0; j < MaxiP; j++)
   {
     double ang = kPi * j * 10;
     double kEx = ax * Math.Pow(Math.E , (b * ang));
     double kEy = ay * Math.Pow(Math.E , (b * ang));
     sx1[j] = (int)(cX + kEx * Math.Cos(ang));
     sx2[j] = (int)(cX - kEx * Math.Cos(ang));
     sy1[j] = (int)(cY + kEy * Math.Sin(-ang));
     sy2[j] = (int)(cY - kEy * Math.Sin(-ang));
   }
   init = false;
 }

 // Copy existing image (source) to destination
 for (int y = rect.Top; y < rect.Bottom; ++y)
   for (int x = rect.Left; x < rect.Right; ++x)
     dst[x, y] = src[x, y];

 Graphics g = new RenderArgs(dst).Graphics; 
 g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
 g.Clip = new Region(rect);
 Xa2 = sx1[0];
 Ya2 = sy1[0];
 Xb2 = sx2[0];
 Yb2 = sy2[0];
 for (int i = 1; i < MaxiP; ++i)
 {
   Xa1 = sx1[i];
   Ya1 = sy1[i];
   Xb1 = sx2[i];
   Yb1 = sy2[i];

   g.DrawLine(Pen1, Xa1, Ya1, Xa2, Ya2);
   g.DrawLine(Pen2, Xb1, Yb1, Xb2, Yb2);

   Xa2 = Xa1;
   Ya2 = Ya1;
   Xb2 = Xb1;
   Yb2 = Yb1;
 }
}

Link to comment
Share on other sites

Same error.... adjusting the third amount.

File: C:\Program Files\Paint.NET\Effects\CurlyQ.dll
     Effect Name: PaintDotNet.Effects.UserScript
     Full error message: PaintDotNet.WorkerThreadException: Worker thread threw an exception ---> System.OverflowException: Overflow error.
  at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
  at System.Drawing.Graphics.DrawLine(Pen pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2)
  at PaintDotNet.Effects.UserScript.Render(Surface dst, Surface src, Rectangle rect)
  at PaintDotNet.Effects.UserScript.Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, Int32 startIndex, Int32 length)
  at PaintDotNet.Effects.BackgroundEffectRenderer.ThreadFunction()
  --- End of inner exception stack trace ---
  at PaintDotNet.Effects.BackgroundEffectRenderer.Join()
  at PaintDotNet.Effects.BackgroundEffectRenderer.Start()
  at PaintDotNet.Menus.EffectMenuBase.<>c__DisplayClassa.b__8(Object sender, EventArgs e)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...