Page 1 of 1

Mathart DEMO (b3)

PostPosted: Wed Apr 20, 2011 12:42 am
by Game A Gogo
A while ago (Like 6 months?) I decided to make a program in which you could draw lines and curved lines, the intention was to add custom curve with formulas.
But I haven't worked on this in a long while so I decided to post what I have made so far of it, enjoy! even if it's not a game :P

How to get around:
Click display -> Tools
First tool is the line tool
Second tool is the natural curve tool (sinual curve)
third tool is view move to move the view around
fourth tool is line move...
Click once and you can select a line (Might be hard when lines are all overlapped, so you can also use the left and right arrow to navigate through the lines)
Hold to move a line around
Hold shift while moving to edit the line
Press d to delete a line

Please comment!

Re: Mathart DEMO (b3)

PostPosted: Wed Apr 20, 2011 5:04 pm
by savvy
great program so far :D could do with free draw, colours aaaand line thickness....
those can be difficult, but im sure a coder with your skill could do it ;)

Re: Mathart DEMO (b3)

PostPosted: Wed Apr 20, 2011 7:09 pm
by Game A Gogo
Free draw would make the file size so huge, this is suppose to be MATH and ART together ;)
But thanks, I don't know if I will work on this again. Maybe if people want me to

Re: Mathart DEMO (b3)

PostPosted: Wed Apr 20, 2011 8:09 pm
by savvy
in all honesty, i dont think most people on this forum care unless its simple code.
you should continue it if you think its gonna get somewhere, otherwise its your decision alone XD

Re: Mathart DEMO (b3)

PostPosted: Tue Jun 28, 2011 5:28 am
by edwardfanboy
For the curve tool, you could click 3 points instead of two in this order, and have it make a Bezier spline with these points:
1. Start point
2. Intermediate point specifying how much to bulge out
3. End point

Re: Mathart DEMO (b3)

PostPosted: Tue Jun 28, 2011 12:06 pm
by Game A Gogo
I had many plans for this before, but I'm not working on it anymore since I had no motivations to do so. I also don't know the code of a Bezier spline

Re: Mathart DEMO (b3)

PostPosted: Sat Dec 03, 2011 11:18 pm
by tintran
bezierCurve function (not optimized, not sure if there is a way to optimize it).
code for drawing a bezier curve: (the larger the number of steps(last parameter) the smoother the curve, 50 should be plenty, smaller number of steps will show the curve as line segments).
Code: Select all
void bezierCurve(double x1, double y1, double x2, double y2, double x3, double y3, int steps)
{
    double px1,py1,px2,py2,dx12,dy12,dx23,dy23,dpx,dpy;
    double x,y;
    int i;
    dx12 = (x2-x1)/steps; dy12 = (y2-y1)/steps;
    dx23 = (x3-x2)/steps; dy23 = (y3-y2)/steps;
    px1 = x1;
    py1 = y1;
    px2 = x2;
    py2 = y2;
    x=x1;
    y=y1;
    moveto(x,y);
    for (i=1;i<=steps;i++)
    {
      px1 += dx12;
      py1 += dy12;
      px2 += dx23;
      py2 += dy23;
      dpx = (px2-px1)/steps;
      dpy = (py2-py1)/steps;
      x=px1+(i*dpx);
      y=py1+(i*dpy);
      lineto(x,y);
    }
}

Re: Mathart DEMO (b3)

PostPosted: Sun Dec 04, 2011 3:13 pm
by Game A Gogo
Thanks a lot, but unfortunately I'm not working on this anymore S: