Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird geometry error when using transform matrices and line/polyline #53

Open
kchanqvq opened this issue Aug 22, 2022 · 2 comments
Open
Labels

Comments

@kchanqvq
Copy link

Test program:

(defsketch test
    ((title "test") (width 640) (height 640))
  (let ((size 48))
    (scale (/ size 2))
    (translate 4 4)
    (with-pen (make-pen :stroke +white+ :weight (/ 2 size))
      #+nil (line 0.4 0.4 1 1)
      #+nil (line 1 1 0.4 0.4)
      (polyline 0.8 0.8 -1 -1 -0.8 -0.8))))

Problem:

  1. the output from the polyline is wrong, it flies outside the screen.

Screen Shot 2022-08-22 at 3 57 56 PM

  1. The output of the two (commented out in the snippet) line has different position. When composing larger algorithms I find geometry gets put in wrong positions everywhere.
@kchanqvq
Copy link
Author

kchanqvq commented Aug 22, 2022

Some more issues:
3. Turns out polyline breaks completely when I use (with-pen (make-pen :stroke +black+ :weight 2) ...), even without any transform.
4. The thickness calculation when using line and (with-pen (make-pen :stroke +black+ :weight 2) ...) looks fishy. I see visually inconsistent thickness when there are overlapping lines, could be the triangulation introduced some tiny offset so lines don't overlap exactly.

Update: according to my partial understanding the issue comes from the treatment of collinear or overlapping line segment, which causes intersect-lines to return abnormal values. Not sure about how to solve it...

@Kevinpgalligan
Copy link
Contributor

Relevant article shared by @Gleefre: https://mattdesl.svbtle.com/drawing-lines-is-hard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants