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

Add the ability to rotate a plane #351

Closed
dankamongmen opened this issue Feb 18, 2020 · 3 comments
Closed

Add the ability to rotate a plane #351

dankamongmen opened this issue Feb 18, 2020 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Milestone

Comments

@dankamongmen
Copy link
Owner

Add ncplane_rotate(n, rad) rotating an ncplane through rad radians (0 <= rad < 2pi). Figure out exactly what it means to do this with a plane full of character graphics. also: Are we rotating around the center? The origin?

@dankamongmen dankamongmen added documentation Improvements or additions to documentation enhancement New feature or request labels Feb 18, 2020
@dankamongmen dankamongmen self-assigned this Feb 18, 2020
@dankamongmen
Copy link
Owner Author

Especially interesting here is that we're dealing with non-square cells, erp!

@dankamongmen dankamongmen added this to the 1.3.0 milestone Mar 5, 2020
@dankamongmen
Copy link
Owner Author

So the idea of rotating general characters is madness, ain't gonna happen. You can sometimes get a pretty good 180 degree flip, and some characters are even amenable to 90, but in general it's not gonna fly.

We'll have to special-case handling of each character either way. So let's enumerate the ones for which square-symmetry rotation is well defined:

  • nul
  • space
  • full block
  • partial blocks

Now what about cell aspect ratio? If we have █ and rotate it 180 degrees, that's still █. Rotated 90 degrees, is that ▄▄, or ▀▀, or ▀, or ▄?

In the tetrimino example, we have e.g. (2 rows, 6 columns):

 ██

██████

an ideal rotation set would yield, i think:

(3 rows, 4 columns)
██
████
██

(2 rows, 6 columns)

██████
██

(3 rows, 4 columns)

 ██

████
██

so each cell is definitely becoming the bottom or upper halves of two cells. so the target plane is

(⌈columns / 2⌉) rows x (⌈rows * 2⌉) columns

if we have

23
67890A

this goes to (clockwise)

67
8923
0A

or (counterclockwise)

0A
2389
67

and finally

0A8967
23

so on clockwise rotations, leftmost becomes topmost, rightmost bottommost, topmost rightmost, and bottommost leftmost.

dankamongmen added a commit that referenced this issue Mar 5, 2020
dankamongmen added a commit that referenced this issue Mar 5, 2020
@dankamongmen
Copy link
Owner Author

We're now working for planes which come in as all top half-blocks. Need to do a little work to handle others, but it's there. ;D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant