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

canvas: Change default transform to remove z #505

Merged
merged 2 commits into from
Feb 21, 2024

Conversation

johannes-wolf
Copy link
Member

@johannes-wolf johannes-wolf commented Feb 14, 2024

Change the default transformation matrix to have z coordinates of zero after transformation.
This is actually a fix, as the final 2D projection should not have a z-value other than zero.

With this change, anchors in 3D space become 2D and thus elements like rect, Bézier or Catmull, … will correctly work when using them with anchors to 3D elements. Intersection between 3D elements will also work (in 2D space).

See: #502 and #493.

matrix.transform-scale((x: 1, y: -1, z: 1)),
),
transform:
((1, 0,+.5, 0),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess hand writing the matrix, instead of using 2 multiplications, is more clear.

@johannes-wolf
Copy link
Member Author

With this PR you can get TikZ like marks on 3D lines:

  set-style(mark: (end: ">", transform-shape: false))
  line((0,0), (1,0))
  line((0,0), (0,1))
  line((0,0), (0,0,1))

grafik

@johannes-wolf johannes-wolf added this to the 0.2.1 milestone Feb 20, 2024
Copy link
Member

@fenjalien fenjalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Add a comment to the default transform matrix to say what transforms it has e.g. shear then scale... xyz
  • Check if the manual says anything about the default transform, update it if so
  • Update changelog

@johannes-wolf
Copy link
Member Author

johannes-wolf commented Feb 20, 2024

  • Add a comment to the default transform matrix to say what transforms it has e.g. shear then scale... xyz
  • Check if the manual says anything about the default transform, update it if so
  • Update changelog

Added a line to the changelog and documentation about the default matrix.

@johannes-wolf johannes-wolf merged commit bf3ec2f into master Feb 21, 2024
1 check passed
@johannes-wolf johannes-wolf deleted the remove-z-coordinate branch February 21, 2024 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working core:draw ✏️
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants