From: Brian G. <bri...@ea...> - 2007-03-20 04:04:38
|
Hi Revar, The documentation is unclear on this subject. Here's a better description taken from the Tcl 8.5 man page: -smooth smoothMethod smoothMethod must have one of the forms accepted by Tcl_GetBoolean or a line smoothing method. Only true and raw are supported in the core (with bezier being an alias for true), but more can be added at runtime. If a boolean false value or empty string is given, no smoothing is applied. A boolean truth value assumes true smoothing. If the smoothing method is true, this indicates that the line should be drawn as a curve, rendered as a set of quadratic splines: one spline is drawn for the first and second line segments, one for the second and third, and so on. Straight-line segments can be generated within a curve by duplicating the end-points of the desired line segment. If the smoothing method is raw, this indicates that the line should also be drawn as a curve but where the list of coordinates is such that the first coordinate pair (and every third coordinate pair thereafter) is a knot point on a cubic Bezier curve, and the other coordinates are control points on the cubic Bezier curve. Straight line segments can be venerated within a curve by making control points equal to their neighbouring knot points. If the last point is a control point and not a knot point, the point is repeated (one or two times) so that it also becomes a knot point. The reason it's confusing is that the original bezier implementation is not a true implementation, but rather, "... it internally computes a Bezier curve representation of each parabolic spline segment. These Bezier curves are then flattened to produce the points filled into the output arrays." The -smooth values of "bezier" or "true" are maintained for backward compatibility. The value of "raw" was added later and implements the true bezier curve. -Brian On Mar 19, 2007, at 8:32 PM, Revar Desmera wrote: > Interesting. The canvas man page I have installed on my system > doesn't mention 'raw' at all. Nor does the canvas.n in my CVS > checkout, though I've not done a cvs update in a couple months. Are > you sure it's in there? > > - Revar > > > > On Mar 19, 2007, at 7:26 PM, Daniel A. Steffen wrote: > >> Revar, >> >> On 20/03/2007, at 3:01, Revar Desmera wrote: >> >>> I've been writing a simple 2D CAD program in TCL/Tk, and I've found >>> something odd in how the canvas widget draws bezier curves. >> >> reread canvas.n ;-) >> you need to use '-smooth raw' for the canvas code to use the >> interpretation of bezier control points that your manual >> computation expects... >> if I use the following in your sample, all 3 curves agree: >> .c create line $path -fill yellow -smooth raw -splinesteps 16 - >> width 5 >> >> Cheers, >> >> Daniel >> >> -- >> ** Daniel A. Steffen Dept. of Mathematics ** >> ** Macquarie University NSW 2109 Australia ** >> >> > > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Tcl-mac mailing list > tc...@li... > https://lists.sourceforge.net/lists/listinfo/tcl-mac > |