Sujet : Re: improve a spline
De : user153 (at) *nospam* newsgrouper.org.invalid (Arjen)
Groupes : comp.lang.tclDate : 13. Jun 2025, 09:28:03
Autres entêtes
Message-ID : <1749803283-153@newsgrouper.org>
References : 1 2 3
User-Agent : Newsgrouper/0.7.2
saito <
saitology9@gmail.com> posted:
On 6/12/2025 7:08 PM, Emiliano wrote:
If by "smooth" you mean antialias, then no, Tk canvas doesn't do antialias.
As I undertand it, the tkpath package does, but I can't confirm since never
used it.
Thanks for taking a look. This is a piece of very old code from someone
else and I need to decide whether to improve it or trash it.
I guess there is no escaping the jagged lines. That is OK. How about
just making it a simple curve? As it is currently, there are two points
where it curves making it look like an S. Any ideas to reduce it to
simple / relaxed sine curve?
This is the character of the Bezier smoothing. If you want a curve with
only a single "bent", you might consider to derive a midpoint from the
two endpoints and draw a smoothed line (-smooth 1) through THREE points.
A possible method:
- Take the vector from point A to point B
- Determine the normal n to that vector (note: choice of direction!)
- Use a fraction of the distance between A and B to calculate the new point:
new point = (A + B)/2 + fraction * distance(A,B) * normal vector
You have a number of choices here :).