How to prevent 2D shapes from being distorted in a 3D CetZ coordinate system?

Hey everyone,

I’m currently working on some illustrations for tasks in analytical geometry using CetZ and its 3D coordinate system. The x, y, and z coordinates are adjusted through a transformation matrix to create an isometric view, which works perfectly for the geometric shapes I’m drawing.

However, when I try to draw 2D shapes like circle to mark points, they also get affected by the transformation matrix and end up distorted instead of remaining perfectly round, which makes sense given the transformation.

Is there a way to position 2D shapes correctly in the 3D coordinate system without them being “stretched” by the transformation matrix?

Here is my current code: Typst Project Link

Thanks a lot for your help!

I think that means that you want to effectively want to draw on the xy plane: on-xy | CeTZ Documentation

if you want a circle at (x, y, z), you would use on-xy(z: z, circle((x, y))). (Admittedly I didn’t test it, if it doesn’t work could you include a minimal example so that it’s easier to test further attempts?)

1 Like

Thank you for the suggestion! You were absolutely right about using on-xy. After reviewing my setup, I realized that I had swapped the axes in my transformation matrix. Therefore, I needed to use on-yz(z: z, circle((y, z))) instead. Now the circles are positioned correctly without distortion.

I appreciate your help! I’ll update the linked project so everyone can see the corrected solution.

1 Like