Smooth strokes
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Smooth strokes
Hi -hh,
I like your post, brilliant like your code.
I tried to implement a simplified version of your smoothIt handler in a drawing stack, I post it here.
I like your post, brilliant like your code.
I tried to implement a simplified version of your smoothIt handler in a drawing stack, I post it here.
- Attachments
-
- Test.livecode.zip
- (2.49 KiB) Downloaded 244 times
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Smooth strokes
..........
Last edited by [-hh] on Wed Aug 13, 2014 2:06 pm, edited 1 time in total.
shiftLock happens
Re: Smooth strokes
Ok, I made some tests, here is a stack with the results.
1. To avoid to remove edges the stack splits every polygon in different segments (e.g an N is split in 3 segments), processes individually each segment and then re-compose the segments before to assign the points to the graphic.
2. The external dimension of the polygon (the rectangle), is preserved by restoring the original rect after the process. In this way I try to avoid to change the dimensions of the polygons created by the user.
4. Straight lines (for example the bars of a T) are not processed by excluding graphics with a certain wide or height of the rect. Maybe here would be better to use some proportional algorithm I think, or more better a way to distinguish a line from a curve.
All this can be improved a lot, if you have ideas or solutions please modify the stack.
1. To avoid to remove edges the stack splits every polygon in different segments (e.g an N is split in 3 segments), processes individually each segment and then re-compose the segments before to assign the points to the graphic.
2. The external dimension of the polygon (the rectangle), is preserved by restoring the original rect after the process. In this way I try to avoid to change the dimensions of the polygons created by the user.
4. Straight lines (for example the bars of a T) are not processed by excluding graphics with a certain wide or height of the rect. Maybe here would be better to use some proportional algorithm I think, or more better a way to distinguish a line from a curve.
All this can be improved a lot, if you have ideas or solutions please modify the stack.
- Attachments
-
- SmoothTest.livecode.zip
- (3.36 KiB) Downloaded 202 times
Re: Smooth strokes
No one has any idea on how to improve the polygons created with the finger?
PS
I am also willing to consider professional solutions as long as the result is good. Please contact me in private.
PS
I am also willing to consider professional solutions as long as the result is good. Please contact me in private.
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Smooth strokes
..........
Last edited by [-hh] on Wed Aug 13, 2014 2:05 pm, edited 1 time in total.
shiftLock happens
Re: Smooth strokes
Hi Mag,Mag wrote:No one has any idea on how to improve the polygons created with the finger?
[snip]
Check if this stack could help in this task:
http://andregarzia.on-rev.com/alejandro ... orithm.zip
This stack implements two polygon smoothing algorithms:
Chaikin and Shemanarev
Re: Smooth strokes
Great work [-hh]!
Thank you capellan, I will check these stacks. Are you involved in the developing of them?
Thank you capellan, I will check these stacks. Are you involved in the developing of them?
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Smooth strokes
..........
Last edited by [-hh] on Wed Aug 13, 2014 2:05 pm, edited 1 time in total.
shiftLock happens
Re: Smooth strokes
Hi Hermann,
thank you. What I'm trying to do is an app for write and draw with the finger. Unfortunately to date I haven't find a way to have smooth polygons. All the project are interesting in theory but I can't find a way to implement these ideas in my project, probably because this requires knowledge of mathematics that I don't have. For example, the stack with the Bezier lines is very nice, but I don't know how to implement it in a project where the user draws with the finger.
For this reason, I said that if someone finds a working solution, even professional (with the meaning that the programmer realizes it for work, so for a fee), I'd be willing to consider pay for it or fund the project.
thank you. What I'm trying to do is an app for write and draw with the finger. Unfortunately to date I haven't find a way to have smooth polygons. All the project are interesting in theory but I can't find a way to implement these ideas in my project, probably because this requires knowledge of mathematics that I don't have. For example, the stack with the Bezier lines is very nice, but I don't know how to implement it in a project where the user draws with the finger.
For this reason, I said that if someone finds a working solution, even professional (with the meaning that the programmer realizes it for work, so for a fee), I'd be willing to consider pay for it or fund the project.
-
- VIP Livecode Opensource Backer
- Posts: 369
- Joined: Sun Dec 19, 2010 1:10 am
- Location: UK
- Contact:
Re: Smooth strokes
Hi, Mag. If you look in the LiveCode user samples for "Air Traffic Control", you'll find an example of some smoothing as lines are drawn with the mouse. It's not great, but does work - and can be improved if you really need it
Also have a look at the Doodle Cards app (created with LC for iOS). It doesn't use any smoothing, but works fine for drawing with fingers - I've got a LOT of examples created with it, as a few of us were using the same drawing code in a 'draw something' style game.
https://itunes.apple.com/gb/app/doodle- ... 56219?mt=8
Also have a look at the Doodle Cards app (created with LC for iOS). It doesn't use any smoothing, but works fine for drawing with fingers - I've got a LOT of examples created with it, as a few of us were using the same drawing code in a 'draw something' style game.
https://itunes.apple.com/gb/app/doodle- ... 56219?mt=8
LiveCode Development & Training : http://splash21.com
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Smooth strokes
..........
Last edited by [-hh] on Wed Aug 13, 2014 2:05 pm, edited 1 time in total.
shiftLock happens
Re: Smooth strokes
Hi splash21, thank you for the tip, I will study the stack.
Hi [-hh], I tried the stack but unfortunately it seems that 5 becomes a S, 3 becomes a kind of snake... maybe there is something to set that I don't understand
Hi [-hh], I tried the stack but unfortunately it seems that 5 becomes a S, 3 becomes a kind of snake... maybe there is something to set that I don't understand
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Smooth strokes
..........
Last edited by [-hh] on Wed Aug 13, 2014 2:05 pm, edited 1 time in total.
shiftLock happens
Re: Smooth strokes
Ah, ok, now I understand. Thank you.
Rounding that you have achieved is very good but has a problem: forces the user to draw what they wrote in different segments. If the process of separating a polygon in segments it were made by the code you would have a really great tool.
Rounding that you have achieved is very good but has a problem: forces the user to draw what they wrote in different segments. If the process of separating a polygon in segments it were made by the code you would have a really great tool.
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Smooth strokes
..........
Last edited by [-hh] on Wed Aug 13, 2014 2:05 pm, edited 1 time in total.
shiftLock happens