If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Tighter tension on curve?
3 posts
• Page 1 of 1
Tighter tension on curve?
I am working on a project, and I am trying to get the right curve on the tension. This is the code I have for it.
What I am after is having a "tighter" tension, rather than having it stretch through the whole plot. This is new to me, so I am experimenting as much as I could. Here is a video example of how it looks and also how I want the curve to go: https://www.youtube.com/watch?v=g97tR-IRmdo
Could someone point to the right direction regarding this?
Many thanks!`
- Code: Select all
def curve x, tension
tn = [[0.5 * (tension+1.0), 0.999999].min, 0.000001].max
t = 1.0 - (2.0*tn-1.0) / tn
return (t!=1.0) ? (t**x-1.0) / (t-1.0) : x
end
What I am after is having a "tighter" tension, rather than having it stretch through the whole plot. This is new to me, so I am experimenting as much as I could. Here is a video example of how it looks and also how I want the curve to go: https://www.youtube.com/watch?v=g97tR-IRmdo
Could someone point to the right direction regarding this?
Many thanks!`
- shrunkyq
- Posts: 15
- Joined: Fri Aug 17, 2018 9:21 pm
Re: Tighter tension on curve?
The curve in the video looks like a rational function.
Suppose your x variable goes from 0 to 1.
Suppose you want to map this to y-values from 0 to 1.
Allow the midpoint x=0.5 to map to some y-valute t between 0 and 1.
So you have the following mapping table:
The general mapping formula would be:
y = t*x/(1 - t +(2t - 1)*x)
Obviously for t = 0.5 this results in the trivial mapping y = x as it should.
Suppose your x variable goes from 0 to 1.
Suppose you want to map this to y-values from 0 to 1.
Allow the midpoint x=0.5 to map to some y-valute t between 0 and 1.
So you have the following mapping table:
- Code: Select all
x y
-------
0 0
0.5 t
1 1
The general mapping formula would be:
y = t*x/(1 - t +(2t - 1)*x)
Obviously for t = 0.5 this results in the trivial mapping y = x as it should.
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: Tighter tension on curve?
Thank you Martin, I will definitely check this out!
martinvicanek wrote:The curve in the video looks like a rational function.
Suppose your x variable goes from 0 to 1.
Suppose you want to map this to y-values from 0 to 1.
Allow the midpoint x=0.5 to map to some y-valute t between 0 and 1.
So you have the following mapping table:
- Code: Select all
x y
-------
0 0
0.5 t
1 1
The general mapping formula would be:
y = t*x/(1 - t +(2t - 1)*x)
Obviously for t = 0.5 this results in the trivial mapping y = x as it should.
- shrunkyq
- Posts: 15
- Joined: Fri Aug 17, 2018 9:21 pm
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: Google [Bot] and 62 guests