Re: Bezier path for volume editor
Re: Bezier path for volume editor
- Subject: Re: Bezier path for volume editor
- From: "R. Scott Thompson" <email@hidden>
- Date: Tue, 21 Sep 2004 14:42:38 -0500
On Sep 20, 2004, at 2:31 AM, Lorenzo wrote:
Hi,
I am trying to build a bezier path in order to control the volume of a
song.
It's something similar to the "iMovie" song volume control.
So I would like to create a path with lines, curves and points which
the
user can create and edit at several points.
My target is to iterate along the "x" axis of the path (time) and get,
for
any "x" value, the relative "y" value of the path (volume).
Is this the right approach? Is yes, how can I get, from the bezier
path, the
"y" value (volume) for any "x" value (time)?
Any sample code about editing a point such a way to modify the curve?
Thank you.
You'd be better off using time as the independent variable and asking
"how can I get the x and y values for a given time".
For a single bezier curve segment defined by the points p0, p1, p2, and
p3 and given a value t that is in the range 0-1 then you can find a
point on the curve Q as
X(t) = p0x (1 - t)^3 + 3 p1x (1-t)^2t + 3 p2x (1-t)t^2 + p3x t^3
Y(t) = p0y (1 - t)^3 + 3 p1y (1-t)^2t + 3 p2y (1-t)t^2 + p3y t^3
Scott
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden