- From: Thomas DeWeese <Thomas.DeWeese@Kodak.com>
- Date: Tue, 10 Aug 2004 11:15:40 -0400
- To: Chris Lilley <chris@w3.org>
- CC: David Turner <novalis@fsf.org>, www-svg@w3.org
Chris Lilley wrote: > On Thursday, August 5, 2004, 6:34:27 PM, David wrote: > > > DT> I'm trying to implement proper direcionality for path > DT> markers in Inkscape (the current version is entirely > DT> nonconforming). > DT> Question: What is the tangent vector to the initial point of > DT> a curve, when the first control point is identical to the > DT> initial control point? > > You are correct that it doesn't have one, its a degenerate case. There > are various ways of dealing with it. The spec should clarify this case. I think if you do some basic algebra you will see that it has a useful result (the one you suggest): The derivative of a Bezier curve is: f'(t) = -3(1-t)(1-t)P0 + 3(1-3t)(1-t)P1 + 3t(2-3t)P2 + 3t*tP3 If P0 == P1: f'(t) = -3(2t)(1-t)P0 + 3(2t)(1-(3/2)t)P2 + 3t*tP3 = 6t((1-(3/2)t)P2 - (1-t)P0) + 3t*tP3 As t approaches zero we can ignore 3t*tP3 as it's contribution is insignificant. This leaves: = 6t((1-(3/2)t)P2 - (1-t)P0) The 6t term is simply a scaling factor (which makes our vector zero length at t=0) but if you look at the rest of the eqn: (1-(3/2)t)P2 - (1-t)P0 You can see that this becomes: P2-P0 as t goes to zero Thus your hunch below is proven out. The directionality of the derivative is P2-P0 but the length of the vector is zero. A similar argument can be followed for the case P0=P1=P2 to find out that the directionality is P3-P1: 6t((1-(3/2)t)P0 - (1-t)P0) + 3t*tP3 = -3t*tP0 + 3t*tP3 = 3t*t(P3-P0) > > If its a vector sum of two vectors and there is only one vector, a > useful result is to just take the second vector. > > DT> My guess (based on eyeballing the > DT> curves onscreen) would be to devolve to the direction from > DT> the initial point to the second control point, then to the > DT> end point, then to the rules for zero-length path segments > DT> (in the implementation notes). > > DT> Is this correct? > > I would be glad of other opinions but it sounds correct to me. > > DT> I'm not subscribed to the mailing list, so please CC me on > DT> replies. > > > >
Received on Tuesday, 10 August 2004 15:17:03 UTC