Home > Software design >  How to determine which cubes the line passes through
How to determine which cubes the line passes through

Time:02-13

I was looking for a way to build cubes of the same size, then draw a line through this space and output the result in the form of coordinates of cubes that this line intersects and paint these cubes with a different color. The line can be either straight or curved.

I used matplotlib to plot cubes and lines. From these sources:

Pain

I spent some extra time to make this more adaptable but my brain stopped working. You might want to adaptively change the step size of the range but good luck.

  • Related