Re: [Flightgear-devel] [OT] curve direction.
Am Donnerstag 20 Januar 2005 21:56 schrieb Curtis L. Olson: > This is kind of off today's topic, but I have an unrelated question. > > Working in 2d space, given 3 points, I know how to compute a circle > (center/radius) that passes through those three points. Now I need to > compute the direction of curvature of the 3 points. In other words, > moving from the 1st point through the second point to the 3rd point, is > the direction of the circle clockwise (curving right) or counter > clockwise (curving left.) Just take the cross product of the vectors 1->2 and 1->3 (any 2 vectors will work, if you ensure a consistent selection). This should give a vector of the form (0 0 z). The sign of z gives the rotation direction. Since this is a special case this simplifies to: dx1 = x2 - x1 dx2 = x3 - x1 dy1 = y2 - y1 dy2 = y3 - y1 z = dx1*dy2 - dx2*dy1 Thomas ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
RE: [Flightgear-devel] [OT] curve direction.
Curtis L. Olson writes: > > This is kind of off today's topic, but I have an unrelated question. > > Working in 2d space, given 3 points, I know how to compute a circle > (center/radius) that passes through those three points. Now I need to > compute the direction of curvature of the 3 points. In other words, > moving from the 1st point through the second point to the 3rd point, is > the direction of the circle clockwise (curving right) or counter > clockwise (curving left.) Classic problem with a classic solution :-) grep clockwise on this page http://exaflop.org/docs/cgafaq/cga6.html Norman ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
Re: [Flightgear-devel] [OT] curve direction.
"Curtis L. Olson" wrote: > This is kind of off today's topic, but I have an unrelated question. Nice intro ! ;-) > Working in 2d space, given 3 points, I know how to compute a circle > (center/radius) that passes through those three points. Now I need to > compute the direction of curvature of the 3 points. In other words, > moving from the 1st point through the second point to the 3rd point, is > the direction of the circle clockwise (curving right) or counter > clockwise (curving left.) What do you think about this solution: Take vector a) from 1) to 2), vector b) from 2) to 3) Compute the angle in 2) running from a) to b) If the angle below 180 degree, then the circle runs clockwise, Martin. -- Unix _IS_ user friendly - it's just selective about who its friends are ! -- ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
Re: [Flightgear-devel] [OT] curve direction.
Citeren "Curtis L. Olson" <[EMAIL PROTECTED]>: > This is kind of off today's topic, but I have an unrelated question. > > Working in 2d space, given 3 points, I know how to compute a circle > (center/radius) that passes through those three points. Now I need > to > compute the direction of curvature of the 3 points. In other words, > > moving from the 1st point through the second point to the 3rd point, > is > the direction of the circle clockwise (curving right) or counter > clockwise (curving left.) Presume you have 3 points A, B and C with A the lowest one, B in the middle and C the upper one. x is the horizontal axis (right=positive) and y the vertical (upward = positive). In pseudo-code: if( (x_A > x_B) && (x_C > x_B)){ curving right }else if( (x_A < x_B) && (x_C < x_B)){ curving left }else{ special cases like x_A = x_B etc. } I hope this is what you need, numerical derivatives are a little bit more complicated for me at the moment :). Back to the books now :/ Steven ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
[Flightgear-devel] [OT] curve direction.
This is kind of off today's topic, but I have an unrelated question. Working in 2d space, given 3 points, I know how to compute a circle (center/radius) that passes through those three points. Now I need to compute the direction of curvature of the 3 points. In other words, moving from the 1st point through the second point to the 3rd point, is the direction of the circle clockwise (curving right) or counter clockwise (curving left.) Thanks, Curt. -- Curtis Olsonhttp://www.flightgear.org/~curt HumanFIRST Program http://www.humanfirst.umn.edu/ FlightGear Project http://www.flightgear.org Unique text:2f585eeea02e2c79d7b1d8c4963bae2d ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d