Recent

Author Topic: Bezier Curve Maker  (Read 3611 times)

Boleeman

  • Hero Member
  • *****
  • Posts: 1006
Bezier Curve Maker
« on: August 31, 2023, 04:21:53 am »
Found a cool Delphi bezier curve maker that I converted to Lazarus. Makes all sorts of COOL curves (symmetrical and non symmetrical)

You fill the parts with own selected colours.
To alter the curve click and drag on the node points.

Play around and enjoy. The Lazarus code is in the 2nd attachment link.

Would REALLY love to see a layered transparent BGRABmp version of this to show off BGRABMP. Imagine having one curve ontop of another and perhaps animating the curves. Really RAD.

« Last Edit: August 31, 2023, 10:17:25 am by Boleeman »

Boleeman

  • Hero Member
  • *****
  • Posts: 1006
Re: Bezier Curve Maker
« Reply #1 on: August 31, 2023, 01:18:09 pm »
Also found a COOL Delphi 3D lissajous program at     https://davdata.nl/math/lissajous3d.html
A compiled version is also on the website.

Got it to compile under Delphi 11.3 Community Edition but wanted to convert to Lazarus.

Converted code to Lazarus and also components. Compiles but I get an initial black screen. The Delphi default to black screen bug, again! Also no graphics show up.

Tried on formcreate to do to initial fill to white but no success in getting the graphics to show.
  paintbox1.Canvas.Brush.Color := clWhite;
  paintbox1.Canvas.FillRect(0, 0, ClientWidth, ClientHeight);

Screenshot below:

« Last Edit: August 31, 2023, 01:50:19 pm by Boleeman »

Boleeman

  • Hero Member
  • *****
  • Posts: 1006
Re: Bezier Curve Maker
« Reply #2 on: August 31, 2023, 03:00:55 pm »
Some  ... 79 designs for the Lissajous 3D maker.

Load them in.

Enjoy.

Boleeman

  • Hero Member
  • *****
  • Posts: 1006
Re: Bezier Curve Maker
« Reply #3 on: September 01, 2023, 05:49:03 am »
An animated gif of designs made by Lissajous 3D maker. All I did was alter the value of "a" in the program.

Kinda REALLY nice and COOL.

Also include the presets that I found by just clicking one part in the program creates symmetrical 2D designs.
The filename tells you which value to only change (either a, b or c in the program)

« Last Edit: September 01, 2023, 05:54:47 am by Boleeman »

circular

  • Hero Member
  • *****
  • Posts: 4455
    • Personal webpage
Re: Bezier Curve Maker
« Reply #4 on: September 03, 2023, 10:37:47 pm »
Wow that's very beautiful  :)
Conscience is the debugger of the mind

wp

  • Hero Member
  • *****
  • Posts: 13264
Re: Bezier Curve Maker
« Reply #5 on: September 04, 2023, 01:01:51 am »
Here is a new version of the lissajous program, completely rewritten with OpenGL support for the 3D output, and with math parsers for arbitrary formulas.

Usage:
Load one of the sample parameter files in the "samples" folder. Or pick one of the predefined equations from the "expressions" comboboxes, or edit them; enter values for the coefficients a,b,c,d and step count. Drag the left or right mouse button to rotate the generated image, or use the mouse wheel to increase/decrease the viewing distance. The currently used calculation and viewing parameters are saved in a config file and will be reactivated when the application is started the next time.

Disclaimer:
Mouse control of the view is sometimes a bit counter-intuitive, and there is another bug which does not always restore the saved view after loading a saved parameter set.

Boleeman

  • Hero Member
  • *****
  • Posts: 1006
Re: Bezier Curve Maker
« Reply #6 on: September 04, 2023, 12:58:40 pm »
WoW WP, man I am impressed.

Feel like I've gone into Space and discovered a fractal type universe.
The ball looks impressive as well.

Love the Tele Lens feature and mouse rotation view control.
Actually just saw this now "use the mouse wheel to increase/decrease the viewing distance" so I will need to connect my mouse (used the mouse pad initially). I also worked out if you resize the window you can get a larger view.

Added more samples for WP's new program.
« Last Edit: September 04, 2023, 04:04:24 pm by Boleeman »

wp

  • Hero Member
  • *****
  • Posts: 13264
Re: Bezier Curve Maker
« Reply #7 on: September 05, 2023, 12:15:43 am »
Added some more ideas:
- draw connecting sticks between the spheres at the calculated points
- allow manual input of the viewing parameters (axis rotation, viewing distance).
- parallel projection, some fixed viewing angles
- predefined views

The current code with the updated samples is in the attachment. Further development will be found on my github (https://github.com/wp-xyz/Lissajous).
« Last Edit: September 05, 2023, 12:57:42 am by wp »

Boleeman

  • Hero Member
  • *****
  • Posts: 1006
Re: Bezier Curve Maker
« Reply #8 on: September 05, 2023, 10:46:00 am »
WP the version below is certainly much better for rotating (with user Mathias corrected code) and more intuitive mouse handling. This version also has the rotation buttons for animating. Thank you also for including save to transparent background. Can't believe how many great features you have added. So COOL. Feel like a "Space Explorer" exploring different universes.

Just a sample to see what it is capable of creating. The shape looks flat but when flipped it is not flat.
So COOL.
« Last Edit: September 10, 2023, 11:55:14 am by Boleeman »

wp

  • Hero Member
  • *****
  • Posts: 13264
Re: Bezier Curve Maker
« Reply #9 on: September 09, 2023, 12:27:22 am »
Here's a new version of the Lissajous project: I remembered an old discussion in the German Lazarus forum about camera positioning in OpenGL (https://www.lazarusforum.de/viewtopic.php?p=86147) in which user Mathias posted the correct code for it - I wonder why so many articles and books about OpenGL present incorrect code here.

Anyway, the new version has a more intuitive mouse handling now. Rotations now are around the screen axes rather than the object axes: Horizontal drag rotates around the vertical monitor axis, vertical drag rotates around the horizontal monitor axis, dragging in a circle with CTRL held down around the monitor center rotates around the depth axis, dragging with the right mouse button down moves the object on the monitor, mouse wheel changes the distance of the scene (if you get too close some balls are no longer drawn correctly).

I also added tool buttons to help a user who does not know these dragging mysteries and to decouple some motions. With a tool button clicked the rotation/movement operation assigned to it is executed by the left-mouse-button drag only. There are also up/down controls to rotate/move in discrete steps.

Unfortunately these changes are incompatibile with the parameter files (.l3d) of the previous version. They still can be used, but the view parameters are lost.

 

TinyPortal © 2005-2018