Closed iamFIREcracker closed 8 months ago
It indeed seems like an exact division would suit better here.
Another example:
(defsketch make-line-bug ()
(translate 100 100)
(scale 10)
(with-pen (make-pen :weight 3 :stroke +black+ :fill +white+)
(destructuring-bind (x y x* y*) (list 1 2 1 9)
(line x y x* y*)
(circle x y 1/10)
(circle x* y* 1/10))))
The result:
(You can see that the line is not properly centered)
After applying the fix:
Thank you both!
The following sketch is setup to do 2 things:
(0, 0)
in the center of the window and range from -1 to 1 in both coordinates0.3*sin(7x)
If you run it, you should be presented the following which hardly resemble what one might expect when trying to plot
sin(x)
:After a little bit of fiddling with
skecth
's source, I realized MAKE-LINE was using FLOOR to figure out the triangle strip to draw, and when I replaced FLOOR with / things immediately started to look better:I am sure there is a reason why FLOOR was chosen instead of /, but it clearly does not work as expected when PEN-WEIGHT returns avalue smaller than 1 (
1/400
in this example).